예제 #1
0
 public void GetArrayBytesOfAnImage()
 {
     using (ArchiViteContext context = new ArchiViteContext())
     {
         List<User> users = context.User.ToList();
         foreach (var u in users)
         {
             ImageManager img = new ImageManager();
             Image i = img.LoadImage(u.Photo);
             byte[] array = img.ImageCoverter(i);
         }
     }
 }
예제 #2
0
        public void PostPrescription()
        {
            using (ArchiViteContext context = new ArchiViteContext())
            {
                DocumentManager dm = new DocumentManager(context);
                List<Professional> listPro = new List<Professional>();
                listPro.Add(context.SelectRequest.SelectProfessional("ClementR", "ClementR"));
                listPro.Add(context.SelectRequest.SelectProfessional("SimonF", "SimonF"));
                User Sender = context.SelectRequest.SelectUser("OlivierS", "OlivierS");
                string Title = "My Title2";
                Patient P = context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF");
                string DocPath = P.PatientId + "$" + Sender.UserId;
                ImageManager img = new ImageManager();
                Image i = img.LoadImage(Sender.Photo);
                Prescription p = new Prescription(Title, Sender.Photo, Sender, listPro, P);

                _documentService.putPrescription(p);

                DocumentSerializable document = dm.SeeDocument(context.SelectRequest.SelectProfessional("ClementR", "ClementR"), context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"));

                foreach (var prescription in document.Prescriptions)
                {
                    if (prescription.Title == "MyTitle2")
                    {
                        _documentService.postPrescripton(context.SelectRequest.SelectPatient("GuillaumF", "GuillaumeF").PatientId, context.SelectRequest.SelectProfessional("AntoineR", "AntoineR").ProfessionalId, prescription.Date);

                        Assert.That(prescription.Receivers.Count == 3);

                        foreach (var pro in prescription.Receivers)
                        {
                            _documentService.deletePrescription(prescription, prescription.DocPath);
                        }

                        Assert.That(prescription.Receivers.Count == 2);

                    }
                }
            }
        }