ClsRegistration
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SNSCT
{
class ClsRegistration
{
public byte[] arr_img { set; get; }
public string Reg_no { set; get; }
public string Name { set; get; }
public DateTime DOB { set; get; }
public DateTime DOJ { set; get; }
public string BloodGroup { set; get; }
public string Father { set; get; }
public DateTime FatherDOB { set; get; }
public string FatherBloodGroup { set; get; }
public string Wife { set; get; }
public DateTime WifeDOB { set; get; }
public string WifeBloodGroup { set; get; }
public string HouseName { set; get; }
public string HouseNo { set; get; }
public string street { set; get; }
public string City { set; get; }
public string District { set; get; }
public string State { set; get; }
public string Occupation { set; get; }
public string Office { set; get; }
public string OfficeBuilding { set; get; }
public string OfficeStreet { set; get; }
public string OfficeCity { set; get; }
public string OfficeDistrict { set; get; }
public string OfficeState { set; get; }
public string OfficeCountry { set; get; }
public string WifeOccupation { set; get; }
public string WifeOffice { set; get; }
public string WifeOfficeBuilding { set; get; }
public string WifeOfficeStreet { set; get; }
public string WifeOfficeCity { set; get; }
public string WifeOfficeDistrict { set; get; }
public string WifeOfficeState { set; get; }
public string WifeOfficeCountry { set; get; }
public string Mobile { set; get; }
public string Landline { set; get; }
public string Phone_Office { set; get; }
public string Email { set; get; }
public string Child1 { set; get; }
public string Child1_Details { set; get; }
public DateTime Child1_DOB { set; get; }
public string Child1_BloodGroup { set; get; }
public string Child2 { set; get; }
public string Child2_Details { set; get; }
public DateTime Child2_DOB { set; get; }
public string Child2_BloodGroup { set; get; }
public string Child3 { set; get; }
public string Child3_Details { set; get; }
public DateTime Child3_DOB { set; get; }
public string Child3_BloodGroup { set; get; }
public string Child4 { set; get; }
public string Child4_Details { set; get; }
public DateTime Child4_DOB { set; get; }
public string Child4_BloodGroup { set; get; }
public int Alert_Sms { set; get; }
public int Alert_VoiceCall { set; get; }
public int Alert_Email { set; get; }
public int RegNo_present()
{
SqlDb Db = new SqlDb();
StringBuilder Str = new StringBuilder();
Str.Append("Select * from Registration where RegNo=" + Reg_no + "");
DataTable Dt_temp = new DataTable();
Dt_temp = Db.getTable_(Str.ToString());
if (Dt_temp.Rows.Count > 0)
{
return 0;
}
else
{
return 1;
}
}
public int Update_reg(int ID)
{
SqlDb Db = new SqlDb();
StringBuilder Str = new StringBuilder();
Str.Append("Select * from Registration where RegNo=" + Reg_no + " and MemberID<>" + ID + " ");
DataTable Dt_temp = new DataTable();
Dt_temp = Db.getTable_(Str.ToString());
if (Dt_temp.Rows.Count > 0)
{
return 2;
}
else
{
Str.Remove(0, Str.Length);
Str.Append("Update Registration set ");
Str.Append("Name='" + Name + "',");
Str.Append("JoinDate='" + DOJ + "',");
Str.Append("Image=@image,");
Str.Append("DOB='" + DOB + "',");
Str.Append("BloodGroup='" + BloodGroup + "',");
Str.Append("Father='" + Father + "',");
Str.Append("FatherDOB='" + FatherDOB + "',");
Str.Append("FatherBloodGroup='" + FatherBloodGroup + "',");
Str.Append("Wife='" + Wife + "',");
Str.Append("WifeDOB='" + WifeDOB + "',");
Str.Append("WifeBloodGroup='" + WifeBloodGroup + "',");
Str.Append("HouseName='" + HouseName + "',");
Str.Append("HouseNo='" + HouseNo + "',");
Str.Append("street='" + street + "',");
Str.Append("City='" + City + "',");
Str.Append("District='" + District + "',");
Str.Append("State='" + State + "',");
Str.Append("Occupation='" + Occupation + "',");
Str.Append("Office='" + Office + "',");
Str.Append("OfficeBuilding='" + OfficeBuilding + "',");
Str.Append("OfficeStreet='" + OfficeStreet + "',");
Str.Append("OfficeCity='" + OfficeCity + "',");
Str.Append("OfficeDistrict='" + OfficeDistrict + "',");
Str.Append("OfficeState='" + OfficeState + "',");
Str.Append("OfficeCountry='" + OfficeCountry + "',");
Str.Append("WifeOccupation='" + WifeOccupation + "',");
Str.Append("WifeOffice='" + WifeOffice + "',");
Str.Append("WifeOfficeBuilding='" + WifeOfficeBuilding + "',");
Str.Append("WifeOfficeStreet='" + WifeOfficeStreet + "',");
Str.Append("WifeOfficeCity='" + WifeOfficeCity + "',");
Str.Append("WifeOfficeDistrict='" + WifeOfficeDistrict + "',");
Str.Append("WifeOfficeState='" + WifeOfficeState + "',");
Str.Append("WifeOfficeCountry='" + WifeOfficeCountry + "',");
Str.Append("Mobile='" + Mobile + "',");
Str.Append("Landline='" + Landline + "',");
Str.Append("Phone_Office='" + Phone_Office + "',");
Str.Append("Email='" + Email + "',");
Str.Append("Child1='" + Child1 + "',");
Str.Append("Child1_Details='" + Child1_Details + "',");
Str.Append("Child1_DOB='" + Child1_DOB + "',");
Str.Append("Child1_BloodGroup='" + Child1_BloodGroup + "',");
Str.Append("Child2='" + Child2 + "',");
Str.Append("Child2_Details='" + Child2_Details + "',");
Str.Append("Child2_DOB='" + Child2_DOB + "',");
Str.Append("Child2_BloodGroup='" + Child2_BloodGroup + "',");
Str.Append("Child3='" + Child3 + "',");
Str.Append("Child3_Details='" + Child3_Details + "',");
Str.Append("Child3_DOB='" + Child3_DOB + "',");
Str.Append("Child3_BloodGroup='" + Child3_BloodGroup + "',");
Str.Append("Child4='" + Child4 + "',");
Str.Append("Child4_Details='" + Child4_Details + "',");
Str.Append("Child4_DOB='" + Child4_DOB + "',");
Str.Append("Child4_BloodGroup='" + Child4_BloodGroup + "',");
Str.Append("AlertSMS=" + Alert_Sms + ",");
Str.Append("AlertvoiceCall=" + Alert_VoiceCall + ",");
Str.Append("AlertEmail=" + Alert_Email + "");
Str.Append(" where MemberID=" + ID + "");
Db.Execute_Img(Str.ToString(), arr_img);
return 1;
}
}
public void Delete_Reg(int ID)
{
SqlDb Db = new SqlDb();
StringBuilder Str = new StringBuilder();
Str.Append("Delete from Registration where MemberID = " + ID + "");
Db.Execute_(Str.ToString());
}
public DataTable Get_by_Name()
{
SqlDb Db = new SqlDb();
StringBuilder Str = new StringBuilder();
Str.Append("Select MemberID,Name from Registration order by Name");
return Db.getTable_(Str.ToString());
}
public DataTable Get_Member(int ID)
{
SqlDb Db = new SqlDb();
StringBuilder Str = new StringBuilder();
Str.Append("Select * from Registration where MemberID=" + ID + "");
return Db.getTable_(Str.ToString());
}
public DataTable Get_by_Reg()
{
SqlDb Db = new SqlDb();
StringBuilder Str = new StringBuilder();
Str.Append("Select MemberID,RegNo from Registration ");
return Db.getTable_(Str.ToString());
}
public void insert_reg()
{
SqlDb Db = new SqlDb();
StringBuilder Str = new StringBuilder();
Str.Append("Insert into Registration(RegNo,JoinDate,Image,Name,DOB,BloodGroup,Father,");
Str.Append("FatherDOB,FatherBloodGroup,Wife,WifeDOB,");
Str.Append("WifeBloodGroup,HouseName,HouseNo,street,");
Str.Append("City,District,State,Occupation,");
Str.Append("Office,OfficeBuilding,OfficeStreet,OfficeCity,");
Str.Append("OfficeDistrict,OfficeState,OfficeCountry,WifeOccupation,");
Str.Append("WifeOffice,WifeOfficeBuilding,WifeOfficeStreet,WifeOfficeCity,");
Str.Append("WifeOfficeDistrict,WifeOfficeState,WifeOfficeCountry,Mobile,");
Str.Append("Landline,Phone_Office,Email,Child1,Child1_Details,");
Str.Append("Child1_DOB,Child1_BloodGroup,Child2,Child2_Details,");
Str.Append("Child2_DOB,Child2_BloodGroup,Child3,Child3_Details,");
Str.Append("Child3_DOB,Child3_BloodGroup,Child4,Child4_Details,");
Str.Append("Child4_DOB,Child4_BloodGroup,AlertSMS,AlertvoiceCall,AlertEmail) values");
Str.Append("('" + Reg_no + "','"+DOJ+"',@image,'" + Name + "','" + DOB + "','" + BloodGroup + "','" + Father + "',");
Str.Append("'" + FatherDOB + "','" + FatherBloodGroup + "','" + Wife + "','" + WifeDOB + "',");
Str.Append("'" + WifeBloodGroup + "','" + HouseName + "','" + HouseNo + "','" + street + "',");
Str.Append("'" + City + "','" + District + "','" + State + "','" + Occupation + "',");
Str.Append("'" + Office + "','" + OfficeBuilding + "','" + OfficeStreet + "','" + OfficeCity + "',");
Str.Append("'" + OfficeDistrict + "','" + OfficeState + "','" + OfficeCountry + "','" + WifeOccupation + "',");
Str.Append("'" + WifeOffice + "','" + WifeOfficeBuilding + "','" + WifeOfficeStreet + "','" + WifeOfficeCity + "',");
Str.Append("'" + WifeOfficeDistrict + "','" + WifeOfficeState + "','" + WifeOfficeCountry + "','" + Mobile + "',");
Str.Append("'" + Landline + "','" + Phone_Office + "','"+Email+"','" + Child1 + "','" + Child1_Details + "',");
Str.Append("'" + Child1_DOB + "','" + Child1_BloodGroup + "','" + Child2 + "','" + Child2_Details + "',");
Str.Append("'" + Child2_DOB + "','" + Child2_BloodGroup + "','" + Child3 + "','" + Child3_Details + "',");
Str.Append("'" + Child3_DOB + "','" + Child3_BloodGroup + "','" + Child4 + "','" + Child4_Details + "',");
Str.Append("'" + Child4_DOB + "','" + Child4_BloodGroup + "',"+Alert_Sms+","+Alert_VoiceCall+","+Alert_Email+")");
Db.Execute_Img(Str.ToString(),arr_img);
}
}
}
No comments:
Post a Comment