Пример #1
0
 public EmployeeForInsertModel Employee_SelectById(int empId)
 {
     using (var con = GetDbConnection())
     {
         try
         {
             EmployeeForInsertModel em = new EmployeeForInsertModel
             {
                 EmployeeId        = empId,
                 EmployeeBasicInfo = con.QueryFirstOrDefault <EmployeeBasicInfoForInsertModel>("dbo.Usp_EmployeeBasicInfo_GetById",
                                                                                               new { @iIntEmployeeId = empId },
                                                                                               commandType: CommandType.StoredProcedure),
                 EmployeeContactInfo = con.QueryFirstOrDefault <EmployeeContactInfoForInsertModel>("dbo.Usp_EmployeeContactInfo_GetByEmployeeId",
                                                                                                   new { @iIntEmployeeId = empId },
                                                                                                   commandType: CommandType.StoredProcedure),
                 EmployeeEducation = con.QueryFirstOrDefault <EmployeeEducationForInsertModel>("dbo.Usp_EmployeeEducation_GetByEmpId",
                                                                                               new { @iIntEmployeeId = empId },
                                                                                               commandType: CommandType.StoredProcedure),
                 EmployeeEmpInfo = con.QueryFirstOrDefault <EmployeeEmpInfoForInsertModel>("dbo.Usp_EmployeeEmpInfo_GetByEmpId",
                                                                                           new { @iIntEmployeeId = empId },
                                                                                           commandType: CommandType.StoredProcedure)
             };
             return(em);
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
 }
Пример #2
0
        private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                MessageBox.Show("Pls. Select an Item.", "Select Item", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                EmployeeForInsertModel emp = svc.Employee_SelectById(int.Parse(listView1.SelectedItems[0].Text));
                frmRptViewer           frm = new frmRptViewer();
                string exeFolder           = Path.GetDirectoryName(Application.StartupPath);
                string reportPath          = Path.Combine(exeFolder, "..\\Reports\\RptEmpProfile.rdlc");
                frm.reportViewer1.LocalReport.ReportPath = reportPath;
                ReportParameter generatedBy = new ReportParameter("UserFullName", GlobalSession.UserFullName);
                ReportParameter imagePath   = new ReportParameter("ImagePath", AppDomain.CurrentDomain.BaseDirectory + "EmpPics\\ProfilePic\\" + listView1.SelectedItems[0].Text + "\\" + emp.EmployeeBasicInfo.PicName);
                List <EmployeeBasicInfoForInsertModel>   empBasicinfo   = new List <EmployeeBasicInfoForInsertModel>();
                List <EmployeeContactInfoForInsertModel> empContactInfo = new List <EmployeeContactInfoForInsertModel>();
                List <EmployeeEducationForInsertModel>   empEducation   = new List <EmployeeEducationForInsertModel>();
                List <EmployeeEmpInfoForInsertModel>     empEmployment  = new List <EmployeeEmpInfoForInsertModel>();
                empBasicinfo.Add(emp.EmployeeBasicInfo);
                empContactInfo.Add(emp.EmployeeContactInfo);
                empEducation.Add(emp.EmployeeEducation);
                empEmployment.Add(emp.EmployeeEmpInfo);
                frm.reportViewer1.LocalReport.DataSources.Clear();
                ReportDataSource rs = new ReportDataSource {
                    Name = "ds_employee_basicinfo", Value = empBasicinfo
                };
                ReportDataSource rs1 = new ReportDataSource {
                    Name = "ds_employee_contactinfo", Value = empContactInfo
                };
                ReportDataSource rs2 = new ReportDataSource {
                    Name = "ds_employee_education", Value = empContactInfo
                };
                ReportDataSource rs3 = new ReportDataSource {
                    Name = "ds_employee_employment", Value = empEmployment
                };

                frm.reportViewer1.LocalReport.DataSources.Add(rs);
                frm.reportViewer1.LocalReport.DataSources.Add(rs1);
                frm.reportViewer1.LocalReport.DataSources.Add(rs2);
                frm.reportViewer1.LocalReport.DataSources.Add(rs3);
                frm.reportViewer1.LocalReport.EnableExternalImages = true;
                frm.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { generatedBy, imagePath });
                frm.ShowDialog();
            }
        }
