14.1.10

Google Checkout code

window.parent.document.getElementById('lblPageHead').innerHTML = '<% =page_title %>'
function ClToolTip() {

var tooltip1 = $find("<%=RadDependent.ClientID%>");
tooltip1.hide();


}
==========================
gc notification:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="gc_notification.aspx.cs"
Inherits="customer_gc_notification" %>




Untitled Page














=============
using System;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using GCheckout;
using GCheckout.AutoGen;
using GCheckout.Util;
using GCheckout.OrderProcessing;
using Customer.order;
using System.IO;
using emailclient;
using settings.templates;
public partial class customer_gc_notification : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetNotification();
}


}
private void GetNotification()
{
Stream RequestStream = Request.InputStream;
StreamReader RequestStreamReader = new StreamReader(RequestStream);
string RequestXml = RequestStreamReader.ReadToEnd();
RequestStream.Close();
OrderBOL objBll;
Orders objBol;
switch (EncodeHelper.GetTopElement(RequestXml))
{
case "new-order-notification":
NewOrderNotification objNewOrd = (NewOrderNotification)EncodeHelper.Deserialize(RequestXml, typeof(NewOrderNotification));
objBll = new OrderBOL();
objBol = new Orders();
objBol.Googleorder_id = objNewOrd.googleordernumber;
objBol.Customer_Id = objNewOrd.buyerid.ToString();
objBol.CustomerName = objNewOrd.buyerbillingaddress.contactname.ToString();
objBol.BillingName = objNewOrd.buyerbillingaddress.contactname.ToString();
objBol.BillingCompanyName = objNewOrd.buyerbillingaddress.companyname.ToString();
objBol.BillingEmail = objNewOrd.buyerbillingaddress.email.ToString();
objBol.BillingPhone = objNewOrd.buyerbillingaddress.phone.ToString();
objBol.BillingFax = objNewOrd.buyerbillingaddress.fax.ToString();
objBol.BillingAddress1 = objNewOrd.buyerbillingaddress.address1.ToString();
objBol.BillingAddress2 = objNewOrd.buyerbillingaddress.address2.ToString();
objBol.BillingCity = objNewOrd.buyerbillingaddress.city.ToString();
objBol.BillingCountry = objNewOrd.buyerbillingaddress.countrycode.ToString();
objBol.BillingRegion = objNewOrd.buyerbillingaddress.region.ToString();
objBol.BillingPostalCode = objNewOrd.buyerbillingaddress.postalcode.ToString();
objBol.OrderTotal = Convert.ToDecimal(objNewOrd.ordertotal.Value);
objBol.UpdatedDate = Convert.ToDateTime(objNewOrd.timestamp);
objBol.Status = false;
objBol.Discount = 0;
objBol.DiscountType = "Discount";
objBol.advertiser_fk = 0;
objBol.Tax = 0;
foreach (Item ThisItem in objNewOrd.shoppingcart.items)
{
if (ThisItem.unitprice.Value > 0)
{
Order_Item objItem = new Order_Item();
objItem.Name = ThisItem.itemname;
objItem.quantity = ThisItem.quantity;
objItem.Price = ThisItem.unitprice.Value;
objItem.Googleorder_id = objBol.Googleorder_id;
string[] st = ThisItem.itemdescription.Split(',');
objBol.Itr_Fk = st[0];
objItem.RetrunDocId =Convert .ToInt64 ( st[1]);
objItem.Service_fk = Convert.ToInt16(st[2]);
hdnItrId.Value = objBol.Itr_Fk;
hdnReturnId.Value = objItem.RetrunDocId.ToString();
objBll.save_Orders_Items(objItem);
objItem = null;

}
else
{
//Use This area for save discount
objBol.DiscountType = ThisItem.itemname.ToString();
objBol.Discount = Convert.ToDecimal(ThisItem.unitprice.Value);
objBol.advertiser_fk = Convert.ToInt16(ThisItem.itemdescription);
}
}
string retval= objBll.save_Orders(objBol);
SendMail(objBol, retval);
objBol = null;
objBll = null;
break;
case "risk-information-notification":
objBll = new OrderBOL();
objBol = new Orders();
RiskInformationNotification objNewOrd1 = (RiskInformationNotification)EncodeHelper.Deserialize(RequestXml, typeof(RiskInformationNotification));
// This notification tells us that Google has authorized the order and it has passed the fraud check.
// Use the data below to determine if you want to accept the order, then start processing it.
objBol.Googleorder_id = objNewOrd1.googleordernumber;
objBol.AVS = objNewOrd1.riskinformation.avsresponse;
objBol.CVN = objNewOrd1.riskinformation.cvnresponse;
bool SellerProtection = objNewOrd1.riskinformation.eligibleforprotection;
objBol.Status = false;
objBol.charge_amount = 0;
objBll.UpdateOrderStatus(objBol);
objBol = null;
objBll = null;
break;
case "order-state-change-notification":
OrderStateChangeNotification N3 = (OrderStateChangeNotification)EncodeHelper.Deserialize(RequestXml, typeof(OrderStateChangeNotification));
// The order has changed either financial or fulfillment state in Google's system.
string OrderNumber3 = N3.googleordernumber;
string NewFinanceState = N3.newfinancialorderstate.ToString();
string NewFulfillmentState = N3.newfulfillmentorderstate.ToString();
string PrevFinanceState = N3.previousfinancialorderstate.ToString();
string PrevFulfillmentState = N3.previousfulfillmentorderstate.ToString();
break;
case "charge-amount-notification":
objBll = new OrderBOL();
objBol = new Orders();
ChargeAmountNotification objNewOrd3 = (ChargeAmountNotification)EncodeHelper.Deserialize(RequestXml, typeof(ChargeAmountNotification));
// Google has successfully charged the customer's credit card.
objBol.Googleorder_id = objNewOrd3.googleordernumber;
objBol.Status = true;
objBol.CVN = "";
objBol.AVS = "";

decimal ChargedAmount = objNewOrd3.latestchargeamount.Value;
objBol.charge_amount = ChargedAmount;
objBll.UpdateOrderStatus(objBol);
objBll = null;
objBol = null;
break;
case "refund-amount-notification":
RefundAmountNotification N5 = (RefundAmountNotification)EncodeHelper.Deserialize(RequestXml, typeof(RefundAmountNotification));
// Google has successfully refunded the customer's credit card.
string OrderNumber5 = N5.googleordernumber;
decimal RefundedAmount = N5.latestrefundamount.Value;
break;
case "chargeback-amount-notification":
ChargebackAmountNotification N6 = (ChargebackAmountNotification)EncodeHelper.Deserialize(RequestXml, typeof(ChargebackAmountNotification));
// A customer initiated a chargeback with his credit card company to get her money back.
string OrderNumber6 = N6.googleordernumber;
decimal ChargebackAmount = N6.latestchargebackamount.Value;
break;
}

}
#region Mail Sent
public void SendMail(Orders objOrder,string EmailAddress)
{
try
{
TemplateManager objTemp = new TemplateManager();
string emailfromName, emailfromId, emailpassword, emailSubject, body;
objTemp.TemplateType = "CUST_ORD";
objTemp = objTemp.fnDisplaySaleTemplateById(objTemp);
emailfromName = objTemp.FromName;
emailfromId = objTemp.FromEmail;
emailpassword = objTemp.Password;
emailSubject = objTemp.TemplateSubject;
body = objTemp.TemplateBody;
body = body.Replace("[Title]", "");
body = body.Replace("[FirstName]", objOrder.CustomerName);
body = body.Replace("[MiddleName]", "");
body = body.Replace("[LastName]", "");
body = body.Replace("[Address]", objOrder.BillingAddress1 + objOrder.BillingAddress2);
body = body.Replace("[City]", objOrder.BillingCity);
body = body.Replace("[State]", "");
body = body.Replace("[Country]", objOrder.BillingCountry);
body = body.Replace("[ZipCode]", objOrder.BillingPostalCode);
body = body.Replace("[Email]", objOrder.BillingEmail);
body = body.Replace("[MobilePhone]", "");
body = body.Replace("[Phone]", objOrder.BillingPhone);
#region Sent Mail

smtpsettings objsmtpsettings = new smtpsettings(objTemp.OutMail[0].OutMailServer, Convert.ToInt32(objTemp.OutMail[0].OutMailPort), emailfromId, emailpassword, true);
SMTPClient objSMTPClient = new SMTPClient(objsmtpsettings);
objSMTPClient.Recepients = EmailAddress;
if (!string.IsNullOrEmpty(objTemp.BCCEmail))
{
objSMTPClient.BCC = objTemp.BCCEmail;
}
if (!string.IsNullOrEmpty(objTemp.CCEmail))
{
objSMTPClient.CC = objTemp.CCEmail;
}
objSMTPClient.SenderName = emailfromName;
objSMTPClient.Subject = emailSubject;
objSMTPClient.Content = body;
objSMTPClient.SendMessage(objSMTPClient);
objsmtpsettings = null;
objSMTPClient = null;
#endregion
SendAdminMail(objOrder);
}
catch
{
}


}
public void SendAdminMail(Orders objOrder)
{
try
{
TemplateManager objTemp = new TemplateManager();
string emailfromName, emailfromId, emailpassword, emailSubject, body;
objTemp.TemplateType = "ADM_ORD";
objTemp = objTemp.fnDisplaySaleTemplateById(objTemp);
emailfromName = objTemp.FromName;
emailfromId = objTemp.FromEmail;
emailpassword = objTemp.Password;
emailSubject = objTemp.TemplateSubject;
body = objTemp.TemplateBody;
body = body.Replace("[Title]", "");
body = body.Replace("[FirstName]", objOrder.CustomerName);
body = body.Replace("[MiddleName]", "");
body = body.Replace("[LastName]", "");
body = body.Replace("[Address]", objOrder.BillingAddress1 + objOrder.BillingAddress2);
body = body.Replace("[City]", objOrder.BillingCity);
body = body.Replace("[State]", "");
body = body.Replace("[Country]", objOrder.BillingCountry);
body = body.Replace("[ZipCode]", objOrder.BillingPostalCode);
body = body.Replace("[Email]", objOrder.BillingEmail);
body = body.Replace("[MobilePhone]", "");
body = body.Replace("[Phone]", objOrder.BillingPhone);
#region Sent Mail
if (objTemp.ToEmai != null)
{
for (int icount = 0; icount < objTemp.ToEmai.Count; icount++)
{
smtpsettings objsmtpsettings = new smtpsettings(objTemp.OutMail[0].OutMailServer, Convert.ToInt32(objTemp.OutMail[0].OutMailPort), emailfromId, emailpassword, true);
SMTPClient objSMTPClient = new SMTPClient(objsmtpsettings);
objSMTPClient.Recepients = objTemp.ToEmai[icount].Email;

objSMTPClient.SenderName = emailfromName;
objSMTPClient.Subject = emailSubject;
objSMTPClient.Content = body;

objSMTPClient.SendMessage(objSMTPClient);
objsmtpsettings = null;
objSMTPClient = null;
}
}


#endregion
}
catch
{
}

}
#endregion
}

