Пример #1
0
 public bool AddPatient(ServicePatient.Patient user)
 {
     try
     {
         using (ServicePatient.ServicePatientClient client = new ServicePatient.ServicePatientClient())
         {
             return(client.AddPatient(user));
         }
     }
     catch
     {
         throw new TimeoutException();
     }
 }
Пример #2
0
        /// <summary>
        /// constructeur
        /// </summary>
        public PatientDeleteViewModel(Page lkView, int idpatient)
        {
            _linkedView = lkView;

            _deleteCommand = new RelayCommand(param => Delete(), param => IsDeleting());

            _id = idpatient;

            ServicePatient.ServicePatientClient servicePatient = new ServicePatient.ServicePatientClient();
            ServicePatient.Patient selectedpatient             = servicePatient.GetPatient(_id);

            _name      = selectedpatient.Name;
            _firstname = selectedpatient.Firstname;
            _birthday  = selectedpatient.Birthday;
        }
Пример #3
0
        public static void UpdatePatient(int id)
        {
            try
            {
                var spc = new ServicePatient.ServicePatientClient();
                Patient = spc.GetPatient(id);

                _basicInformation = StringHelper.FullName(Patient.Firstname, Patient.Name) + " - " +
                    String.Format("{0:dd/MM/yyyy}", Patient.Birthday);

                (App.ViewModels["PatientDetails"] as PatientDetailsViewModel).UpdateChart();
            }
            catch (Exception)
            {
            }
        }
Пример #4
0
        public static bool AddPatient(string firstname, string name, DateTime birthday)
        {
            try
            {
                ServicePatientManager s = new ServicePatientManager();

                ServicePatient.Patient p = new ServicePatient.Patient();
                p.Firstname    = firstname;
                p.Name         = name;
                p.Birthday     = birthday;
                p.Observations = new ServicePatient.Observation[0];
                return(s.AddPatient(p));
            }
            catch (EndpointNotFoundException e)
            {
                MessageBox.Show("Le serveur ne répond pas.", "Erreur");
                throw e;
            }
        }
Пример #5
0
 public bool AddPatient(String Firstname, String Name, DateTime Birthday)
 {
     try
     {
         ServicePatient.Patient patient = new ServicePatient.Patient();
         patient.Firstname = Firstname;
         patient.Name = Name;
         patient.Birthday = Birthday;
         if (new ServicePatient.ServicePatientClient().AddPatient(patient))
             return true;
         return false;
     }
     catch (Exception ex)
     {
         //traitement exception ...
         Debug.WriteLine(ex.Message);
         return false;
     }
 }
Пример #6
0
        public static bool AddPatient(string firstname, string name, DateTime birthday)
        {
            try
            {
                ServicePatientManager s = new ServicePatientManager();

                ServicePatient.Patient p = new ServicePatient.Patient();
                p.Firstname = firstname;
                p.Name = name;
                p.Birthday = birthday;
                p.Observations = new ServicePatient.Observation[0];
                return s.AddPatient(p);
            }
            catch (EndpointNotFoundException e)
            {
                MessageBox.Show("Le serveur ne répond pas.", "Erreur");
                throw e;
            }
        }
Пример #7
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);
        }
Пример #8
0
 public ServicePatient.Patient GetPatient(int id)
 {
     try
     {
         using (ServicePatient.ServicePatientClient client = new ServicePatient.ServicePatientClient())
         {
             ServicePatient.Patient patient = client.GetPatient(id);
             if (patient == null)
             {
                 throw new ArgumentNullException();
             }
             else
             {
                 return(patient);
             }
         }
     }
     catch
     {
         throw new TimeoutException();
     }
 }