Пример #3
0
 public void Employee_Update(EmployeeForInsertModel em)
 {
     _repo.Employee_Update(em);
 }
Пример #4
0
 public int Employee_Insert(EmployeeForInsertModel em)
 {
     return(_repo.Employee_Insert(em));
 }
Пример #5
0
        void GetEmpDetails(int employeeId)
        {
            if (employeeId > 0)
            {
                emp = empSvc.Employee_SelectById(employeeId);

                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + emp.EmployeeBasicInfo.PicName) == true)
                {
                    picEmployee.Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + emp.EmployeeBasicInfo.PicName, true);
                }

                try
                {
                    lblDesignation.Text = emp.EmployeeEmpInfo.Designation;
                    lblDepartment.Text  = emp.EmployeeEmpInfo.DepartmentName;
                    lblRate.Text        = emp.EmployeeEmpInfo.BasicPay.ToString("#,####.00");
                    lblPayOption.Text   = emp.EmployeeEmpInfo.BasicRateOption;

                    var dtr = dsvc.DTR_GetDetailsForPayroll(emp.EmployeeId, (int)cmbPayrollPeriod.SelectedValue);
                    if (dtr != null)
                    {
                        lblTotalLate.Text      = dtr.TotalLate.ToString(".00");
                        lblTotalUndertime.Text = dtr.TotalUndertime.ToString(".00");
                        lblTotDaysWork.Text    = dtr.TotalDaysWork.ToString(".00");
                        label2.Visible         = false;
                        HAS_DTR = true;

                        if (employeeId > 0 && (int)cmbPayrollPeriod.SelectedValue > 0)
                        {
                            var model = _payrollService.GetPayrollDetails(employeeId, (int)cmbPayrollPeriod.SelectedValue);
                            if (model != null)
                            {
                                //lblTotDaysWork.Text = model.TotalDaysWork.ToString("0.00");
                                //lblTotalLate.Text = model.MinsLate.ToString("0.00");
                                //lblTotalUndertime.Text = model.UnderTime.ToString("0.00");
                                txtCottageRental.Text = model.Cottage_Rental.ToString("#,####.00");
                                lblGrossEarning.Text  = model.GrossAmount.ToString("#,####.00");
                                //HDMF_Tax.Text = model.Tax.ToString("#,####.00");
                                txtHDMF.Text          = model.HDMF_Premiums.ToString("#,####.00");
                                txtHDMF_Calamity.Text = model.HDMF_Calamity.ToString("#,####.00");
                                lblNetAmount.Text     = model.NetAmount.ToString("#,####.00");
                                lblLateAmount.Text    = model.LateAmtDeduction.ToString("#,####.00");
                                lblUnderTime.Text     = model.UnderTimeAmtDeduction.ToString("#,####.00");
                            }
                        }
                    }
                    else
                    {
                        label2.Visible         = true;
                        lblTotalLate.Text      = "";
                        lblTotalUndertime.Text = "";
                        lblTotDaysWork.Text    = "";
                        HAS_DTR = false;
                    }
                }
                catch (Exception ex)
                {
                    lblTotalLate.Text      = "";
                    lblTotalUndertime.Text = "";
                    lblTotDaysWork.Text    = "";
                    HAS_DTR = false;
                }
            }
            else
            {
                ClearAll();
            }
        }
