Esempio n. 1
0
        private void Connecting()
        {
            bool isValid = false;

            //Call service

            if (!string.IsNullOrEmpty(LoginInput) && !string.IsNullOrEmpty(PasswordInput))
            {
                ServiceUser.ServiceUserClient clientService = new ServiceUser.ServiceUserClient();
                try
                {
                    isValid = clientService.Connect(_loginInput, _passwordInput);
                    if (isValid)
                    {
                        ServiceUser.User user = new ServiceUser.User();
                        user = clientService.GetUser(this._loginInput);
                        View.MainWindow      mainwindow   = (View.MainWindow)Application.Current.MainWindow;
                        ViewModel.MainWindow mainwindowVM = (ViewModel.MainWindow)mainwindow.DataContext;
                        mainwindowVM.MenuIsActive  = true;
                        mainwindowVM.FadeOut       = false;
                        mainwindowVM.ConnectedUser = new Model.User
                        {
                            Firstname     = user.Firstname,
                            Name          = user.Firstname,
                            Login         = user.Login,
                            Password      = user.Pwd,
                            Pic           = user.Picture,
                            Role          = user.Role,
                            Connected     = true,
                            Co            = true,
                            ExtensionData = user.ExtensionData
                        };
                        mainwindowVM.UserIdentity = user.Name + " " + user.Firstname;
                        View.Patients view             = new View.Patients();
                        ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
                        view.DataContext = vm;
                        mainwindow.contentcontrol.Content = view;
                    }
                    else
                    {
                        ErrorMessage     = "Identifiant ou mot de passe incorrect";
                        ShowConnectError = 1;
                        ShowConnectError = 0;
                    }
                }
                catch (Exception e)
                {
                    ErrorMessage     = "La connexion a échouée, réessayez plus tard";
                    ShowConnectError = 1;
                    ShowConnectError = 0;
                }
            }
            else
            {
                ErrorMessage     = "Identifiant ou mot de passe manquant";
                ShowConnectError = 1;
                ShowConnectError = 0;
            }
        }
Esempio n. 2
0
        public void FillListPatient()
        {
            ServicePatient.ServicePatientClient service = new ServicePatient.ServicePatientClient();
            try
            {
                ServicePatient.Patient[] listPatient = service.GetListPatient();
                this._allPatient = new List <Model.Patient>();
                List <Model.Observation> listObs = new List <Model.Observation>();

                foreach (ServicePatient.Patient pat in listPatient)
                {
                    Model.Patient patient = new Model.Patient
                    {
                        Birth     = pat.Birthday,
                        Firstname = pat.Firstname,
                        Name      = pat.Name,
                        Id        = pat.Id
                    };

                    if (pat.Observations != null)
                    {
                        foreach (ServicePatient.Observation obs in pat.Observations)
                        {
                            Model.Observation observation = new Model.Observation
                            {
                                Comments      = obs.Comment,
                                Date          = obs.Date,
                                Pic           = obs.Pictures ?? new List <byte[]>().ToArray(),
                                Prescriptions = obs.Prescription.ToList() ?? new List <string>(),
                                Pressure      = obs.BloodPressure,
                                Weight        = obs.Weight
                            };
                            listObs.Add(observation);
                        }
                        patient.Obs = listObs;
                    }

                    patient.Name      = FirstUpper(patient.Name);
                    patient.Firstname = FirstUpper(patient.Firstname);
                    patient.Birthday  = pat.Birthday.ToString("dd/MM/yyyy");

                    this._allPatient.Add(patient);
                }
                ListPatient = new ObservableCollection <Model.Patient>(this._allPatient);
            }
            catch
            {
                MainWindow      main       = new MainWindow();
                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;

                main.navigate((UserControl)mainwindow.contentcontrol.Content, view);
            }
        }
Esempio n. 3
0
        private void showPatients()
        {
            View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow.DataContext;

            View.Patients view             = new colle_tMedecine.View.Patients();
            ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
            view.DataContext = vm;
            mainwindow.contentcontrol.Content = view;
        }