Пример #9
0
        private void CreatePatient()
        {
            BackgroundWorker worker = new BackgroundWorker();

            ServicePatient.Patient newPatient = new ServicePatient.Patient();

            newPatient.Name = _name;
            newPatient.Firstname = _firstname;
            int d = 0;
            int m = 0;
            int y = 0;
            if (int.TryParse(_birthday, out d) && int.TryParse(_birthmonth, out m) && int.TryParse(_birthyear, out y))
            {

                newPatient.Birthday = new DateTime(y, m, d);

                worker.DoWork += new DoWorkEventHandler((object s, DoWorkEventArgs e) =>
                {
                    ServicePatient.ServicePatientClient servicePatient = new ServicePatient.ServicePatientClient();

                    Debug.WriteLine("DEBUT");
                    _iscreatingpatient = true;

                    BackgroundWorker bg = s as BackgroundWorker;
                    e.Result = servicePatient.AddPatient(newPatient);
                });

                // TODO penser a mettre un comportement en fonction des differents cas notamment en cas de fail
                worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler((object s, RunWorkerCompletedEventArgs e) =>
                {
                    Debug.WriteLine("FIN");
                    _iscreatingpatient = false;
                    WaitingMessage = "";

                    if (e.Cancelled)
                    {
                        Debug.WriteLine("CANCELLED");
                        WaitingMessage = "L'opération a été annulée.";
                    }
                    if (e.Error != null)
                    {
                        Debug.WriteLine("ERROR");
                        WaitingMessage = "Erreur lors de la création : " + e.Error.Message;
                    }
                    bool? res = e.Result as bool?;

                    if (res == null)
                    {
                        Debug.WriteLine("ERREUR COTE SERVEUR");
                        WaitingMessage = "Erreur côté serveur lors de la création. Veuillez recommencer";
                    }
                    if (res == true)
                    {
                        WaitingMessage = "Création réussie";

                        View.PatientBrowserView window = new View.PatientBrowserView();
                        ViewModel.PatientBrowserViewModel vm = new PatientBrowserViewModel(window);
                        window.DataContext = vm;

                        _ns = NavigationService.GetNavigationService(_linkedView);
                        _ns.Navigate(window);
                        WaitingMessage = "";
                    }
                    else
                    {
                        Debug.WriteLine("ECHEC DE LA CREATION");
                        WaitingMessage = "La création a échoué. Veuillez recommencer.";
                    }
                });

                worker.RunWorkerAsync();
                WaitingMessage = "Création du patient";
            }
            WaitingMessage = "Veuillez indiquer des dates valides (ex : 26 07 1989)";
        }
Пример #10
0
        private void CreatePatient()
        {
            BackgroundWorker worker = new BackgroundWorker();

            ServicePatient.Patient newPatient = new ServicePatient.Patient();

            newPatient.Name      = _name;
            newPatient.Firstname = _firstname;
            int d = 0;
            int m = 0;
            int y = 0;

            if (int.TryParse(_birthday, out d) && int.TryParse(_birthmonth, out m) && int.TryParse(_birthyear, out y))
            {
                newPatient.Birthday = new DateTime(y, m, d);

                worker.DoWork += new DoWorkEventHandler((object s, DoWorkEventArgs e) =>
                {
                    ServicePatient.ServicePatientClient servicePatient = new ServicePatient.ServicePatientClient();

                    Debug.WriteLine("DEBUT");
                    _iscreatingpatient = true;

                    BackgroundWorker bg = s as BackgroundWorker;
                    e.Result            = servicePatient.AddPatient(newPatient);
                });

                // TODO penser a mettre un comportement en fonction des differents cas notamment en cas de fail
                worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler((object s, RunWorkerCompletedEventArgs e) =>
                {
                    Debug.WriteLine("FIN");
                    _iscreatingpatient = false;
                    WaitingMessage     = "";

                    if (e.Cancelled)
                    {
                        Debug.WriteLine("CANCELLED");
                        WaitingMessage = "L'opération a été annulée.";
                    }
                    if (e.Error != null)
                    {
                        Debug.WriteLine("ERROR");
                        WaitingMessage = "Erreur lors de la création : " + e.Error.Message;
                    }
                    bool?res = e.Result as bool?;

                    if (res == null)
                    {
                        Debug.WriteLine("ERREUR COTE SERVEUR");
                        WaitingMessage = "Erreur côté serveur lors de la création. Veuillez recommencer";
                    }
                    if (res == true)
                    {
                        WaitingMessage = "Création réussie";

                        View.PatientBrowserView window       = new View.PatientBrowserView();
                        ViewModel.PatientBrowserViewModel vm = new PatientBrowserViewModel(window);
                        window.DataContext = vm;

                        _ns = NavigationService.GetNavigationService(_linkedView);
                        _ns.Navigate(window);
                        WaitingMessage = "";
                    }
                    else
                    {
                        Debug.WriteLine("ECHEC DE LA CREATION");
                        WaitingMessage = "La création a échoué. Veuillez recommencer.";
                    }
                });

                worker.RunWorkerAsync();
                WaitingMessage = "Création du patient";
            }
            WaitingMessage = "Veuillez indiquer des dates valides (ex : 26 07 1989)";
        }