===============================
public Boolean fnActive(string Module, string Role)
{
string ret = "false";
string resourcefile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "Resources/Roles.xml");
XPathDocument objdoc = new XPathDocument(resourcefile);
XPathNavigator objnav;
objnav = objdoc.CreateNavigator();
XPathNodeIterator objitr;
XPathExpression objexp;
objexp = objnav.Compile("//Table[Name='" + Module + "' and Role='" + Role + "']/Active");
objitr = objnav.Select(objexp);
while (objitr.MoveNext())
{
ret = objitr.Current.ToString();
}

return Convert.ToBoolean(ret);
}

Write three Tier with Microsoft Application block

1.)BOL

using System;
using System.Text;

namespace Customer.Registration
{
public class Registration
{
#region Customer Registration variable
//Customer Registration variable
String _Salutation;
String _Regi_PK;
String _User_Name;
String _User_Pwd;
String _FirstName;

#endregion

#region Customer Registration Properties
// Customer Registration Properties



public String Salutation
{
get { return _Salutation; }
set { _Salutation = value; }
}

public String Regi_PK
{
get { return _Regi_PK; }
set { _Regi_PK = value; }
}
public String SSN
{
get { return _SSN; }
set { _SSN = value; }
}
public String User_Name
{
get { return _User_Name; }
set { _User_Name = value; }
}
public String User_Pwd
{
get { return _User_Pwd; }
set { _User_Pwd = value; }
}
public String FirstName
{
get { return _FirstName; }
set { _FirstName = value; }
}

#endregion
}
}


