private void Ok_Click(object sender, RoutedEventArgs e) { var submit = new Submit(); int DateIntOfCleaning = DateOfCleaning.DayOfYear; submit.WhenDone = DateOfCleaning.DayOfYear; submit.Executer = user; submit.Checker = checker; if (Wash.IsChecked == true) { submit.Wash = true; } else { submit.Wash = false; } if (Sweep.IsChecked == true) { submit.Sweep = true; } else { submit.Sweep = false; } if (Trash.IsChecked == true) { submit.Trash = true; } else { submit.Trash = false; } if (submit.Wash == false && submit.Trash == false && submit.Sweep == false) { MessageBox.Show("Please, change reason!"); return; } submitRepository.AddSubmit(submit); submitRepository.Save(); Close(); }
private void Ok_Click(object sender, RoutedEventArgs e) { if (user.Id == submit.Checker.Id) { int DateIntOfCleaning = DateTime.Now.DayOfYear; submit.WhenChecked = DateIntOfCleaning; if (Wash.IsChecked == true) { submit.Wash = true; } else { submit.Wash = false; } if (Sweep.IsChecked == true) { submit.Sweep = true; } else { submit.Sweep = false; } if (Trash.IsChecked == true) { submit.Trash = true; } else { submit.Trash = false; } submitRepository.EditSubmit(submit); submitRepository.Save(); Close(); } else { Close(); } }