Tuesday, April 12, 2011

Handler code

using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web.Mail;


public class EmailHandler : IHttpHandler {

    string result = null;
    int id = 0;
    SqlConnection con = null;
    DataSet ds;
   StringBuilder sb = new StringBuilder();
 
   
    public void ProcessRequest (HttpContext context) {
       
         con = new SqlConnection("Data Source=CRM1-PC;Initial Catalog=LibraryApp;User ID=sa;Password=hyd@345");
        context.Response.ContentType = "text/plain";


        string Mehtodname = "sendemail";//context.Request.QueryString["str"].ToString();
       

        //if (!String.IsNullOrEmpty(context.Request.Form["CategoryId"]))
        //{
        //    categoryId = Convert.ToInt32(context.Request.Form["CategoryId"]);
        //}


        //if (!String.IsNullOrEmpty(context.Request.QueryString["StrMethodName"]))
        //{
        //    strMethodName = Convert.ToString(context.Request.QueryString["StrMethodName"]);
        //}

        //if (strMethodName.Length > 0 && strMethodName.ToUpper().Equals("REGISTERUSER"))
        //{

        //    Result = RegisterUser();
        //    context.Response.Write(Result);
        //    //context.Response.Write("<div><p><strong>Name : </strong>" + strSalutation + " " + strFirstName + " " + strLastName + "</p><p><strong>Email: </strong>" + strEmailID + "</p><p><strong>Location: </strong> " + strCity + ", " + strContactNo + ", " + strReferalId + ", " + strCaptcha + "</p></div>");
        //}
      
        //context.Response.Write("Hello World");
    }



    //private int RegisterUser()
    //{
    //    objuser.Salutation = strSalutation;
    //    objuser.FirstName = strFirstName;
    //    objuser.LastName = strLastName;
    //    objuser.Email = strEmailID;
    //    objuser.Phone = strContactNo;
    //    objuser.ReferalId = strReferalId;
    //    // objuser.City = strCity;
    //    objuser.RoleId = 3;
    //    objuser.Captcha = strCaptcha;
    //    objuser.IsFirstLogin = false;
    //    objuser.Status = 0;

    //    return objuser.AddUser();

    //}
   

    public bool IsReusable {
        get {
            return false;
        }
    }

}

No comments:

Post a Comment