2.)BLL

using System;
using System.Collections.Generic;


namespace Customer.Registration
{
public class RegistrationBOL : RegistrationDAL
{
#region Public Function

public void saveRegistartion(Registration objRegistration)
{
base.saveRegistartion(objRegistration);
}
public Boolean UpdateRegistartion(Registration objRegistration)
{
Boolean Status = false;
base.UpdateRegistartion(objRegistration,out Status);
return Status;
}
public void UpdateRegistration(Registration objRegistration)
{
base.UpdateRegistration(objRegistration);
}
public Registration GetRegistrationInfoById(String RegID)
{
return base.GetRegistrationInfoById(RegID);
}

public List RegistrationInfoGetAll(int UserId)
{
return base.RegistrationInfoGetAll(UserId);
}
#endregion


}
}


3.)DAL


using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using System.Collections.Generic;
namespace Customer.Registration
{
public class RegistrationDAL : AppConfig
{
protected void saveRegistartion(Registration objRegistration)
{
SqlParameter[] Param;
Param = new SqlParameter[14];
Param[0] = new SqlParameter("@FirstName", SqlDbType.NVarChar);
Param[0].Value = objRegistration.FirstName;
Param[1] = new SqlParameter("@LastName", SqlDbType.NVarChar);
Param[1].Value = objRegistration.LastName;
Param[2] = new SqlParameter("@Address1", SqlDbType.NVarChar);
Param[2].Value = objRegistration.Address1;
Param[3] = new SqlParameter("@Address2", SqlDbType.NVarChar);
Param[3].Value = objRegistration.Address2;
Param[4] = new SqlParameter("@Address3", SqlDbType.NVarChar);
Param[4].Value = objRegistration.Address3;
Param[5] = new SqlParameter("@Country", SqlDbType.NVarChar);
Param[5].Value = objRegistration.Country;
Param[6] = new SqlParameter("@PostCode", SqlDbType.NVarChar);
Param[6].Value = objRegistration.PostCode;
Param[7] = new SqlParameter("@EmailAddress", SqlDbType.NVarChar);
Param[7].Value = objRegistration.EmailAddress;
Param[8] = new SqlParameter("@Phone", SqlDbType.NVarChar);
Param[8].Value = objRegistration.Phone;
Param[9] = new SqlParameter("@InfoMode", SqlDbType.NVarChar);
Param[9].Value = objRegistration.InfoMode;
Param[10] = new SqlParameter("@InfoMode_Other", SqlDbType.NVarChar);
Param[10].Value = objRegistration.InfoModeOther;
Param[11] = new SqlParameter("@Resi_ID", SqlDbType.NVarChar, 36);
Param[11].Direction = ParameterDirection.Output;
Param[12] = new SqlParameter("@Services", SqlDbType.NVarChar);
Param[12].Value = objRegistration.Services;
Param[13] = new SqlParameter("@PreferredName", SqlDbType.NVarChar);
Param[13].Value = objRegistration.PreferredName;

SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "usp_Customer_RegistrationAdd", Param);
objRegistration.Regi_PK = Param[11].Value.ToString();
}

protected void UpdateRegistartion(Registration objRegistration, out Boolean Status)
{
SqlParameter[] Param;
Param = new SqlParameter[20];
Param[0] = new SqlParameter("@Regi_PK", SqlDbType.NVarChar);
Param[0].Value = objRegistration.Regi_PK;
Param[1] = new SqlParameter("@Salutation", SqlDbType.NVarChar);
Param[1].Value = objRegistration.Salutation;
Param[2] = new SqlParameter("@FirstName", SqlDbType.NVarChar);
Param[2].Value = objRegistration.FirstName;
Param[3] = new SqlParameter("@MiddleName", SqlDbType.NVarChar);
Param[3].Value = objRegistration.MiddleName;
Param[4] = new SqlParameter("@LastName", SqlDbType.NVarChar);
Param[4].Value = objRegistration.LastName;
Param[5] = new SqlParameter("@PreferredName", SqlDbType.NVarChar);
Param[5].Value = objRegistration.PreferredName;
Param[6] = new SqlParameter("@DateofBirth", SqlDbType.DateTime);
Param[6].Value = objRegistration.DateOfBirth;
Param[7] = new SqlParameter("@Occupation", SqlDbType.NVarChar);
Param[7].Value = objRegistration.Occupation;
Param[8] = new SqlParameter("@SSNNo", SqlDbType.NVarChar);
Param[8].Value = objRegistration.SSN;


Param[9] = new SqlParameter("@Address1", SqlDbType.NVarChar);
Param[9].Value = objRegistration.Address1;
Param[10] = new SqlParameter("@Address2", SqlDbType.NVarChar);
Param[10].Value = objRegistration.Address2;
Param[11] = new SqlParameter("@Address3", SqlDbType.NVarChar);
Param[11].Value = objRegistration.Address3;
Param[12] = new SqlParameter("@City", SqlDbType.NVarChar);
Param[12].Value = objRegistration.City;
Param[13] = new SqlParameter("@State", SqlDbType.NVarChar);
Param[13].Value = objRegistration.State;

Param[14] = new SqlParameter("@Country", SqlDbType.NVarChar);
Param[14].Value = objRegistration.Country;
Param[15] = new SqlParameter("@PostCode", SqlDbType.NVarChar);
Param[15].Value = objRegistration.PostCode;
Param[16] = new SqlParameter("@EmailAddress", SqlDbType.NVarChar);
Param[16].Value = objRegistration.EmailAddress;
Param[17] = new SqlParameter("@Phone", SqlDbType.NVarChar);
Param[17].Value = objRegistration.Phone;
Param[18] = new SqlParameter("@Message", SqlDbType.NVarChar);
Param[18].Value = objRegistration.Message;
Param[19] = new SqlParameter("@Status", SqlDbType.Bit);
Param[19].Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "[usp_Customer_RegistrationUpdate]", Param);
Status = Convert.ToBoolean(Param[19].Value);
}
protected void UpdateRegistration(Registration objRegistration)
{
SqlParameter[] Param;
Param = new SqlParameter[11];
Param[0] = new SqlParameter("@Regi_PK", SqlDbType.NVarChar);
Param[0].Value = objRegistration.Regi_PK;

Param[1] = new SqlParameter("@FirstName", SqlDbType.NVarChar);
Param[1].Value = objRegistration.FirstName;

Param[2] = new SqlParameter("@LastName", SqlDbType.NVarChar);
Param[2].Value = objRegistration.LastName;
Param[3] = new SqlParameter("@PreferredName", SqlDbType.NVarChar);
Param[3].Value = objRegistration.PreferredName;
Param[4] = new SqlParameter("@Address1", SqlDbType.NVarChar);
Param[4].Value = objRegistration.Address1;
Param[5] = new SqlParameter("@Address2", SqlDbType.NVarChar);
Param[5].Value = objRegistration.Address2;
Param[6] = new SqlParameter("@Address3", SqlDbType.NVarChar);
Param[6].Value = objRegistration.Address3;

Param[7] = new SqlParameter("@Country", SqlDbType.NVarChar);
Param[7].Value = objRegistration.Country;
Param[8] = new SqlParameter("@PostCode", SqlDbType.NVarChar);
Param[8].Value = objRegistration.PostCode;
Param[9] = new SqlParameter("@EmailAddress", SqlDbType.NVarChar);
Param[9].Value = objRegistration.EmailAddress;
Param[10] = new SqlParameter("@Phone", SqlDbType.NVarChar);
Param[10].Value = objRegistration.Phone;

SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "[usp_Customer_RegistrationUpdate1]", Param);
}

