public void ClearControls() { try { FormUtil.ClearForm(this, FormClearOptions.ClearAll, true); InitializeSession(); Session["EmpKey"] = null; Image img = (Image)ctrlEmployeeGeneralInfo.FindControl("ctrlPictureUpload").FindControl("imgEmp"); Image signature = (Image)ctrlEmployeeGeneralInfo.FindControl("imgSignature"); img.ImageUrl = null; signature.ImageUrl = null; EmployeeAddressInformation empAddrInfo = ctrlEmployeeAddressInfo as EmployeeAddressInformation; empAddrInfo.InitializeSession(); EmployeeEducationInformation empEdu = ctrlEmployeeEducationInfo as EmployeeEducationInformation; empEdu.InitializeSession(); EmpHistory empHist = ctrlEmpHistory as EmpHistory; empHist.InitializationSession(); EmpAttachmentInfo empFile = ctrlEmpAttachmentInfo as EmpAttachmentInfo; empFile.ClearControl(); ctrlLanguage.InitializationSession(); btnUpdate.Visible = false; btnSave.Visible = true; btnDelete.Visible = false; } catch (Exception ex) { throw (ex); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { var empInfo = new ArrayList(); EmployeeGeneralInfo empGeneralInfo = ctrlEmployeeGeneralInfo as EmployeeGeneralInfo; empGeneralInfo.UpdateEmpGeneralInfo(empInfo); CustomList <HRM_Emp> empList = (CustomList <HRM_Emp>)empInfo[0]; SetOfficialInfo(empList[0]); EmployeeAddressInformation empAddrInfo = ctrlEmployeeAddressInfo as EmployeeAddressInformation; empAddrInfo.UpdateEmpAddr(empInfo); CustomList <JobResponsibility> ResponsibilityList = JobResponsibilityList; empInfo.Add(ResponsibilityList); EmployeeEducationInformation empEdu = ctrlEmployeeEducationInfo as EmployeeEducationInformation; empEdu.SaveEmpEducationInfo(empInfo); EmpHistory empHist = ctrlEmpHistory as EmpHistory; empHist.Update(empInfo); EmpAttachmentInfo empFile = ctrlEmpAttachmentInfo as EmpAttachmentInfo; empFile.Update(empInfo); EmployeeHKInfoSave(empInfo); ucSalaryInfo empSalary = ctrlSalaryInfo as ucSalaryInfo; empSalary.Save(empInfo); ucLanguage empLanguage = ctrlLanguage as ucLanguage; empLanguage.Save(empInfo); CustomList <HRM_EmpFamDet> FamilyDetList = EmpFamDetList; empInfo.Add(FamilyDetList); CustomList <MedicalReinSetup> lstMedicalAllowance = MedicalAllowanceSetList; if (lstMedicalAllowance.Count == 0) { MedicalReinSetup newSetup = new MedicalReinSetup(); lstMedicalAllowance.Add(newSetup); } SetDataMedicalAllowance(ref lstMedicalAllowance); if (lstMedicalAllowance[0].FYKey == 0) { lstMedicalAllowance = new CustomList <MedicalReinSetup>(); } empInfo.Add(lstMedicalAllowance); _empManager.SaveEmployeeInfo(empInfo, "update"); this.SuccessMessage = (StaticInfo.UpdatedSuccessfullyMsg); } catch (Exception ex) { this.ErrorMessage = ex.Message; } }
protected void btnDelete_Click(object sender, EventArgs e) { try { EmployeeAddressInformation empAddrInfo = ctrlEmployeeAddressInfo as EmployeeAddressInformation; empAddrInfo.DeleteEmpAddr(); EmployeeEducationInformation empEdu = ctrlEmployeeEducationInfo as EmployeeEducationInformation; empEdu.Delete(); EmpHistory empHist = ctrlEmpHistory as EmpHistory; empHist.Delete(); EmpAttachmentInfo empFile = ctrlEmpAttachmentInfo as EmpAttachmentInfo; empFile.Delete(); EmployeeGeneralInfo empGeneralInfo = ctrlEmployeeGeneralInfo as EmployeeGeneralInfo; empGeneralInfo.DeleteEmpGeneralInfo(); this.SuccessMessage = (StaticInfo.DeletedSuccessfullyMsg); this.ClearControls(); } catch (Exception ex) { this.ErrorMessage = ex.InnerException.Message; } }
public void PopulteControl(HRM_Emp emp) { Session["EmpKey"] = emp.EmpKey; Label1.Visible = true; Label1.Text = _empManager.GetEmpInfoForShowingLevel(emp.EmpCode)[0].Level; EmployeeGeneralInfo empGeneralInfo = ctrlEmployeeGeneralInfo as EmployeeGeneralInfo; empGeneralInfo.PopulateControl(emp); PopulateOfficialInfo(emp); EmployeeAddressInformation empAddrInfo = ctrlEmployeeAddressInfo as EmployeeAddressInformation; empAddrInfo.PopulateControl(); EmployeeEducationInformation empEdu = ctrlEmployeeEducationInfo as EmployeeEducationInformation; empEdu.PopulateControl(); EmpHistory empHist = ctrlEmpHistory as EmpHistory; empHist.PopulateControl(); EmpAttachmentInfo empFile = ctrlEmpAttachmentInfo as EmpAttachmentInfo; empFile.PopulateControl(); PopulateEmpHKInfo(emp); ucSalaryInfo empSalary = ctrlSalaryInfo as ucSalaryInfo; empSalary.PopulateControl(emp, CurrentUserSession.UserCode); ucLanguage empLanguage = ctrlLanguage as ucLanguage; empLanguage.PopulateControl(emp.EmpKey); JobResponsibilityList = _empManager.GetAllJobResponsibility(emp.EmpKey); EmpFamDetList = _empManager.GetAllHRM_EmpFamDetByFamKey(emp.EmpKey); MedicalAllowanceSetList = _empManager.GetAllMedicalReinSetup(ddlYear_nc.SelectedValue, emp.EmpKey.ToString()); if (MedicalAllowanceSetList.Count != 0) { PopulateMedicalInfo(MedicalAllowanceSetList[0]); } else { txtSelfLimit.Text = "Unlimited"; } }
protected void btnSave_Click(object sender, EventArgs e) { try { TextBox empCodeTextBox = (TextBox)ctrlEmpSearch2.FindControl("txtSearch"); TextBox firstNameTextBox = (TextBox)ctrlEmployeeGeneralInfo.FindControl("txtFirstName"); string empCode = HRM_Emp.GetExistingEmp(firstNameTextBox.Text); if (empCode.IsNotNullOrEmpty()) { this.ErrorMessage = "Employee Name Already Exist!"; return; } var empInfo = new ArrayList(); EmployeeGeneralInfo empGeneralInfo = ctrlEmployeeGeneralInfo as EmployeeGeneralInfo; empGeneralInfo.SaveEmpGeneralInfo(empInfo); CustomList <HRM_Emp> empList = (CustomList <HRM_Emp>)empInfo[0]; SetOfficialInfo(empList[0]); EmployeeAddressInformation empAddrInfo = ctrlEmployeeAddressInfo as EmployeeAddressInformation; empAddrInfo.SaveEmpAddr(empInfo); CustomList <JobResponsibility> ResponsibilityList = JobResponsibilityList; empInfo.Add(ResponsibilityList); EmployeeEducationInformation empEdu = ctrlEmployeeEducationInfo as EmployeeEducationInformation; empEdu.SaveEmpEducationInfo(empInfo); EmpHistory empHist = ctrlEmpHistory as EmpHistory; empHist.Save(empInfo); EmpAttachmentInfo empFile = ctrlEmpAttachmentInfo as EmpAttachmentInfo; empFile.Save(empInfo); EmployeeHKInfoSave(empInfo); ucSalaryInfo empSalary = ctrlSalaryInfo as ucSalaryInfo; empSalary.Save(empInfo); ucLanguage empLanguage = ctrlLanguage as ucLanguage; empLanguage.Save(empInfo); CustomList <HRM_EmpFamDet> FamilyDetList = EmpFamDetList; empInfo.Add(FamilyDetList); //Medical CustomList <MedicalReinSetup> lstMedicalAllowanceSetup = new CustomList <MedicalReinSetup>(); MedicalReinSetup newMedicalAllowance = new MedicalReinSetup(); lstMedicalAllowanceSetup.Add(newMedicalAllowance); SetDataMedicalAllowance(ref lstMedicalAllowanceSetup); if (lstMedicalAllowanceSetup[0].FYKey == 0) { lstMedicalAllowanceSetup = new CustomList <MedicalReinSetup>(); } empInfo.Add(lstMedicalAllowanceSetup); //End _empManager.SaveEmployeeInfo(empInfo); this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg); this.btnSave.Visible = false; this.btnUpdate.Visible = true; } catch (Exception ex) { this.ErrorMessage = ex.Message; } }