/// <summary>
 /// GridView bind function
 /// </summary>
 public void GetUserInfo()
 {
     Methods_BLL obj = new Methods_BLL();
     DataTable dt = obj.GetUserDetails();
     GridUserInfo.DataSource = dt;
     GridUserInfo.DataBind();
 }
 /// <summary>
 /// code for delete link in GridView
 /// </summary>
 /// <param name="sender">Delete a Row </param>
 /// <param name="e">GridViewDeleteEventArgs e </param>
 protected void GridUserInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Label lblid = (Label)GridUserInfo.Rows[e.RowIndex].FindControl("LblId");
     int id = Convert.ToInt32(lblid.Text);
     Methods_BLL obj = new Methods_BLL();
     int output = obj.DeleteUserinfo(id);
     this.GetUserInfo();
 }
 /// <summary>
 /// method for fill the form of selected user id
 /// </summary>
 /// <param name="id">id of selected user</param>
 public void Setvalue(int id)
 {
     Methods_BLL obj = new Methods_BLL();
     DataSet ds = obj.GetUserDetailsForEdit(id);
     TxtFirstName.Text = ds.Tables[0].Rows[0]["first_name"].ToString();
     TxtLastname.Text = ds.Tables[0].Rows[0]["last_name"].ToString();
     TxtAddress.Text = ds.Tables[0].Rows[0]["address"].ToString();
     TxtDate.Text = ds.Tables[0].Rows[0]["date"].ToString();
     TxtBankAccountNo.Text = ds.Tables[0].Rows[0]["bank_account"].ToString();
     TxtCurrentLocation.Text = ds.Tables[0].Rows[0]["location"].ToString();
     TxtEmailId.Text = ds.Tables[0].Rows[0]["email"].ToString();
     TxtMobileNo.Text = ds.Tables[0].Rows[0]["mobile"].ToString();
     TxtNationality.Text = ds.Tables[0].Rows[0]["nationality"].ToString();
     TxtPanNo.Text = ds.Tables[0].Rows[0]["pan_no"].ToString();
     TxtPhoneNo.Text = ds.Tables[0].Rows[0]["phone"].ToString();
     this.ViewState["Ïd"] = this.Session["id"];
     this.EnableViewState = false;
 }
 /// <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;
 }