コード例 #1
0
        private void signInBtn_Click(object sender, RoutedEventArgs e)
        {
            secretary = (Secretary)userController.SignIn(NameTextBox.Text,PasswordBox.Password);

            if(NameTextBox.Text.Equals("") || PasswordBox.Password.Equals(""))
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text = "Unos korisničkog imena i lozinke je obavezan!";
                okMbx.ShowDialog();
            }
            else if (secretary == null)
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text = "Unijeli ste pogrešno korisničko ime ili lozinku!";
                okMbx.ShowDialog();
            }
            else
            {
                var s = new MainWindow();
                s.Main.Content = new Home();
                s.Show();
                this.Close();
            }        
        }
コード例 #2
0
        private void btnEditExm_Click(object sender, RoutedEventArgs e)
        {
            ExaminationDTO examinationToEdit = (ExaminationDTO)dgSearchExaminations.SelectedItem;

            if (examinationToEdit == null)
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Prvo odaberite pregled koji mijenjate!";
                okMb.ShowDialog();
            }
            else
            {
                var ee = new EditExamination(examinationToEdit, this);
                ee.ShowDialog();
            }
        }
コード例 #3
0
        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]);
                    }
                }
            }
        }
コード例 #4
0
 private void yesBtn_Click(object sender, RoutedEventArgs e)
 {
     if (pbOldPass.Password.Equals("") || newPass.Password.Equals("") || newPassOk.Password.Equals(""))
     {
         var mbOk = new OKMessageBox(this, 1);
         mbOk.titleMsgBox.Text = "Greška";
         mbOk.textMsgBox.Text  = "Polja za unos lozinke ne mogu ostati prazna!";
         mbOk.ShowDialog();
     }
     else if (!pbOldPass.Password.Equals(userController.ViewProfile(LogIn.secretary.Jmbg).Password))
     {
         var mbOk = new OKMessageBox(this, 1);
         mbOk.titleMsgBox.Text = "Greška";
         mbOk.textMsgBox.Text  = "Unijeli ste neispravnu staru lozinku!";
         mbOk.ShowDialog();
     }
     else if (!newPass.Password.Equals(newPassOk.Password))
     {
         var mbOk = new OKMessageBox(this, 2);
         mbOk.titleMsgBox.Text = "Greška";
         mbOk.textMsgBox.Text  = "Unesene nove lozinke se ne poklapaju!";
         mbOk.ShowDialog();
     }
     else
     {
         Secretary s = LogIn.secretary;
         s.Password = newPass.Password;
         if (userController.EditProfile(s) == null)
         {
             var mbOk = new OKMessageBox(this, 2);
             mbOk.titleMsgBox.Text = "Greška";
             mbOk.textMsgBox.Text  = "Nova lozinka mora da ima makar 8 dozvoljenih karaktera (a-z A-Z 0-9 . - _) !";
             mbOk.ShowDialog();
         }
         else
         {
             var okMb = new OKMessageBox(this, 3);
             okMb.titleMsgBox.Text = "Obavještenje";
             okMb.textMsgBox.Text  = "Uspješno ste promijenili lozinku.";
             okMb.ShowDialog();
             this.Close();
         }
     }
 }
コード例 #5
0
        private void btnDeletePatient_Click(object sender, RoutedEventArgs e)
        {
            Patient patientToDelete = (Patient)dgPatients.SelectedItem;

            if (patientToDelete == null)
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Odaberite pacijenta koga želite obrisati!";
                okMb.ShowDialog();
            }
            else
            {
                var mb = new MyMessageBoxDelete(patientToDelete, this);
                mb.titleMsgBox.Text = "Brisanje pacijenta";
                mb.textMsgBox.Text  = "Da li ste sigurni da želite obrisati pacijenta?";
                mb.ShowDialog();
            }
        }