protected Registration GetRegistrationInfoById(String RegID)
{
Registration objRegistration = new Registration();
SqlParameter[] Param;
Param = new SqlParameter[2];
Param[0] = new SqlParameter("@ITR_Fk", SqlDbType.NVarChar, 36);
Param[0].Value = RegID;
Param[1] = new SqlParameter("@step", SqlDbType.SmallInt);
Param[1].Value = 2;

SqlDataReader Dr = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "usp_Customer_GetStepWiseDataByITRID", Param);

if (Dr.HasRows)
{
Dr.Read();
objRegistration.Regi_PK = Dr["Regi_PK"].ToString();
objRegistration.FirstName = DBNull.Value.Equals(Dr["FirstName"]) ? "" : Dr["FirstName"].ToString();
objRegistration.MiddleName = DBNull.Value.Equals(Dr["MiddleName"]) ? "" : Dr["MiddleName"].ToString();
objRegistration.LastName = DBNull.Value.Equals(Dr["LastName"]) ? "" : Dr["LastName"].ToString();
objRegistration.Address1 = DBNull.Value.Equals(Dr["Address1"]) ? "" : Dr["Address1"].ToString();
objRegistration.Address2 = DBNull.Value.Equals(Dr["Address2"]) ? "" : Dr["Address2"].ToString();
objRegistration.Address3 = DBNull.Value.Equals(Dr["Address3"]) ? "" : Dr["Address3"].ToString();
objRegistration.Phone = DBNull.Value.Equals(Dr["Phone"]) ? "" : Dr["Phone"].ToString();
objRegistration.SSN = DBNull.Value.Equals(Dr["SSNNo"]) ? "" : Dr["SSNNo"].ToString();
objRegistration.Country = DBNull.Value.Equals(Dr["Country"]) ? "" : Dr["Country"].ToString();
objRegistration.PostCode = DBNull.Value.Equals(Dr["PostCode"]) ? "" : Dr["PostCode"].ToString();
objRegistration.PreferredName = DBNull.Value.Equals(Dr["PreferredName"]) ? "" : Dr["PreferredName"].ToString();

objRegistration.City = DBNull.Value.Equals(Dr["City"]) ? "" : Dr["City"].ToString();
objRegistration.State = DBNull.Value.Equals(Dr["State"]) ? "" : Dr["State"].ToString();
try
{
objRegistration.DateOfBirth = Convert.ToDateTime(Dr["DateOfBirth"]);
}
catch
{
objRegistration.DateOfBirth = DateTime.Today;
}
objRegistration.RegisteredOn = Convert.ToDateTime(Dr["RegisteredOn"]);
objRegistration.Message = DBNull.Value.Equals(Dr["Message"]) ? "" : Dr["Message"].ToString();
objRegistration.Salutation = DBNull.Value.Equals(Dr["Salutation"]) ? "" : Dr["Salutation"].ToString();
objRegistration.Occupation = DBNull.Value.Equals(Dr["Occupation"]) ? "" : Dr["Occupation"].ToString();
objRegistration.UpdatedOn = Convert.ToDateTime(Dr["UpdatedOn"]);
objRegistration.EmailAddress = DBNull.Value.Equals(Dr["User_Name"]) ? "" : Dr["User_Name"].ToString();
objRegistration.User_Pwd = DBNull.Value.Equals(Dr["User_Pwd"]) ? "" : Dr["User_Pwd"].ToString();

}
return objRegistration;
}
protected List RegistrationInfoGetAll(int UserId)
{

SqlParameter[] Param;
Param = new SqlParameter[1];
Param[0] = new SqlParameter("@UserId", SqlDbType.Int);
Param[0].Value = UserId;

List objList = new List();
SqlDataReader Dr = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "Usp_Control_CustomerRegisterationGetAll", Param);
while (Dr.Read())
{
Registration objRegistration = new Registration();

objRegistration.Regi_PK = Dr["Regi_PK"].ToString();
objRegistration.SSN = Convert.ToInt64(Dr["SSNNo"]).ToString("###-##-####");
objRegistration.FirstName = DBNull.Value.Equals(Dr["FirstName"]) ? "" : Dr["FirstName"].ToString();
objRegistration.LastName = DBNull.Value.Equals(Dr["LastName"]) ? "" : Dr["LastName"].ToString();
objRegistration.PreferredName = DBNull.Value.Equals(Dr["PreferredName"]) ? "" : Dr["PreferredName"].ToString();
objRegistration.EmailAddress = DBNull.Value.Equals(Dr["EmailAddress"]) ? "" : Dr["EmailAddress"].ToString();
objRegistration.UpdatedOn = Convert.ToDateTime(Dr["UpdatedOn"]);
objRegistration.InfoMode = DBNull.Value.Equals(Dr["InfoMode"]) ? "" : Dr["InfoMode"].ToString();
objList.Add(objRegistration);
objRegistration = null;
}
return objList;
}

