/// <summary>
 /// Updates the global payroll.
 /// passed as delegate to payrollform when it is called from EmployeeList.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="PayrollUpdatedEventArgs"/> instance containing the event data.</param>
 public static void UpdateGlobalPayroll(object sender, PayrollUpdatedEventArgs e)
 {
     for (int i = 0; i < payrollList.Count; i++)
     {
         Payroll payroll = payrollList[i];
         if (payroll.Employee.Id == e.Payroll.Employee.Id)
         {
             payrollList[i] = e.Payroll;
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Handles the Click event of the saveBtn control.
        /// Saves the input data using delegate.
        /// </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 saveBtn_Click(object sender, EventArgs e)
        {
            if (!ValidFields())
            {
                return;
            }
            this.payroll.HoursWorked = Convert.ToInt32(hoursWorkedTxt.Text);
            PayrollUpdatedEventArgs args = new PayrollUpdatedEventArgs(this.payroll);

            this.PayrollUpdated(this, new PayrollUpdatedEventArgs(this.payroll));
            this.Close();
        }
 /// <summary>
 /// Gets passed to the delegate in the PayrollForm.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="PayrollUpdatedEventArgs"/> instance containing the event data.</param>
 private void UpdateRecord(object sender, PayrollUpdatedEventArgs e)
 {
     UpdateRecord(e.Payroll.HoursWorked);
 }