コード例 #6
0
 private void btnExmByDoctor_Click(object sender, RoutedEventArgs e)
 {
     if (dgDoctors.SelectedItem != null)
     {
         Doctor selectedDoctor = (Doctor)dgDoctors.SelectedItem;
         foreach (Window window in Application.Current.Windows)
         {
             if (window.GetType() == typeof(MainWindow))
             {
                 (window as MainWindow).Main.Content = new ExaminationViewByDoctor(selectedDoctor.Jmbg);
             }
         }
     }
     else
     {
         var okMbx = new OKMessageBox(this, 2);
         okMbx.titleMsgBox.Text = "Greška";
         okMbx.textMsgBox.Text  = "Izaberite doktora za kojeg želite prikazati raspored pregleda!";
         okMbx.ShowDialog();
     }
 }
コード例 #7
0
        private void btnEditExm_Click(object sender, RoutedEventArgs e)
        {
            ExaminationDTO examinationToEdit = (ExaminationDTO)dgCanceledExaminations.SelectedItem;

            if (examinationToEdit == null)
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Prvo odaberite pregled koji mijenjate!";
                okMb.ShowDialog();
            }
            else
            {
                var ee = new EditExamination(examinationToEdit, this);

                ee.cmbDoctor.IsEnabled            = false;
                ee.cmbTypeOfExamination.IsEnabled = false;
                ee.dpDate.IsEnabled = true;
                ee.tpTime.IsEnabled = true;
                ee.ShowDialog();
            }
        }
コード例 #8
0
        private void btnEditPatient_Click(object sender, RoutedEventArgs e)
        {
            Patient patientToEdit = (Patient)dgPatients.SelectedItem;

            if (patientToEdit == null)
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Odaberite pacijenta čije podatke mijenjate!";
                okMb.ShowDialog();
            }
            else
            {
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(MainWindow))
                    {
                        (window as MainWindow).Main.Content = new EditPatient(patientToEdit);
                    }
                }
            }
        }
コード例 #9
0
        private void btnScheduleExm_Click(object sender, RoutedEventArgs e)
        {
            ExaminationDTO examinationToSchedule = (ExaminationDTO)dgExaminations.SelectedItem;

            if (examinationToSchedule == null)
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Prvo odaberite slobodan termin doktora!";
                okMb.ShowDialog();
            }
            else if (!examinationToSchedule.Room.Equals(""))
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Izabrani pregled je već zakazan!";
                okMb.ShowDialog();
            }
            else
            {
                var ee = new ScheduleExamination(examinationToSchedule);
                ee.ShowDialog();
            }
        }
コード例 #10
0
        private void editExaminationBtn_Click(object sender, RoutedEventArgs e)
        {
            ExaminationDTO examinationToEdit = (ExaminationDTO)dgExaminations.SelectedItem;

            if (examinationToEdit == null)
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Prvo odaberite pregled koji mijenjate!";
                okMb.ShowDialog();
            }
            else if (examinationToEdit.Room.Equals(""))
            {
                var okMb = new OKMessageBox(this, 0);
                okMb.titleMsgBox.Text = "Greška";
                okMb.textMsgBox.Text  = "Izabrani termin nije zakazan!";
                okMb.ShowDialog();
            }
            else
            {
                var ee = new EditExamination(examinationToEdit, this);
                ee.ShowDialog();
            }
        }
コード例 #11
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();
                    }
                }
            }
        }
