public bool Insert(OvertimeParam overtimeParam) { try { var result = 0; overtime.createDate = DateTimeOffset.Now.LocalDateTime; overtime.check_in = overtimeParam.check_in; overtime.employee_id = overtimeParam.employee_id; _context.Overtimes.Add(overtime); result = _context.SaveChanges(); if (result > 0) { status = true; MessageBox.Show("Login Successfully"); } } catch(Exception e) { MessageBox.Show(e.StackTrace); } return status; }
private void LogoutButton_Click(object sender, RoutedEventArgs e) { OvertimeParam overtimeParam = new OvertimeParam(); MessageBoxResult result = MessageBox.Show("Yakin ingin Log out?", "Peringatan", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { overtimeParam.check_out = DateTimeOffset.Now.LocalDateTime; _overtimeService.Update(Settings.Default.Id, overtimeParam); LoginPage login = new LoginPage(); login.Show(); this.Close(); } }
public bool Update(int?Id, int?total, OvertimeParam overtimeParam) { var result = 0; int selisih = 0; selisih = overtimeParam.check_out.Hour - 17; int?kuota = total + selisih; var overtimes = GetId(Id); if (overtimes != null) { //Jam 17 ubah ke setting double overtime_salary; if (selisih >= 3 && selisih <= 5) { overtime_salary = (1 * 1.5 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)) + ((selisih - 1) * 2 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)); } else if (selisih > 5) { selisih = 5; overtime_salary = (1 * 1.5 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)) + ((selisih - 1) * 2 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)); } else { overtime_salary = 0; selisih = 0; } //Selisih ubah ke setting overtimes.check_out = overtimeParam.check_out; overtimes.difference = selisih; overtimes.overtime_salary = Convert.ToInt32(overtime_salary); result = _context.SaveChanges(); if (result > 0) { status = true; } } else if (kuota > 40) { MessageBox.Show("Your Overtime Hours Reach Limit"); } else { status = false; } return(status); }
public bool Update(int?Id, OvertimeParam overtimeParam) { var result = 0; var overtimes = GetId(Id); if (overtimes != null) { //Jam 17 ubah ke setting int selisih = overtimeParam.check_out.Hour - 17; double overtime_salary; if (selisih >= 3 && selisih <= 5) { overtime_salary = (1 * 1.5 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)) + ((selisih - 1) * 2 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)); } else if (selisih > 5) { selisih = 5; overtime_salary = (1 * 1.5 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)) + ((selisih - 1) * 2 * (1.0 / 173.0) * Convert.ToDouble(overtimes.Employees.salary)); } else { overtime_salary = 0; } //Selisih ubah ke setting overtimes.check_out = overtimeParam.check_out; overtimes.difference = selisih; overtimes.overtime_salary = Convert.ToInt32(overtime_salary); result = _context.SaveChanges(); if (result > 0) { status = true; } } return(status); }
public bool Update(int?Id, OvertimeParam overtimeParam) { return(_overtimeRepository.Update(Id, overtimeParam)); }
public bool Insert(OvertimeParam overtimeParam) { return(_overtimeRepository.Insert(overtimeParam)); }