コード例 #1
0
        private void buttonConfrim_Click(object sender, RoutedEventArgs e)
        {
            if (firstName.Text.Equals("") || lastName.Text.Equals("") || jmbg.Text.Equals("") || dateOfBirthPicker.Text.Equals("") || telephoneNumber.Text.Equals("") || homeAdress.Text.Equals("") || cityAdress.Text.Equals("") || emailAdress.Text.Equals(""))
            {
                ValidationMessageWindow validationWindow = new ValidationMessageWindow();
                validationWindow.Show();
            }
            else
            {
                string name = firstName.Text;

                string surname = lastName.Text;

                GenderType gender;

                if (male.IsChecked == true)
                {
                    gender = GenderType.M;
                }
                else
                {
                    gender = GenderType.Z;
                }

                DateTime dateOfBirth = (DateTime)dateOfBirthPicker.SelectedDate;

                string telephone = telephoneNumber.Text;

                string street = homeAdress.Text;

                City city = (City)cityAdress.SelectedItem;

                string email = emailAdress.Text;

                patient = new Patient(MainWindow.patient.Jmbg, name, surname, dateOfBirth, gender, city, street, telephone, email, MainWindow.patient.Username, MainWindow.patient.Password, MainWindow.patient.DateOfRegistration, MainWindow.patient.IsGuest);

                PatientCard pc = new PatientCard(patient);

                if (userController.EditProfile(patient) != null && patientCardController.EditPatientCard(pc) != null)
                {
                    List <Examination> examinations = examinationController.ViewExaminationsByPatient(patient.Jmbg);

                    foreach (Examination exm in examinations)
                    {
                        exm.patientCard = pc;
                        examinationController.EditExamination(exm);
                    }

                    List <Therapy> therapies = therapyController.ViewAllTherapyByPatient(patient.Jmbg);

                    foreach (Therapy t in therapies)
                    {
                        t.patientCard = pc;
                        therapyController.EditTherapy(t);
                    }

                    List <PlacemetnInARoom> placemetnInARooms = placementInSickRoomController.ViewPatientPlacements(patient.Jmbg);

                    foreach (PlacemetnInARoom p in placemetnInARooms)
                    {
                        p.patientCard = pc;
                        placementInSickRoomController.EditPlacement(p);
                    }

                    ProfileWindow profileWindow = new ProfileWindow();
                    profileWindow.Show();
                    this.Close();
                }
                else
                {
                    ValidationMessageWindow validationMessageWindow = new ValidationMessageWindow();
                    validationMessageWindow.caption.Text = "Neuspešna izmena podataka!";
                    validationMessageWindow.Show();
                }
            }
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Regex regex = new Regex(@"^[a-z]{2}[0-9]{3}$");
            Match match = regex.Match(txtLbo.Text);

            if (match.Success == false)
            {
                MessageBox.Show("Broj osiguranja mora biti u formatu xxYYY (x-slovo, Y-cifra).", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtLbo.Focus();
                return;
            }

            PatientCard patinetC = p;

            patinetC.Lbo      = txtLbo.Text;
            patinetC.Alergies = txtAlergija.Text;
            if (comboKrvna.SelectedItem.ToString().Equals("A"))
            {
                patinetC.BloodType = BloodType.A;
            }
            else if (comboKrvna.SelectedItem.ToString().Equals("B"))
            {
                patinetC.BloodType = BloodType.B;
            }
            else if (comboKrvna.SelectedItem.ToString().Equals("AB"))
            {
                patinetC.BloodType = BloodType.AB;
            }
            else
            {
                patinetC.BloodType = BloodType.O;
            }

            if (comboRh.SelectedItem.ToString().Equals("Pozitivna"))
            {
                patinetC.RhFactor = RhFactorType.Pozitivna;
            }
            else
            {
                patinetC.RhFactor = RhFactorType.Negativna;
            }

            pc.EditPatientCard(patinetC);

            List <Examination> examinations = ec.ViewExaminationsByPatient(patinetC.patient.Jmbg);

            foreach (Examination exm in examinations)
            {
                exm.patientCard = patinetC;
                ec.EditExamination(exm);
            }

            List <PlacemetnInARoom> placements = prc.ViewPatientPlacements(patinetC.patient.Jmbg);

            foreach (PlacemetnInARoom p in placements)
            {
                p.patientCard = patinetC;
                prc.EditPlacement(p);
            }

            List <Therapy> therapies = tc.ViewAllTherapyByPatient(patinetC.patient.Jmbg);

            foreach (Therapy t in therapies)
            {
                t.patientCard = patinetC;
                tc.EditTherapy(t);
            }


            this.Close();
        }
コード例 #3
0
        private void yesBtn_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(txtLbo.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(""))
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos imena, prezimena i jmbg-a 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 (!txtLbo.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
            {
                bool hi = false;
                if ((bool)yesCheckBtn.IsChecked)
                {
                    hi = true;
                }
                BloodType    blood = BloodType.O;
                RhFactorType rh    = RhFactorType.Negativna;
                DateTime     date  = DateTime.Today;
                GenderType   gen   = GenderType.Z;

                if (cmbBloodType.Text.Equals("A"))
                {
                    blood = BloodType.A;
                }
                else if (cmbBloodType.Text.Equals("B"))
                {
                    blood = BloodType.B;
                }
                else if (cmbBloodType.Text.Equals("AB"))
                {
                    blood = BloodType.AB;
                }

                if (cmbRh.Text.Equals("+"))
                {
                    rh = RhFactorType.Pozitivna;
                }
                if (dpDateOfBirth.SelectedDate != null)
                {
                    date = (DateTime)dpDateOfBirth.SelectedDate;
                }
                if (cmbGender.Text.Equals("M"))
                {
                    gen = GenderType.M;
                }

                City city = (City)txtCity.SelectedItem;

                bool guest = false;
                if (txtUsername.Text.Equals("") || txtUsername.Text == null)
                {
                    guest = true;
                }


                Patient p = new Patient(txtJmbg.Text, txtName.Text, txtSurname.Text, date, gen, city, txtStreet.Text, txtPhone.Text, txtEmail.Text, txtUsername.Text, txtPassword.Password, DateTime.Today, guest);

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

                if (!txtDate.Text.Equals(dates) || !txtTherapy.Text.Equals(therapy) || !txtDesc.Text.Equals(desc))
                {
                    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] + ";";
                        }
                    }
                }
                else
                {
                    medicalHistory = dates + desc + therapy;
                    medicalHistory = medicalHistory.Replace('\n', ':');
                    if (medicalHistory.Length > 0)
                    {
                        medicalHistory  = medicalHistory.Substring(0, medicalHistory.Length - 1);
                        medicalHistory += ";";
                    }
                }

                PatientCard pc = new PatientCard(p, blood, rh, txtAllergy.Text, medicalHistory, hi, txtLbo.Text);

                if (patientController.EditProfile(p) != null && patientCardController.EditPatientCard(pc) != null)
                {
                    List <Examination> examinations = examinationController.ViewExaminationsByPatient(p.Jmbg);
                    foreach (Examination exm in examinations)
                    {
                        exm.patientCard = pc;
                        examinationController.EditExamination(exm);
                    }
                    List <Therapy> therapies = therapyController.ViewAllTherapyByPatient(p.Jmbg);
                    foreach (Therapy t in therapies)
                    {
                        t.patientCard = pc;
                        therapyController.EditTherapy(t);
                    }
                    List <PlacemetnInARoom> placemetnInARooms = placementInSickRoomController.ViewPatientPlacements(p.Jmbg);
                    foreach (PlacemetnInARoom pr in placemetnInARooms)
                    {
                        pr.patientCard = pc;
                        placementInSickRoomController.EditPlacement(pr);
                    }

                    var okMb = new OKMessageBox(this, 3);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste izmijenili informacije o pacijentu.";
                    okMb.ShowDialog();
                }
                else
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Došlo je do greške prilikom izmjene informacija! Provjerite da li su korisničko ime/lozinka validni.";
                    okMbx.ShowDialog();
                }
            }
        }