コード例 #12
0
        private void btnYes_Click(object sender, RoutedEventArgs e)
        {
            Regex regexJmbg  = new Regex(@"^[0-9]{13}$");
            Match match      = regexJmbg.Match(txtJmbg.Text);
            Regex regexPhone = new Regex(@"^[0-9]+$");
            Match match1     = regexPhone.Match(txtPhone.Text);
            Regex regexLbo   = new Regex(@"^[a-z]{2}[0-9]{3}$");
            Match match2     = regexLbo.Match(lboTextInput.Text);
            Regex regexEmail = new Regex(@"^[a-z0-9\.\-_]{4,20}[@]{1}[a-z.]{4,10}");
            Match match3     = regexEmail.Match(txtEmail.Text);

            if (txtName.Text.Equals("") || txtSurname.Text.Equals("") || txtJmbg.Text.Equals("") || cmbGender.SelectedItem == null || datePicker.SelectedDate == null)
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos imena, prezimena, JMBG-a, pola i datuma rođenja je obavezan!";
                okMbx.ShowDialog();
            }
            else if (!match.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "JMBG mora da sadrži 13 cifara!";
                okMbx.ShowDialog();
            }
            else if (!txtPhone.Text.Equals("") && !match1.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Telefon može da sadrži samo cifre!";
                okMbx.ShowDialog();
            }
            else if (!lboTextInput.Text.Equals("") && !match2.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Lbo mora da bude u formatu xx000!";
                okMbx.ShowDialog();
            }
            else if (!txtEmail.Text.Equals("") && !match3.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Pogrešan format za email!";
                okMbx.ShowDialog();
            }
            else if ((bool)completeRadioBtn.IsChecked && (txtUsername.Text.Equals("") || txtPassword.Password.Equals("")))
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos korisničkog imena i lozinke je obavezan za kompletnu registraciju!";
                okMbx.ShowDialog();
            }
            else
            {
                bool hi = false;
                if ((bool)yesCheckBtn.IsChecked)
                {
                    hi = true;
                }
                BloodType    bloodType    = BloodType.O;
                RhFactorType rhFactorType = RhFactorType.Negativna;
                GenderType   gender       = GenderType.Z;
                DateTime     sd           = DateTime.Today;
                if (cmbBlood.SelectedItem != null)
                {
                    if (cmbBlood.Text.Equals("A"))
                    {
                        bloodType = BloodType.A;
                    }
                    else if (cmbBlood.Text.Equals("B"))
                    {
                        bloodType = BloodType.B;
                    }
                    else if (cmbBlood.Text.Equals("AB"))
                    {
                        bloodType = BloodType.AB;
                    }
                }
                if (cmbRh.SelectedItem != null)
                {
                    if (cmbRh.Text.Equals("+"))
                    {
                        rhFactorType = RhFactorType.Pozitivna;
                    }
                }
                if (datePicker.SelectedDate != null)
                {
                    sd = (DateTime)datePicker.SelectedDate;
                }
                if (cmbGender.SelectedItem != null)
                {
                    if (cmbGender.Text.Equals("M"))
                    {
                        gender = GenderType.M;
                    }
                }

                bool isGuest = false;
                if ((bool)quickRadioBtn.IsChecked)
                {
                    isGuest = true;
                }

                if (txtCity.SelectedItem != null)
                {
                    city = (City)txtCity.SelectedItem;
                }
                else
                {
                    city = new City();
                }

                string   medicalHistory = "";
                string[] partsDate      = txtDate.Text.Split('\n');
                string[] partsDesc      = txtDesc.Text.Split('\n');
                string[] partsTherapy   = txtTherapy.Text.Split('\n');


                if (partsDate.Length != partsDesc.Length || partsDate.Length != partsTherapy.Length || partsDate.Length != partsTherapy.Length)
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                    okMbx.ShowDialog();
                    return;
                }

                if (!txtDate.Text.Equals("") || !txtDesc.Text.Equals("") || !txtTherapy.Text.Equals(""))
                {
                    for (int i = 0; i < partsDate.Length; i++)
                    {
                        if (partsDate[i].Equals("") || partsDesc[i].Equals("") || partsTherapy[i].Equals(""))
                        {
                            var okMbx = new OKMessageBox(this, 2);
                            okMbx.titleMsgBox.Text = "Greška";
                            okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                            okMbx.ShowDialog();
                            return;
                        }
                        medicalHistory += partsDate[i] + ":" + partsDesc[i] + ":" + partsTherapy[i] + ";";
                    }
                }

                patient     = new Patient(txtJmbg.Text, txtName.Text, txtSurname.Text, sd, gender, city, txtStreet.Text, txtPhone.Text, txtEmail.Text, txtUsername.Text, txtPassword.Password, DateTime.Today, isGuest);
                patientCard = new PatientCard(patient, bloodType, rhFactorType, txtAllergy.Text, medicalHistory, hi, lboTextInput.Text);

                if (userController.Register(patient) != null && patientCardController.CreatePatientCard(patientCard) != null)
                {
                    var okMb = new OKMessageBox(this, 3);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste registrovali novog pacijenta.";
                    okMb.ShowDialog();
                }
                else
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Pacijent je već registrovan ili ste unijeli nedovoljan broj karaktera za korisničko ime/lozinku!";
                    okMbx.ShowDialog();
                }
            }
        }
