예제 #1
0
        private void UpdateImagesList(Model.Observation value)
        {
            List <Image> limages = new List <Image>();

            if (value == null)
            {
                ListImages = limages;
            }
            else
            {
                if (value.Pic != null)
                {
                    foreach (byte[] img in value.Pic)
                    {
                        if (img == null)
                        {
                            continue;
                        }
                        MemoryStream stream = new MemoryStream(img);
                        stream.Position = 0;
                        BitmapImage bi = new BitmapImage();
                        bi.BeginInit();
                        bi.StreamSource = stream;
                        bi.EndInit();

                        ImageSource imgsrc = bi;
                        Image       tmp    = new Image();
                        tmp.Source = imgsrc;
                        limages.Add(tmp);
                    }
                    ListImages = limages;
                }
            }
        }
예제 #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Observation obs = new Model.Observation();

            //cardId = Convert.ToInt32(Session["CardId"]);
            //cardId = Convert.ToInt32(Request.QueryString["CardId"]);
            obs.CardId = cardId;
            //date = o.Date;
            obs.Date = context.Observations.Where(x => x.CardId == cardId).Select(x => x.Date).First();

            obs.Location        = ddlLocation.Text;
            obs.Others          = tbxOthers.Text;
            obs.Classification  = ddlClassification.Text;
            obs.Description     = tbxDescription.Text;
            obs.ImmediateAction = tbxImmAction.Text;
            obs.FurtherAction   = tbxFurtherAction.Text;
            obs.PositiveComment = tbxComment.Text;
            string fileName  = DateTime.Now.ToString("ddMMyyyy-hhmmss") + Path.GetExtension(UploadPhoto.FileName);
            string photopath = Server.MapPath("~/Pictures/") + fileName;

            if (UploadPhoto.PostedFile.FileName != "")
            {
                UploadPhoto.SaveAs(photopath);
                obs.PhotoPath = fileName;
            }
            oc.UpdateObservation(obs);

            Response.Redirect("~/Users/ObservationList.aspx");
        }
예제 #3
0
        public void Delete(Observation model)
        {
            #region 取資料
            Model.Observation query = this.Get(model.ID_Observation);
            //var queryoverseastaff = this._overseaService.GetForOverType(query.ID_OverType);
            #endregion

            #region 邏輯驗證
            if (query == null)//沒有資料
            {
                throw new Exception("MessageNoData".ToLocalized());
            }

            //驗證
            //if (queryoverseastaff == null)//沒有資料
            //    throw new Exception("MessageDataHasLinking".ToLocalized());
            #endregion

            #region 變為Models需要之型別及邏輯資料

            #endregion

            #region Models資料庫
            this._repository.Delete(query);
            this._unitOfWork.SaveChange();
            #endregion
        }
예제 #4
0
        public Fiche_PatientViewModel(Model.Patient patient)
        {
            _liveActionCommand = new RelayCommand(LiveAction);
            _addObservation    = new RelayCommand(param => AddObs(), param => true);
            Patient            = patient;
            if (Patient.Obs != null && Patient.Obs.Count() > 0)
            {
                SelectedObservation = Patient.Obs.ElementAt(0);
            }
            else
            {
                SelectedObservation = null;
            }
            View.MainWindow mainwindow  = (View.MainWindow)Application.Current.MainWindow;
            object          datacontext = mainwindow.DataContext;

            ViewModel.MainWindow main = (ViewModel.MainWindow)datacontext;
            if (main.ConnectedUser.Role.Equals("Medecin"))
            {
                this._isAdmin = true;
            }
            else
            {
                this._isAdmin = false;
            }
            ListImages = null;
        }
예제 #5
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);
            }
        }
예제 #6
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);
        }
예제 #7
0
        private void CreateObsMethod()
        {
            if (Prescriptions == null || Prescriptions.Equals("") || BloodPressure.Equals("0") || Weight.Equals("0"))
            {
                MaterialMessageBox.ShowError("Remplir les champs obligatoire de l'observation (poids, pression sanguine, prescription");
                return;
            }
            Model.Observation obs = new Model.Observation()
            {
                bloodPressure = _bloodPressure,
                comment       = Comment,
                date          = Date,
                pictures      = Pictures.ToArray(),
                prescription  = Prescriptions.Split('\n'),
                weight        = _weight
            };
            int patientId = lastWindow.SelectedPatient.id;

            Observations.CreateObservation(patientId, obs);
            lastWindow.SelectedPatient.observations.Add(obs);
            lastWindow.SelectedObservation = obs;
            CloseWindow();
        }
예제 #8
0
        public static bool CreateObservation(int idPatient, Model.Observation observation)
        {
            ServiceObservationClient serviceObservation = new ServiceObservationClient();
            bool result = false;

            try
            {
                ServiceObservation.Observation obs = new Observation()
                {
                    BloodPressure = observation.bloodPressure,
                    Comment       = observation.comment,
                    Date          = observation.date,
                    Pictures      = observation.pictures,
                    Prescription  = observation.prescription,
                    Weight        = observation.weight
                };
                System.Console.WriteLine("on se met mal avant");
                result = serviceObservation.AddObservation(idPatient, obs);
                System.Console.WriteLine("on se met mal après");
            }
            catch (Exception e) { Console.WriteLine("Exception : " + e.Message); }
            finally { serviceObservation.Close(); }
            return(result);
        }
예제 #9
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);
            }
        }