public static Patient[] GetListPatient()
        {
            ServicePatientClient servicePatient = new ServicePatientClient();

            try
            {
                return servicePatient.GetListPatient();
            }
            catch (Exception)
            {
                return new Patient[0];
            }
        }
        public static Patient GetPatient(int id)
        {
            ServicePatientClient servicePatient = new ServicePatientClient();

            try
            {
                return servicePatient.GetPatient(id);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public static bool AddPatient(Patient patient)
        {
            ServicePatientClient servicePatient = new ServicePatientClient();

            try
            {
                return servicePatient.AddPatient(patient);
            }
            catch (Exception)
            {
                return false;
            }
        }
        public static bool DeletePatient(int id)
        {
            ServicePatientClient servicePatient = new ServicePatientClient();

            try
            {
                return servicePatient.DeletePatient(id);
            }
            catch (Exception)
            {
                return false;
            }
        }
Exemplo n.º 5
0
        public static bool DeletePatient(int id)
        {
            ServicePatientClient servicePatient = new ServicePatientClient();
            bool result = false;

            try
            {
                result = servicePatient.DeletePatient(id);
            }
            catch (Exception) { }
            finally { servicePatient.Close(); }
            return(result);
        }
Exemplo n.º 6
0
        private void addPatient()
        {
            if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
            {
                Patient patient = new Patient();
                patient.Birthday     = _dateInput ?? DateTime.Now;
                patient.Firstname    = _firstnameInput;
                patient.Name         = _nameInput;
                patient.Observations = null;

                ServicePatientClient service = new ServicePatientClient();

                if (service.AddPatient(patient))
                {
                    View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;

                    View.Patients view             = new colle_tMedecine.View.Patients();
                    ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
                    view.DataContext = vm;
                    mainwindow.contentcontrol.Content = view;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                {
                    ErrorMessage = _typeErrorMessage[0];
                }
                else if (!string.IsNullOrEmpty(FirstnameInput) && string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                {
                    ErrorMessage = _typeErrorMessage[1];
                }
                else if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && string.IsNullOrEmpty(DateInput.ToString()))
                {
                    ErrorMessage = _typeErrorMessage[2];
                }
                else
                {
                    ErrorMessage = _typeErrorMessage[3];
                }
                ShowConnectError = 1;
                ShowConnectError = 0;
            }
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public static bool CreatePatient(Model.Patient patient)
        {
            ServicePatientClient servicePatient = new ServicePatientClient();
            bool result = false;

            try
            {
                ServicePatient.Patient patientS = new ServicePatient.Patient()
                {
                    Birthday     = patient.birthday,
                    Firstname    = patient.firstname,
                    Name         = patient.name,
                    Observations = null
                };
                result = servicePatient.AddPatient(patientS);
            }
            catch (Exception) { }
            finally { servicePatient.Close(); }
            return(result);
        }
 public ServicePatientManager()
 {
     this._client = new ServicePatientClient();
 }
        private void addPatient()
        {
            if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
            {
                Patient patient = new Patient();
                patient.Birthday = _dateInput ?? DateTime.Now;
                patient.Firstname = _firstnameInput;
                patient.Name = _nameInput;
                patient.Observations = null;

                ServicePatientClient service = new ServicePatientClient();

                if (service.AddPatient(patient))
                {
                    View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;

                    View.Patients view = new colle_tMedecine.View.Patients();
                    ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
                    view.DataContext = vm;
                    mainwindow.contentcontrol.Content = view;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                    ErrorMessage = _typeErrorMessage[0];
                else if (!string.IsNullOrEmpty(FirstnameInput) && string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                    ErrorMessage = _typeErrorMessage[1];
                else if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && string.IsNullOrEmpty(DateInput.ToString()))
                    ErrorMessage = _typeErrorMessage[2];
                else
                    ErrorMessage = _typeErrorMessage[3];
                ShowConnectError = 1;
                ShowConnectError = 0;
            }
        }
Exemplo n.º 11
0
 public ServicePatientManager()
 {
     this._client = new ServicePatientClient();
 }
Exemplo n.º 12
0
 public PatientDA()
 {
     _service = new ServicePatientClient();
 }