コード例 #13
0
        private void yesBtn_Click(object sender, RoutedEventArgs e)
        {
            if (txtPatient.Text.Equals(""))
            {
                var okMbx = new OKMessageBox(this, 4);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Morate odabrati pacijenta!";
                okMbx.ShowDialog();
                return;
            }
            if (cmbDoctor.SelectedItem == null)
            {
                var okMbx = new OKMessageBox(this, 4);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Morate odabrati doktora!";
                okMbx.ShowDialog();
                return;
            }
            if (cmbTypeOfExamination.SelectedItem == null)
            {
                var okMbx = new OKMessageBox(this, 4);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Morate odabrati vrstu pregleda!";
                okMbx.ShowDialog();
            }
            if (cmbNumberOfRoom.SelectedItem == null)
            {
                var okMbx = new OKMessageBox(this, 4);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Morate odabrati sobu!";
                okMbx.ShowDialog();
                return;
            }
            if (dpDate.SelectedDate == null)
            {
                var okMbx = new OKMessageBox(this, 4);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Morate odabrati datum!";
                okMbx.ShowDialog();
                return;
            }
            if (tpTime.SelectedItem == null)
            {
                var okMbx = new OKMessageBox(this, 4);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Morate odabrati vrijeme!";
                okMbx.ShowDialog();
                return;
            }


            DateTime selectedDate   = (DateTime)dpDate.SelectedDate;
            Room     selectedRoom   = (Room)cmbNumberOfRoom.SelectedItem;
            Doctor   selectedDoctor = (Doctor)cmbDoctor.SelectedItem;
            TimeDTO  timeDTO        = (TimeDTO)tpTime.SelectedItem;
            DateTime date           = Convert.ToDateTime(selectedDate.ToShortDateString() + " " + timeDTO.Time, CultureInfo.InvariantCulture);

            string[]    partsPatient        = examination.Patient.Split(' ');
            PatientCard selectedPatientCard = patientCardController.ViewPatientCard(partsPatient[partsPatient.Length - 1]);

            TypeOfExamination    type;
            TypeOfExaminationDTO selectedType = (TypeOfExaminationDTO)cmbTypeOfExamination.SelectedItem;

            if (selectedType.Type.Equals("Opšti pregled"))
            {
                type = TypeOfExamination.Opsti;
            }
            else if (selectedType.Type.Equals("Specijalistički pregled"))
            {
                type = TypeOfExamination.Specijalisticki;
            }
            else
            {
                type = TypeOfExamination.Operacija;
            }

            if (parent.GetType() == typeof(CanceledExaminationsView))
            {
                if (examinationController.ScheduleExamination(new Examination(examination.Id, type, date, selectedDoctor, selectedRoom, selectedPatientCard)) == null)
                {
                    var okMbx = new OKMessageBox(this, 4);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Došlo je do greške, doktor ili soba su zauzeti u odabranom terminu!";
                    okMbx.ShowDialog();
                    return;
                }

                else
                {
                    int    lastId  = notificationController.getLastId();
                    string message = "Ponovo zakazan otkazani pregled\n" + "Doktor: " + selectedDoctor.Name + " " + selectedDoctor.Surname

                                     + "\nBroj sobe: " + selectedRoom.Number + "\nDatum:" + date.ToShortDateString() + "\nVrijeme: " + date.ToShortTimeString();
                    notificationController.SendNotification(new Notification(++lastId, TypeOfNotification.Pregled, message, selectedPatientCard.patient.Jmbg));


                    var okMb = new OKMessageBox(this, 0);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste zakazali pregled koji je bio otkazan. Pacijent je obaviješten o izmjeni.";
                    okMb.ShowDialog();
                    this.Close();
                }

                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(MainWindow))
                    {
                        (window as MainWindow).Main.Content = new CanceledExaminationsView();
                    }
                }
            }
            else if (parent.GetType() == typeof(ExaminationViewByDoctor))
            {
                if (examinationController.EditExamination(new Examination(examination.Id, type, date, selectedDoctor, selectedRoom, selectedPatientCard)) == null)
                {
                    var okMbx = new OKMessageBox(this, 4);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Došlo je do greške, doktor ili soba su zauzeti u odabranom terminu!";
                    okMbx.ShowDialog();
                    return;
                }
                else
                {
                    int    lastId  = notificationController.getLastId();
                    string message = "Pregled izmijenjen\n" + "Doktor: " + selectedDoctor.Name + " " + selectedDoctor.Surname

                                     + "\nBroj sobe: " + selectedRoom.Number + "\nDatum:" + date.ToShortDateString() + "\nVrijeme: " + date.ToShortTimeString();
                    notificationController.SendNotification(new Notification(++lastId, TypeOfNotification.Pregled, message, selectedPatientCard.patient.Jmbg));


                    var okMb = new OKMessageBox(this, 0);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste izmijenili pregled. Pacijent je obaviješten o izmjeni.";
                    okMb.ShowDialog();
                    this.Close();
                }

                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(MainWindow))
                    {
                        (window as MainWindow).Main.Content = new ExaminationViewByDoctor(selectedDoctor.Jmbg);
                    }
                }
            }
            else if (parent.GetType() == typeof(SearchExaminations))
            {
                if (examinationController.EditExamination(new Examination(examination.Id, type, date, selectedDoctor, selectedRoom, selectedPatientCard)) == null)
                {
                    var okMbx = new OKMessageBox(this, 4);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Došlo je do greške, doktor ili soba su zauzeti u odabranom terminu!";
                    okMbx.ShowDialog();
                    return;
                }
                else
                {
                    int    lastId  = notificationController.getLastId();
                    string message = "Pregled izmijenjen\n" + "Doktor: " + selectedDoctor.Name + " " + selectedDoctor.Surname

                                     + "\nBroj sobe: " + selectedRoom.Number + "\nDatum:" + date.ToShortDateString() + "\nVrijeme: " + date.ToShortTimeString();
                    notificationController.SendNotification(new Notification(++lastId, TypeOfNotification.Pregled, message, selectedPatientCard.patient.Jmbg));


                    var okMb = new OKMessageBox(this, 0);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste izmijenili pregled. Pacijent je obaviješten o izmjeni.";
                    okMb.ShowDialog();
                    this.Close();
                }

                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(MainWindow))
                    {
                        (window as MainWindow).Main.Content = new SearchExaminations();
                    }
                }
            }
        }
