Esempio n. 1
0
        } // end method BtnRequestApproval_Click()

        /// <summary>
        /// To show the benefits form populated with users data
        /// </summary>
        /// <param name="sender">The object generating the event</param>
        /// <param name="e">The event args</param>
        private void BtnEmpBenefits_Click(object sender, EventArgs e)
        {
            //Create new instance of FrmEmp_Benefits
            FrmEmp_Benefits form = new FrmEmp_Benefits();

            //Set current employee & display in TxtBox
            form.CurrEmp            = CurrEmp;
            form.TxtCurrentEmp.Text = CurrEmp.FirstName + " " + CurrEmp.LastName;

            //HOURLY grades
            if (CurrEmp.EmpType.Equals(EType.HOURLY))
            {
                //Configure Grades
                form.CBxGrade.Items.RemoveAt(8);
                form.CBxGrade.Items.RemoveAt(7);
                form.CBxGrade.Items.RemoveAt(6);
                form.CBxGrade.Items.RemoveAt(5);
                //Configure Edit Grades
                form.CBxEditGrade.Items.RemoveAt(8);
                form.CBxEditGrade.Items.RemoveAt(7);
                form.CBxEditGrade.Items.RemoveAt(6);
                form.CBxEditGrade.Items.RemoveAt(5);
            } // end if
            //SALARY grades
            if (CurrEmp.EmpType.Equals(EType.SALARY))
            {
                //Configure Grades
                form.CBxGrade.Items.RemoveAt(8);
                form.CBxGrade.Items.RemoveAt(7);
                form.CBxGrade.Items.RemoveAt(6);
                form.CBxGrade.Items.RemoveAt(5);
                form.CBxGrade.Items.RemoveAt(4);
                //Configure Edit Grades
                form.CBxEditGrade.Items.RemoveAt(8);
                form.CBxEditGrade.Items.RemoveAt(7);
                form.CBxEditGrade.Items.RemoveAt(6);
                form.CBxEditGrade.Items.RemoveAt(5);
                form.CBxEditGrade.Items.RemoveAt(4);
            } // end if
            //SALES grades
            if (CurrEmp.EmpType.Equals(EType.SALES))
            {
                //Configure Grades
                form.CBxGrade.Items.RemoveAt(8);
                form.CBxGrade.Items.RemoveAt(7);
                //Configure Edit Grades
                form.CBxEditGrade.Items.RemoveAt(8);
                form.CBxEditGrade.Items.RemoveAt(7);
            } // end if

            //Show form
            form.ShowDialog(this);
        } // end method BtnEmpBenefits_Click()
Esempio n. 2
0
        }     // end method OnFormClosing()

        /// <summary>
        /// To show an Employee Benefits form, loaded with an employee object's data
        /// </summary>
        /// <param name="sender">the object generating the event</param>
        /// <param name="e">the event args</param>
        private void MnuTestBenefits_Click(object sender, EventArgs e)
        {
            //Create new instance of FrmEmp_Benefits
            FrmEmp_Benefits form = new FrmEmp_Benefits();

            //Try to get employee using given empID (key)
            Employee emp = BusinessRules.Instance[3];

            //Set the new form's current employee object
            form.CurrEmp = emp;

            //Set the new form's current employee
            form.TxtCurrentEmp.Text = emp.FirstName + " " + emp.LastName;

            //Show form
            form.ShowDialog(this);
        } // end method MnuTestBenefits_Click()