コード例 #4
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();
                    }
                }
            }
        }
コード例 #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (IsDigitsOnly(txtPhone.Text) == false)
            {
                MessageBox.Show("Broj telefona mora sadržati samo cifre.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtPhone.Focus();
                return;
            }
            else if (!txtEmail.Text.Contains("@"))
            {
                MessageBox.Show("E-mail mora biti u formatu [email protected]", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtEmail.Focus();
                return;
            }
            else if (!txtEmail.Text.Contains(".com"))
            {
                MessageBox.Show("E-mail mora biti u formatu [email protected]", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtEmail.Focus();
                return;
            }

            Doctor d1 = doc;

            d1.HomeAddress = txtAdress.Text;
            d1.Email       = txtEmail.Text;
            d1.Phone       = txtPhone.Text;

            if (comboSpecial.SelectedItem.ToString().Equals("Dermatolog"))
            {
                d1.Type = TypeOfDoctor.Dermatolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("drOpstePrakse"))
            {
                d1.Type = TypeOfDoctor.drOpstePrakse;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Endokrinolog"))
            {
                d1.Type = TypeOfDoctor.Endokrinolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Ginekolog"))
            {
                d1.Type = TypeOfDoctor.Ginekolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("KardioVaskularniHirurg"))
            {
                d1.Type = TypeOfDoctor.KardioVaskularniHirurg;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Neurolog"))
            {
                d1.Type = TypeOfDoctor.Neurolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Oftamolog"))
            {
                d1.Type = TypeOfDoctor.Oftamolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Onkolog"))
            {
                d1.Type = TypeOfDoctor.Onkolog;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Ortoped"))
            {
                d1.Type = TypeOfDoctor.Ortoped;
            }
            else if (comboSpecial.SelectedItem.ToString().Equals("Pulmolog"))
            {
                d1.Type = TypeOfDoctor.Pulmolog;
            }
            else
            {
                d1.Type = TypeOfDoctor.Radiolog;
            }

            List <City> cities = cc.ViewCities();

            foreach (City c in cities)
            {
                if (comboCity.SelectedItem.ToString().Equals(c.Name))
                {
                    d1.City = c;
                }
            }

            uc.EditProfile(d1);

            List <Examination> examinations = ec.ViewExaminationsByDoctor(doc.Jmbg);

            foreach (Examination exm in examinations)
            {
                exm.doctor = d1;
                ec.EditExamination(exm);
            }

            WorkingTime work = wc.viewWorkingTimeDoctor(doc.Jmbg);

            work.doctor = d1;
            wc.EditWorkingTime(work);

            var s = new MessageEditProfile();

            s.Show();

            this.Close();
        }
コード例 #6
0
        private void Button_Click_9(object sender, RoutedEventArgs e)
        {
            string s1 = dataOd.SelectedDate.ToString();

            string[] lines1  = s1.Split(' ');
            string   datumOd = lines1[0];

            if (String.IsNullOrEmpty(datumOd))
            {
                MessageBox.Show("Morate izabrati datum početka ležanja.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                dataOd.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(comboSoba.Text))
            {
                MessageBox.Show("Morate izabrati sobu u koju želite smjesiti pacijenta.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
                comboSoba.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(comboKrevet.Text))
            {
                MessageBox.Show("Morate izabrati krevet u koji želite smjesiti pacijenta.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
                comboKrevet.Focus();
                return;
            }
            else if (comboKrevet.Text.Contains("zauzet"))
            {
                MessageBox.Show("Ne možete smjestiti pacijenta u krevet koji je zauzet.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
                comboKrevet.Focus();
                return;
            }

            string[] t1 = datumOd.Split('/');

            string s2 = dataDo.SelectedDate.ToString();

            string[] lines2  = s2.Split(' ');
            string   datumDo = lines2[0];

            if (String.IsNullOrEmpty(datumDo))
            {
                MessageBox.Show("Morate izabrati datum kraja ležanja.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                dataDo.Focus();
                return;
            }

            string[] t2 = datumDo.Split('/');

            int god1 = Int32.Parse(t1[2]);
            int god2 = Int32.Parse(t2[2]);

            int mj1 = Int32.Parse(t1[0]);
            int mj2 = Int32.Parse(t2[0]);

            int dan1 = Int32.Parse(t1[1]);
            int dan2 = Int32.Parse(t2[1]);

            if (god2 < god1)
            {
                MessageBox.Show("Greška! Krajnji datum je stariji od početnog.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                dataOd.Focus();
                return;
            }
            else if (god1 == god2 && mj1 > mj2)
            {
                MessageBox.Show("Greška! Krajnji datum je stariji od početnog.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                dataOd.Focus();
                return;
            }
            else if (god1 == god2 && mj1 == mj2 && dan1 > dan2)
            {
                MessageBox.Show("Greška! Krajnji datum je stariji od početnog.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                dataOd.Focus();
                return;
            }
            Room r = roomPlacment;

            r.Occupation = r.Occupation + 1;
            rc.EditRoom(r);

            List <Examination> examinations = ec.ViewExaminationsByRoom(r.Number);

            foreach (Examination exm in examinations)
            {
                exm.room = r;
                ec.EditExamination(exm);
            }

            RenovationPeriod period = rpc.ViewRenovationByRoomNumber(r.Number);

            period.room = r;
            rpc.EditRenovation(period);

            PlacemetnInARoom placement = new PlacemetnInARoom();
            int idPlacement            = prc.getLastId();

            placement.Id = ++idPlacement;
            placement.DateOfPlacement = (DateTime)dataOd.SelectedDate;
            placement.DateOfDismison  = (DateTime)dataDo.SelectedDate;
            placement.room            = r;
            placement.patientCard     = patientCard;

            prc.PlaceInRoom(placement);

            var p = new PlaceInSickRoom();

            p.Show();
        }