private void createPayrollButton_Click(object sender, EventArgs e) { TimeSpan validDate = endDatePeriod.Value - startDatePeriod.Value; if (validDate <= fetchValidDateDuration()) { showErrorMessage("Invalid period."); return; } hideErrorMessage(); if (!selectAllCheckBox.Checked) { EmployeeControllerInterface employeeController = new EmployeeController(); Employee employee = employeeController.fetchEmployeeByUsername(usernameOrEmployeeId.Text); if (employee == null || employee.Equals("")) { showErrorMessage("Please input a valid username."); return; } PayrollControllerInterface payslipController = new PayrollController(); Payslip payslip = payslipController.createPayslip(startDatePeriod.Value, endDatePeriod.Value, employee); if (thirteenMonthPayCheckBox.Checked) { payslipController.addThirteenMonthPayToPayslip(employee, payslip); } loadPayrollList(); adminTab.SelectedTab = payrollTab; showErrorMessage("Successfully created payroll to user: "******"admin" && user.status == AccountStatus.Enable) { EmployeeControllerInterface employeeController = new EmployeeController(); Employee employee = employeeController.fetchEmployeeByUsername(user.username); if (employee == null || employee.Equals("")) { showErrorMessage("Please input a valid username."); return; } PayrollControllerInterface payslipController = new PayrollController(); payslipController.createPayslip(startDatePeriod.Value, endDatePeriod.Value, employee); } } selectAllCheckBox.Checked = false; loadPayrollList(); adminTab.SelectedTab = payrollTab; showErrorMessage("Successfully create payroll to all users"); } }
private void createPayrollButton_Click(object sender, EventArgs e) { EmployeeControllerInterface employeeController = new EmployeeController(); Employee employee = employeeController.fetchEmployeeByUsername(usernameOrEmployeeId.Text); PayrollControllerInterface payslipController = new PayrollController(); payslipController.createPayslip(startDatePeriod.Value, endDatePeriod.Value, employee); }
private void resetLeaveCreditsButton_Click(object sender, EventArgs e) { hideErrorMessage(); if (!selectAllCheckBox.Checked) { EmployeeControllerInterface employeeController = new EmployeeController(); Employee employee = employeeController.fetchEmployeeByUsername(usernameOrEmployeeId.Text); if (employee == null || employee.Equals("")) { showErrorMessage("Please input a valid username."); return; } LeaveCreditsControllerInteface leaveCreditsController = new LeaveCreditsController(); EmployeeLeaveCredits employeeLeaveCredits = leaveCreditsController.resetEmployeeLeaveCredits(employee); showErrorMessage("Successfully created payroll to user: "******"admin") { EmployeeControllerInterface employeeController = new EmployeeController(); Employee employee = employeeController.fetchEmployeeByUsername(user.username); if (employee == null || employee.Equals("")) { showErrorMessage("Please input a valid username."); return; } PayrollControllerInterface payslipController = new PayrollController(); payslipController.createPayslip(startDatePeriod.Value, endDatePeriod.Value, employee); } } selectAllCheckBox.Checked = false; showErrorMessage("Successfully create payroll to all users"); } }