Пример #6
0
        public void Employee_Update(EmployeeForInsertModel em)
        {
            using (var con = GetDbConnection())
            {
                con.Open();
                using (var tran = con.BeginTransaction())
                {
                    try
                    {
                        con.Execute("dbo.Usp_EmployeeBasicInfo_Update",
                                    new
                        {
                            @iIntEmployeeId          = em.EmployeeId,
                            @iStrLastName            = em.EmployeeBasicInfo.LastName,
                            @iStrFirstName           = em.EmployeeBasicInfo.FirstName,
                            @iStrMiddleName          = em.EmployeeBasicInfo.MiddleName,
                            @iStrSuffix              = em.EmployeeBasicInfo.Suffix,
                            @iStrBirthDate           = em.EmployeeBasicInfo.BirthDate,
                            @iStrPlaceOfBirth        = em.EmployeeBasicInfo.PlaceOfBirth,
                            @iStrCitizenship         = em.EmployeeBasicInfo.Citizenship,
                            @iStrHeight              = em.EmployeeBasicInfo.Height,
                            @iStrWeight              = em.EmployeeBasicInfo.Weight,
                            @iStrReligion            = em.EmployeeBasicInfo.Religion,
                            @iStrResidentialAddress1 = em.EmployeeBasicInfo.ResidentialAddress1,
                            @iStrResidentialAddress2 = em.EmployeeBasicInfo.ResidentialAddress2,
                            @iStrCurrentAddress1     = em.EmployeeBasicInfo.CurrentAddress1,
                            @iStrCurrentAddress2     = em.EmployeeBasicInfo.CurrentAddress2,
                            @iStrGender              = em.EmployeeBasicInfo.Gender,
                            @iStrCivilStatus         = em.EmployeeBasicInfo.CivilStatus,
                            @iStrPicName             = em.EmployeeBasicInfo.PicName
                        },
                                    transaction: tran, commandType: CommandType.StoredProcedure);

                        con.Execute("dbo.Usp_EmployeeContactInfo_Update",
                                    new
                        {
                            @iIntEmployeeId            = em.EmployeeId,
                            @iStrSpouseName            = em.EmployeeContactInfo.SpouseName,
                            @iStrSpouseOccupation      = em.EmployeeContactInfo.SpouseOccupation,
                            @iDtSpouseBirthDate        = em.EmployeeContactInfo.SpouseBirthDate,
                            @iStrFatherName            = em.EmployeeContactInfo.FatherName,
                            @iStrFatherOccupation      = em.EmployeeContactInfo.FatherOccupation,
                            @iDtFatherBirthDate        = em.EmployeeContactInfo.FatherBirthDate,
                            @iStrMotherName            = em.EmployeeContactInfo.MotherName,
                            @iStrMotherOccupation      = em.EmployeeContactInfo.MotherOccupation,
                            @iDtMotherBirthDate        = em.EmployeeContactInfo.MotherBirthDate,
                            @iStrParentAddress1        = em.EmployeeContactInfo.ParentAddress1,
                            @iStrParentAddress2        = em.EmployeeContactInfo.ParentAddress2,
                            @iStrContactNum1           = em.EmployeeContactInfo.ContactNum1,
                            @iStrContactNum2           = em.EmployeeContactInfo.ContactNum2,
                            @iStrEmailAddress          = em.EmployeeContactInfo.EmailAddress,
                            @iStrContactPersonName     = em.EmployeeContactInfo.ContactPersonName,
                            @iStrContactPersonNumber   = em.EmployeeContactInfo.ContactPersonNumber,
                            @iStrContactPersonAddress1 = em.EmployeeContactInfo.ContactPersonAddress1,
                            @iStrContactPersonAddress2 = em.EmployeeContactInfo.ContactPersonAddress2
                        },
                                    transaction: tran, commandType: CommandType.StoredProcedure);

                        con.Execute("dbo.Usp_EmployeeEducation_Update",
                                    new
                        {
                            @iIntEmployeeId             = em.EmployeeId,
                            @iStrElementary             = em.EmployeeEducation.Elementary,
                            @iDtElemDateGraduated       = em.EmployeeEducation.ElemDateGraduated,
                            @iStrHighSchool             = em.EmployeeEducation.HighSchool,
                            @iDtHighSchoolDateGraduated = em.EmployeeEducation.HighSchoolDateGraduated,
                            @iStrVocational             = em.EmployeeEducation.Vocational,
                            @iStrVocationalCourse       = em.EmployeeEducation.VocationalCourse,
                            @iDtVocationalDateGraduated = em.EmployeeEducation.VocationalDateGraduated,
                            @iStrCollege                      = em.EmployeeEducation.College,
                            @iStrCollegeCourse                = em.EmployeeEducation.CollegeCourse,
                            @iDtCollegeDateGraduated          = em.EmployeeEducation.CollegeDateGraduated,
                            @iStrHighestEducAttainment        = em.EmployeeEducation.HighestEducAttainment,
                            @iStrEducationalBackgroundRemarks = em.EmployeeEducation.EducationalBackgroundRemarks
                        },
                                    transaction: tran, commandType: CommandType.StoredProcedure);

                        con.Execute("dbo.Usp_EmployeeEmpInfo_Update",
                                    new
                        {
                            @iIntEmployeeId         = em.EmployeeId,
                            @iStrDesignation        = em.EmployeeEmpInfo.Designation,
                            @iIntDepartment         = em.EmployeeEmpInfo.DepartmentId,
                            @iStrEmploymentType     = em.EmployeeEmpInfo.EmploymentType,
                            @iDecBasicPay           = em.EmployeeEmpInfo.BasicPay,
                            @iDtDateHired           = em.EmployeeEmpInfo.DateHired,
                            @iStrTINNo              = em.EmployeeEmpInfo.TINNo,
                            @iStrSSSNo              = em.EmployeeEmpInfo.SSSNo,
                            @iStrPhilHealth         = em.EmployeeEmpInfo.PhilHealth,
                            @iStrPagIbigNo          = em.EmployeeEmpInfo.PagIbigNo,
                            @iStrCharRefFullName1   = em.EmployeeEmpInfo.CharRefFullName1,
                            @iStrCharRefOccupation1 = em.EmployeeEmpInfo.CharRefOccupation1,
                            @iStrCharRefContactNum1 = em.EmployeeEmpInfo.CharRefContactNum1,
                            @iStrCharRefFullName2   = em.EmployeeEmpInfo.CharRefFullName2,
                            @iStrCharRefOccupation2 = em.EmployeeEmpInfo.CharRefOccupation2,
                            @iStrCharRefContactNum2 = em.EmployeeEmpInfo.CharRefContactNum2,
                            @iStrCharRefFullName3   = em.EmployeeEmpInfo.CharRefFullName3,
                            @iStrCharRefOccupation3 = em.EmployeeEmpInfo.CharRefOccupation3,
                            @iStrCharRefContactNum3 = em.EmployeeEmpInfo.CharRefContactNum3,
                            @istrEmpStatus          = em.EmployeeEmpInfo.EmpStatus,
                            @iStrBasicPayOption     = em.EmployeeEmpInfo.BasicRateOption
                        },
                                    transaction: tran, commandType: CommandType.StoredProcedure);

                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        throw new Exception(ex.Message);
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
        }
Пример #7
0
        private void bttnSave_Click(object sender, EventArgs e)
        {
            int result;

            picName = (txtFirstName.Text + " " + txtLastName.Text + ".jpeg");

            if (Validation.IsTextEmpty(txtLastName))
            {
                tabControl1.SelectedIndex = 0;
                Validation.FocusTextBox(txtLastName, "Last Name");
                return;
            }
            else if (Validation.IsTextEmpty(txtFirstName))
            {
                tabControl1.SelectedIndex = 0;
                Validation.FocusTextBox(txtFirstName, "First Name");
                return;
            }
            else if (Validation.IsTextEmpty(txtMiddleName))
            {
                tabControl1.SelectedIndex = 0;
                Validation.FocusTextBox(txtMiddleName, "Middle Name");
                return;
            }
            else if (Validation.IsComboEmpty(cmbGender))
            {
                tabControl1.SelectedIndex = 0;
                Validation.FocusComboBox(cmbGender, "Gender");
                return;
            }
            else if (Validation.IsComboEmpty(cmbCivilStatus))
            {
                tabControl1.SelectedIndex = 0;
                Validation.FocusComboBox(cmbCivilStatus, "Marital Status");
                return;
            }
            else if (Validation.IsComboEmpty(cmbCitizen))
            {
                tabControl1.SelectedIndex = 0;
                Validation.FocusComboBox(cmbCitizen, "Citizenship");
                return;
            }
            else if (Validation.IsTextEmpty(txtResidentialAddress1))
            {
                tabControl1.SelectedIndex = 0;
                Validation.FocusTextBox(txtResidentialAddress1, "Residential street address");
                return;
            }
            else if (txtResidentialAddress2.Text == string.Empty)
            {
                tabControl1.SelectedIndex = 0;
                ShowMessage.CustomErrorMessage("Residential Address2 is empty. Please check the field.");
                button2.PerformClick();
            }
            else if (cmbCivilStatus.Text == "Married" && Validation.IsTextEmpty(txtSpouseName))
            {
                tabControl1.SelectedIndex = 2;
                Validation.FocusTextBox(txtSpouseName, "Spouse Name");

                return;
            }
            else if (Validation.IsTextEmpty(txtDesignation))
            {
                tabControl1.SelectedIndex = 3;
                Validation.FocusTextBox(txtDesignation, "Designation");
                return;
            }
            else if (Validation.IsComboEmpty(cmbDepartment))
            {
                tabControl1.SelectedIndex = 3;
                Validation.FocusComboBox(cmbDepartment, "Department");
                return;
            }
            else if (Validation.IsComboEmpty(cmbEmpType))
            {
                tabControl1.SelectedIndex = 3;
                Validation.FocusComboBox(cmbEmpType, "Employee Type");
                return;
            }
            else if (double.Parse(txtBasicPay.Text) <= 0)
            {
                tabControl1.SelectedIndex = 3;
                MessageBox.Show("Invalid basic pay value.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtBasicPay.Focus();
                return;
            }
            else if (Validation.IsComboEmpty(cmbRateOption))
            {
                tabControl1.SelectedIndex = 3;
                Validation.FocusComboBox(cmbRateOption, "Basic Rate Option");
                return;
            }
            else if (Validation.IsComboEmpty(cmbEmpStatus))
            {
                tabControl1.SelectedIndex = 3;
                Validation.FocusComboBox(cmbEmpStatus, "Employee Status");
                return;
            }
            else
            {
                string bdate = "";
                if (dtBdate.Text == "")
                {
                    bdate = "";
                }
                else
                {
                    bdate = dtBdate.Value.ToString("yyyy-MM-dd");
                }

                dtBdate.Format = DateTimePickerFormat.Custom;
                EmployeeForInsertModel em = new EmployeeForInsertModel
                {
                    EmployeeBasicInfo = new EmployeeBasicInfoForInsertModel
                    {
                        LastName            = txtLastName.Text,
                        FirstName           = txtFirstName.Text,
                        MiddleName          = txtMiddleName.Text,
                        Suffix              = cmbSuffix.Text,
                        BirthDate           = bdate,
                        PlaceOfBirth        = txtPlaceOfBirth.Text,
                        Gender              = cmbGender.Text,
                        Citizenship         = cmbCitizen.Text,
                        Height              = txtHeight.Text,
                        Weight              = txtWeight.Text,
                        Religion            = cmbReligion.Text,
                        ResidentialAddress1 = txtResidentialAddress1.Text,
                        ResidentialAddress2 = txtResidentialAddress2.Text,
                        CurrentAddress1     = txtCurrentAddress1.Text,
                        CurrentAddress2     = txtCurrentAddress2.Text,
                        CivilStatus         = cmbCivilStatus.Text
                    },
                    EmployeeEducation = new EmployeeEducationForInsertModel
                    {
                        Elementary              = txtElementary.Text,
                        ElemDateGraduated       = dtElemGraduated.Value,
                        HighSchool              = txtHighSchool.Text,
                        HighSchoolDateGraduated = dtHSGraduated.Value,
                        Vocational              = txtVocational.Text,
                        VocationalCourse        = txtVocationalCourse.Text,
                        VocationalDateGraduated = dtVocGraduated.Value,
                        College                      = txtCollege.Text,
                        CollegeCourse                = txtCollegeCourse.Text,
                        CollegeDateGraduated         = dtCollegeGraudated.Value,
                        HighestEducAttainment        = txtEdcuAttainment.Text,
                        EducationalBackgroundRemarks = txtRemarks.Text
                    },
                    EmployeeContactInfo = new EmployeeContactInfoForInsertModel
                    {
                        SpouseName            = txtSpouseName.Text,
                        SpouseBirthDate       = dtSpouseBdate.Value,
                        SpouseOccupation      = txtSpouseOccupation.Text,
                        FatherBirthDate       = dtFatherBdate.Value,
                        FatherName            = txtFatherName.Text,
                        FatherOccupation      = txtFatherOccupation.Text,
                        MotherName            = txtMotherName.Text,
                        MotherOccupation      = txtMotherOccupation.Text,
                        MotherBirthDate       = dtMotherBdate.Value,
                        ParentAddress1        = txtParentAddress1.Text,
                        ParentAddress2        = txtParentAddress2.Text,
                        ContactNum1           = txtContactNum1.Text,
                        ContactNum2           = txtContactNum2.Text,
                        EmailAddress          = txtEmailAddress.Text,
                        ContactPersonName     = txtContactPersonName.Text,
                        ContactPersonNumber   = txtContactPersonMobile.Text,
                        ContactPersonAddress1 = txtContactPersonAddress1.Text,
                        ContactPersonAddress2 = txtContactPersonAddress2.Text
                    },
                    EmployeeEmpInfo = new EmployeeEmpInfoForInsertModel
                    {
                        Designation        = txtDesignation.Text,
                        DepartmentId       = (int)cmbDepartment.SelectedValue,
                        EmploymentType     = cmbEmpType.Text,
                        BasicPay           = decimal.Parse(txtBasicPay.Text),
                        DateHired          = dtDateHired.Value,
                        TINNo              = txtTIN.Text,
                        SSSNo              = txtSSS.Text,
                        PhilHealth         = txtPhilHealth.Text,
                        PagIbigNo          = txtPagIbig.Text,
                        CharRefFullName1   = txtCharRefFullName1.Text,
                        CharRefFullName2   = txtCharRefFullName2.Text,
                        CharRefFullName3   = txtCharRefFullName3.Text,
                        CharRefOccupation1 = txtCharRefOccupation1.Text,
                        CharRefOccupation2 = txtCharRefOccupation2.Text,
                        CharRefOccupation3 = txtCharRefOccupation3.Text,
                        CharRefContactNum1 = txtCharRefContactNum1.Text,
                        CharRefContactNum2 = txtCharRefContactNum2.Text,
                        CharRefContactNum3 = txtCharRefContactNum3.Text,
                        EmpStatus          = cmbEmpStatus.Text,
                        BasicRateOption    = cmbRateOption.Text
                    }
                };

                if (ADD_STATE == true)
                {
                    em.EmployeeBasicInfo.PicName = picName;
                    result = empSvc.Employee_Insert(em);

                    if (picPath.Equals(""))
                    {
                        picName = "NoPic";
                    }
                    else
                    {
                        Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + result + "\\");
                        File.Copy(picPath, AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + result + "\\" + picName, true);
                    }

                    if (result > 0)
                    {
                        ShowMessage.ShowMessageBox(1);
                        this.Close();
                    }
                    else if (result == -1)
                    {
                        ShowMessage.ShowMessageBox(4);
                    }
                    else
                    {
                        ShowMessage.ShowMessageBox(3);
                    }

                    this.Close();
                }
                else
                {
                    if (picPath != "")
                    {
                        em.EmployeeBasicInfo.PicName = picName;
                        if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\"))
                        {
                            Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\");
                        }

                        if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + picName) == true)
                        {
                            File.Delete(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + picName);
                            File.Copy(picPath, AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + picName, true);
                        }
                        else
                        {
                            File.Copy(picPath, AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + picName, true);
                        }
                    }
                    else
                    {
                        em.EmployeeBasicInfo.PicName = emp.EmployeeBasicInfo.PicName;
                    }

                    em.EmployeeId = this.employeeId;
                    empSvc.Employee_Update(em);
                    ShowMessage.ShowMessageBox(2);
                }
            }
        }
Пример #8
0
        private void frmEmployee_AE_Load(object sender, EventArgs e)
        {
            loadDepartment();
            if (employeeId > 0 && !ADD_STATE)
            {
                emp                = empSvc.Employee_SelectById(employeeId);
                label76.Text       = "Employee ID No. : " + emp.EmployeeId.ToString("0000");
                txtLastName.Text   = emp.EmployeeBasicInfo.LastName;
                txtFirstName.Text  = emp.EmployeeBasicInfo.FirstName;
                txtMiddleName.Text = emp.EmployeeBasicInfo.MiddleName;
                cmbSuffix.Text     = emp.EmployeeBasicInfo.Suffix;

                if (emp.EmployeeBasicInfo.BirthDate == "1/1/1900 12:00:00 AM")
                {
                    dtBdate.CustomFormat = " ";
                    dtBdate.Format       = DateTimePickerFormat.Custom;
                }

                else
                {
                    dtBdate.Value = DateTime.Parse(emp.EmployeeBasicInfo.BirthDate);
                }

                txtPlaceOfBirth.Text        = emp.EmployeeBasicInfo.PlaceOfBirth;
                cmbGender.Text              = emp.EmployeeBasicInfo.Gender;
                cmbCitizen.Text             = emp.EmployeeBasicInfo.Citizenship;
                txtHeight.Text              = emp.EmployeeBasicInfo.Height;
                txtWeight.Text              = emp.EmployeeBasicInfo.Weight;
                cmbReligion.Text            = emp.EmployeeBasicInfo.Religion;
                txtResidentialAddress1.Text = emp.EmployeeBasicInfo.ResidentialAddress1;
                txtResidentialAddress2.Text = emp.EmployeeBasicInfo.ResidentialAddress2;
                txtCurrentAddress1.Text     = emp.EmployeeBasicInfo.CurrentAddress1;
                txtCurrentAddress2.Text     = emp.EmployeeBasicInfo.CurrentAddress2;
                cmbCivilStatus.Text         = emp.EmployeeBasicInfo.CivilStatus;

                txtElementary.Text       = emp.EmployeeEducation.Elementary;
                dtElemGraduated.Value    = emp.EmployeeEducation.ElemDateGraduated;
                txtHighSchool.Text       = emp.EmployeeEducation.HighSchool;
                dtHSGraduated.Value      = emp.EmployeeEducation.HighSchoolDateGraduated;
                txtVocational.Text       = emp.EmployeeEducation.Vocational;
                txtVocationalCourse.Text = emp.EmployeeEducation.VocationalCourse;
                dtVocGraduated.Value     = emp.EmployeeEducation.VocationalDateGraduated;
                txtCollege.Text          = emp.EmployeeEducation.College;
                txtCollegeCourse.Text    = emp.EmployeeEducation.CollegeCourse;
                dtCollegeGraudated.Value = emp.EmployeeEducation.CollegeDateGraduated;
                txtEdcuAttainment.Text   = emp.EmployeeEducation.HighestEducAttainment;
                txtRemarks.Text          = emp.EmployeeEducation.EducationalBackgroundRemarks;

                txtSpouseName.Text            = emp.EmployeeContactInfo.SpouseName;
                dtSpouseBdate.Value           = emp.EmployeeContactInfo.SpouseBirthDate;
                txtSpouseOccupation.Text      = emp.EmployeeContactInfo.SpouseOccupation;
                dtFatherBdate.Value           = emp.EmployeeContactInfo.FatherBirthDate;
                txtFatherName.Text            = emp.EmployeeContactInfo.FatherName;
                txtFatherOccupation.Text      = emp.EmployeeContactInfo.FatherOccupation;
                txtMotherName.Text            = emp.EmployeeContactInfo.MotherName;
                txtMotherOccupation.Text      = emp.EmployeeContactInfo.MotherOccupation;
                dtMotherBdate.Value           = emp.EmployeeContactInfo.MotherBirthDate;
                txtParentAddress1.Text        = emp.EmployeeContactInfo.ParentAddress1;
                txtParentAddress2.Text        = emp.EmployeeContactInfo.ParentAddress2;
                txtContactNum1.Text           = emp.EmployeeContactInfo.ContactNum1;
                txtContactNum2.Text           = emp.EmployeeContactInfo.ContactNum2;
                txtEmailAddress.Text          = emp.EmployeeContactInfo.EmailAddress;
                txtContactPersonName.Text     = emp.EmployeeContactInfo.ContactPersonName;
                txtContactPersonMobile.Text   = emp.EmployeeContactInfo.ContactPersonNumber;
                txtContactPersonAddress1.Text = emp.EmployeeContactInfo.ContactPersonAddress1;
                txtContactPersonAddress2.Text = emp.EmployeeContactInfo.ContactPersonAddress2;

                if (emp.EmployeeBasicInfo.CivilStatus != "Single")
                {
                    txtSpouseName.Enabled       = true;
                    txtSpouseOccupation.Enabled = true;
                    dtSpouseBdate.Enabled       = true;
                }

                if ((emp.EmployeeBasicInfo.ResidentialAddress1 == emp.EmployeeBasicInfo.CurrentAddress1) && (emp.EmployeeBasicInfo.ResidentialAddress2 == emp.EmployeeBasicInfo.CurrentAddress2))
                {
                    checkBox1.Checked = true;
                }
                else
                {
                    checkBox1.Checked = false;
                }

                if ((emp.EmployeeBasicInfo.ResidentialAddress1 == emp.EmployeeContactInfo.ParentAddress1) && (emp.EmployeeBasicInfo.ResidentialAddress2 == emp.EmployeeContactInfo.ParentAddress2))
                {
                    checkBox2.Checked = true;
                }
                else
                {
                    checkBox2.Checked = false;
                }

                if (emp.EmployeeEducation.HighestEducAttainment != "")
                {
                    checkBox3.Checked = true;
                }
                else
                {
                    checkBox3.Checked = false;
                }

                txtDesignation.Text         = emp.EmployeeEmpInfo.Designation;
                cmbDepartment.SelectedValue = emp.EmployeeEmpInfo.DepartmentId;
                cmbEmpType.Text             = emp.EmployeeEmpInfo.EmploymentType;
                txtBasicPay.Text            = emp.EmployeeEmpInfo.BasicPay.ToString("#,####.00");
                dtDateHired.Value           = emp.EmployeeEmpInfo.DateHired;
                txtTIN.Text                = emp.EmployeeEmpInfo.TINNo;
                txtSSS.Text                = emp.EmployeeEmpInfo.SSSNo;
                txtPhilHealth.Text         = emp.EmployeeEmpInfo.PhilHealth;
                txtPagIbig.Text            = emp.EmployeeEmpInfo.PagIbigNo;
                txtCharRefFullName1.Text   = emp.EmployeeEmpInfo.CharRefFullName1;
                txtCharRefFullName2.Text   = emp.EmployeeEmpInfo.CharRefFullName2;
                txtCharRefFullName3.Text   = emp.EmployeeEmpInfo.CharRefFullName3;
                txtCharRefOccupation1.Text = emp.EmployeeEmpInfo.CharRefOccupation1;
                txtCharRefOccupation2.Text = emp.EmployeeEmpInfo.CharRefOccupation2;
                txtCharRefOccupation3.Text = emp.EmployeeEmpInfo.CharRefOccupation3;
                txtCharRefContactNum1.Text = emp.EmployeeEmpInfo.CharRefContactNum1;
                txtCharRefContactNum2.Text = emp.EmployeeEmpInfo.CharRefContactNum2;
                txtCharRefContactNum3.Text = emp.EmployeeEmpInfo.CharRefContactNum3;
                cmbEmpStatus.Text          = emp.EmployeeEmpInfo.EmpStatus;
                cmbRateOption.Text         = emp.EmployeeEmpInfo.BasicRateOption;

                bttnSave.Text = "&Edit Item";
                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + emp.EmployeeBasicInfo.PicName) == true)
                {
                    picEmployee.Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\EmpPics\\ProfilePic\\" + employeeId + "\\" + emp.EmployeeBasicInfo.PicName, true);
                }
                button6.Enabled = true;
            }
            else
            {
                bttnRefresh.PerformClick();
            }
        }