public override void OnEnter() { if (Settings.IsOfflineMode) { MessageBox.Show("Dit scherm is niet beschikbaar in offline mode."); _router.GoBack(); return; } TemplateQuestions.Clear(); if (ViewBag?.Template == null) { Checklist = new Checklist(); return; } Checklist = ViewBag.Template.GetCleanModel(); const string regex = "\\s{1}[Vv]{1}\\d{1,}$"; if (Regex.Match(Checklist.Name, regex).Success) { Checklist.Name = Regex.Replace(Checklist.Name, regex, string.Empty); } Checklist.Name += $" v{Checklist.Version}"; RaisePropertyChanged(nameof(Checklist)); _checklistQuestionRepository.GetChecklistQuestions(Checklist.Parent).ForEach(q => TemplateQuestions.Add(q.GetCleanModel())); _questionRepository.All().ForEach(ExistingQuestions.Add); }
public override void OnEnter() { if (Settings.IsOfflineMode) { MessageBox.Show("Dit scherm is niet beschikbaar in offline mode."); _router.GoBack(); return; } }
private void Save() { if (!CanSave()) { return; } if (!_customerRepository.Update(Customer)) { MessageBox.Show("Kon klant niet opslaan!"); return; } MessageBox.Show("Klant opgeslagen!"); _router.GoBack(); }
private void GoBack() { if (_router.IsAtRoot()) { return; } _router.GoBack(); }
public override void OnEnter() { if (Settings.IsOfflineMode) { MessageBox.Show("Dit scherm is niet beschikbaar in offline mode."); _router.GoBack(); return; } if (_isEditing) { _isEditing = false; return; } if (ViewBag?.Task != null) { SelectedTask = ViewBag.Task; } else { SelectedTask = new Task { Inspections = new List <Inspection>(), TaskSchedules = new List <TaskSchedule>(), DateTimeStart = DateTime.Today, Hash = MD5.Crypt($"{DateTime.Now.ToLongDateString()}-{SelectedTask?.GetHashCode()}") }; EndDate = DateTime.Today.AddDays(1); IsRepeating = false; CanEditStartDate = true; } if (SelectedTask.Remarks == null) { SelectedTask.Remarks = ""; } SelectedTask.TaskSchedules.ToList().ForEach(t => TaskSchedules.Add(t)); Customers.Clear(); ParkingLots.Clear(); Checklists.Clear(); StartDate = DateTime.Today; EndDate = DateTime.Today.AddDays(1); _customerRepository.All().ForEach(Customers.Add); _checklistRepository.All().ForEach(Checklists.Add); _parkingLotRepository.All().ForEach(ParkingLots.Add); CalculateInspectionDates(); SelectFirstComboBoxItem(); }
public override void OnEnter() { if (Settings.IsOfflineMode) { MessageBox.Show("Dit scherm is niet beschikbaar in offline mode."); _router.GoBack(); return; } RaisePropertyChanged(nameof(GoBack)); GoBack = true; }
private void Save(List <object> passwordBoxes) { if (!CanSave(passwordBoxes)) { return; } var passwordBox = (PasswordBox)passwordBoxes[0]; Employee.Password = HashPassword(passwordBox.Password); Employee.JobTitle = SelectedJobType; if (_userRepository.Add(Employee)) { MessageBox.Show($"Werknemer {Employee.FirstName} toegevoegd!"); _router.GoBack(); return; } MessageBox.Show("Er heeft zich een fout voorgedaan."); }
private void Save() { var iiList = new List <InspectionInspector>(); foreach (var e in SelectedInspectors) { var ii = new InspectionInspector { Employee = _userRepository.Find(e.ID), Inspection = _inspectionRepository.Find(_inspection.ID), LastUpdated = DateTime.Now }; e.InspectionInspectors.Add(ii); _userRepository.Update(e); iiList.Add(ii); } _inspection.InspectionInspectors = iiList; _inspectionRepository.Update(_inspection); MessageBox.Show("De wijzigingen zijn opgeslagen!"); _router.GoBack(); }
public override void OnEnter() { if (Settings.IsOfflineMode) { MessageBox.Show("Dit scherm is niet beschikbaar in offline mode."); _router.GoBack(); return; } SelectedEmployee = ViewBag.Employee; if (SelectedEmployee == null) { MessageBox.Show("Geen medewerker geselecteerd."); _router.GoBack(); return; } JobTitles.Clear(); _jobTitleRepository.All().ForEach(JobTitles.Add); SelectedJobTitle = JobTitles.FirstOrDefault(j => j.Name.Equals(SelectedEmployee.JobTitle.Name)); }
private void SaveAnswers() { var invalid = ControlList.FirstOrDefault(control => !control.IsValid); if (invalid != null) { MessageBox.Show($"De vraag \"{invalid.Question.Text}\" is niet geldig ingevuld!", "Fout", MessageBoxButton.OK, MessageBoxImage.Information); return; } ControlList.ToList().ForEach(x => { var answer = x.GetAnswer(); answer.Inspection = _inspection; answer.Employee = Settings.CurrentUser; if (answer.Photo != null) { answer.Photo.Inspection = _inspection; } _inspection.DateTimeDone = DateTime.Now; _inspection.Answers.Add(answer); x.Question.Answers.Add(answer); }); if (!_inspectionRepository.Update(_inspection)) { MessageBox.Show("Er ging iets fout, probeer het opnieuw!"); return; } MessageBox.Show("De inspectie is opgeslagen."); _router.GoBack(); }
public void Router_IsAtRoot() { _router.GoTo(ControlType.ChangePasswordControl); Assert.IsTrue(_router.IsAtRoot()); _router.GoTo(ControlType.UserManagementControl); Assert.IsFalse(_router.IsAtRoot()); _router.GoBack(); Assert.IsTrue(_router.IsAtRoot()); }
public override void OnEnter() { if (ViewBag?.Task == null) { MessageBox.Show("Er is geen inspectie geselecteerd!"); _router.GoBack(); return; } Task = ViewBag.Task; Inspections.Clear(); Task.Inspections.ToList().ForEach(Inspections.Add); Inspectors.Clear(); Task.Inspections.SelectMany(x => x.InspectionInspectors.Select(i => i.Employee)).Distinct().ToList().ForEach(Inspectors.Add); Remarks = Task.Remarks; RaisePropertyChanged(nameof(Task)); }
private void Save() { var point = GetLatLong(); var error = CanSave(point); if (error != string.Empty) { MessageBox.Show(error); return; } ParkingLot.GeoLongitude = point.Longitude; ParkingLot.GeoLatitude = point.Latitude; _repository.Add(ParkingLot); MessageBox.Show("De locatie is opgeslagen!"); _router.GoBack(); }