コード例 #14
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            filteredExaminations.Clear();
            filteredExaminations.AddRange(scheduledExaminations);

            if (!searchPatients.Text.Equals(""))
            {
                if (!searchPatients.Text.Contains(' '))
                {
                    var okMb = new OKMessageBox(this, 0);
                    okMb.titleMsgBox.Text = "Greška";
                    okMb.textMsgBox.Text  = "Unesite ime i prezime pacijenta za pretragu!";
                    okMb.ShowDialog();
                    searchPatients.Text = null;
                    return;
                }
                else if (getPatientsFromSearch(searchPatients.Text).Count < 1)
                {
                    var okMb = new OKMessageBox(this, 0);
                    okMb.titleMsgBox.Text = "Greška";
                    okMb.textMsgBox.Text  = "Odabrani pacijent ne postoji u sistemu!";
                    okMb.ShowDialog();
                    searchPatients.Text = null;
                    return;
                }
            }
            else if (!cmbSearchDoctors.Text.Equals(""))
            {
                if (!cmbSearchDoctors.Text.Contains(' '))
                {
                    var okMb = new OKMessageBox(this, 0);
                    okMb.titleMsgBox.Text = "Greška";
                    okMb.textMsgBox.Text  = "Unesite ime i prezime doktora za pretragu!";
                    okMb.ShowDialog();
                    searchPatients.Text = null;
                    return;
                }
                else if (getDoctorsFromSearch(cmbSearchDoctors.Text).Count < 1)
                {
                    var okMb = new OKMessageBox(this, 0);
                    okMb.titleMsgBox.Text = "Greška";
                    okMb.textMsgBox.Text  = "Odabrani doktor ne postoji u sistemu!";
                    okMb.ShowDialog();
                    cmbSearchDoctors.Text = null;
                    return;
                }
            }

            Room selectedRoom = (Room)cmbRoom.SelectedItem;

            if (!searchPatients.Text.Equals(""))
            {
                filteredExaminations = filteredExaminations.Where(exm => exm.Patient.Contains(searchPatients.Text.ToString())).ToList();
            }
            if (!cmbSearchDoctors.Text.Equals(""))
            {
                filteredExaminations = filteredExaminations.Where(exm => exm.Doctor.Contains(cmbSearchDoctors.Text.ToString())).ToList();
            }
            if (cmbTypeExm.SelectedItem != null)
            {
                filteredExaminations = filteredExaminations.Where(exm => exm.TypeOfExamination.Equals(cmbTypeExm.SelectedItem.ToString())).ToList();
            }
            if (selectedRoom != null)
            {
                filteredExaminations = filteredExaminations.Where(exm => exm.Room.Contains(selectedRoom.Number.ToString())).ToList();
            }
            if (datePicker.SelectedDate != null)
            {
                DateTime selectedDate = (DateTime)datePicker.SelectedDate;
                filteredExaminations = filteredExaminations.Where(exm => exm.Date.Equals(selectedDate.ToShortDateString())).ToList();
            }
            if (tpTime.SelectedTime != null)
            {
                DateTime selectedTime = (DateTime)tpTime.SelectedTime;
                filteredExaminations = filteredExaminations.Where(exm => exm.Time.Equals(selectedTime.ToShortTimeString())).ToList();
            }

            dgSearchExaminations.ItemsSource = filteredExaminations;
        }
