protected void BranchEmpCurrentStatusGV_RowUpdating(object sender, GridViewUpdateEventArgs e) { clearMsgPanel(); int index = BranchEmpCurrentStatusGV.EditIndex; GridViewRow row = BranchEmpCurrentStatusGV.Rows[index]; Label EmpID = (Label)row.FindControl("lblEmpID"); TextBox firstName = (TextBox)row.FindControl("txtFname"); TextBox middleName = (TextBox)row.FindControl("txtMName"); TextBox lastName = (TextBox)row.FindControl("txtLName"); DropDownList Sex = (DropDownList)row.FindControl("DropSex"); DropDownList PrevJob = (DropDownList)row.FindControl("DropPrevJob"); DropDownList JobTitle = (DropDownList)row.FindControl("DropJobTitle"); DropDownList Grade = (DropDownList)row.FindControl("DropGrade"); TextBox Salary = (TextBox)row.FindControl("txtSalary"); TextBox HDate = (TextBox)row.FindControl("txtHDate"); TextBox dateOfBirth = (TextBox)row.FindControl("txtDBirth"); DropDownList Branch = (DropDownList)row.FindControl("DropBranch"); DropDownList MajorCategory = (DropDownList)row.FindControl("DropMajCate"); DropDownList District = (DropDownList)row.FindControl("DropDistrict"); employee.EmpID = EmpID.Text; employee.FName = firstName.Text; employee.MName = middleName.Text; employee.LName = lastName.Text; employee.Sex = Sex.SelectedValue; employee.PrevJob = PrevJob.SelectedValue; employee.JobTitle = JobTitle.SelectedValue; employee.JobGrade = Grade.SelectedValue; double tempSalary = 0; try { tempSalary = Convert.ToDouble(Salary.Text); } catch (FormatException) { clearMsgPanel(); msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = "Invalid Salary value."; return; } catch (Exception ex) { clearMsgPanel(); msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = ex.StackTrace; return; } DateTime? dateOfBirthtemp = null; try { dateOfBirthtemp = Convert.ToDateTime(dateOfBirth.Text); } catch (FormatException) { clearMsgPanel(); msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = "Invalid Date of birth value."; return; } catch (Exception ex) { clearMsgPanel(); msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = ex.StackTrace; return; } employee.DateOfBirth = dateOfBirth.Text.Trim(); employee.Salary = Salary.Text; employee.Hdate = HDate.Text; employee.Branch = Branch.SelectedValue; EmployeeManager brEmployeeManager = new EmployeeManager(employee); DataTable districtID = brEmployeeManager.getDistrictBasedOnBranch(); employee.District = districtID.Rows[0]["district_id"].ToString(); employee.MajorCategory = MajorCategory.SelectedValue; brEmployeeManager.Updateemployee(); BranchEmpCurrentStatusGV.EditIndex = -1; DataTable getds = null; if (isAllbranch) { Panel1.Visible = true; getds = BranchEmployeeStatusManager.getAllBranchEmpStatus(); } else { Panel1.Visible = true; getds = BranchEmployeeStatusManager.getSpecBranchEmpStatus(branchID); } BindDataSetToGV(getds); }
protected void AssignedEmpGV_RowUpdating(object sender, GridViewUpdateEventArgs e) { int index = AssignedEmpGV.EditIndex; GridViewRow row = AssignedEmpGV.Rows[index]; Label EmpID = (Label)row.FindControl("lblEmpID"); DropDownList PrevJob = (DropDownList)row.FindControl("DropPrevJob"); DropDownList JobTitle = (DropDownList)row.FindControl("DropJobTitle"); DropDownList Grade = (DropDownList)row.FindControl("DropGrade"); TextBox Salary = (TextBox)row.FindControl("txtSalary"); DropDownList Branch = (DropDownList)row.FindControl("DropBranch"); DropDownList PromStatus = (DropDownList)row.FindControl("DropDownList1"); employee.EmpID = EmpID.Text; employee.PrevJob =PrevJob.SelectedValue; employee.JobTitle =JobTitle.SelectedValue; employee.JobGrade =Grade.SelectedValue; employee.Salary = Salary.Text; employee.Branch =Branch.SelectedValue; employee.Promstatus =PromStatus.SelectedValue; EmployeeManager brEmployeeManager = new EmployeeManager(employee); DataTable districtID = brEmployeeManager.getDistrictBasedOnBranch(); employee.District = districtID.Rows[0]["district_id"].ToString(); brEmployeeManager = new EmployeeManager(employee); brEmployeeManager.UpdateAssignedemployee(); AssignedEmpGV.EditIndex = -1; DataTable dt = BranchEmployeeStatusManager.BindGrid(); BindDataSetToGV(dt); }