protected RegistrationSearch RegistrationInfoGetAll(RegistrationSearch objRegistrationSearch)
{

SqlParameter[] Param;
Param = new SqlParameter[10];

Param[0] = new SqlParameter("@PageIndex", SqlDbType.Int);
Param[0].Value = objRegistrationSearch.PageIndex;
Param[1] = new SqlParameter("@RowsPerPage", SqlDbType.Int);
Param[1].Value = objRegistrationSearch.RecordperPage;
Param[2] = new SqlParameter("@OrderBY", SqlDbType.SmallInt);
Param[2].Value = objRegistrationSearch.OrderBy;
Param[3] = new SqlParameter("@Order", SqlDbType.SmallInt);
Param[3].Value = objRegistrationSearch.Order;

Param[4] = new SqlParameter("@UserId", SqlDbType.Int);
Param[4].Value = objRegistrationSearch.UserId;
Param[5] = new SqlParameter("@datefrom", SqlDbType.VarChar, 10);
Param[5].Value = objRegistrationSearch.DateFrom;
Param[6] = new SqlParameter("@dateto", SqlDbType.VarChar, 10);
Param[6].Value = objRegistrationSearch.DateTo;
Param[7] = new SqlParameter("@SSNNo", SqlDbType.VarChar, 100);
Param[7].Value = objRegistrationSearch.SSNo;
Param[8] = new SqlParameter("@Name", SqlDbType.VarChar, 100);
Param[8].Value = objRegistrationSearch.CustomerName;
Param[9] = new SqlParameter("@EmailId", SqlDbType.VarChar, 100);
Param[9].Value = objRegistrationSearch.EmailAddress;

SqlDataReader Dr = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "Usp_Control_CustomerRegisterationGetAll", Param);
while (Dr.Read())
{
objRegistrationSearch.TotalRecords = Convert.ToInt32(Dr["TotalRecords"]);
}
Dr.NextResult();



