private void btnCancelExm_Click(object sender, RoutedEventArgs e) { ExaminationDTO examinationToCancel = (ExaminationDTO)dgExaminations.SelectedItem; if (examinationToCancel == null) { var okMb = new OKMessageBox(this, 0); okMb.titleMsgBox.Text = "Greška"; okMb.textMsgBox.Text = "Odaberite pregled koji želite otkazati!"; okMb.ShowDialog(); } else if (examinationToCancel.Room.Equals("")) { var okMb = new OKMessageBox(this, 0); okMb.titleMsgBox.Text = "Greška"; okMb.textMsgBox.Text = "Izabrani termin nije zakazan!"; okMb.ShowDialog(); } else { string[] partsDoctor = examinationToCancel.Doctor.Split(' '); if (examinationController.CancelExamination(examinationToCancel.Id) == false) { var okMb = new OKMessageBox(this, 0); okMb.titleMsgBox.Text = "Greška"; okMb.textMsgBox.Text = "Došlo je do greške prilikom otkazivanja pregleda!"; okMb.ShowDialog(); return; } int lastId = notificationController.getLastId(); string message = "Vas pregled za datum " + examinationToCancel.Date + " u " + examinationToCancel.Time + " sati je otkazan."; string[] partsPatient = examinationToCancel.Patient.Split(' '); notificationController.SendNotification(new Notification(++lastId, TypeOfNotification.Pregled, message, partsPatient[partsPatient.Length - 1])); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(MainWindow)) { (window as MainWindow).Main.Content = new ExaminationViewByDoctor(partsDoctor[partsDoctor.Length - 1]); } } } }