示例#1
0
        private void btnDeleteExm_Click(object sender, RoutedEventArgs e)
        {
            ExaminationDTO examinationDelete = (ExaminationDTO)dgCanceledExaminations.SelectedItem;

            if (examinationDelete == null)
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Prvo odaberite pregled koji brišete!";
                okMb.ShowDialog();
            }
            else
            {
                if (examinationController.DeleteCanceledExamination(examinationDelete.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;
                }

                var okMb1 = new OKMessageBox(this, 0);
                okMb1.titleMsgBox.Text = "Obavještenje";
                okMb1.textMsgBox.Text  = "Uspješno ste obrisali pregled.";
                okMb1.ShowDialog();

                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(MainWindow))
                    {
                        (window as MainWindow).Main.Content = new CanceledExaminationsView();
                    }
                }
            }
        }