1.)BOL
using System;
namespace Customer.Login
{
public class LoggedInUser
{
String _Regi_PK, _ITR_PK;
String _User_Name;
String _PrefferredName;
String _EmailAddress;
String _Address, _SSN;
Boolean _IsJointStatement,_HaveDependents,_IsLocked;
Int16 _Step ;
String _Year;
Int32 _NewMessages;
public String Regi_PK
{
get { return _Regi_PK; }
set { _Regi_PK = value; }
}
public String ITR_PK
{
get { return _ITR_PK; }
set { _ITR_PK = value; }
}
public String User_Name
{
get { return _User_Name; }
set { _User_Name = value; }
}
public String PrefferredName
{
get { return _PrefferredName; }
set { _PrefferredName = value; }
}
public String EmailAddress
{
get { return _EmailAddress; }
set { _EmailAddress = value; }
}
public String Address
{
get { return _Address; }
set { _Address = value; }
}
public String SSN
{
get { return _SSN; }
set { _SSN = value; }
}
public String Year
{
get { return _Year; }
set { _Year = value; }
}
public Boolean IsJointStatement
{
get { return _IsJointStatement; }
set { _IsJointStatement = value; }
}
public Boolean HaveDependents
{
get { return _HaveDependents; }
set { _HaveDependents = value; }
}
public Boolean IsLocked
{
get { return _IsLocked; }
set { _IsLocked = value; }
}
public Int16 Step
{
get { return _Step; }
set { _Step = value; }
}
public Int32 NewMessages
{
get { return _NewMessages; }
set { _NewMessages = value; }
}
public LoggedInUser(String Regi_PK, String ITR_PK, String User_Name, String EmailAddress, String Address, String PreferredName)
{
this.Regi_PK = Regi_PK;
this.ITR_PK = ITR_PK;
this.User_Name = User_Name;
this.PrefferredName = PreferredName;
this.EmailAddress = EmailAddress;
this.Address = Address;
this.SSN = "";
this.NewMessages = 0;
this.Step = 0;
this.Year = "All";
}
public LoggedInUser(String Regi_PK, String ITR_PK, String User_Name, String EmailAddress, String Address, String SSN, String PreferredName,Int32 NewMessages)
{
this.Regi_PK = Regi_PK;
this.ITR_PK = ITR_PK;
this.User_Name = User_Name;
this.PrefferredName = PreferredName;
this.EmailAddress = EmailAddress;
this.Address = Address;
this.SSN = SSN;
this.NewMessages = NewMessages;
this.Step = 0;
this.Year = "All";
}
}
}
2.)BLL
using System;
using System.Collections.Generic;
namespace Customer.Login
{
public class LoginBOL : LoginDAL
{
String _LoginMessage;
public String LoginMessage
{
get { return _LoginMessage; }
set { _LoginMessage = value; }
}
public LoggedInUser UpdatePassword(String Regi_PK, String Email, String Pwd, String NewPwd)
{
String Message = "";
String Regi_Id = "";
String FullName = "";
String Address = "";
String ITR_PK = "";
String PreferredName="";
base.UpdatePassword(Regi_PK, Email, Pwd, NewPwd, out Message, out Regi_Id, out ITR_PK, out FullName, out Address, out PreferredName);
this.LoginMessage = Message;
return new LoggedInUser(Regi_Id, ITR_PK, FullName, Email, Address, PreferredName);
}
public LoggedInUser ValidateUser(String Email, String Pwd)
{
String Message = "";
String Regi_Id = "";
String FullName = "";
String Address = "";
String SSN = "";
String ITR_PK = "";
String PreferredName = "";
Int32 NewEmails = 0;
base.ValidateUser(Email, Pwd, out Message, out Regi_Id, out FullName, out Address, out SSN, out PreferredName, out NewEmails);
this.LoginMessage = Message;
return new LoggedInUser(Regi_Id, ITR_PK, FullName, Email, Address, SSN, PreferredName, NewEmails);
}
public void ChangePassword(String Regi_PK, String Email, String Pwd, String NewPwd)
{
String Message = "";
base.ChangePassword(Regi_PK, Email, Pwd, NewPwd, out Message);
this.LoginMessage = Message;
}
public LoggedInUser ForgotPassword(String Email)
{
String Message = "";
String Regi_Id = "";
String ITR_PK = "";
String FullName = "";
String Password = "";
String SSN = "";
String PreferredName = "";
base.ForgotPassword(Email, out Message, out Regi_Id, out FullName, out Password, out PreferredName);
this.LoginMessage = Message;
return new LoggedInUser(Regi_Id, ITR_PK,FullName, Email, Password, PreferredName);
}
}
}
3.)DAL
using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
namespace Customer.Login
{
public class LoginDAL : AppConfig
{
protected void UpdatePassword(String Regi_PK, String Email, String Pwd, String NewPwd, out String Message, out String Regi_Id, out String ITR_PK, out String FullName, out String Address, out String PreferredName)
{
SqlParameter[] Param;
Param = new SqlParameter[11];
Param[0] = new SqlParameter("@Flag", SqlDbType.SmallInt);
Param[0].Value = 1;
Param[1] = new SqlParameter("@Regi_PK", SqlDbType.NVarChar);
Param[1].Value = Regi_PK;
Param[2] = new SqlParameter("@UserName", SqlDbType.NVarChar);
Param[2].Value = Email;
Param[3] = new SqlParameter("@Password", SqlDbType.NVarChar);
Param[3].Value = Pwd;
Param[4] = new SqlParameter("@NewPassword", SqlDbType.NVarChar);
Param[4].Value = NewPwd;
Param[5] = new SqlParameter("@ITR_PK", SqlDbType.NVarChar, 36);
Param[5].Direction = ParameterDirection.Output;
Param[6] = new SqlParameter("@Regi_Id", SqlDbType.NVarChar, 36);
Param[6].Direction = ParameterDirection.Output;
Param[7] = new SqlParameter("@fullName", SqlDbType.NVarChar, 500);
Param[7].Direction = ParameterDirection.Output;
Param[8] = new SqlParameter("@Address", SqlDbType.NVarChar, 500);
Param[8].Direction = ParameterDirection.Output;
Param[9] = new SqlParameter("@msgout", SqlDbType.NVarChar, 100);
Param[9].Direction = ParameterDirection.Output;
Param[10] = new SqlParameter("@preferred", SqlDbType.NVarChar, 200);
Param[10].Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "usp_Customer_ValidateUser", Param);
Message = Param[9].Value.ToString();
if (Message == "OK")
{
ITR_PK = Param[5].Value.ToString();
Regi_Id = Param[6].Value.ToString();
FullName = Param[7].Value.ToString();
Address = Param[8].Value.ToString();
PreferredName = Param[10].Value.ToString();
}
else
{
ITR_PK = String.Empty;
Regi_Id = String.Empty;
FullName = String.Empty;
Address = String.Empty;
PreferredName = String.Empty;
}
}
protected void ValidateUser(String Email, String Pwd, out String Message, out String Regi_Id, out String FullName, out String Address, out String SSN, out String PreferredName, out Int32 NewMessages)
{
SqlParameter[] Param;
Param = new SqlParameter[12];
Param[0] = new SqlParameter("@Flag", SqlDbType.SmallInt);
Param[0].Value = 4;
Param[1] = new SqlParameter("@Regi_PK", SqlDbType.NVarChar);
Param[1].Value = String.Empty;
Param[2] = new SqlParameter("@UserName", SqlDbType.NVarChar);
Param[2].Value = Email;
Param[3] = new SqlParameter("@Password", SqlDbType.NVarChar);
Param[3].Value = Pwd;
Param[4] = new SqlParameter("@NewPassword", SqlDbType.NVarChar);
Param[4].Value = String.Empty;
Param[5] = new SqlParameter("@Regi_Id", SqlDbType.NVarChar, 36);
Param[5].Direction = ParameterDirection.Output;
Param[6] = new SqlParameter("@fullName", SqlDbType.NVarChar, 500);
Param[6].Direction = ParameterDirection.Output;
Param[7] = new SqlParameter("@Address", SqlDbType.NVarChar, 500);
Param[7].Direction = ParameterDirection.Output;
Param[8] = new SqlParameter("@msgout", SqlDbType.NVarChar, 100);
Param[8].Direction = ParameterDirection.Output;
Param[9] = new SqlParameter("@SSN", SqlDbType.NVarChar, 100);
Param[9].Direction = ParameterDirection.Output;
Param[10] = new SqlParameter("@preferred", SqlDbType.NVarChar, 200);
Param[10].Direction = ParameterDirection.Output;
Param[11] = new SqlParameter("@newMessages", SqlDbType.Int);
Param[11].Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "usp_Customer_ValidateUser", Param);
Message = Param[8].Value.ToString();
if (Message == "OK")
{
Regi_Id = Param[5].Value.ToString();
FullName = Param[6].Value.ToString();
Address = Param[7].Value.ToString();
PreferredName = Param[10].Value.ToString();
try
{
SSN = Convert.ToInt64(Param[9].Value).ToString("###-##-####");
}
catch
{
SSN = String.Empty;
}
NewMessages = Convert.ToInt32(Param[11].Value);
}
else
{
Regi_Id = String.Empty;
FullName = String.Empty;
Address = String.Empty;
SSN = String.Empty;
PreferredName = String.Empty;
NewMessages = 0;
}
}
protected void ChangePassword(String Regi_PK, String Email, String Pwd, String NewPwd, out String Message)
{
SqlParameter[] Param;
Param = new SqlParameter[6];
Param[0] = new SqlParameter("@Flag", SqlDbType.SmallInt);
Param[0].Value = 2;
Param[1] = new SqlParameter("@Regi_PK", SqlDbType.NVarChar);
Param[1].Value = Regi_PK;
Param[2] = new SqlParameter("@UserName", SqlDbType.NVarChar);
Param[2].Value = Email;
Param[3] = new SqlParameter("@Password", SqlDbType.NVarChar);
Param[3].Value = Pwd;
Param[4] = new SqlParameter("@NewPassword", SqlDbType.NVarChar);
Param[4].Value = NewPwd;
Param[5] = new SqlParameter("@msgout", SqlDbType.NVarChar, 100);
Param[5].Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "usp_Customer_ValidateUser", Param);
Message = Param[5].Value.ToString();
}
protected void ForgotPassword(String Email, out String Message, out String Regi_Id, out String FullName, out String Password, out String PreferredName)
{
SqlParameter[] Param;
Param = new SqlParameter[7];
Param[0] = new SqlParameter("@Flag", SqlDbType.SmallInt);
Param[0].Value = 3;
Param[1] = new SqlParameter("@UserName", SqlDbType.NVarChar);
Param[1].Value = Email;
Param[2] = new SqlParameter("@Regi_Id", SqlDbType.NVarChar, 36);
Param[2].Direction = ParameterDirection.Output;
Param[3] = new SqlParameter("@fullName", SqlDbType.NVarChar, 500);
Param[3].Direction = ParameterDirection.Output;
Param[4] = new SqlParameter("@Address", SqlDbType.NVarChar, 500);
Param[4].Direction = ParameterDirection.Output;
Param[5] = new SqlParameter("@msgout", SqlDbType.NVarChar, 100);
Param[5].Direction = ParameterDirection.Output;
Param[6] = new SqlParameter("@preferred", SqlDbType.NVarChar, 200);
Param[6].Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "usp_Customer_ValidateUser", Param);
Message = Param[5].Value.ToString();
if (Message == "OK")
{
Regi_Id = Param[2].Value.ToString();
FullName = Param[3].Value.ToString();
Password = Param[4].Value.ToString();
PreferredName = Param[5].Value.ToString();
}
else
{
Regi_Id = String.Empty;
FullName = String.Empty;
Password = String.Empty;
PreferredName = String.Empty;
}
}
}
}
Showing posts with label Three Tier with Application Block. Show all posts
Showing posts with label Three Tier with Application Block. Show all posts
14.1.10
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
}
}
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
{
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
{
SqlParameter[] Param;
Param = new SqlParameter[1];
Param[0] = new SqlParameter("@UserId", SqlDbType.Int);
Param[0].Value = UserId;
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
#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
{
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
}
}
Subscribe to:
Posts (Atom)