protected void FillView() { int doctorId = Consultation.DoctorId.HasValue ? Consultation.DoctorId.Value : 0; View.DoctorId = doctorId; var consultationDoctor = DoctorsDataAccess.GetDoctorById(doctorId); if (consultationDoctor != null) { View.DoctorName = consultationDoctor.Name; } else { View.DoctorName = "Не е избран лекар"; } int patientId = Consultation.PatientId.HasValue ? Consultation.PatientId.Value : 0; View.PatientId = patientId; var consultationPatient = PatientsDataAccess.GetPatientById(patientId); if (consultationPatient != null) { View.PatientName = consultationPatient.Name; View.PatientNumber = consultationPatient.Number; } else { View.PatientName = "Не е избран пациент"; View.PatientNumber = string.Empty; } DateTime scheduleDate = Consultation.ScheduleDate.HasValue ? Consultation.ScheduleDate.Value : DateTime.Now; View.ScheduleDate = scheduleDate; View.Notes = Consultation.Notes; View.Reason = Consultation.Reason; View.Conclusion = Consultation.Conclusion; View.ConsultationId = Consultation.ConsultationId; }
protected void FillView() { int doctorId = Diagnosis.DoctorId.HasValue ? Diagnosis.DoctorId.Value : 0; View.DoctorId = doctorId; var consultationDoctor = DoctorsDataAccess.GetDoctorById(doctorId); if (consultationDoctor != null) { View.DoctorName = consultationDoctor.Name; } else { View.DoctorName = "Не е избран лекар"; } int patientId = Diagnosis.PatientId.HasValue ? Diagnosis.PatientId.Value : 0; View.PatientId = patientId; var consultationPatient = PatientsDataAccess.GetPatientById(patientId); if (consultationPatient != null) { View.PatientName = consultationPatient.Name; View.PatientNumber = consultationPatient.Number; } else { View.PatientName = "Не е избран пациент"; View.PatientNumber = string.Empty; } DateTime scheduleDate = Diagnosis.DiagnosticationDate.HasValue ? Diagnosis.DiagnosticationDate.Value : DateTime.Now; View.DiagnosticationDate = scheduleDate; View.Notes = Diagnosis.Notes; View.Subject = Diagnosis.Subect; View.Prescription = Diagnosis.Prescription; View.DiagnoseId = Diagnosis.DiagnoseId; }
public void Load(int patientId) { try { if (patientId == 0) { throw new ArgumentNullException("patientId должен отличаться от 0!"); } patient = PatientsDataAccess.GetPatientById(patientId); textBoxAddress.Text = patient.Address; textBoxName.Text = patient.Name; textBoxPhone.Text = patient.Phone; dateTimePickerBirthdate.SelectedDate = patient.Birthdate; dataGridViewVisits.ItemsSource = VisitsDataAccess.GetVisitsByPatientId(patientId); Flag = true; } catch (Exception e) { string message = "Ошибка!:" + e.Message; MessageBox.Show(message); } }