Posts

Showing posts from 2014

Email Availability Control using Microsoft AJAX and Json WCF

Image
Hi Guys, If you are a web developer, I am sure you would have encountered a scenario where you have to check the email/username availability. So I thought of making a control which will call a WCF service through Microsoft AJAX and let the user know whether the email/username is already taken or not. Hope you like it. Solution 1) Create a Solution like following, - One is a web site - Other is a Class Library 2) Open AjaxEnabledControls -> EmailTextBox.cs and paste the following code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace AjaxEnabled {     public class EmailTextBox : TextBox,IScriptControl     {         private ScriptManager sMgr;         public string ServiceUrl;                  prote...

Bootstrap and Web API

Image
Hi Guys, This time I made a small webpage which consumes a JSON Web API Restfully. Hope you like it. Solution 1) Create a Solution like following  Add New Project -> ASP.NET MVC 4 Web Application  Select Web API as the Project Template The Solution will look as following Right Click on Controllers -> Add -> Controller as follows name it as the TimeLogController. Remember you have to call it as Timelog if you name it TimeLog[Controller]. Then Open App_Start -> WebApiConfig.cs and add the following line to enable JSON format (default is XML format) //Add this to allow Json format through  config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); Then Create a LINQ-SQL Classes for your database objects and add the following code to the TimeLogController. using System; using System.Collections.Generic; using System.Linq; using System.Net; using ...

nHibernate, SQL Server and WCF

Image
Hi Guys, This time I made a small program to illustrate the power and maturity of nHibernate ORM and integration of WCF with it. Hope you like it. Solution 1) Create a Solution like following  2) Download the nHibernate from http://nhforge.org/ and add it to your solution 3) Create Domain -> EP_TimeLog.cs and paste the following code using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace nHibernateDL.Domain {     /// <summary>     /// Time Log Class      /// </summary>     [Serializable]         [DataContract]     public class EP_TimeLog     {         [DataMember]         public virtual long Id { get; set; }         [DataMember]         publi...