/// <summary> /// method to insert user details /// </summary> /// <param name="objregformbll">parameter of property layer</param> /// <returns>number of affected rows</returns> public int Settask(regformbll objregformbll) { SqlCommand insertcommand = new SqlCommand("sp_insert"); insertcommand.CommandType = CommandType.StoredProcedure; insertcommand.Parameters.AddWithValue("@first_name", objregformbll.First_Name); insertcommand.Parameters.AddWithValue("@last_name", objregformbll.Last_Name); insertcommand.Parameters.AddWithValue("@address", objregformbll.Address); insertcommand.Parameters.AddWithValue("@phone", objregformbll.Phone); insertcommand.Parameters.AddWithValue("@mobile", objregformbll.Mobile); insertcommand.Parameters.AddWithValue("@bank_account", objregformbll.Bank_Account); insertcommand.Parameters.AddWithValue("@pan_no", objregformbll.Pan_No); insertcommand.Parameters.AddWithValue("@email", objregformbll.Email); insertcommand.Parameters.AddWithValue("@gender", objregformbll.Gender); insertcommand.Parameters.AddWithValue("@location", objregformbll.Current_Location); insertcommand.Parameters.AddWithValue("@nationality", objregformbll.Nationality); insertcommand.Parameters.AddWithValue("@date", objregformbll.Date); int rowsaffectd = this.objDataAccess.RunSql(insertcommand); return rowsaffectd; }
/// <summary> /// click event of submit button which update user information /// </summary> /// <param name="sender">update the form</param> /// <param name="e"> EventArgs e</param> protected void BtnUpdate_Click(object sender, EventArgs e) { regformbll objbll = new regformbll(); objbll.Id = Convert.ToInt32(this.Session["id"]); objbll.First_Name = TxtFirstName.Text; objbll.Last_Name = TxtLastname.Text; objbll.Address = TxtAddress.Text; objbll.Date = DateTime.Parse(TxtDate.Text.Substring(6, 4) + "/" + TxtDate.Text.Substring(3, 2) + "/" + TxtDate.Text.Substring(0, 2)); objbll.Bank_Account = TxtBankAccountNo.Text; objbll.Email = TxtEmailId.Text; objbll.Current_Location = TxtCurrentLocation.Text; objbll.Mobile = TxtMobileNo.Text; objbll.Nationality = TxtNationality.Text; objbll.Pan_No = TxtPanNo.Text; objbll.Phone = TxtPhoneNo.Text; objbll.Gender = int.Parse(RadioGender.SelectedValue.ToString()); Methods_BLL objdal = new Methods_BLL(); int output = objdal.UpdateUserinfo(objbll); this.Session["id"] = null; Response.Redirect("regform.aspx"); }
/// <summary> /// insert registration form in database /// </summary> /// <param name="sender"> Submit the registration form in database</param> /// <param name="e">EventArgs e</param> protected void BtnSubmit_Click(object sender, EventArgs e) { regformbll objbll = new regformbll(); objbll.First_Name = TxtFirst_Name.Text; objbll.Last_Name = TxtLast_Name.Text; objbll.Address = Txt_Address.Text; objbll.Date = DateTime.Parse(Txt_Date.Text.Substring(6, 4) + "/" + Txt_Date.Text.Substring(3, 2) + "/" + Txt_Date.Text.Substring(0, 2)); objbll.Bank_Account = Txt_BankAccountNo.Text; objbll.Email = Txt_Email.Text; objbll.Current_Location = Txt_CurrentLocation.Text; objbll.Mobile = Txt_Mobile.Text; objbll.Nationality = Txt_Nationality.Text; objbll.Pan_No = Txt_PanNo.Text; objbll.Phone = Txt_Phone.Text; objbll.Gender = int.Parse(Radio_Gender.SelectedValue.ToString()); Methods_BLL objdal = new Methods_BLL(); int output = objdal.Settask(objbll); lblerror.Text = "Add New User Successfully"; this.GetUserInfo(); panusergrid.Visible = true; panregform.Visible = false; }