コード例 #15
0
        private void btnYes_Click(object sender, RoutedEventArgs e)
        {
            Regex regex      = new Regex(@"^[0-9]{13}$");
            Match match      = regex.Match(txtJmbg.Text);
            Regex regex1     = new Regex(@"^[0-9]+$");
            Match match1     = regex1.Match(txtPhone.Text);
            Regex regexEmail = new Regex(@"^[a-z0-9\.\-_]{4,20}[@]{1}[a-z.]{4,10}");
            Match match3     = regexEmail.Match(txtEmail.Text);

            if (txtName.Text.Equals("") || txtSurname.Text.Equals("") || txtJmbg.Text.Equals("") || cmbGender.SelectedItem == null || dpDateOfBirth.SelectedDate == null)
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos imena, prezimena, JMBG-a, pola i datuma rođenja je obavezan!";
                okMbx.ShowDialog();
            }
            else if (!match.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "JMBG mora da sadrži 13 cifara!";
                okMbx.ShowDialog();
            }
            else if (!txtPhone.Text.Equals("") && !match1.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Telefon može da sadrži samo cifre!";
                okMbx.ShowDialog();
            }
            else if (!txtEmail.Text.Equals("") && !match3.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Pogrešan format za email!";
                okMbx.ShowDialog();
            }
            else
            {
                DateTime   date = (DateTime)dpDateOfBirth.SelectedDate;
                GenderType gender;
                City       city;

                if (txtCity.SelectedItem != null)
                {
                    city = (City)txtCity.SelectedItem;
                }
                else
                {
                    city = new City();
                }

                if (cmbGender.Text.Equals("M"))
                {
                    gender = GenderType.M;
                }
                else
                {
                    gender = GenderType.Z;
                }

                Secretary s = new Secretary(txtJmbg.Text, txtName.Text, txtSurname.Text, date, gender, city, txtStreet.Text, txtPhone.Text, txtEmail.Text,
                                            LogIn.secretary.Username, LogIn.secretary.Password, LogIn.secretary.Qualifications, LogIn.secretary.DateOfEmployment);

                Secretary changedSecretary = (Secretary)userController.EditProfile(s);

                if (changedSecretary != null)
                {
                    LogIn.secretary = changedSecretary;

                    var okMb = new OKMessageBox(this, 3);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste izmijenili svoje informacije.";
                    okMb.ShowDialog();
                }
                else
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Došlo je do greške, provjerite da li je dobar format podataka!";
                    okMbx.ShowDialog();
                }
            }
        }