public bool IsEqualeActionsAndBenefitsPersistanceAndActionsAndBenefitsEntity(IdentifiableDTO <ActionAndBenefitsDTO> actionsAndBenefitsDTO, ActionsAndBenefits action) { if (action.IDAction != actionsAndBenefitsDTO.Id) { return(false); } if (action.IsApproved != actionsAndBenefitsDTO.EntityDTO.IsApproved) { return(false); } if (!action.ActionName.Equals(actionsAndBenefitsDTO.EntityDTO.ActionName)) { return(false); } if (action.DateRange.StartDateTime != actionsAndBenefitsDTO.EntityDTO.BeginDate) { return(false); } if (action.DateRange.EndDateTime != actionsAndBenefitsDTO.EntityDTO.EndDate) { return(false); } if (action.Price.OldPrice != actionsAndBenefitsDTO.EntityDTO.OldCost) { return(false); } if (action.Price.NewPrice != actionsAndBenefitsDTO.EntityDTO.NewCost) { return(false); } return(true); }
private bool IsEqualAdminEntitiesAndIdentifierAdminDTO(Admin admin, IdentifiableDTO <AdminDTO> identfierAdminDTO) { if (admin.Id != admin.Id) { return(false); } if (!admin.Jmbg.Equals(admin.Jmbg)) { return(false); } if (!admin.Username.Equals(admin.Username)) { return(false); } if (!admin.Password.Equals(admin.Password)) { return(false); } if (!admin.Name.Equals(admin.Name)) { return(false); } if (!admin.Surname.Equals(admin.Surname)) { return(false); } return(true); }
private void sendEmail(Boolean value, IdentifiableDTO <PharmacyOffersDTO> offer) { using (MailMessage mail = new MailMessage()) { mail.From = new MailAddress("*****@*****.**"); mail.To.Add(offer.EntityDTO.PharmacyEmail); mail.Subject = "TENDER " + offer.EntityDTO.IdTender; if (value) { mail.Body = textForBody(offer); } else { mail.Body = "<h1>We didnt choose your offer!</h1><p>Hospital MQuince Medic. More luck next time. :) </p>"; } mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587)) { smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential("*****@*****.**", "mucibabic123"); smtp.EnableSsl = true; smtp.Send(mail); } } }
public bool IsEqualAppointmentPersistanceAndAppointmentEntity(IdentifiableDTO <AppointmentDTO> appointmentDTO, Appointment appointment) { if (appointment.Id != appointmentDTO.Id) { return(false); } if (!appointment.DoctorId.Equals(appointmentDTO.EntityDTO.DoctorId)) { return(false); } if (!appointment.PatientId.Equals(appointmentDTO.EntityDTO.PatientId)) { return(false); } if (!appointment.DateRange.StartDateTime.Equals(appointmentDTO.EntityDTO.StartDateTime)) { return(false); } if (!appointment.DateRange.EndDateTime.Equals(appointmentDTO.EntityDTO.EndDateTime)) { return(false); } if (appointment.IsCanceled != appointmentDTO.EntityDTO.IsCanceled) { return(false); } return(true); }
private IdentifiableDTO <AppointmentDTO> InitializeAppointments(Appointment appointment, Guid patientId, Guid doctorId) { IdentifiableDTO <AppointmentDTO> appointmentDTO = AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment); appointmentDTO.EntityDTO.PatientId = patientId; appointmentDTO.EntityDTO.DoctorId = doctorId; return(appointmentDTO); }
public void Map_actions_and_benefits_entity_to_actions_and_benefits_identifier_dto() { ActionsAndBenefits action = this.GetActionAndBenefits(); IdentifiableDTO <ActionAndBenefitsDTO> actionsAndBenefitsDTO = ActionAndBenefitsMapper.MapActionsAndBenefitsEntityToActionsAndBenefitsIdentifierDTO(action); Assert.True(IsEqualeActionsAndBenefitsPersistanceAndActionsAndBenefitsEntity(actionsAndBenefitsDTO, action)); }
public void Get_by_id_returns_doctor() { patientRepository.GetById(Guid.Parse("54455a55-094f-4081-89b3-757cafbd5ea1")).Returns(this.GetPatient()); IdentifiableDTO <PatientDTO> patient = patientService.GetById(Guid.Parse("54455a55-094f-4081-89b3-757cafbd5ea1")); Assert.True(this.IsEqualPatientAndIdentifierPatient(this.GetPatient(), patient)); }
public void Map_admin_entity_to_identifier_admin_dto() { Admin admin = this.GetAdminFirts(); IdentifiableDTO <AdminDTO> identifierAdminDTO = AdminMapper.MapAdminEntityToIdentifierAdminDTO(admin); Assert.True(IsEqualAdminEntitiesAndIdentifierAdminDTO(admin, identifierAdminDTO)); }
public void Map_patient_entity_to_patient_identifier_dto() { Patient patient = this.GetPatient(); IdentifiableDTO <PatientDTO> patientDTO = PatientMapper.MapPatientEntityToPatientIdentifierDTO(patient); Assert.True(IsEqualPatientPersistanceAndPatientEntity(patientDTO, patient)); }
public void Map_appointment_entity_to_appointment_identifier_dto() { Appointment appointment = this.GetPatient(); IdentifiableDTO <AppointmentDTO> appointmentDTO = AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment); Assert.True(IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentDTO, appointment)); }
public void Map_doctor_entity_to_identifier_doctor_dto() { Doctor doctor = this.GetDoctorFirts(); IdentifiableDTO <DoctorDTO> identifierDoctorDTO = DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(doctor); Assert.True(IsEqualDoctorEntitiesAndIdentifierDoctorDTO(doctor, identifierDoctorDTO)); }
public void Get_by_id_returns_medications() { medicationRepository.GetById(Guid.Parse("51d5a046-bc14-4cce-9ab0-222565f50526")).Returns(this.GetFirstMedication()); IdentifiableDTO <MedicationsConsumptionDTO> medication = medicationService.GetById(Guid.Parse("51d5a046-bc14-4cce-9ab0-222565f50526")); Assert.True(this.CompareMedicationAndIdentifierMedication(this.GetFirstMedication(), medication)); }
public void Get_by_id_returns_pharmacy() { pharmacyRepository.GetById(Guid.Parse("51d5a046-bc14-4cce-9ab0-222565f50526")).Returns(this.GetFirstPharmacy()); IdentifiableDTO <PharmacyDTO> pharmacy = pharmacyService.GetByApi(Guid.Parse("51d5a046-bc14-4cce-9ab0-222565f50526")); Assert.True(this.ComparePharmacyAndIdentifierPharmacy(this.GetFirstPharmacy(), pharmacy)); }
public void Map_medications_consumptiony_entity_to_medications_consumption_identifier_dto() { MedicationsConsumption medicationsConsumption = this.GetMedicationsConsumption(); IdentifiableDTO <MedicationsConsumptionDTO> medicationsConsumptionDTO = MedicationsConsumptionMapper.MapMedicationsConsumptionEntityToMedicationsConsumptionIdentifierDTO(medicationsConsumption); Assert.True(IsEqualedicationsConsumptionPersistanceAndedicationsConsumptionEntity(medicationsConsumptionDTO, medicationsConsumption)); }
public Guid sendOffers(Guid id, Boolean approve) { IdentifiableDTO <PharmacyOffersDTO> offer = GetById(id); sendEmail(approve, offer); _pharmacyOffersRepository.Delete(id); return(id); }
public void GetReportForAppointment_returns_appointment() { reportRepository.GetReportForAppointment(Guid.Parse("0d619cf3-25d6-49b2-b4c4-1f70d3121b32")).Returns(this.GetFirstReport()); IdentifiableDTO <ReportDTO> report = appointmentService.GetReportForAppointment(Guid.Parse("0d619cf3-25d6-49b2-b4c4-1f70d3121b32")); Assert.True(this.CompareReportAndIdentifierReport(this.GetFirstReport(), report)); }
public void GetById_returns_appointment() { appointmentRepository.GetById(Guid.Parse("54455a55-054f-4081-89b3-757cafbd5ea1")).Returns(this.GetFirstAppointment()); IdentifiableDTO <AppointmentDTO> appointment = appointmentService.GetById(Guid.Parse("54455a55-054f-4081-89b3-757cafbd5ea1")); Assert.True(this.CompareAppointmentAndIdentifierAppointment(this.GetFirstAppointment(), appointment)); }
public void Get_by_id_returns_doctor() { doctorRepository.GetById(Guid.Parse("51d5a046-bc14-4cce-9ab0-222565f50526")).Returns(this.GetFirstDoctor()); IdentifiableDTO <DoctorDTO> doctor = doctorService.GetById(Guid.Parse("51d5a046-bc14-4cce-9ab0-222565f50526")); Assert.True(this.CompareDoctorAndIdentifierDoctor(this.GetFirstDoctor(), doctor)); }
private String textForBody(IdentifiableDTO <PharmacyOffersDTO> offer) { return("<h1>CONGRATULATION!</h1>" + "<p>We approve your offer! </p>" + "<p> Medication: " + offer.EntityDTO.Medicationes + " </p>" + "<p> Quantity: " + offer.EntityDTO.Quantity + " </p>" + "<p> Price: " + offer.EntityDTO.Price + " </p>" + "<h2> MQuince Medic </h2>"); }
public void Map_specialization_entity_to_specialization_identifier_dto() { Guid id = Guid.Parse("11ac21e1-1361-4c06-9751-9666ce10d30a"); Specialization specialization = new Specialization(id, "Hirurg"); IdentifiableDTO <SpecializationDTO> identifierSpecificationDTO = SpecializationMapper.MapSpecializationEntityToSpecializationIdentifierDTO(specialization); Assert.Equal(specialization.Id, identifierSpecificationDTO.Id); Assert.Equal(specialization.Name, identifierSpecificationDTO.EntityDTO.Name); }
private bool CompareDoctorAndIdentifierDoctor(Doctor doctor, IdentifiableDTO <DoctorDTO> identifierDoctor) { if (doctor.Id != identifierDoctor.Id) { return(false); } if (!doctor.Jmbg.Equals(identifierDoctor.EntityDTO.Jmbg)) { return(false); } if (!doctor.Username.Equals(identifierDoctor.EntityDTO.Username)) { return(false); } if (!doctor.Password.Equals(identifierDoctor.EntityDTO.Password)) { return(false); } if (!doctor.Name.Equals(identifierDoctor.EntityDTO.Name)) { return(false); } if (!doctor.Surname.Equals(identifierDoctor.EntityDTO.Surname)) { return(false); } if (!doctor.Biography.Equals(identifierDoctor.EntityDTO.Biography)) { return(false); } if (doctor.SpecializationId != identifierDoctor.EntityDTO.Specialization) { return(false); } return(true); }
public bool IsEqualPatientPersistanceAndPatientEntity(IdentifiableDTO <PatientDTO> patientDTO, Patient patient) { if (patient.Id != patientDTO.Id) { return(false); } if (!patient.Jmbg.Equals(patientDTO.EntityDTO.Jmbg)) { return(false); } if (!patient.Username.Equals(patientDTO.EntityDTO.Username)) { return(false); } if (!patient.Password.Equals(patientDTO.EntityDTO.Password)) { return(false); } if (!patient.Name.Equals(patientDTO.EntityDTO.Name)) { return(false); } if (!patient.Surname.Equals(patientDTO.EntityDTO.Surname)) { return(false); } if (patient.Guest != patientDTO.EntityDTO.Guest) { return(false); } if (patient.PersonalDoctor != patientDTO.EntityDTO.PersonalDoctor) { return(false); } return(true); }
public bool IsEqualPharmacyPersistanceAndPharmacyEntity(IdentifiableDTO <PharmacyDTO> pharmacyDTO, MyPharmacy pharmacy) { if (pharmacy.ApiKey != pharmacyDTO.Key) { return(false); } if (!pharmacy.Name.Equals(pharmacyDTO.EntityDTO.Name)) { return(false); } if (!pharmacy.Url.Equals(pharmacyDTO.EntityDTO.Url)) { return(false); } return(true); }
private bool CompareReportAndIdentifierReport(Report appointment, IdentifiableDTO <ReportDTO> identifierReport) { if (appointment.Id != identifierReport.Id) { return(false); } if (!appointment.ReportText.Equals(identifierReport.EntityDTO.ReportText)) { return(false); } if (!appointment.AppointmentId.Equals(identifierReport.EntityDTO.AppointmentId)) { return(false); } return(true); }
private bool ComparePharmacyAndIdentifierPharmacy(MyPharmacy pharmacy, IdentifiableDTO <PharmacyDTO> identifierPharmacy) { if (pharmacy.ApiKey != identifierPharmacy.EntityDTO.ApiKey) { return(false); } if (!pharmacy.Name.Equals(identifierPharmacy.EntityDTO.Name)) { return(false); } if (!pharmacy.Url.Equals(identifierPharmacy.EntityDTO.Url)) { return(false); } return(true); }
public IActionResult Update(String data) { string[] parts = _medicationsService.GetData(data); IdentifiableDTO <MedicationsDTO> medications = _medicationsService.GetById(new Guid(parts[0])); service.SendUrgentMessage(medications.EntityDTO.Name, medications.EntityDTO.Quantity.ToString()); _medicationsService.Delete(new Guid(parts[0])); try { _medicationsService.Update(new MedicationsDTO() { Name = medications.EntityDTO.Name, Quantity = (medications.EntityDTO.Quantity + Int32.Parse(parts[1])) }, medications.Id); return(Ok(medications.Id)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult Update([FromQuery] Guid id, Boolean opened) { IdentifiableDTO <TenderDTO> tender = _tenderService.GetById(id); try { _tenderService.Update(new TenderDTO() { Name = tender.EntityDTO.Name, Descritpion = tender.EntityDTO.Descritpion, EndDate = tender.EntityDTO.EndDate, StartDate = tender.EntityDTO.StartDate, FormLink = tender.EntityDTO.FormLink, Opened = opened }, tender.Id); _tenderService.Delete(id); return(Ok(tender.Id)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult Update(Guid id) { IdentifiableDTO <ActionAndBenefitsDTO> actionAndBenefits = _actionAndBenefitsService.GetById(id); try { _actionAndBenefitsService.Update(new ActionAndBenefitsDTO() { IsApproved = true, PharmacyName = actionAndBenefits.EntityDTO.PharmacyName, ActionName = actionAndBenefits.EntityDTO.ActionName, BeginDate = actionAndBenefits.EntityDTO.BeginDate, EndDate = actionAndBenefits.EntityDTO.EndDate, OldCost = actionAndBenefits.EntityDTO.OldCost, NewCost = actionAndBenefits.EntityDTO.NewCost }, actionAndBenefits.Id, true); return(Ok(actionAndBenefits.Id)); } catch (Exception e) { return(BadRequest(e.Message)); } }
private bool CompareActionAndBenefitsAndIdentifierActionAndBenefits(ActionsAndBenefits actionAndBenefits, IdentifiableDTO <ActionAndBenefitsDTO> actionAndBenefitsDTO) { if (actionAndBenefits.IDAction != actionAndBenefitsDTO.Id) { return(false); } if (!actionAndBenefits.PharmacyName.Equals(actionAndBenefitsDTO.EntityDTO.PharmacyName)) { return(false); } if (!actionAndBenefits.ActionName.Equals(actionAndBenefitsDTO.EntityDTO.ActionName)) { return(false); } if (actionAndBenefits.DateRange.StartDateTime != actionAndBenefitsDTO.EntityDTO.BeginDate) { return(false); } if (actionAndBenefits.DateRange.EndDateTime != actionAndBenefitsDTO.EntityDTO.EndDate) { return(false); } if (actionAndBenefits.Price.OldPrice != actionAndBenefitsDTO.EntityDTO.OldCost) { return(false); } if (actionAndBenefits.Price.NewPrice != actionAndBenefitsDTO.EntityDTO.NewCost) { return(false); } if (actionAndBenefits.IsApproved != actionAndBenefitsDTO.EntityDTO.IsApproved) { return(false); } return(true); }
private bool CompareMedicationAndIdentifierMedication(MedicationsConsumption medication, IdentifiableDTO <MedicationsConsumptionDTO> identifierMedication) { if (medication.KeyConsumtion != identifierMedication.Id) { return(false); } if (!medication.Name.Equals(identifierMedication.EntityDTO.Name)) { return(false); } if (!medication.DateOfConsumtion.Equals(identifierMedication.EntityDTO.DateOfConsumtion)) { return(false); } if (!medication.Quantity.Equals(identifierMedication.EntityDTO.Quantity)) { return(false); } return(true); }