Esempio n. 4
0
        private void showPatients()
        {
            View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow.DataContext;

            View.Patients view = new colle_tMedecine.View.Patients();
            ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
            view.DataContext = vm;
            mainwindow.contentcontrol.Content = view;
        }
Esempio n. 5
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;
            }
        }
        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;
            }
        }
Esempio n. 7
0
        private void Connecting()
        {
            bool isValid = false;
            //Call service

            if (!string.IsNullOrEmpty(LoginInput) && !string.IsNullOrEmpty(PasswordInput))
            {
                ServiceUser.ServiceUserClient clientService = new ServiceUser.ServiceUserClient();
                    try
                    {
                        isValid = clientService.Connect(_loginInput, _passwordInput);
                        if (isValid)
                        {
                            ServiceUser.User user = new ServiceUser.User();
                            user = clientService.GetUser(this._loginInput);
                            View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;
                            ViewModel.MainWindow mainwindowVM = (ViewModel.MainWindow)mainwindow.DataContext;
                            mainwindowVM.MenuIsActive = true;
                            mainwindowVM.FadeOut = false;
                            mainwindowVM.ConnectedUser = new Model.User
                            {
                                Firstname = user.Firstname,
                                Name = user.Firstname,
                                Login = user.Login,
                                Password = user.Pwd,
                                Pic = user.Picture,
                                Role = user.Role,
                                Connected = true,
                                Co = true,
                                ExtensionData = user.ExtensionData
                            };
                            mainwindowVM.UserIdentity = user.Name + " " + user.Firstname;
                            View.Patients view = new View.Patients();
                            ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
                            view.DataContext = vm;
                            mainwindow.contentcontrol.Content = view;
                        }
                        else
                        {
                            ErrorMessage = "Identifiant ou mot de passe incorrect";
                            ShowConnectError = 1;
                            ShowConnectError = 0;
                        }
                    }
                    catch (Exception e)
                    {
                        ErrorMessage = "La connexion a échouée, réessayez plus tard";
                        ShowConnectError = 1;
                        ShowConnectError = 0;
                    }
            }
            else
            {
                ErrorMessage = "Identifiant ou mot de passe manquant";
                ShowConnectError = 1;
                ShowConnectError = 0;
            }
        }
        public void FillListPatient()
        {
            ServicePatient.ServicePatientClient service = new ServicePatient.ServicePatientClient();
            try
            {
                ServicePatient.Patient[] listPatient = service.GetListPatient();
                this._allPatient = new List<Model.Patient>();
                List<Model.Observation> listObs = new List<Model.Observation>();

                foreach (ServicePatient.Patient pat in listPatient)
                {
                    Model.Patient patient = new Model.Patient
                    {
                        Birth = pat.Birthday,
                        Firstname = pat.Firstname,
                        Name = pat.Name,
                        Id = pat.Id
                    };

                    if (pat.Observations != null)
                    {
                        foreach (ServicePatient.Observation obs in pat.Observations)
                        {
                            Model.Observation observation = new Model.Observation
                            {
                                Comments = obs.Comment,
                                Date = obs.Date,
                                Pic = obs.Pictures ?? new List<byte[]>().ToArray(),
                                Prescriptions = obs.Prescription.ToList() ?? new List<string>(),
                                Pressure = obs.BloodPressure,
                                Weight = obs.Weight
                            };
                            listObs.Add(observation);
                        }
                        patient.Obs = listObs;
                    }

                    patient.Name = FirstUpper(patient.Name);
                    patient.Firstname = FirstUpper(patient.Firstname);
                    patient.Birthday = pat.Birthday.ToString("dd/MM/yyyy");

                    this._allPatient.Add(patient);
                }
                ListPatient = new ObservableCollection<Model.Patient>(this._allPatient);
            }
            catch
            {
                MainWindow main = new MainWindow();
                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;

                main.navigate((UserControl)mainwindow.contentcontrol.Content, view);
            }
        }