public async Task<IHttpActionResult> DeletePrescription(Prescription prescription, string FilePath) { if (prescription == null || FilePath == null) { return NotFound(); } Do.deletePrescription(prescription, FilePath); return StatusCode(HttpStatusCode.NoContent); }
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); } } } }
public void PutDocPrescription() { 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 Title"; Patient P = context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF"); string DocPath = P.PatientId + "$" + Sender.UserId; Prescription p = new Prescription(Title, Sender.Photo, Sender, listPro, P); _documentService.putPrescription(p); DocumentSerializable document = dm.SeeDocument(context.SelectRequest.SelectProfessional("OlivierS", "OlivierS"), context.SelectRequest.SelectPatient("GuillaumeF", "GuillaumeF")); Assert.AreEqual(document.Prescriptions.Count, 3); } }
private PrescriptionXML CreatePrescription(Prescription pres) { PrescriptionXML p = new PrescriptionXML() { Date = pres.Date, Doc = _img.ImageCoverter(_img.LoadImage(pres.DocPath)), DocPath = pres.DocPath, Patient = CreatePatient(pres.Patient), Recievers = CreateProList(pres.Receivers), Sender = CreateUser(pres.Sender), Title = pres.Title }; return p; }
public void DeleteDoc(Prescription prescription, string FilePath) { DocumentSerializable Documents = DeserializeListDoc(GetPathFile(FilePath)); foreach (var pres in Documents.Prescriptions) { if (pres.Date == prescription.Date && pres.DocPath == prescription.DocPath && pres.Patient.PatientId == prescription.Patient.PatientId) { Documents.Prescriptions.Remove(pres); } } SerializeListDoc(Documents, GetPathFile(FilePath)); }
private void AddDoc(Prescription prescription, string FilePath) { DocumentSerializable Documents = DeserializeListDoc(GetPathFile(FilePath)); Documents.Prescriptions.Add(prescription); SerializeListDoc(Documents, GetPathFile(FilePath)); }
public void CreatePrescription(List<Professional> Receivers, User Sender, Patient Patient, string Title, string DocPath) { Prescription p = new Prescription(Title, DocPath, Sender, Receivers, Patient); CreateDoc(p); }
private void CreateDoc(Prescription prescription) { var senderFollow = _context.SelectRequest.SelectOneFollow(prescription.Patient.PatientId, prescription.Sender.UserId); if (senderFollow != null) { AddDoc(prescription, prescription.Patient.PatientId + "$" + prescription.Sender.UserId); } foreach (var receiver in prescription.Receivers) { var follow = _context.SelectRequest.SelectOneFollow(prescription.Patient.PatientId, receiver.ProfessionalId); if (follow != null && follow != senderFollow) { AddDoc(prescription, senderFollow.PatientId + "$" + senderFollow.ProfessionnalId); } } AddDoc(prescription, GetPathFile(prescription.Patient.PatientId.ToString())); }