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 buttonMakeAppointment_Click(object sender, RoutedEventArgs e) { patientCard = patientCardController.ViewPatientCard(MainWindow.patient.Jmbg); examinationController.ScheduleExamination(new Examination(recommendExamination.IdExamination, recommendExamination.Type, recommendExamination.DateAndTime, recommendExamination.doctor, doctor.DoctorsOffice, patientCard)); ReviewExaminationsWindow reviewExaminationsWindow = new ReviewExaminationsWindow(); reviewExaminationsWindow.Show(); this.Close(); }
private void yesBtn_Click(object sender, RoutedEventArgs e) { Patient selectedPatient = (Patient)txtPatient.SelectedItem; Room selectedRoom = (Room)cmbNumberOfRoom.SelectedItem; if (selectedPatient == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati pacijenta!"; 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(); return; } if (selectedRoom == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati sobu!"; okMbx.ShowDialog(); return; } 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; } DateTime date = Convert.ToDateTime(examination.Date + " " + examination.Time, CultureInfo.InvariantCulture); string[] partsDoctor = examination.Doctor.Split(' '); Doctor selectedDoctor = (Doctor)userDoctorController.ViewProfile(partsDoctor[partsDoctor.Length - 1]); PatientCard selectedPatientCard = patientCardController.ViewPatientCard(selectedPatient.Jmbg); 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/soba su već zauzeti u izabranom terminu!"; okMbx.ShowDialog(); return; } int lastId = notificationController.getLastId(); string message = "Zakazan 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."; 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); } } }
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(); } } } }
private void Button_Click_6(object sender, RoutedEventArgs e) { if (appointment < 0) { MessageBox.Show("Morate selektovati red u tabeli da bi zakazali pregled.", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } else if (String.IsNullOrEmpty(txtVrsta.Text)) { System.Windows.MessageBox.Show("Morate izabrati vrstu pregleda.", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning); txtVrsta.Focus(); return; } Examination exam = new Examination(); exam.IdExamination = id; exam.DateAndTime = dt; exam.doctor = (Doctor)textBoxDoctorExam.SelectedItem; exam.Type = TypeOfExamination.Opsti; if (txtVrsta.SelectedItem.ToString().Equals("Operacija")) { exam.Type = TypeOfExamination.Operacija; } else if (txtVrsta.SelectedItem.ToString().Equals("Specijalisticki")) { exam.Type = TypeOfExamination.Specijalisticki; } if (String.IsNullOrEmpty(txtSoba.Text)) { System.Windows.MessageBox.Show("Morate izabrati sobu u kojoj zelite zakazati pregled.", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning); txtSoba.Focus(); return; } string roomStr = txtSoba.SelectedValue.ToString(); int roomId = Int32.Parse(roomStr); exam.room = rc.ViewRoomByNumber(roomId); string[] ss = showName.Text.Split(' '); exam.patientCard = ap.ViewPatientCard(ss[ss.Length - 1]); ec.ScheduleExamination(exam); TimeSpan ts = new TimeSpan(8, 0, 0); if (second.IsSelected) { ts = new TimeSpan(16, 0, 0); } else if (third.IsSelected) { ts = new TimeSpan(12, 0, 0); } List <Examination> allAppointments; Doctor selectedDoctor = (Doctor)textBoxDoctorExam.SelectedItem; allAppointments = ec.getAllAppointments(selectedDoctor, (DateTime)dataExam.SelectedDate + ts); List <ExaminationDTO> examDTO = new List <ExaminationDTO>(); foreach (Examination exm in allAppointments) { string room = ""; string type = ""; if (exm.room.Number != 0) { room = exm.room.Number.ToString(); } if (room.Equals("")) { type = ""; } else { type = exm.Type.ToString(); } ExaminationDTO e1 = new ExaminationDTO(); e1.IdExamination = exm.IdExamination; e1.doctor = exm.doctor.Name + " " + exm.doctor.Name; e1.patientCard = exm.patientCard.patient.Name + " " + exm.patientCard.patient.Surname + " " + exm.patientCard.patient.Jmbg; e1.DateAndTime = exm.DateAndTime.ToString(); e1.room = room; e1.Type = type; examDTO.Add(e1); } if (examDTO.Count == 0) { MessageBox.Show("Nema slobodnih pregelda za odabrani datum.", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } DataGrid4.ItemsSource = examDTO; Notification n = new Notification(); int idNotification = nc.getLastId(); n.Id = ++idNotification; n.Type = TypeOfNotification.Pregled; n.Message = "Novi termin zakazan " + dt.ToString() + " dr. " + selectedDoctor.Name + " " + selectedDoctor.Surname; n.JmbgOfReceiver = patientCard.patient.Jmbg; nc.SendNotification(n); appointment = -1; }