コード例 #1
0
        private void NavigateToBrowserPatient()
        {
            View.PatientBrowserView window = new View.PatientBrowserView();
            ViewModel.PatientBrowserViewModel vm = new PatientBrowserViewModel(window);
            window.DataContext = vm;

            _ns = NavigationService.GetNavigationService(_linkedView);
            _ns.Navigate(window);
        }
コード例 #2
0
        private void ClickPatient()
        {
            View.PatientBrowserView           window = new View.PatientBrowserView();
            ViewModel.PatientBrowserViewModel vm     = new PatientBrowserViewModel(window);
            window.DataContext = vm;

            _ns = NavigationService.GetNavigationService(_linkedView);
            _ns.Navigate(window);
        }
コード例 #3
0
        /// <summary>
        /// Le clic sur le bouton permet de supprimer le patient
        /// </summary>
        private void Delete()
        {
            BackgroundWorker worker = new BackgroundWorker();

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

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

                BackgroundWorker bg = s as BackgroundWorker;
                e.Result            = servicePatient.DeletePatient(_id);
            });

            // 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");
                _isdeleting    = 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 suppression : " + 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 suppression. Veuillez recommencer";
                }
                if (res == true)
                {
                    WaitingMessage = "Suppression 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 SUPPRESSION");
                    WaitingMessage = "La suppression a échoué. Veuillez recommencer.";
                }
            });

            worker.RunWorkerAsync();
            WaitingMessage = "Suppression du patient";
        }
コード例 #4
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)";
        }
コード例 #5
0
        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";
        }
コード例 #6
0
        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";
        }
コード例 #7
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)";
        }
コード例 #8
0
        /// <summary>
        /// Le clic sur le bouton permet de supprimer le patient
        /// </summary>
        private void Delete()
        {
            BackgroundWorker worker = new BackgroundWorker();

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

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

                BackgroundWorker bg = s as BackgroundWorker;
                e.Result = servicePatient.DeletePatient(_id);
            });

            // 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");
                _isdeleting = 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 suppression : " + 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 suppression. Veuillez recommencer";
                }
                if (res == true)
                {
                    WaitingMessage = "Suppression 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 SUPPRESSION");
                    WaitingMessage = "La suppression a échoué. Veuillez recommencer.";
                }
            });

            worker.RunWorkerAsync();
            WaitingMessage = "Suppression du patient";
        }