private void AddObservation()
        {
            ServiceObservation.ServiceObservationClient client = new ServiceObservation.ServiceObservationClient();
            ServiceObservation.Observation obs = new ServiceObservation.Observation();
            obs.BloodPressure = BloodPressure;
            obs.Comment       = Comment;
            obs.Prescription  = Prescriptions.ToArray();
            obs.Weight        = Weight;
            obs.Pictures      = ConverttobyteArray().ToArray();
            obs.Date          = Date;

            try
            {
                client.AddObservation(Patient.Id, obs);

                View.MainWindow     mainwindow       = (View.MainWindow)Application.Current.MainWindow;
                View.NewObservation view             = new colle_tMedecine.View.NewObservation();
                ViewModel.NewObservationViewModel vm = new colle_tMedecine.ViewModel.NewObservationViewModel(Patient);
                view.DataContext = vm;
                mainwindow.contentcontrol.Content = view;
            }
            catch
            {
                View.MainWindow     mainwindow       = (View.MainWindow)Application.Current.MainWindow;
                View.NewObservation view             = new colle_tMedecine.View.NewObservation();
                ViewModel.NewObservationViewModel vm = new colle_tMedecine.ViewModel.NewObservationViewModel(Patient);
                view.DataContext = vm;
                mainwindow.contentcontrol.Content = view;
            }
        }
Beispiel #2
0
 public static bool AddObservation(int idPatient, ServiceObservation.Observation o)
 {
     try
     {
         ServiceObservation.ServiceObservationClient c = new ServiceObservation.ServiceObservationClient();
         return(c.AddObservation(idPatient, o));
     }
     catch (EndpointNotFoundException)
     {
         MessageBox.Show("Le serveur ne répond pas.", "Erreur");
         return(false);
     }
 }
Beispiel #3
0
 public static bool AddObservation(int idPatient, ServiceObservation.Observation o)
 {
     try
     {
         ServiceObservation.ServiceObservationClient c = new ServiceObservation.ServiceObservationClient();
         return c.AddObservation(idPatient, o);
     }
     catch (EndpointNotFoundException)
     {
         MessageBox.Show("Le serveur ne répond pas.", "Erreur");
         return false;
     }
 }
Beispiel #4
0
 public bool AddObservation(int idPatient, ServiceObservation.Observation obs)
 {
     using (ServiceObservation.ServiceObservationClient client = new ServiceObservation.ServiceObservationClient())
     {
         try
         {
             return client.AddObservation(idPatient, obs);
         }
         catch
         {
             throw new TimeoutException();
         }
     }
 }
Beispiel #5
0
 public bool AddObservation(int idPatient, ServiceObservation.Observation obs)
 {
     using (ServiceObservation.ServiceObservationClient client = new ServiceObservation.ServiceObservationClient())
     {
         try
         {
             return(client.AddObservation(idPatient, obs));
         }
         catch
         {
             throw new TimeoutException();
         }
     }
 }
