private void ScatterData()
        {
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                TBL_MP_Master_Employee_LastEmployerDetail model = _service.GetLastEmployerInfoDBRecordByID(this.SelectID);
                if (model != null)
                {
                    txtName.Text        = model.LastEmployerName;
                    txtAddress.Text     = model.Address;
                    txtContactNo.Text   = model.ContactNo.ToString();
                    chkIsActive.Checked = model.isActive;
                }
                TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(SelectedEmployeeID);
                this.Text = string.Format("{0} ({1}) - Update X-Employer's Info.", emp.EmployeeName, emp.EmployeeCode);
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditLastEmployerInfo::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
 private void cboEmployee_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         lblEmpCategoryInfo.Text = string.Empty;
         this.EmployeeID         = 0;
         if (cboEmployee.SelectedItem != null)
         {
             this.EmployeeID = ((SelectListItem)cboEmployee.SelectedItem).ID;
         }
         this.IsOnSiteEmployee = ServiceEmployee.IsOnSiteEmployee(this.EmployeeID);
         if (IsOnSiteEmployee == true)
         {
             lblEmpCategoryInfo.Text = "Onsite Employee";
             //cboProject.Enabled = true;
         }
         else
         {
             //cboProject.Enabled = false;
             lblEmpCategoryInfo.Text = "Office Employee";
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmAddEditMannualAttendanceEntry::cboEmployee_SelectedValueChanged", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void frmAddEditEmployeeQualification_Load(object sender, EventArgs e)
        {
            try
            {
                ServiceEmployee _service = new ServiceEmployee();


                if (this.EmployeeQualificationID == 0)
                {
                    txtQualification.Text = txtNameOfInstitute.Text = txtGradeClass.Text = string.Empty;

                    if (this.SelectedEmployeeID != 0)
                    {
                        TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(SelectedEmployeeID);
                        this.Text = string.Format("{0} ({1}) - Add Qualification", emp.EmployeeName, emp.EmployeeCode);
                    }
                }
                else
                {
                    ScatterData();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditEmployeeQualification::frmAddEditEmployeeQualification_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
        private void ScatterData()
        {
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                TBL_MP_Master_Employee_Relative model = _service.GetEmployeeRelativeDBRecordByID(this.EmployeeRelationshipID);
                if (model != null)
                {
                    txtRelativeName.Text = model.RelativeName;
                    txtRemark.Text       = model.Remarks;
                    if (model.RelativeDOB != null)
                    {
                        dtDateOfBirth.Value = (DateTime)model.RelativeDOB;
                    }
                    else
                    {
                        dtDateOfBirth.Checked = false;
                    }

                    cboSelectRelation.SelectedItem = ((List <SelectListItem>)cboSelectRelation.DataSource).Where(x => x.ID == model.FK_UL_RelationID).FirstOrDefault();
                }
                TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(SelectedEmployeeID);
                this.Text = string.Format("{0} ({1}) - Add Relationship", emp.EmployeeName, emp.EmployeeCode);
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditEmployeeRelation::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void ScatterData()
        {
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                TBL_MP_Master_Employee_Qualification model = _service.GetEmployeeQualificationDBRecordByID(this.EmployeeQualificationID);
                if (model != null)
                {
                    txtQualification.Text   = model.Qualification;
                    txtNameOfInstitute.Text = model.NameOfInstitute;
                    txtGradeClass.Text      = model.Grade;

                    TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(model.FK_EmployeeId);
                    this.Text = string.Format("{0} ({1}) - Update Qualification", emp.EmployeeName, emp.EmployeeCode);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditEmployeeQualification::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void ScatterData()
        {
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                TBL_MP_Master_Employee_MedicalDetail obj = (new ServiceEmployee()).GetEmployeeMedicalInfoDbRecord(this.EmployeeMedicalID);
                if (obj != null)
                {
                    //populate all textboxes,datepickers from obj
                    txtMedicalName.Text      = obj.MedicalName;
                    cboRelation.SelectedItem = ((List <SelectListItem>)cboRelation.DataSource).Where(x => x.ID == obj.FK_UL_RelationID).FirstOrDefault();
                    txtCardNo.Text           = obj.CardNo;
                    txtCardType.Text         = obj.CardType;
                    txtCompanyName.Text      = obj.CompanyName;
                    txtRemark.Text           = obj.Remark;
                    chkIsActive.Checked      = obj.IsActive;
                    dtIssueDate.Value        = obj.IssueDate;
                    dtExpieryDate.Value      = obj.ExpiryDate;
                }
                TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(obj.fk_EmployeeId);
                this.Text = string.Format("{0} ({1}) - Update Medical Info", emp.EmployeeName, emp.EmployeeCode);
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditMedicalInfo::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 7
0
 private void frmAddEditEmployeeRelation_Load(object sender, EventArgs e)
 {
     try
     {
         ServiceEmployee _service = new ServiceEmployee();
         PopulateRelationshipDropdown();
         if (EmployeeRelationshipID == 0)
         {
             txtRelativeName.Text  = txtRemark.Text = string.Empty;
             dtDateOfBirth.Checked = false;
             if (this.SelectedEmployeeID != 0)
             {
                 TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(SelectedEmployeeID);
                 this.Text = string.Format("{0} ({1}) - Add Relationship", emp.EmployeeName, emp.EmployeeCode);
             }
         }
         else
         {
             ScatterData();
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmAddEditEmployeeRelation::frmAddEditEmployeeRelation_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 8
0
        private void gridInactiveEmployees_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                this.SelectedEmployeeID = (int)gridInactiveEmployees.Rows[e.RowIndex].Cells["ID"].Value;
                string strDescription = gridInactiveEmployees.Rows[e.RowIndex].Cells["Description"].Value.ToString().Replace("\n", "  ");
                headerGroupMain.ValuesPrimary.Heading = strDescription.ToUpper();

                this.SelectedEmployeeActive  = false;
                this.SelectedEmployeeDeleted = ServiceEmployee.IsDeletedEmployee(this.SelectedEmployeeID);
                btnDeleteItem.Text           = (this.SelectedEmployeeDeleted) ? "Undelete" : "Delete";
                btnActivate.Text             = (this.SelectedEmployeeActive) ? "Deactivate" : "Activate";

                RefreshTabPage();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pageEmployees::gridInactiveEmployees_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void frmAddEditMedicalInfo_Load(object sender, EventArgs e)
        {
            try
            {
                ServiceEmployee _service = new ServiceEmployee();
                PopulateRelationshipDropdown();
                if (EmployeeMedicalID == 0)
                {
                    txtMedicalName.Text   = txtCardNo.Text = txtCardType.Text = txtCompanyName.Text = txtRemark.Text = String.Empty;
                    dtExpieryDate.Checked = false;
                    chkIsActive.Checked   = true;

                    if (this.selectedEmployeeMedicalID != 0)
                    {
                        TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(selectedEmployeeMedicalID);
                        this.Text = string.Format("{0} ({1}) - Add Medical Info", emp.EmployeeName, emp.EmployeeCode);
                    }
                }
                else
                {
                    ScatterData();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditMedicalInfo::frmAddEditMedicalInfo_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 10
0
 public SalaryViewModel(Salary salaryOpen, vwEmployee employeeEdit, vwManager managerLog)
 {
     salary          = salaryOpen;
     employee        = employeeEdit;
     manager         = managerLog;
     serviceEmployee = new ServiceEmployee();
 }
 public MainWindowViewModel(MainWindow mainOpen)
 {
     main            = mainOpen;
     serviceEmployee = new ServiceEmployee();
     EmployeeList    = serviceEmployee.GetAllEmployees();
     serviceEmployee.AddLocations();
 }
        private void frmAddEditLastEmployerInfo_Load(object sender, EventArgs e)
        {
            try
            {
                ServiceEmployee _service = new ServiceEmployee();


                if (this.SelectID == 0)
                {
                    txtName.Text        = txtAddress.Text = txtContactNo.Text = string.Empty;
                    chkIsActive.Checked = false;
                    if (this.SelectedEmployeeID != 0)
                    {
                        TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(SelectedEmployeeID);
                        this.Text = string.Format("{0} ({1}) - Add Last Employer Info", emp.EmployeeName, emp.EmployeeCode);
                    }
                }
                else
                {
                    ScatterData();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditLastEmployerInfo::frmAddEditLastEmployerInfo_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public AddEmployeeViewModel(AddEmployee addEmployeeOpen)
 {
     addEmployee     = addEmployeeOpen;
     serviceEmployee = new ServiceEmployee();
     serviceManager  = new ServiceManager();
     employee        = new vwEmployee();
     floorManager    = serviceManager.GetManagerFloor().ToList();
 }
        public ManagerWindowViewModel(ManagerWindow managerWindowOpen, vwManager managerLog)
        {
            managerWindow = managerWindowOpen;
            manager       = managerLog;

            serviceEmployee = new ServiceEmployee();
            serviceManager  = new ServiceManager();
            employeeList    = serviceEmployee.GetAllEmployees(manager.Floor).ToList();
        }
Esempio n. 15
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            TBL_MP_Master_Employee_Relative model = null;
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }

                if (this.EmployeeRelationshipID == 0)
                {
                    model = new TBL_MP_Master_Employee_Relative();
                }
                else
                {
                    model = _service.GetEmployeeRelativeDBRecordByID(EmployeeRelationshipID);
                }

                model.FK_EmployeeID    = this.SelectedEmployeeID;
                model.FK_UL_RelationID = ((SelectListItem)cboSelectRelation.SelectedItem).ID;
                model.RelativeName     = txtRelativeName.Text.Trim();
                if (dtDateOfBirth.Checked)
                {
                    model.RelativeDOB = dtDateOfBirth.Value;
                }
                else
                {
                    model.RelativeDOB = null;
                }
                model.Remarks = txtRemark.Text.Trim();

                if (this.EmployeeRelationshipID == 0)
                {
                    this.EmployeeRelationshipID = _service.AddNewEmployeeRelative(model);
                }
                else
                {
                    _service.UpdateEmployeeRelative(model);
                }


                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditEmployeeRelation::btnOK_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            TBL_MP_Master_Employee_MedicalDetail model = null;

            ServiceEmployee serviceEmployee = new ServiceEmployee();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }
                if (this.EmployeeMedicalID == 0)
                {
                    model = new TBL_MP_Master_Employee_MedicalDetail();
                }
                else
                {
                    model = serviceEmployee.GetEmployeeMedicalInfoDbRecord(this.EmployeeMedicalID);
                }


                model.fk_EmployeeId = this.EmployeeID;

                #region GATHER DATA INTO MODEL FROM VIEW
                model.MedicalName      = txtMedicalName.Text;
                model.FK_UL_RelationID = ((SelectListItem)cboRelation.SelectedItem).ID;
                model.CardNo           = txtCardNo.Text;
                model.CardType         = txtCardType.Text;
                model.CompanyName      = txtCompanyName.Text;
                model.IssueDate        = dtIssueDate.Value;
                model.ExpiryDate       = dtExpieryDate.Value;
                model.Remark           = txtRemark.Text;
                model.IsActive         = chkIsActive.Checked;

                #endregion
                if (this.EmployeeMedicalID == 0)
                {
                    this.EmployeeMedicalID = serviceEmployee.AddNewEmployeeMedicalnfo(model);
                }
                else
                {
                    serviceEmployee.UpdateEmployeeMedicalnfo(model);
                }
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditMedicalInfo::btnOK_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 17
0
        private void gridRoles_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    SelectedRoleID = (int)gridRoles.Rows[e.RowIndex].Cells["ID"].Value;
                    headerGroupModule.ValuesPrimary.Heading = string.Format("[{0}] - Accessible Modules", gridRoles.Rows[e.RowIndex].Cells["Description"].Value);
                    PopulateRoleModules();
                }

                headerGroupDeleteRole.ValuesPrimary.Heading = string.Empty;
                txtDeleteRoleInfo.Text = string.Empty;

                bool isactive = (bool)gridRoles.Rows[e.RowIndex].Cells["IsActive"].Value;
                if (isactive)
                {
                    btnAddNewRole.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnEditRole.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnDeleteRole.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnRestoreRole.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;

                    headerGroupModule.Enabled = headerGroupForms.Enabled = true;
                }
                else
                {
                    btnAddNewRole.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnEditRole.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnDeleteRole.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnRestoreRole.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;

                    headerGroupModule.Enabled = headerGroupForms.Enabled = false;
                }

                TBL_MP_Master_Role dbRole = (new ServiceRoles()).GetRoleDBRecordByID(this.SelectedRoleID);
                if (dbRole != null)
                {
                    if (dbRole.DeletedBy != null)
                    {
                        string empName = ServiceEmployee.GetEmployeeNameByID((int)dbRole.DeletedBy);
                        headerGroupDeleteRole.ValuesPrimary.Heading = string.Format("Deleted by {0} dt. {1}", empName, dbRole.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt"));
                    }
                    txtDeleteRoleInfo.Text = dbRole.DeleteRemarks;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pageRoleManager::gridRoles_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 18
0
        public async Task <bool> SendEmail(int fromEmpID, String msgFrom, string msgTo, string Subject, string msgBody)
        {
            MailMessage mailMessage     = new MailMessage();
            string      strPassword     = ServiceEmployee.GetEmailPasswordForEmployee(fromEmpID);
            string      strEmailAddress = ServiceEmployee.GetEmployeeEmailByID(fromEmpID);
            string      strEmpName      = ServiceEmployee.GetEmployeeNameByID(fromEmpID);

            if (strPassword == string.Empty)
            {
                MessageBox.Show("You cannot send Emails, unless you set your valid Password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }


            if (!new EmailAddressAttribute().IsValid(strEmailAddress))
            {
                MessageBox.Show("It appears that you have not set your Email Address in the Employee database or is Invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            mailMessage.From = new MailAddress(strEmailAddress, strEmpName);
            foreach (var address in msgTo.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
            {
                if (new EmailAddressAttribute().IsValid(address))
                {
                    mailMessage.To.Add(address);
                }
            }
            if (mailMessage.To.Count == 0)
            {
                MessageBox.Show("Invalid number of Recipients or Invalid Email Address", "Terminating", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            mailMessage.Subject    = Subject;
            mailMessage.Body       = msgBody;
            mailMessage.IsBodyHtml = false;

            //SmtpClient smtp = new SmtpClient(Properties.Settings.Default.EMAIL_SERVER.ToString());
            //smtp.Port = int.Parse(Properties.Settings.Default.EMAIL_PORT.ToString());
            //smtp.Credentials = new NetworkCredential(strEmailAddress, strPassword);
            //smtp.EnableSsl = Properties.Settings.Default.EMAIL_ENABLE_SSL;
            SmtpClient smtp = new SmtpClient(ConfigurationManager.AppSettings["EMAIL_SERVER"].ToString());

            smtp.Port        = int.Parse(ConfigurationManager.AppSettings["EMAIL_PORT"].ToString());
            smtp.Credentials = new NetworkCredential(strEmailAddress, strPassword);
            smtp.EnableSsl   = (ConfigurationManager.AppSettings["EMAIL_ENABLE_SSL"].ToString() == "True") ? true : false;



            await smtp.SendMailAsync(mailMessage);

            return(true);
        }
Esempio n. 19
0
        private void gridModules_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                headerGroupDeleteModule.ValuesPrimary.Heading = string.Empty;
                txtDeleteModuleInfo.Text = string.Empty;

                if (e.RowIndex >= 0)
                {
                    SelectedModuleID = (int)gridModules.Rows[e.RowIndex].Cells["ID"].Value;
                    PopulateForms();
                }
                bool isactive = (bool)gridModules.Rows[e.RowIndex].Cells["IsActive"].Value;
                if (isactive)
                {
                    btnRestoreModule.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnEditModule.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnDeleteModule.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;

                    btnAddNewForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnEditForm.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnDeleteForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnRestoreForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                }
                else
                {
                    btnRestoreModule.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnEditModule.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnDeleteModule.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;

                    btnAddNewForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnEditForm.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnDeleteForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnRestoreForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                }

                Tbl_MP_Master_Module dbModule = (new ServiceModules()).GetModuleDBRecordByID(this.SelectedModuleID);
                if (dbModule != null)
                {
                    if (dbModule.DeletedBy != null)
                    {
                        string empName = ServiceEmployee.GetEmployeeNameByID((int)dbModule.DeletedBy);
                        headerGroupDeleteModule.ValuesPrimary.Heading = string.Format("Deleted by {0} dt. {1}", empName, dbModule.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt"));
                    }
                    txtDeleteModuleInfo.Text = dbModule.DeleteRemarks;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "pageModules::gridModules_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            TBL_MP_Master_Employee_LastEmployerDetail model = null;
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }

                if (this.SelectID == 0)
                {
                    model = new TBL_MP_Master_Employee_LastEmployerDetail();
                }
                else
                {
                    model = _service.GetLastEmployerInfoDBRecordByID(this.SelectID);
                }

                model.LastEmployerID   = SelectID;
                model.FK_EmployeeId    = this.SelectedEmployeeID;
                model.LastEmployerName = txtName.Text.Trim();
                model.Address          = txtAddress.Text.Trim();
                model.ContactNo        = int.Parse(txtContactNo.Text.Trim());
                model.isActive         = chkIsActive.Checked;

                if (this.SelectID == 0)
                {
                    this.SelectID = _service.AddNewLastEmployerInfo(model);
                }
                else
                {
                    _service.UpdateLastEmployerInfo(model);
                }


                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditLastEmployerInfo::btnOK_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 21
0
 public void ScatterData()
 {
     try
     {
         TBL_MP_Master_Employee_LeaveConfiguration model = (new ServiceEmployee()).GetEmpLeaveInfoDbRecord(this.PK_LeaveID);
         if (model != null)
         {
             if (EmployeeID != 0)
             {
                 headerEmployeeName.Values.Description = ServiceEmployee.GetEmployeeNameByID(model.FK_EmployeeID);
             }
             txtLimitDays.Text                    = model.CarryForwardLimitDays.ToString();
             txtMaxDaysallow.Text                 = model.MaxDaysAllow.ToString();
             cboLeaveType.SelectedItem            = ((List <SelectListItem>)cboLeaveType.DataSource).Where(x => x.ID == model.FK_LeaveTypeID).FirstOrDefault();
             chkApplicableProbationPeriod.Checked = model.ApplicableInProbation;
             chkLeaveCarryForward.Checked         = model.CarryForwardLeave;
             chkLeaveEncashable.Checked           = model.LeaveEnchashable;
             txtLeaveOpeningBalance.Text          = model.LeavesEarned.ToString();
             chkIsActive.Checked                  = model.IsActive;
             this.SeledctedYearID                 = model.FK_FinYearID;
             if (this.SeledctedYearID != 0)
             {
                 cboYear.SelectedItem = ((List <SelectListItem>)cboYear.DataSource).Where(x => x.ID == this.SeledctedYearID).FirstOrDefault();
             }
             if (model.LeaveEnchashable)
             {
                 string[] IDs = model.EncashableSalaryHeadIDs.Split(',');
                 foreach (string headID in IDs)
                 {
                     foreach (DataGridViewRow mRow in gridAllounces.Rows)
                     {
                         if (mRow.Cells["ID"].Value.ToString().Trim() == headID.Trim())
                         {
                             mRow.Cells["IsActive"].Value = true;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmAddEditEmployeeLeaveConfig::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void btnOK_Click(object sender, EventArgs e)
        {
            TBL_MP_Master_Employee_Qualification model = null;
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                if (!this.ValidateChildren())
                {
                    return;
                }

                if (this.EmployeeQualificationID == 0)
                {
                    model = new TBL_MP_Master_Employee_Qualification();
                }
                else
                {
                    model = _service.GetEmployeeQualificationDBRecordByID(EmployeeQualificationID);
                }


                model.Qualification   = txtQualification.Text.Trim();
                model.NameOfInstitute = txtNameOfInstitute.Text.Trim();
                model.Grade           = txtGradeClass.Text.Trim();

                if (this.EmployeeQualificationID == 0)
                {
                    model.FK_EmployeeId          = SelectedEmployeeID;
                    this.EmployeeQualificationID = _service.AddNewEmployeeQualification(model);
                }
                else
                {
                    _service.UpdateEmployeeQualification(model);
                }


                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditEmployeeQualification::btnOK_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 23
0
 public void SetDefaultNew()
 {
     try
     {
         int leadStatusOpen = Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.DefaultLeadStatusID].DEFAULT_VALUE;
         int currID         = Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.DefaultCurrencyID].DEFAULT_VALUE;
         cboAgencies.Enabled             = btnAddAgency.Enabled = false;
         cboSalesLeadStatus.SelectedItem = ((List <SelectListItem>)cboSalesLeadStatus.DataSource).Where(x => x.ID == leadStatusOpen).FirstOrDefault();
         cboCurrency.SelectedItem        = ((List <SelectListItem>)cboCurrency.DataSource).Where(x => x.ID == currID).FirstOrDefault();
         txtGeneratedBy.Text             = ServiceEmployee.GetEmployeeNameByID(Program.CURR_USER.EmployeeID);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "frmSalesLead::SetDefaultNew", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 24
0
        static void Main(string[] args)
        {
            ServiceEmployee Employee = new ServiceEmployee();

            Employee.CreateEmployers();

            foreach (Employee item in Employee.employers)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("------------");
            foreach (Employee item in Employee.FindManager(prof.klerk))
            {
                Console.WriteLine(item);
            }
        }
        public void PrepareCalendarSummary()
        {
            try
            {
                headerGroupMain.ValuesPrimary.Heading = string.Format("Attendance {1} {0}",
                                                                      ServiceEmployee.GetEmployeeNameByID(this.EmployeeID),
                                                                      AttendanceMonth.ToString("MMMM yyyy"));

                lblTotalDays.Text = lblNonWorkingDays.Text = lblPaidDays.Text = string.Empty;
                lblPL.Text        = lblCL.Text = lblSL.Text = lblCompOff.Text = string.Empty;
                lblPresent.Text   = lblAbsent.Text = lblOutdoor.Text = lblLateComing.Text = lblEarlyLeaving.Text = string.Empty;

                MODEL = (new ServiceAttendance()).GetAttendanceSummaryOfEmployeeForMonth(this.EmployeeID, this.AttendanceMonth);
                if (MODEL != null)
                {
                    lblTotalDays.Text      = MODEL.TotalDays.Text;
                    lblNonWorkingDays.Text = MODEL.NonWorkingDays.Text;
                    lblPaidDays.Text       = MODEL.PaidDays.Text;
                    if (MODEL.PaidDays.Days > MODEL.TotalDays.Days)
                    {
                        lblPaidDays.Text = MODEL.TotalDays.Text;
                    }
                    lblPL.Text           = MODEL.PLs.Text;
                    lblCL.Text           = MODEL.CLs.Text;
                    lblSL.Text           = MODEL.SLs.Text;
                    lblCompOff.Text      = MODEL.CompOffs.Text;
                    lblPresent.Text      = MODEL.Present.Text;
                    lblAbsent.Text       = MODEL.Absent.Text;
                    lblOutdoor.Text      = MODEL.Outdoor.Text;
                    lblLateComing.Text   = MODEL.LateComings.Text;
                    lblEarlyLeaving.Text = MODEL.EarlyGoings.Text;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlEmployeeAttendanceSummary::PrepareCalendarSummary", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 26
0
        public void EmployeeUpdateByFirst()
        {
            EmployeeDto employeeDto = new EmployeeDto
            {
                TCompany = new CompanyDto
                {
                    CompanyID = 2,
                    Name      = "Hillgate"
                },
                UserName = "******",
                Password = "******"
            };


            var employee = ServiceEmployee.FindByUserName(employeeDto);

            if (employee != null)
            {
                System.Diagnostics.Debug.WriteLine(String.Format("Id: {0} -> Name: {1} ", employee.EmployeeID, employee.FirstName + " " + employee.LastName));
                employee.LastName = "Almeida Tereza";

                ServiceEmployee.UpdateEmployee(employee);

                foreach (EmployeeDto employeeLoop in ServiceEmployee.GetAllEmployee(new EmployeeDto
                {
                    TCompany = new CompanyDto
                    {
                        CompanyID = 2,
                        Name = "Hillgate"
                    }
                }))
                {
                    System.Diagnostics.Debug.WriteLine("Employees:" + employeeLoop.EmployeeID + "-" + employeeLoop.FirstName + " " + employeeLoop.LastName);
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(String.Format("None with name: {0} ", employeeDto.UserName));
                //Assert.Fail("Vazio");
            }
        }
Esempio n. 27
0
        private void btnGeneratePayslips_Click(object sender, EventArgs e)
        {
            ServiceEmployee service = new ServiceEmployee();

            this.Cursor = Cursors.WaitCursor;
            try
            {
                int idx = 1;
                headerGroupMain.ValuesSecondary.Heading = string.Format("Processing Payroll for {0}", dtSalaryMonth.Value.ToString("MMMM yyyy"));
                _EmployeesList = AppCommon.ConvertToBindingList <SelectListItem>((new ServiceAttendance()).GetDistinctEmployeesListForMonthInAttendance(dtSalaryMonth.Value));
                headerGroupMain.ValuesSecondary.Heading = string.Format("Generating Payslip [{0}/{1}].Employees", idx, _EmployeesList.Count);
                foreach (SelectListItem emp in _EmployeesList)
                {
                    //if (emp.ID == 8) // for debugging
                    //{
                    //    MessageBox.Show(emp.ID.ToString());
                    //}


                    EmployeePayslipModel model = (new ServiceEmployee()).GetEmployeePayslipModel(emp.ID, dtSalaryMonth.Value);
                    (new ServiceEmployee()).SaveEmployeePayslip(model);
                    headerGroupMain.ValuesSecondary.Heading = string.Format("Processed [{0}/{1}].\n{2}", idx++, _EmployeesList.Count, emp.Description);
                    Application.DoEvents();
                }
                gridActiveEmployees.DataSource = _EmployeesList;
                FormatEmployeeGrid();
                headerGroupMain.ValuesSecondary.Heading = string.Format("Select Employee to View/Modify Salary");
                Application.DoEvents();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "PageGeneratePayslips::btnGeneratePayslips_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
Esempio n. 28
0
        public void EmployeeDelete()
        {
            EmployeeDto employeeDto = new EmployeeDto
            {
                TCompany = new CompanyDto {
                    CompanyID = 2
                },
                UserName = "******",
                Password = "******"
            };


            var employee = ServiceEmployee.FindByUserName(employeeDto);

            if (employee != null)
            {
                System.Diagnostics.Debug.WriteLine(String.Format("Id: {0} -> Name: {1} ", employee.EmployeeID,
                                                                 employee.FirstName + " " + employee.LastName));

                ServiceEmployee.DeleteEmployee(employee);
            }
        }
Esempio n. 29
0
        private void ScatterData()
        {
            ServiceEmployee _service = new ServiceEmployee();

            try
            {
                TBL_MP_Master_Employee model = _service.GetEmployeeDbRecordByID(this.EmployeeID);
                if (model != null)
                {
                    txtEmployeeCode.Text           = model.EmployeeCode;
                    txtEmployeeName.Text           = model.EmployeeName;
                    txtEmail.Text                  = model.EmailAddress;
                    txtMobileNo.Text               = model.PhoneNo1;
                    cboDepartment.SelectedItem     = ((List <SelectListItem>)cboDepartment.DataSource).Where(x => x.ID == model.FK_DepartmentId).FirstOrDefault();
                    cboDesignation.SelectedItem    = ((List <SelectListItem>)cboDesignation.DataSource).Where(x => x.ID == model.FK_DesignationId).FirstOrDefault();
                    cboEmploymentType.SelectedItem = ((List <SelectListItem>)cboEmploymentType.DataSource).Where(x => x.ID == model.FK_EmploymentTypeID).FirstOrDefault();

                    chkIsActive.Checked    = (bool)model.isActive;
                    chkHasResigned.Checked = (bool)model.IsResigned;
                    //     txtUserName.Text = model.FK_LoginID;
                    //txtPassword.Text = model.FK_LoginPassword;
                    //txtUserName.Text = model.TBL_User_Master.
                    cboEmployeeBoss.SelectedItem = ((List <SelectListItem>)cboEmployeeBoss.DataSource).Where(x => x.ID == model.FK_BossID).FirstOrDefault();

                    TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(EmployeeID);
                    this.Text = string.Format("{0} ({1}) - Add Relationship", emp.EmployeeName, emp.EmployeeCode);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditEmployee::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 30
0
        private void frmAddEditEmployeeLeaveConfig_Load(object sender, EventArgs e)
        {
            try
            {
                PopulateFinancialYearDropdown();
                PopulateleaveTypeDropDown();
                PopulateAllounceSalaryHeads();
                if (PK_LeaveID == 0)
                {
                    if (EmployeeID != 0)
                    {
                        headerEmployeeName.Values.Description = ServiceEmployee.GetEmployeeNameByID(this.EmployeeID);
                    }
                    txtLimitDays.Text            = txtMaxDaysallow.Text = String.Empty;
                    chkLeaveCarryForward.Checked = chkApplicableProbationPeriod.Checked = chkLeaveEncashable.Checked = false;
                    chkIsActive.Checked          = true;

                    if (this.SeledctedYearID != 0)
                    {
                        cboYear.SelectedItem = ((List <SelectListItem>)cboYear.DataSource).Where(x => x.ID == this.SeledctedYearID).FirstOrDefault();
                    }
                }
                else
                {
                    ScatterData();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "frmAddEditEmployeeLeaveConfig::frmAddEditEmployeeLeaveConfig_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }