public String CreatePrescription(EPrescription prescription) { String complete = @"FilePrescriptions\Prescription" + DateTime.Now.ToString("dd-MM-yyyy") + "_" + HelperFunctions.GetRandomNumber() + ".txt"; System.IO.File.WriteAllText(complete, GetTextForPrescription(prescription)); return(complete); }
public IActionResult AddEPrescription(EPrescriptionDto dto) { EPrescription eprescription = EPrescriptionMapper.EPrescriptionDtoToEPrescription(dto); App.Instance().EPrescriptionService.AddEntity(eprescription); return(Ok()); }
public IActionResult PostHttp(EPrescription prescription) { if (PrescriptionFileService.SendPrescriptionHttp(prescription)) { return(Ok()); } return(BadRequest()); }
public void Not_found_ePrescription_for_patient() { EPrescriptionService ePrescriptionService = new EPrescriptionService(CreateStubRepository()); EPrescription ePrescription = ePrescriptionService.GetEPrescriptionForPatient(7); Assert.Null(ePrescription); }
public static EPrescription EPrescriptionDtoToEPrescription(EPrescriptionDto dto) { EPrescription newEPrescriptions = new EPrescription(); newEPrescriptions.PatientName = dto.PatientName; newEPrescriptions.MedicamentName = dto.MedicamentName; newEPrescriptions.Comment = dto.Comment; newEPrescriptions.PublishingDate = dto.PublishingDate; return(newEPrescriptions); }
private void DefineTypeOfApiKey(EPrescription prescription, RegistrationInPharmacy registrationInPharmacy) { if (registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Substring(registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Length - 1).Equals("H")) { new PharmacyHttp(Context).SendPrescription(prescription); } else { new PharmacyGrpcSftp(Context).SendPrescription(prescription); } }
public Boolean SendPrescription(EPrescription prescription) { try { foreach (RegistrationInPharmacy registrationInPharmacy in HttpRequests.GetPharmacyRegistrations()) { DefineTypeOfApiKey(prescription, registrationInPharmacy); } return(true); } catch (Exception e) { return(false); } }
public Boolean SendPrescriptionHttp(EPrescription prescription) { String prescriptionFile = CreatePrescription(prescription); try { HttpService.UploadPrescriptionFile(prescriptionFile); SmptServerService.SendEMailNotification(prescriptionFile, "prescription"); return(true); } catch (Exception e) { return(false); } }
public static EPrescriptionDto EPrescriptionToEPresctriptionDto(EPrescription ePrescription) { EPrescriptionDto dto = new EPrescriptionDto(); dto.Id = ePrescription.Id; dto.PatientId = ePrescription.PatientId; dto.PatientName = ePrescription.PatientName; dto.Comment = ePrescription.Comment; dto.MedicamentName = ePrescription.MedicamentName; dto.PublishingDate = ePrescription.PublishingDate; return(dto); }
public Boolean SendPrescriptionSftp(EPrescription prescription) { String prescriptionFile = CreatePrescription(prescription); String[] prescriptionParts = prescriptionFile.Split("\\"); try { SftpService.UploadFile(prescriptionFile, @"\pub\" + prescriptionParts[1]); SmptServerService.SendEMailNotification(prescriptionFile, "prescription"); return(true); } catch (Exception e) { return(false); } }
public static IEPrescriptionRepository Create_stub_repository() { var stubRepository = new Mock <IEPrescriptionRepository>(); EPrescription prescription = new EPrescription("Jankovic", "Pera", "Peric", "12356489", "Paracetamol", 3, "3 times per week"); EPrescription prescription2 = new EPrescription("Benu", "Zika", "Milic", "11111111", "Brufen", 5, "5 times per week"); var prescriptions = new List <EPrescription>(); prescriptions.Add(prescription); prescriptions.Add(prescription2); stubRepository.Setup(m => m.GetAll()).Returns(prescriptions); return(stubRepository.Object); }
public EPrescription Create(EPrescription prescription) { dbContext.EPrescriptions.Add(prescription); dbContext.SaveChanges(); return(prescription); }
public String GetTextForPrescription(EPrescription prescription) { return(prescription.Pharmacy + " Precription for medicine\n\nPatients name: " + prescription.Name + "\nPatients surname: " + prescription.Surname + "\nPatients medical ID number: " + prescription.MedicalIDNumber + "\nMedication: " + prescription.Medicine + " Quantity: " + prescription.Quantity + "\nUsage: " + prescription.Usage + "\n"); }
public String GeneratePrescriptionForPatient(string medicalIdNumber) { EPrescription prescription = GetAllForStub().SingleOrDefault(prescriptionIt => (prescriptionIt.MedicalIDNumber.Equals(medicalIdNumber))); return(prescription != null ? getTextForPrescription(prescription) : ""); }
public EPrescription Create(EPrescriptionDto dto) { EPrescription prescription = EPrescriptionAdapter.EPrescriptionDtoToEPresctiption(dto); return(EPrescriptionRepository.Create(prescription)); }