Пример #1
0
 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);
     }
 }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        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";
            }
        }
Пример #5
0
        //Employee EmpHistory
        public async Task AddEmployeeEmpHistory(EmpHistory user)
        {
            using (var sqlConnection = new SqlConnection(connectionString))
            {
                await sqlConnection.OpenAsync();

                var dynamicParameters = new DynamicParameters();
                dynamicParameters.Add("@StatementType", "Insert");
                dynamicParameters.Add("@EmployeeId", user.EmployeeId);
                dynamicParameters.Add("@jobTitle", user.jobTitle);
                dynamicParameters.Add("@dateOfJoining", user.dateOfJoining);
                dynamicParameters.Add("@lastWorkingDate", user.lastWorkingDate);
                dynamicParameters.Add("@isLeft", user.isLeft);
                dynamicParameters.Add("@notes", user.notes);

                await sqlConnection.ExecuteAsync(
                    "spSelectInsertUpdateDeleteEmpHistory",
                    dynamicParameters,
                    commandType : CommandType.StoredProcedure);
            }
        }
Пример #6
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;
            }
        }
        public ActionResult EmployeesProfile()
        {
            string employeenumber = Session["employeenumber"].ToString();

            ViewBag.empPicture = Session["picture"].ToString();
            Masterlist masterlist       = new Masterlist();
            DataTable  dtblEmployeeInfo = new DataTable();

            using (SqlConnection sqlCon = new SqlConnection(connectionString))
            {
                sqlCon.Open();
                string query = "SELECT EmployeeNumber,FirstName,LastName,PersonalEmail,Department,JobTitle,DateHired,ContactNumber,Street_Address1,Street_Address2,City," +
                               "Province,ZipCode,Birthday,Gender,MaritalStatus from Masterlist Where EmployeeNumber = @ID";
                SqlDataAdapter sqlDa = new SqlDataAdapter(query, sqlCon);
                sqlDa.SelectCommand.Parameters.AddWithValue("@ID", employeenumber);
                sqlDa.Fill(dtblEmployeeInfo);
            }
            if (dtblEmployeeInfo.Rows.Count == 1)
            {
                ViewBag.empID         = employeenumber;
                ViewBag.firstName     = dtblEmployeeInfo.Rows[0][1].ToString();
                ViewBag.lastName      = dtblEmployeeInfo.Rows[0][2].ToString();
                ViewBag.eMail         = dtblEmployeeInfo.Rows[0][3].ToString();
                ViewBag.dept          = dtblEmployeeInfo.Rows[0][4].ToString();
                ViewBag.jobTitle      = dtblEmployeeInfo.Rows[0][5].ToString();
                ViewBag.dateHired     = dtblEmployeeInfo.Rows[0][6].ToString();
                ViewBag.contactNum    = dtblEmployeeInfo.Rows[0][7].ToString();
                ViewBag.street1       = dtblEmployeeInfo.Rows[0][8].ToString();
                ViewBag.street2       = dtblEmployeeInfo.Rows[0][9].ToString();
                ViewBag.city          = dtblEmployeeInfo.Rows[0][10].ToString();
                ViewBag.province      = dtblEmployeeInfo.Rows[0][11].ToString();
                ViewBag.zipcode       = dtblEmployeeInfo.Rows[0][12].ToString();
                ViewBag.bday          = dtblEmployeeInfo.Rows[0][13].ToString();
                ViewBag.gender        = dtblEmployeeInfo.Rows[0][14].ToString();
                ViewBag.maritalStatus = dtblEmployeeInfo.Rows[0][15].ToString();

                return(View(masterlist));
            }

            EmpHistory empHistory     = new EmpHistory();
            DataTable  dtblEmpHistory = new DataTable();

            using (SqlConnection sqlConn = new SqlConnection(connectionString))
            {
                sqlConn.Open();
                string         qryEmpHistory = "SELECT DatePromoted,GrossPay,Allowance,EmploymentStatus from EmpHistory Where EmployeeNumber = @ID";
                SqlDataAdapter sqlDa         = new SqlDataAdapter(qryEmpHistory, sqlConn);
                sqlDa.SelectCommand.Parameters.AddWithValue("@ID", employeenumber);
                sqlDa.Fill(dtblEmpHistory);
            }

            if (dtblEmployeeInfo.Rows.Count == 1)
            {
                ViewBag.firstName     = dtblEmployeeInfo.Rows[0][1].ToString();
                ViewBag.lastName      = dtblEmployeeInfo.Rows[0][2].ToString();
                ViewBag.eMail         = dtblEmployeeInfo.Rows[0][3].ToString();
                ViewBag.dept          = dtblEmployeeInfo.Rows[0][4].ToString();
                ViewBag.jobTitle      = dtblEmployeeInfo.Rows[0][5].ToString();
                ViewBag.dateHired     = dtblEmployeeInfo.Rows[0][6].ToString();
                ViewBag.contactNum    = dtblEmployeeInfo.Rows[0][7].ToString();
                ViewBag.street1       = dtblEmployeeInfo.Rows[0][8].ToString();
                ViewBag.street2       = dtblEmployeeInfo.Rows[0][9].ToString();
                ViewBag.city          = dtblEmployeeInfo.Rows[0][10].ToString();
                ViewBag.province      = dtblEmployeeInfo.Rows[0][11].ToString();
                ViewBag.zipcode       = dtblEmployeeInfo.Rows[0][12].ToString();
                ViewBag.bday          = dtblEmployeeInfo.Rows[0][13].ToString();
                ViewBag.gender        = dtblEmployeeInfo.Rows[0][14].ToString();
                ViewBag.maritalStatus = dtblEmployeeInfo.Rows[0][15].ToString();

                return(View(masterlist));
            }
            return(View());
        }