public void Load(int doctorId) { try { if (doctorId == 0) { throw new ArgumentNullException("doctorId трябва да е различно от 0!"); } var doctor = DoctorsDataAccess.GetDoctorById(doctorId); this.Doctor = doctor; this.FillView(); } catch (Exception e) { string message = "Грешка!:" + e.Message; View.Message = message; } }
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; }
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; }