Esempio n. 1
0
        private void buttonSignIn_Click(object sender, RoutedEventArgs e)
        {
            string patientUserName = username.Text;
            string patientPassword = password.Password;

            if (patientUserName == "" || patientPassword == "")
            {
                ValidationMessageWindow validationMessage = new ValidationMessageWindow();
                validationMessage.Show();
            }
            else
            {
                patient = (Patient)userController.SignIn(patientUserName, patientPassword);

                if (patient != null)
                {
                    HomePageWindow homePageWindow = new HomePageWindow();
                    homePageWindow.Show();
                    this.Close();
                }
                else
                {
                    SignInMessageWindow signInMessage = new SignInMessageWindow();
                    signInMessage.Show();
                    resetInputText();
                }
            }
        }
        private void buttonMakeAppointment_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxDoctor.Text.Equals("") || datePickerExamination.Text.Equals("") || comboBoxAppointemtTime.Text.Equals(""))
            {
                ValidationMessageWindow validationWindow = new ValidationMessageWindow();
                validationWindow.Show();
            }
            else
            {
                patientCard = patientCardController.ViewPatientCard(MainWindow.patient.Jmbg);
                int               lastId                 = examinationController.getLastId();
                DateTime          dateAndTime            = (DateTime)datePickerExamination.SelectedDate;
                string            date                   = dateAndTime.ToShortDateString();
                string            time                   = comboBoxAppointemtTime.Text;
                DateTime          dateAndTimeExamination = Convert.ToDateTime(date + " " + time, CultureInfo.InvariantCulture);
                TypeOfExamination general                = TypeOfExamination.Opsti;
                doctor = (Doctor)comboBoxDoctor.SelectedItem;

                Examination examination = examinationController.ScheduleExamination(new Examination(++lastId, general, dateAndTimeExamination, doctor, doctor.DoctorsOffice, patientCard));

                if (examination == null)
                {
                    BusyTermWindow busyTermWindow = new BusyTermWindow();
                    busyTermWindow.caption.Text = "Termin koji ste izabrali " + date + " " + time + " " + "je već zauzet kod doktora " + doctor.Name + " " + doctor.Surname + " " + doctor.Jmbg;
                    busyTermWindow.Show();
                }
                else
                {
                    ReviewExaminationsWindow reviewExaminationsWindow = new ReviewExaminationsWindow();
                    reviewExaminationsWindow.Show();
                    this.Close();
                }
            }
        }
        private void dataGridExaminations_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                ExaminationDTO examinationCancel = (ExaminationDTO)dataGridExaminations.SelectedItem;


                if (dataGridExaminations.Items.Count > 0)
                {
                    if (examinationCancel == null)
                    {
                        ValidationMessageWindow validationMessageWindow = new ValidationMessageWindow();
                        validationMessageWindow.caption.Text = "Nemate izabran pregled za brisanje!";
                        validationMessageWindow.Show();
                    }
                    else
                    {
                        DateTime selectedExamiantionDateTime = Convert.ToDateTime(examinationCancel.Date + " " + examinationCancel.Time, CultureInfo.InvariantCulture);

                        if (DateTime.Compare(selectedExamiantionDateTime, DateTime.Now.AddDays(1)) <= 0)
                        {
                            ValidationMessageWindow validationMessageWindow = new ValidationMessageWindow();
                            validationMessageWindow.caption.Text = "Brisanje pregleda nije moguće!";
                            validationMessageWindow.Show();
                        }
                        else
                        {
                            MessageBoxResult messageBoxResult = MessageBox.Show("Da li želite da otkažete pregled?", "Potvrda otkazivanja", MessageBoxButton.YesNo, MessageBoxImage.Error);

                            if (messageBoxResult == MessageBoxResult.Yes)
                            {
                                examinationController.DeleteScheduledExamination(examinationCancel.Id);

                                dataGridExaminations.DataContext = null;

                                ReviewExaminationsWindow reviewExaminationsWindow = new ReviewExaminationsWindow();
                                reviewExaminationsWindow.Show();
                                this.Close();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Nije moguce brisati iz prazne tabele.", "Greska!", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Esempio n. 4
0
        private void buttonConfrim_Click(object sender, RoutedEventArgs e)
        {
            if (oldPassword.Password.Equals("") || newPassword.Password.Equals("") || confirmPassword.Password.Equals(""))
            {
                ValidationMessageWindow validationWindow = new ValidationMessageWindow();
                validationWindow.Show();
            }
            else if (!oldPassword.Password.Equals(userController.ViewProfile(MainWindow.patient.Jmbg).Password))
            {
                ValidationOldPasswordWindow validationOldPassword = new ValidationOldPasswordWindow();
                validationOldPassword.Show();
            }
            else if (!confirmPassword.Password.Equals(newPassword.Password))
            {
                ValidationNewPasswordWindow validationNewPassword = new ValidationNewPasswordWindow();
                validationNewPassword.Show();
            }
            else
            {
                patient.Password = newPassword.Password;

                if (userController.EditProfile(patient) != null)
                {
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.Show();
                    SuccessfulUpdatePasswordWindow successfulUpdatePasswordWindow = new SuccessfulUpdatePasswordWindow();
                    successfulUpdatePasswordWindow.Show();
                    this.Close();
                }
                else
                {
                    ValidationMessageWindow validationWindowPassword = new ValidationMessageWindow();
                    validationWindowPassword.caption.Text = "Unesite najmanje 8 karaktera, jedan broj i bar jedno malo i veliko slovo!";
                    validationWindowPassword.Show();
                }
            }
        }
        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();
                }
            }
        }
        private void buttonRegistration_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("") || user.Text.Equals("") || pass.Text.Equals(""))
            {
                ValidationMessageWindow validationWindow = new ValidationMessageWindow();
                validationWindow.Show();
            }
            else
            {
                string jmbgPatient = jmbg.Text;

                string name = firstName.Text;

                string surname = lastName.Text;

                DateTime dateOfBirth = (DateTime)dateOfBirthPicker.SelectedDate;

                GenderType gender;

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

                string telephone = telephoneNumber.Text;

                string street = homeAdress.Text;

                City city = (City)cityAdress.SelectedItem;

                string email = emailAdress.Text;

                string username = user.Text;

                string password = pass.Text;

                DateTime currentDate = DateTime.Now;

                bool isGuest = false;

                patient = new Patient(jmbgPatient, name, surname, dateOfBirth, gender, city, street, telephone, email, username, password, currentDate, isGuest);

                patientCard = new PatientCard(patient);

                if (userController.Register(patient) != null && patientCardController.CreatePatientCard(patientCard) != null)
                {
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.Show();
                    this.Close();
                    SuccessfulRegistrationWindow successfulRegistrationWindow = new SuccessfulRegistrationWindow();
                    successfulRegistrationWindow.ShowDialog();
                }
                else
                {
                    NotSuccessfulRegistratonWindow notSuccessfulRegistratonWindow = new NotSuccessfulRegistratonWindow();
                    notSuccessfulRegistratonWindow.ShowDialog();
                }
            }
        }
