コード例 #1
0
        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;
            }
        }