public static void Main(string[] args) { Class_Entity e = new Class_Entity(); Console.Write("Enter First Name: \t"); e.First_Name = Console.ReadLine(); Console.Write("Enter Last Name: \t"); e.Last_Name = Console.ReadLine(); Console.Write("Enter Present Address: \t"); e.Present_Address = Console.ReadLine(); Console.Write("Enter Permanent Address:\t"); e.Permanent_Address = Console.ReadLine(); Console.Write("Enter Password: \t"); e.Password = Console.ReadLine(); Console.Write("Enter State:\t"); e.State = Console.ReadLine(); Console.Write("Enter Country:\t"); e.Country = Console.ReadLine(); Console.Write("Enter Email:\t"); e.Email_Address = Console.ReadLine(); Console.Write("Gender: \t"); e.Gender = Console.ReadLine(); Console.Write("Marital Status:\t"); e.Marital_Status = Console.ReadLine(); Console.Write("Enter Contact Number:\t"); e.Contact_Number = Console.ReadLine(); Console.Write("Enter Date of Birth:\t"); e.Date_of_Birth = DateTime.Parse(Console.ReadLine()); Console.Write("Enter Identification Proof:\t"); e.Identification_Proof = Console.ReadLine(); Class_DAO dao = new Class_DAO(); dao.dbcon(e); }
public void dbcon(Class_Entity d) { SqlConnection con = new SqlConnection(Helper.ConnectionString); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_SaveAdminData"; cmd.Parameters.Add(new SqlParameter("@First_Name", SqlDbType.NVarChar)).Value = d.First_Name; cmd.Parameters.Add(new SqlParameter("@Last_Name", SqlDbType.NVarChar)).Value = d.Last_Name; cmd.Parameters.Add(new SqlParameter("@Present_Address", SqlDbType.NVarChar)).Value = d.Present_Address; cmd.Parameters.Add(new SqlParameter("@Permanent_Address", SqlDbType.NVarChar)).Value = d.Permanent_Address; cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.NVarChar)).Value = d.Password; cmd.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar)).Value = d.State; cmd.Parameters.Add(new SqlParameter("@Country", SqlDbType.NVarChar)).Value = d.Country; cmd.Parameters.Add(new SqlParameter("@Email_Address", SqlDbType.NVarChar)).Value = d.Email_Address; cmd.Parameters.Add(new SqlParameter("@Gender", SqlDbType.NVarChar)).Value = d.Engine; cmd.Parameters.Add(new SqlParameter("@Marital_Status", SqlDbType.NVarChar)).Value = d.MyBikes; cmd.Parameters.Add(new SqlParameter("@Contact_Number", SqlDbType.NVarChar)).Value = d.Contact_Number; cmd.Parameters.Add(new SqlParameter("@Date_of_Birth", SqlDbType.DateTime)).Value = d.Date_of_Birth; cmd.Parameters.Add(new SqlParameter("@Identification_Proof", SqlDbType.NVarChar)).Value = d.Identification_Proof; con.Open(); cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
protected void BtnSubmit_Click(object sender, EventArgs e) { Class_Entity ce = new Class_Entity(); ce.First_Name = FName.Text.ToString(); ce.Last_Name = LName.Text.ToString(); ce.Present_Address = PresentAddress.Text.ToString(); ce.Permanent_Address = PermanentAddress.Text.ToString(); ce.Password = Password.Text.ToString(); ce.State = StateDropDownList.Text.ToString(); ce.Country = CountryDropDownList.Text.ToString(); ce.Email_Address = Email.Text.ToString(); ce.Engine = EngineList.Text.ToString(); ce.MyBikes = MyBikes.Text.ToString(); ce.Contact_Number = Number.Text.ToString(); ce.Date_of_Birth = Convert.ToDateTime(Dob.Text); ce.Identification_Proof = IdType.Text.ToString(); Class_DAO dao = new Class_DAO(); dao.dbcon(ce); Response.Write("<script LANGUAGE='JavaScript' >alert('we will contact you soon for your dreambike.')</script>"); EmptyTextBoxes(form1); }