while (Dr.Read())
{
Registration objRegistration = new Registration();

objRegistration.Regi_PK = Dr["Regi_PK"].ToString();
try
{
objRegistration.SSN = Convert.ToInt64(Dr["SSNNo"]).ToString("###-##-####");
}
catch { objRegistration.SSN = ""; }
objRegistration.FirstName = DBNull.Value.Equals(Dr["FirstName"]) ? "" : Dr["FirstName"].ToString();
objRegistration.LastName = DBNull.Value.Equals(Dr["LastName"]) ? "" : Dr["LastName"].ToString();
objRegistration.PreferredName = DBNull.Value.Equals(Dr["PreferredName"]) ? "" : Dr["PreferredName"].ToString();
objRegistration.EmailAddress = DBNull.Value.Equals(Dr["EmailAddress"]) ? "" : Dr["EmailAddress"].ToString();
objRegistration.UpdatedOn = Convert.ToDateTime(Dr["UpdatedOn"]);
objRegistration.InfoMode = DBNull.Value.Equals(Dr["InfoMode"]) ? "" : Dr["InfoMode"].ToString();
objRegistrationSearch.Registrations.Add(objRegistration);
objRegistration = null;
}
return objRegistrationSearch;
}
protected RegistrationSearch RegistrationInfoGetAll_reminderEmail(RegistrationSearch objRegistrationSearch)
{

SqlParameter[] Param;
Param = new SqlParameter[11];

Param[0] = new SqlParameter("@PageIndex", SqlDbType.Int);
Param[0].Value = objRegistrationSearch.PageIndex;
Param[1] = new SqlParameter("@RowsPerPage", SqlDbType.Int);
Param[1].Value = objRegistrationSearch.RecordperPage;
Param[2] = new SqlParameter("@OrderBY", SqlDbType.SmallInt);
Param[2].Value = objRegistrationSearch.OrderBy;
Param[3] = new SqlParameter("@Order", SqlDbType.SmallInt);
Param[3].Value = objRegistrationSearch.Order;
Param[4] = new SqlParameter("@UserId", SqlDbType.Int);
Param[4].Value = objRegistrationSearch.UserId;
Param[5] = new SqlParameter("@SSNNo", SqlDbType.VarChar, 100);
Param[5].Value = objRegistrationSearch.SSNo;
Param[6] = new SqlParameter("@Name", SqlDbType.VarChar, 100);
Param[6].Value = objRegistrationSearch.CustomerName;
Param[7] = new SqlParameter("@EmailId", SqlDbType.VarChar, 100);
Param[7].Value = objRegistrationSearch.EmailAddress;
Param[8] = new SqlParameter("@ReminderPeriod", SqlDbType.VarChar, 200);
Param[8].Value = objRegistrationSearch.ReminderPeriod;
Param[9] = new SqlParameter("@datefrom", SqlDbType.VarChar, 10);
Param[9].Value = objRegistrationSearch.DateFrom;
Param[10] = new SqlParameter("@dateto", SqlDbType.VarChar, 10);
Param[10].Value = objRegistrationSearch.DateTo;

//Param[10] = new SqlParameter("@FinancialYear", SqlDbType.VarChar, 100);
//Param[10].Value = objRegistrationSearch.financialYear;



SqlDataReader Dr = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "[Usp_Control_reminderEmail_CustomerRegisterationGetAll]", Param);
while (Dr.Read())
{
objRegistrationSearch.TotalRecords = Convert.ToInt32(Dr["TotalRecords"]);
}
Dr.NextResult();