Beispiel #6
0
        public void AddObservation(ServiceObservation.Observation observation)
        {
            var patient = PatientViewModel.Patient;

            var soc = new ServiceObservation.ServiceObservationClient();
            if (soc.AddObservation(patient.Id, observation))
            {
                PatientViewModel.UpdatePatient(patient.Id);

                if (PatientViewModel.Patient.Observations != null)
                {
                    Observations = PatientViewModel.Patient.Observations.OrderByDescending(o => o.Date).ToList();
                }
            }
            else
            {
                throw new Exception("L'observation n'a pas été ajoutée !");
            }
        }
        private void AddObservation()
        {
            ServiceObservation.ServiceObservationClient client = new ServiceObservation.ServiceObservationClient();
            ServiceObservation.Observation obs = new ServiceObservation.Observation();
            obs.BloodPressure = BloodPressure;
            obs.Comment = Comment;
            obs.Prescription = Prescriptions.ToArray();
            obs.Weight = Weight;
            obs.Pictures = ConverttobyteArray().ToArray();
            obs.Date = Date;

            try
            {
                client.AddObservation(Patient.Id, obs);

                View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;
                View.NewObservation view = new colle_tMedecine.View.NewObservation();
                ViewModel.NewObservationViewModel vm = new colle_tMedecine.ViewModel.NewObservationViewModel(Patient);
                view.DataContext = vm;
                mainwindow.contentcontrol.Content = view;
            }
            catch
            {
                View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;
                View.NewObservation view = new colle_tMedecine.View.NewObservation();
                ViewModel.NewObservationViewModel vm = new colle_tMedecine.ViewModel.NewObservationViewModel(Patient);
                view.DataContext = vm;
                mainwindow.contentcontrol.Content = view;
            }
        }
        private void CreateObservation()
        {
            ServiceObservation.Observation newObs = new ServiceObservation.Observation();

            int tmp = 0;
            if (Int32.TryParse(_weight, out tmp)) {
                newObs.Weight = tmp;
            }

            if (Int32.TryParse(_bloodPressure, out tmp)) {
                newObs.BloodPressure = tmp;
            }

            if (_comment != null) {
                newObs.Comment = _comment;
            }

            if (_arrayPrescription != null) {
                newObs.Prescription = _arrayPrescription.ToArray();
            }

            if (_listDisplayedImages != null && _listDisplayedImages.Count != 0)
            {
                /// Le nombre d'images voulues utile pour creer le tableau statique
                int finalSize = _listDisplayedImages.Count;

                /// Le tableau d'images final
                byte[][] finalArrayImages = new byte[finalSize][];

                ///Pour convertir nos images en byte[]
                ByteArrayConverter cv = new ByteArrayConverter();

                for (int i = 0; i < finalSize; i++)
                {
                    byte[] convertedImg = (byte[])cv.ConvertBack(_listDisplayedImages.ElementAt(i), null, null, null);
                    finalArrayImages[i] = convertedImg;
                }
                newObs.Pictures = finalArrayImages;

                newObs.Date = DateTime.Now;
            }

            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += new DoWorkEventHandler((object s, DoWorkEventArgs e) =>
            {
                ServiceObservation.ServiceObservationClient observService = new ServiceObservation.ServiceObservationClient();
                e.Result = observService.AddObservation(_idPatient, newObs);
            });

            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler((object s, RunWorkerCompletedEventArgs e) =>
            {
                WaitingMessage = "";
                if (e.Cancelled)
                {
                    WaitingMessage = "L'opération a été annulée.";
                }
                if (e.Error != null)
                {
                    WaitingMessage = "Erreur lors de la création : " + e.Error.Message;
                }
                bool? resWebService = e.Result as bool?;
                if (resWebService.HasValue && resWebService.Value)
                {
                    View.PatientBrowserView window = new View.PatientBrowserView();
                    ViewModel.PatientBrowserViewModel vm = new PatientBrowserViewModel(window);
                    window.DataContext = vm;

                    _ns = NavigationService.GetNavigationService(_linkedView);
                    _ns.Navigate(window);
                }
                else {
                    WaitingMessage = "Erreur côté serveur lors de la création. Veuillez recommencer";
                }

            });

            worker.RunWorkerAsync();
            WaitingMessage = "Ajout de l'observation en cours";
        }
        private void CreateObservation()
        {
            ServiceObservation.Observation newObs = new ServiceObservation.Observation();

            int tmp = 0;

            if (Int32.TryParse(_weight, out tmp))
            {
                newObs.Weight = tmp;
            }

            if (Int32.TryParse(_bloodPressure, out tmp))
            {
                newObs.BloodPressure = tmp;
            }

            if (_comment != null)
            {
                newObs.Comment = _comment;
            }

            if (_arrayPrescription != null)
            {
                newObs.Prescription = _arrayPrescription.ToArray();
            }

            if (_listDisplayedImages != null && _listDisplayedImages.Count != 0)
            {
                /// Le nombre d'images voulues utile pour creer le tableau statique
                int finalSize = _listDisplayedImages.Count;

                /// Le tableau d'images final
                byte[][] finalArrayImages = new byte[finalSize][];

                ///Pour convertir nos images en byte[]
                ByteArrayConverter cv = new ByteArrayConverter();

                for (int i = 0; i < finalSize; i++)
                {
                    byte[] convertedImg = (byte[])cv.ConvertBack(_listDisplayedImages.ElementAt(i), null, null, null);
                    finalArrayImages[i] = convertedImg;
                }
                newObs.Pictures = finalArrayImages;

                newObs.Date = DateTime.Now;
            }

            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += new DoWorkEventHandler((object s, DoWorkEventArgs e) =>
            {
                ServiceObservation.ServiceObservationClient observService = new ServiceObservation.ServiceObservationClient();
                e.Result = observService.AddObservation(_idPatient, newObs);
            });

            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler((object s, RunWorkerCompletedEventArgs e) =>
            {
                WaitingMessage = "";
                if (e.Cancelled)
                {
                    WaitingMessage = "L'opération a été annulée.";
                }
                if (e.Error != null)
                {
                    WaitingMessage = "Erreur lors de la création : " + e.Error.Message;
                }
                bool?resWebService = e.Result as bool?;
                if (resWebService.HasValue && resWebService.Value)
                {
                    View.PatientBrowserView window       = new View.PatientBrowserView();
                    ViewModel.PatientBrowserViewModel vm = new PatientBrowserViewModel(window);
                    window.DataContext = vm;

                    _ns = NavigationService.GetNavigationService(_linkedView);
                    _ns.Navigate(window);
                }
                else
                {
                    WaitingMessage = "Erreur côté serveur lors de la création. Veuillez recommencer";
                }
            });

            worker.RunWorkerAsync();
            WaitingMessage = "Ajout de l'observation en cours";
        }