Esempio n. 7
0
        private void buttonRecommendAppointment_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxDoctor.Text.Equals("") || startDatePicker.Text.Equals("") || endDatePicker.Text.Equals(""))
            {
                ValidationMessageWindow validationWindow = new ValidationMessageWindow();
                validationWindow.Show();
            }
            else
            {
                doctor = (Doctor)comboBoxDoctor.SelectedItem;
                DateTime sDate = (DateTime)startDatePicker.SelectedDate;
                DateTime eDate = (DateTime)endDatePicker.SelectedDate;

                if (DateTime.Compare(sDate, eDate) >= 0)
                {
                    DateMessageWindow dateMessageWindow = new DateMessageWindow();
                    dateMessageWindow.caption.Text = "Pažnja, datum početka mora biti pre datuma kraja vremenskog intervala!";
                    dateMessageWindow.Show();
                }
                else
                {
                    string   dateStart = sDate.ToShortDateString();
                    string   dateEnd   = eDate.ToShortDateString();
                    string   time;
                    DateTime startDate;
                    DateTime endDate;

                    workShifts = workingTimeController.getShiftForDoctor(doctor.Jmbg);

                    if (priorityDoctor.IsChecked == true)
                    {
                        if (workShifts == WorkShifts.FIRST)
                        {
                            time                 = "8:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDoctor(doctor, startDate, endDate);
                        }
                        else if (workShifts == WorkShifts.SECOND)
                        {
                            time                 = "4:00 PM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDoctor(doctor, startDate, endDate);
                        }
                        else
                        {
                            time                 = "12:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDoctor(doctor, startDate, endDate);
                        }


                        recommendedDate.Text = recommendExamination.DateAndTime.ToShortDateString();

                        recommendedTime.Text = recommendExamination.DateAndTime.ToShortTimeString();

                        buttonMakeAppointment.IsEnabled = true;
                    }
                    else
                    {
                        if (workShifts == WorkShifts.FIRST)
                        {
                            time                 = "8:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDate(doctor, startDate, endDate);
                        }
                        else if (workShifts == WorkShifts.SECOND)
                        {
                            time                 = "4:00 PM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDate(doctor, startDate, endDate);
                        }
                        else
                        {
                            time                 = "12:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDate(doctor, startDate, endDate);
                        }


                        recommendedDate.Text = recommendExamination.DateAndTime.ToShortDateString();

                        recommendedTime.Text = recommendExamination.DateAndTime.ToShortTimeString();

                        buttonMakeAppointment.IsEnabled = true;
                    }
                }
            }
        }