while (Dr.Read())
{
Registration objRegistration = new Registration();

objRegistration.Regi_PK = Dr["Regi_PK"].ToString();
try
{
objRegistration.SSN = Convert.ToInt64(Dr["SSNNo"]).ToString("###-##-####");
}
catch { objRegistration.SSN = ""; }
objRegistration.FirstName = DBNull.Value.Equals(Dr["FirstName"]) ? "" : Dr["FirstName"].ToString();
objRegistration.LastName = DBNull.Value.Equals(Dr["LastName"]) ? "" : Dr["LastName"].ToString();
objRegistration.PreferredName = DBNull.Value.Equals(Dr["PreferredName"]) ? "" : Dr["PreferredName"].ToString();
objRegistration.EmailAddress = DBNull.Value.Equals(Dr["EmailAddress"]) ? "" : Dr["EmailAddress"].ToString();
objRegistration.UpdatedOn = Convert.ToDateTime(Dr["UpdatedOn"]);
objRegistration.InfoMode = DBNull.Value.Equals(Dr["InfoMode"]) ? "" : Dr["InfoMode"].ToString();
objRegistrationSearch.Registrations.Add(objRegistration);
objRegistration = null;
}
return objRegistrationSearch;
}
protected RegistrationSearch RegistrationInfoGetAll_dateSpecificEmail(RegistrationSearch objRegistrationSearch)
{

SqlParameter[] Param;
Param = new SqlParameter[12];

Param[0] = new SqlParameter("@PageIndex", SqlDbType.Int);
Param[0].Value = objRegistrationSearch.PageIndex;
Param[1] = new SqlParameter("@RowsPerPage", SqlDbType.Int);
Param[1].Value = objRegistrationSearch.RecordperPage;
Param[2] = new SqlParameter("@OrderBY", SqlDbType.SmallInt);
Param[2].Value = objRegistrationSearch.OrderBy;
Param[3] = new SqlParameter("@Order", SqlDbType.SmallInt);
Param[3].Value = objRegistrationSearch.Order;
Param[4] = new SqlParameter("@UserId", SqlDbType.Int);
Param[4].Value = objRegistrationSearch.UserId;
Param[5] = new SqlParameter("@SSNNo", SqlDbType.VarChar, 100);
Param[5].Value = objRegistrationSearch.SSNo;
Param[6] = new SqlParameter("@Name", SqlDbType.VarChar, 100);
Param[6].Value = objRegistrationSearch.CustomerName;
Param[7] = new SqlParameter("@EmailId", SqlDbType.VarChar, 100);
Param[7].Value = objRegistrationSearch.EmailAddress;
Param[8] = new SqlParameter("@MailDate", SqlDbType.VarChar, 200);
Param[8].Value = objRegistrationSearch.MailDate;
Param[9] = new SqlParameter("@FinancialYear", SqlDbType.VarChar, 100);
Param[9].Value = objRegistrationSearch.financialYear;

Param[10] = new SqlParameter("@datefrom", SqlDbType.VarChar, 10);
Param[10].Value = objRegistrationSearch.DateFrom;
Param[11] = new SqlParameter("@dateto", SqlDbType.VarChar, 10);
Param[11].Value = objRegistrationSearch.DateTo;


SqlDataReader Dr = SqlHelper.ExecuteReader(connectionString, CommandType.StoredProcedure, "[Usp_Control_dateSpecific_CustomerRegisterationGetAll]", Param);
while (Dr.Read())
{
objRegistrationSearch.TotalRecords = Convert.ToInt32(Dr["TotalRecords"]);
}
Dr.NextResult();



while (Dr.Read())
{
Registration objRegistration = new Registration();

objRegistration.Regi_PK = Dr["Regi_PK"].ToString();
try
{
objRegistration.SSN = Convert.ToInt64(Dr["SSNNo"]).ToString("###-##-####");
}
catch { objRegistration.SSN = ""; }
objRegistration.FirstName = DBNull.Value.Equals(Dr["FirstName"]) ? "" : Dr["FirstName"].ToString();
objRegistration.LastName = DBNull.Value.Equals(Dr["LastName"]) ? "" : Dr["LastName"].ToString();
objRegistration.PreferredName = DBNull.Value.Equals(Dr["PreferredName"]) ? "" : Dr["PreferredName"].ToString();
objRegistration.EmailAddress = DBNull.Value.Equals(Dr["EmailAddress"]) ? "" : Dr["EmailAddress"].ToString();
objRegistration.UpdatedOn = Convert.ToDateTime(Dr["UpdatedOn"]);
objRegistration.InfoMode = DBNull.Value.Equals(Dr["InfoMode"]) ? "" : Dr["InfoMode"].ToString();
objRegistrationSearch.Registrations.Add(objRegistration);
objRegistration = null;
}
return objRegistrationSearch;
}
}
}

