public ReviewExaminationsWindow() { InitializeComponent(); patient = (Patient)userController.ViewProfile(MainWindow.patient.Jmbg); patientExamiantions = examinationController.ViewExaminationsByPatient(patient.Jmbg); foreach (Examination e in patientExamiantions) { string type; if (e.Type == TypeOfExamination.Opsti) { type = "OPŠTI"; } else if (e.Type == TypeOfExamination.Operacija) { type = "OPERACIJA"; } else { type = "SPECIJALISTIČKI"; } int id = e.IdExamination; string date = e.DateAndTime.ToShortDateString(); string time = e.DateAndTime.ToShortTimeString(); string doctor = e.doctor.Name + " " + e.doctor.Surname + " " + e.doctor.Jmbg; ExaminationDTO examinationDTO = new ExaminationDTO(id, type, date, time, doctor); examinationDTOs.Add(examinationDTO); } dataGridExaminations.DataContext = examinationDTOs; }
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(); }
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 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(); } } }