Пример #1
0
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidatePSDate())
            {
                return;
            }
            else if (!ValidatePSTime())
            {
                return;
            }
            else if (!ValidatePSPatient())
            {
                return;
            }
            else if (!ValidatePSDoctor())
            {
                return;
            }
            else if (!ValidatePSHospital())
            {
                return;
            }
            else if (!ValidateDiagnose())
            {
                return;
            }
            else
            {
                switch (VisitationType)
                {
                case "DoctorPSForm":
                    JObject doctorVisitation = new JObjectBuilder().With(visit => visit.Patient = new JObjectBuilder().With(patient => patient.Guid = Patients[DoctorPSPatient.SelectedIndex].Guid).Build())
                                               .With(visit => visit.Doctor    = new JObjectBuilder().With(doctor => doctor.Guid = User.Guid).Build())
                                               .With(visit => visit.Hospital  = new JObjectBuilder().With(hospital => hospital.Guid = Hospitals[DoctorPSHospital.SelectedIndex].Guid).Build())
                                               .With(visit => visit.VisitTime = (DoctorPSDate.SelectedDate.Value).Date.Add(DoctorPSTime.SelectedTime.Value.TimeOfDay))
                                               .Build();
                    POSTVisitsRequest(User.AuthenticationCredentials, doctorVisitation);
                    JObject doctorDiagnosis = new JObjectBuilder().With(diagnosis => diagnosis.Patient = new JObjectBuilder().With(patient => patient.Guid = Patients[DoctorPSPatient.SelectedIndex].Guid).Build())
                                              .With(diagnosis => diagnosis.Doctor               = new JObjectBuilder().With(doctor => doctor.Guid = doctor.Guild = User.Guid).Build())
                                              .With(diagnosis => diagnosis.DiagnosisTime        = (DoctorPSDate.SelectedDate.Value).Date.Add(DoctorPSTime.SelectedTime.Value.TimeOfDay))
                                              .With(diagnosis => diagnosis.DiagnosisDescription = DoctorPSDiagnose.Text).Build();
                    POSTDiagnosisRequest(User.AuthenticationCredentials, doctorDiagnosis);
                    return;

                case "HospitalPSForm":
                    JObject hospitalVisitation = new JObjectBuilder().With(visit => visit.Patient = new JObjectBuilder().With(patient => patient.Guid = Patients[HospitalPSPatient.SelectedIndex].Guid).Build())
                                                 .With(visit => visit.Doctor    = new JObjectBuilder().With(doctor => doctor.Guid = Doctors[HospitalPSDoctor.SelectedIndex].Guid).Build())
                                                 .With(visit => visit.Hospital  = new JObjectBuilder().With(hospital => hospital.Guid = User.Guid).Build())
                                                 .With(visit => visit.VisitTime = (HospitalPSDate.SelectedDate.Value).Date.Add(HospitalPSTime.SelectedTime.Value.TimeOfDay))
                                                 .Build();
                    POSTVisitsRequest(User.AuthenticationCredentials, hospitalVisitation);
                    JObject hospitalDiagnosis = new JObjectBuilder().With(diagnosis => diagnosis.Patient = new JObjectBuilder().With(patient => patient.Guid = Patients[HospitalPSPatient.SelectedIndex].Guid).Build())
                                                .With(diagnosis => diagnosis.Doctor = new JObjectBuilder().With(doctor => doctor.Guid = Doctors[HospitalPSDoctor.SelectedIndex].Guid).Build())
                                                .With(diagnosis => diagnosis.DiagnosisDescription = HospitalPSDiagnose.Text)
                                                .With(diagnosis => diagnosis.DiagnosisTime        = (HospitalPSDate.SelectedDate.Value).Date.Add(HospitalPSTime.SelectedTime.Value.TimeOfDay)).Build();
                    POSTDiagnosisRequest(User.AuthenticationCredentials, hospitalDiagnosis);
                    return;
                }
            }
        }
Пример #2
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidateReservationDate())
            {
                return;
            }
            else if (!ValidateReservationTime())
            {
                return;
            }
            else if (!ValidateReservationPatient())
            {
                return;
            }
            else if (!ValidateReservationDoctor())
            {
                return;
            }
            else if (!ValidateReservationHospital())
            {
                return;
            }
            else if (!ValidateReason())
            {
                return;
            }
            else
            {
                switch (ReservationType)
                {
                case "DoctorReservationForm":
                    JObject doctorReservation = new JObjectBuilder().With(reservation => reservation.Patient = new JObjectBuilder().With(patient => patient.Guid = PatientList[DoctorReservationPatient.SelectedIndex].Guid).Build())
                                                .With(reservation => reservation.Doctor          = new JObjectBuilder().With(doctor => doctor.Guid = User.Guid).Build())
                                                .With(reservation => reservation.Hospital        = new JObjectBuilder().With(hospital => hospital.Guid = HospitalList[DoctorReservationHospital.SelectedIndex].Guid).Build())
                                                .With(reservation => reservation.ReservationTime = (DoctorReservationDate.SelectedDate.Value).Date.Add(DoctorReservationTime.SelectedTime.Value.TimeOfDay))
                                                .With(reservation => reservation.Reason          = DoctorReason.Text)
                                                .Build();
                    POSTReservationRequest(User.AuthenticationCredentials, doctorReservation);
                    return;

                case "HospitalReservationForm":
                    JObject hospitalReservation = new JObjectBuilder().With(reservation => reservation.Patient = new JObjectBuilder().With(patient => patient.Guid = PatientList[HospitalReservationPatient.SelectedIndex].Guid).Build())
                                                  .With(reservation => reservation.Doctor          = new JObjectBuilder().With(doctor => doctor.Guid = DoctorList[HospitalReservationDoctor.SelectedIndex].Guid).Build())
                                                  .With(reservation => reservation.Hospital        = new JObjectBuilder().With(hospital => hospital.Guid = User.Guid).Build())
                                                  .With(reservation => reservation.ReservationTime = (HospitalReservationDate.SelectedDate.Value).Date.Add(HospitalReservationTime.SelectedTime.Value.TimeOfDay))
                                                  .With(reservation => reservation.Reason          = HospitalReason.Text)
                                                  .Build();
                    POSTReservationRequest(User.AuthenticationCredentials, hospitalReservation);
                    return;
                }
            }
        }