Thursday, June 25, 2015

Unable to Update OnPropertyChanged

Add this nmethod after OnPropertyChanged("");
CommandManager.InvalidateRequerySuggested();

Monday, August 4, 2014

WSDL

Developer command prompt

wsdl http://10.10.107.200/webservices/WebGetProfileManager.asmx?WSDL


Tuesday, July 15, 2014

Json.Net

Adding Json string to sql.

Model
[{"LocationId":152,"BranchCode":"21","SourceSystem":"RSSSP"}]
List
[{"LocationId":152,"BranchCode":"21","SourceSystem":"RSSSP"},{"LocationId":156,"BranchCode":"17","SourceSystem":"RSSSP"}]


.Net
using Newtonsoft.Json;

Create exact model
List<Model> objs = JsonConvert.DeserializeObject<List<Model>>(string);

Ref
http://james.newtonking.com/json

Tuesday, December 10, 2013

MVC 4 and Ninject

Starting MVC 4 with Ninject.

In VS 2012, Go to > Tools > Library Package Manager > Manage NuGet Packages for Solution.

----
Search for and select Ninject.MVC3 then install.
----

It will create a NinjectWebCommon.cs inside App_Start

Reference your dependency resolution project / dll

Add code to instantiate implementations for your interfaces.

e.g: //IKernel kernel = new StandardKernel(
            //    new LoggingModule(typeof(App).ToString(), App.AppPath.ToString())
            //    );

            //kernel.Bind<IUserService>().To<UserService>();
            //kernel.Bind<IDialogService>().To<DialogService>();
            //kernel.Bind<IWorker>().To<AsyncWorker>();
            //kernel.Bind<IDialogService>().To<DialogService>();          
            string appPath = System.Web.Hosting.HostingEnvironment.MapPath(System.Web.HttpRuntime.AppDomainAppVirtualPath);
            var modules = new List<INinjectModule>
            {
                new LoggingModule(("Ninject"), appPath)
                //new RepositoryModule()              
            };
            kernel.Load(modules);

Monday, July 15, 2013

Self Hosting WCF

Security Rights

Check and firewall:

Window 7 Client

  • netsh http add urlacl url=http://+:8090/ClientService/AppointmentNotification user=myUser or = users

XP

  • httpcfg.exe set urlacl /u http://+:11715/service/ /a <http://+:11715/service/%20/a>  D:(A;;GX;;;BU)

Refference:
http://msdn.microsoft.com/en-us/library/ms733768.aspx

Tuesday, June 25, 2013

Sync to ancestors properties


<Canvas>

  <DockPanel
      Width="{Binding RelativeSource=
                {RelativeSource FindAncestor,
                AncestorType={x:Type Canvas}},
                Path=ActualWidth}"
      Height="{Binding RelativeSource=
                {RelativeSource FindAncestor,
                AncestorType={x:Type Canvas}},
                Path=ActualHeight}">
  </DockPanel>
</Canvas>

Window Service - Pointers and troubles encountered.

AppDomain.CurrentDomain.BaseDirectory - To have a path same as the service location.
----------------------------------------
Add debug mode in win service
     #if DEBUG #else #end
----------------------------------------
Install Manually
Right click window service and add install

  • click serviceProcessInstaller and go to properties
    1. change account property : LocalService for local and LocalSystem for server

  • click serviceInstaller and go to properties
    1. start type - automatic
    2. update service name and description to project name
Go to developer cmd: run as ADMINISTRATOR
Create batch files
  • InstallUtil ServiceName.exe
  • InstallUtil /u ServiceName
C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe

Right click service and select recovery
----------------------------------------
Error encountered 1
System.ComponentModel.Win32Exception: The specified service already exists serviceInstaller.DisplayName = "A new name";

  • sc delete YourServiceName

Error encountered 2
Error 1053: The service did not respond to the start or control request in a timely fashion framework version problem 2008 r2
----------------------------------------
Error Handling
Add another thread to catch the error
catch (Exception exception)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(
                    _ => { _logger.Error("", exception.Message, "", "", exception.StackTrace); });              
                    //_ => { throw new Exception("Exception on timer.", exception); });              
            }

----------------------------------------
Setup same framework

Check Windows Event, Windows Logs, System
----------------------------------------
Helpfull Links
http://stackoverflow.com/questions/14121079/windows-could-not-start-service-on-win-server-2008-r2-sp1-error-1053
http://www.coretechnologies.com/products/AlwaysUp/Apps/RunCommandPromptAsAService.html

----------------------------------------
Install Automatically manually

Add a new project