protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if ((Session["employeeID"] == null)) { // go back to the seach employee page Response.Redirect("~/Admin/EmployeeManagement/SearchEmployee.aspx"); } else { employeeID = Convert.ToInt32(Session["employeeID"]); employeeSearched = EmployeeManager.GetEmployeeByID(employeeID); // dislay the employee details DisplayEmployee(employeeSearched); // Get job description position = JobPositionManager.GetPositionByID(employeeSearched.JobPositionID); DisplayJobPosition(position); // With the employee id, get the address id for the Home Address // from the EmployeeAddress table homeAddress.AddressID = EmployeeAddressManager.GetAddressID(Convert.ToInt32(AddressType.Home), employeeSearched.EmployeeID); homeAddress = AddressManager.GetAddressById(homeAddress.AddressID); DisplayHomeAddress(homeAddress); } } }
protected void lnkSavePersonalInformationOnEdit_OnCommand(object sender, CommandEventArgs e) { //hide the modal popup mPopupEdit_PersonalInformation.Hide(); //get the new values from the form employeeSearched.Firstname = (fview_EditPersonalInformation.FindControl("txtFirstname") as TextBox).Text.Trim(); employeeSearched.Lastname = (fview_EditPersonalInformation.FindControl("txtLastname") as TextBox).Text.Trim(); employeeSearched.Email = (fview_EditPersonalInformation.FindControl("txtEmail") as TextBox).Text.Trim(); employeeSearched.Gender = (fview_EditPersonalInformation.FindControl("ddlGender") as DropDownList).Text.Trim(); employeeSearched.Homephone = (fview_EditPersonalInformation.FindControl("txtHomePhone") as TextBox).Text.Trim(); employeeSearched.Mobilephone = (fview_EditPersonalInformation.FindControl("txtMobilePhone") as TextBox).Text.Trim(); employeeSearched.EmergencyContact = (fview_EditPersonalInformation.FindControl("txtEmergencyContact") as TextBox).Text.Trim(); employeeSearched.EmergencyPhone1 = (fview_EditPersonalInformation.FindControl("txtEmergencyPhone1") as TextBox).Text.Trim(); employeeSearched.EmergencyPhone2 = (fview_EditPersonalInformation.FindControl("txtEmergencyPhone2") as TextBox).Text.Trim(); employeeSearched.Notes = (fview_EditPersonalInformation.FindControl("txtNotes") as TextBox).Text.Trim(); employeeSearched.ModifiedDate = DateTime.Now.ToLocalTime(); employeeSearched.JobPositionID = Convert.ToInt32((fview_EditPersonalInformation.FindControl("ddlJobTitle") as DropDownList).Text.Trim()); position.PositionID = Convert.ToInt32((fview_EditPersonalInformation.FindControl("ddlJobTitle") as DropDownList).Text.Trim()); //save the changes EmployeeManager.Save(employeeSearched); DisplayEmployee(employeeSearched); position = JobPositionManager.GetPositionByID(employeeSearched.JobPositionID); DisplayJobPosition(position); }
protected void lnkEditPersonalInformation_OnCommand(object sender, CommandEventArgs e) { EmployeeList el = new EmployeeList(); el.Add(EmployeeManager.GetEmployeeByID(employeeSearched.EmployeeID)); JobPositionList jl = new JobPositionList(); jl.Add(JobPositionManager.GetPositionByID(employeeSearched.JobPositionID)); fview_EditPersonalInformation.DataSource = el; fview_EditPersonalInformation.DataBind(); this.mPopupEdit_PersonalInformation.Show(); }