private void CheckOut_Click(object sender, RoutedEventArgs e)
        {
            int? total    = 0;
            bool status   = overtimeService.Update(Settings.Default.Id, total, overtimeParam);
            var  gettotal = _approvalService.GetTotal(Settings.Default.Id);

            foreach (var hitung in gettotal)
            {
                total = total + hitung.Overtime.difference;
            }

            MessageBoxResult result = MessageBox.Show("Yakin ingin Check Out?", "Peringatan", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                if (status == false)
                {
                    LoginPage login = new LoginPage();
                    login.Show();
                    this.Close();
                }
                else
                {
                    overtimeParam.check_out = DateTimeOffset.Now.LocalDateTime;
                    overtimeService.Update(Settings.Default.Id, total, overtimeParam);
                    int selisih = 0;
                    selisih = DateTime.Now.Hour - 17;
                    var approval = _approvalService.Get(Settings.Default.Id);
                    if (approval == null)
                    {
                        if (selisih > 3 && selisih <= 5)
                        {
                            approvalParam.employee_id     = Settings.Default.Id;
                            approvalParam.approval_status = "WAITING";
                            approvalParam.reason          = ReasonTextBox.Text;
                            approvalParam.overtime_id     = overtimeService.GetId(Settings.Default.Id).Id;
                            _approvalService.insert(approvalParam);
                        }
                        int Id = Settings.Default.Id;
                        OvertimeEmployeeGrid.ItemsSource = _approvalService.GetOvertimeAll(Id);
                    }
                    else
                    {
                        MessageBox.Show("Already Check Out For This Day");
                    }
                }
            }
        }
        public async Task <ActionResult> Put(int id, [FromBody] Overtime overtime)
        {
            try
            {
                VerifyUser();
                _validateService.Validate(overtime);
                Overtime overtimeToUpdate = await _overtimeService.GetSingleById(id);

                await _overtimeService.Update(overtimeToUpdate, overtime);

                return(NoContent());
            }
            catch (ServiceValidationExeption e)
            {
                var result = new ResultFormatter(API_VERSION, General.BAD_REQUEST_STATUS_CODE, General.BAD_REQUEST_MESSAGE)
                             .Fail(e);
                return(BadRequest(result));
            }
            catch (Exception e)
            {
                var result = new ResultFormatter(API_VERSION, General.INTERNAL_ERROR_STATUS_CODE, e.Message)
                             .Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, result));
            }
        }
        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();
            }
        }