public static Patient[] GetListPatient() { ServicePatientClient servicePatient = new ServicePatientClient(); try { return servicePatient.GetListPatient(); } catch (Exception) { return new Patient[0]; } }
public static ObservableCollection <Model.Patient> GetAllPatients() { ServicePatientClient servicePatient = new ServicePatientClient(); ObservableCollection <Model.Patient> result = new ObservableCollection <Model.Patient>(); try { var response = servicePatient.GetListPatient(); foreach (var patient in response) { ObservableCollection <Model.Observation> observations = new ObservableCollection <Model.Observation>(); Model.Patient newP = new Model.Patient() { birthday = patient.Birthday, firstname = patient.Firstname, id = patient.Id, name = patient.Name }; if (patient.Observations != null) { foreach (var observation in patient.Observations) { Model.Observation newOb = new Model.Observation() { bloodPressure = observation.BloodPressure, comment = observation.Comment, date = observation.Date, pictures = observation.Pictures, prescription = observation.Prescription, weight = observation.Weight }; observations.Add(newOb); } } newP.observations = observations; result.Add(newP); } } catch (Exception e) { System.Console.WriteLine(e.Message); } finally { servicePatient.Close(); } return(result); }
/// <summary> /// Call WCF GetListPatient function /// </summary> /// <returns></returns> public Patient[] GetListPatient() { return(_service.GetListPatient()); }