示例#1
0
        /// <summary>
        /// Handles the Click event of the calcPayroll control.
        /// Hours worked details is asked for each employee whose hours are not already entered.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void calcPayroll_Click(object sender, EventArgs e)
        {
            if (NoEmployeeData())
            {
                return;
            }

            Globals.ReducePayrollList();
            MessageBox.Show("Please input the no. of hours the employees worked in this week.\n\tPress cancel for the employee has not worked", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            int count = 0;

            for (int i = 0; i < Globals.payrollList.Count; i++)
            {
                Payroll payroll = Globals.payrollList[i];
                if (payroll.HoursWorked == 0)
                {
                    count++;
                    PayrollForm payrollForm = new PayrollForm(payroll);
                    payrollForm.PayrollUpdated += Globals.UpdateGlobalPayroll;
                    payrollForm.ShowDialog();
                }
            }
            if (count == 0)
            {
                MessageBox.Show("All Payrolls Already Set. To Edit: Click on " + this.viewReport.Text, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            new PayrollReport(this.empList.ToList()).ShowDialog();
        }
        /// <summary>
        /// Prompts the edit of selected payroll detail.
        /// Called on cell double click and on edit button click
        /// </summary>
        private void PromptEdit()
        {
            PayrollForm payrollForm = new PayrollForm(this.payrollList[row]);

            payrollForm.PayrollUpdated += UpdateRecord;
            payrollForm.ShowDialog();
        }