4.)Search

using System;
using System.Collections.Generic;
using System.Text;

namespace Customer.Registration
{
public class RegistrationSearch : RegistrationDAL
{
#region private variable

private Int32 _pageindex;
private Int32 _recordperpage;
private Int16 _orderby;
private Int16 _order;
private Int32 _totalrecords;

private Int32 _UserId;
private String _ssno;
private String _customername;
private String _emailid;
private String _datefrom;
private String _dateto;
private int _financialYear;
private String _ReminderPeriod;
private string _MailDate;

private List _Registrations = new List();
#endregion

#region Public Properties
public Int32 UserId
{
get
{
return this._UserId;
}
set
{
if ((this._UserId != value))
{
this._UserId = value;
}
}
}
public Int32 PageIndex
{
get
{
return this._pageindex;
}
set
{
if ((this._pageindex != value))
{
this._pageindex = value;
}
}
}
public Int32 RecordperPage
{
get
{
return this._recordperpage;
}
set
{
if ((this._recordperpage != value))
{
this._recordperpage = value;
}
}
}
public Int32 TotalRecords
{
get
{
return this._totalrecords;
}
set
{
if ((this._totalrecords != value))
{
this._totalrecords = value;
}
}
}
public Int16 OrderBy
{
get
{
return this._orderby;
}
set
{
if ((this._orderby != value))
{
this._orderby = value;
}
}
}
public Int16 Order
{
get
{
return this._order;
}
set
{
if ((this._order != value))
{
this._order = value;
}
}
}

public String SSNo
{
get { return _ssno; }
set { _ssno = value; }
}
public String CustomerName
{
get { return _customername; }
set { _customername = value; }
}
public String EmailAddress
{
get { return _emailid; }
set { _emailid = value; }
}
public String DateFrom
{
get { return _datefrom; }
set { _datefrom = value; }
}
public String DateTo
{
get { return _dateto; }
set { _dateto = value; }
}
public String ReminderPeriod
{
get { return _ReminderPeriod; }
set { _ReminderPeriod = value; }
}
public String MailDate
{
get { return _MailDate; }
set { _MailDate = value; }
}
public int financialYear
{
get { return _financialYear; }
set { _financialYear = value; }
}

public List Registrations
{
get
{
return this._Registrations;
}
set
{
if ((this._Registrations != value))
{
this._Registrations = value;
}
}


}
#endregion

#region Public Function

public RegistrationSearch RegistrationInfoGetAll(RegistrationSearch objRegistrationSearch)
{
return base.RegistrationInfoGetAll(objRegistrationSearch);
}
public RegistrationSearch RegistrationInfoGetAll_reminderEmail(RegistrationSearch objRegistrationSearch)
{
return base.RegistrationInfoGetAll_reminderEmail(objRegistrationSearch);
}
public RegistrationSearch RegistrationInfoGetAll_dateSpecificEmail(RegistrationSearch objRegistrationSearch)
{
return base.RegistrationInfoGetAll_dateSpecificEmail(objRegistrationSearch);
}
#endregion
}
}

27.11.09

HL7

http://www.codeproject.com/KB/XML/HL7ToXMLConverter.aspx

http://nhapi.sourceforge.net/home.php

9.11.09

Using FindControl with a MasterPage in ASP.NET & C#

http://www.aspnettutorials.com/tutorials/controls/findcontrol-csharp.aspx

4.11.09

Jquery Videos

http://plugins.jquery.com/

http://blog.themeforest.net/screencasts/jquery-for-absolute-beginners-video-series/

http://sorgalla.com/jcarousel/

http://www.smashingmagazine.com/2009/01/15/45-new-jquery-techniques-for-a-good-user-experience/

http://www.beansoftware.com/ASP.NET-Tutorials/Using-jQuery-ASP.NET.aspx

29.10.09

Rad Rotataor with client side

http://www.telerik.com/community/forums/aspnet-ajax/rotator/client-side-control-of-rad-rotator.aspx

http://www.telerik.com/help/aspnet-ajax/rotator-clientside-api.html