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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
                }
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
        public void Map_admin_entity_to_identifier_admin_dto()
        {
            Admin admin = this.GetAdminFirts();

            IdentifiableDTO <AdminDTO> identifierAdminDTO = AdminMapper.MapAdminEntityToIdentifierAdminDTO(admin);

            Assert.True(IsEqualAdminEntitiesAndIdentifierAdminDTO(admin, identifierAdminDTO));
        }
Exemplo n.º 9
0
        public void Map_patient_entity_to_patient_identifier_dto()
        {
            Patient patient = this.GetPatient();

            IdentifiableDTO <PatientDTO> patientDTO = PatientMapper.MapPatientEntityToPatientIdentifierDTO(patient);

            Assert.True(IsEqualPatientPersistanceAndPatientEntity(patientDTO, patient));
        }
Exemplo n.º 10
0
        public void Map_appointment_entity_to_appointment_identifier_dto()
        {
            Appointment appointment = this.GetPatient();

            IdentifiableDTO <AppointmentDTO> appointmentDTO = AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment);

            Assert.True(IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentDTO, appointment));
        }
Exemplo n.º 11
0
        public void Map_doctor_entity_to_identifier_doctor_dto()
        {
            Doctor doctor = this.GetDoctorFirts();

            IdentifiableDTO <DoctorDTO> identifierDoctorDTO = DoctorMapper.MapDoctorEntityToIdentifierDoctorDTO(doctor);

            Assert.True(IsEqualDoctorEntitiesAndIdentifierDoctorDTO(doctor, identifierDoctorDTO));
        }
Exemplo n.º 12
0
        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));
        }
Exemplo n.º 13
0
        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));
        }
Exemplo n.º 14
0
        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));
        }
Exemplo n.º 15
0
        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));
        }
Exemplo n.º 18
0
        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));
        }
Exemplo n.º 19
0
 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>");
 }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        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);
        }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
0
        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));
            }
        }
Exemplo n.º 27
0
        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));
            }
        }
Exemplo n.º 28
0
        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));
            }
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
        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);
        }