public void GetByIdReturnsGiftCertificateForKnownId()
        {
            GiftCertificate giftCertificate = _repository.GetById(KNOWN_GIFT_CERTIFICATE_ID);

            Assert.IsNotNull(giftCertificate, "GetById returned null GiftCertificate.");
            Assert.IsInstanceOf <GiftCertificate>(giftCertificate, "GetById returned the wrong type of object.");
        }
Esempio n. 2
0
        private File FileObject(string fileNamePrefix, string fileUploadElementName, MediaLocation fileLocation, long fileId = 0)
        {
            if (Request.Files != null && Request.Files.Count > 0 && Request.Files[fileUploadElementName] != null)
            {
                var fileUploaded = Request.Files[fileUploadElementName];
                if (string.IsNullOrEmpty(fileUploaded.FileName))
                {
                    return(fileId > 0 ? _fileRepository.GetById(fileId) : null);
                }

                var newFileName = fileNamePrefix.Replace(" ", "") + "_" + DateTime.Now.ToFileTimeUtc() + Path.GetExtension(fileUploaded.FileName);

                fileUploaded.SaveAs(fileLocation.PhysicalPath + newFileName);

                return(new File
                {
                    Id = fileId,
                    FileSize = fileUploaded.ContentLength,
                    Path = newFileName,
                    Type = FileType.Image,
                    UploadedOn = DateTime.Now,
                    UploadedBy = new OrganizationRoleUser(_sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId)
                });
            }

            return(fileId > 0 ? _fileRepository.GetById(fileId) : null);
        }
Esempio n. 3
0
        public ChaperoneFormModel GetChaperoneFormModel(long eventCustomerId)
        {
            var chaperoneSignature = _chaperoneSignatureRepository.GetByEventCustomerId(eventCustomerId);

            var staffSignatureFile = chaperoneSignature != null?_fileRepository.GetById(chaperoneSignature.StaffSignatureFileId) : null;

            if (staffSignatureFile == null)
            {
                return(new ChaperoneFormModel
                {
                    EventCustomerId = eventCustomerId,
                    CustomerAnswers = null,
                    PatientSignatureBytes = null,
                });
            }

            var chaperoneQuestions = _chaperoneQuestionRepository.GetAllQuestions();

            var chaperoneAnswers = _chaperoneAnswerRepository.GetByEventCustomerId(eventCustomerId);

            var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId);

            var mediaLocation = _mediaRepository.GetChaperoneSignatureLocation(eventCustomer.EventId, eventCustomer.CustomerId);

            string signatureFilePath = string.Empty;

            var signatureFile = chaperoneSignature != null && chaperoneSignature.SignatureFileId.HasValue ? _fileRepository.GetById(chaperoneSignature.SignatureFileId.Value) : null;

            if (signatureFile != null)
            {
                signatureFilePath = Path.Combine(mediaLocation.PhysicalPath, signatureFile.Path);
            }

            var staffSignatureFilePath = Path.Combine(mediaLocation.PhysicalPath, staffSignatureFile.Path);

            var chaperoneFormModel = new ChaperoneFormModel();

            chaperoneFormModel.EventCustomerId = eventCustomerId;
            chaperoneFormModel.CustomerAnswers = chaperoneAnswers
                                                 .Select(x => new ChaperoneAnswerModel
            {
                QuestionId = x.QuestionId,
                Answer     = x.Answer
            })
                                                 .ToArray();

            if (!string.IsNullOrEmpty(signatureFilePath) && File.Exists(signatureFilePath))
            {
                var signatureFileByte = File.ReadAllBytes(signatureFilePath);
                chaperoneFormModel.PatientSignatureBytes = Convert.ToBase64String(signatureFileByte);
            }

            if (File.Exists(staffSignatureFilePath))
            {
                var staffSignatureFileByte = File.ReadAllBytes(staffSignatureFilePath);
                chaperoneFormModel.StaffSignatureBytes = Convert.ToBase64String(staffSignatureFileByte);
            }

            return(chaperoneFormModel);
        }
Esempio n. 4
0
        public void GetThrowsExceptionWhenTestWithInvalidIdNotFound()
        {
            ExpectGetDataAccessAdapterAndDispose();
            ExpectFetchEntity(false);

            _mocks.ReplayAll();
            _uniqueItemRepository.GetById(0);
            _mocks.VerifyAll();
        }
Esempio n. 5
0
        public UserSessionModel GetUserSessionModel(string userName)
        {
            var user          = _userRepository.GetUser(_userLoginRepository.GetByUserName(userName).Id);
            var orgRoles      = _organizationRoleUserRepository.GetOrganizationRoleUserCollectionforaUser(user.Id);
            var orgs          = _organizationRepository.GetAllOrganizationsforUser(user.Id);
            var files         = orgs.Where(o => o.LogoImageId > 0).Select(o => _fileRepository.GetById(o.LogoImageId)).ToArray();
            var mediaLocation = _mediaRepository.GetOrganizationLogoImageFolderLocation();

            var roles = _roleRepository.GetAll();

            return(_userSessionModelFactory.Create(user, orgRoles, orgs, roles, files, mediaLocation));
        }
        public EventCustomerPcpAppointmentViewModel GetEventCustomerPcpAppointmentViewModel(Event eventData, Customer customer, CorporateAccount account, PrimaryCarePhysician pcp, EventCustomer eventCustomer)
        {
            var pcpDispositions = _pcpDispositionRepository.GetByEventCustomerId(eventCustomer.Id);

            var pcpAppointment = GetPcpAppointment(eventCustomer, pcpDispositions);

            var logoUrl = string.Empty;
            if (account != null)
            {
                var org = _organizationRepository.GetOrganizationbyId(account.Id);
                var file = org.LogoImageId > 0 ? _fileRepository.GetById(org.LogoImageId) : null;
                if (file != null)
                {
                    var location = _mediaRepository.GetOrganizationLogoImageFolderLocation();
                    logoUrl = location.Url + file.Path;
                }
            }

            return new EventCustomerPcpAppointmentViewModel
            {
                CustomerId = customer.CustomerId,
                CustomerName = customer.Name,
                AppointmentDateTime = pcpAppointment != null ? pcpAppointment.AppointmentOn : (DateTime?)null,
                Pcp = pcp,
                AccountLogoUrl = logoUrl,
                BookAfterNumberOfDays = account != null ? account.NumberOfDays : 0,
                EventDate = eventData.EventDate,

            };
        }
Esempio n. 7
0
        public void GetByIdReturnsRefundForKnownId()
        {
            Refund refund = _repository.GetById(KNOWN_REFUND_ID);

            Assert.IsNotNull(refund, "GetById returned null Refund.");
            Assert.IsInstanceOf <Refund>(refund, "GetById returned the wrong type of object.");
        }
        public EventCustomersFindingEditModel GetforanEvent(long eventId)
        {
            var selectedEvent  = _eventRepository.GetById(eventId);
            var eventCustomers = _eventCustomerRepository.GetbyEventId(eventId);
            var tests          = _testRepository.GetTestsForEvent(eventId);

            var pod = _podRepository.GetPodsForEvent(selectedEvent.Id);

            var customerRecieptModels = new List <CustomerItemizedReceiptModel>();

            if (eventCustomers.IsNullOrEmpty())
            {
                return(_eventCustomerFindingFactory.Create(selectedEvent, customerRecieptModels, tests, null, null, null, pod));
            }

            eventCustomers = eventCustomers.Where(ec => ec.AppointmentId.HasValue && !ec.NoShow).ToArray();
            var customers = _customerRepository.GetCustomers(eventCustomers.Select(crm => crm.CustomerId).ToArray());

            customerRecieptModels.AddRange(from eventCustomer in eventCustomers
                                           where eventCustomer.AppointmentId != null
                                           select _service.GetItemizedRecieptModel(eventCustomer.CustomerId, eventId));

            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);
                var eventCustomerFindingEntities =
                    linqMetaData.CustomerEventTestFinding.Where(ce => ce.EventId == eventId).ToArray();

                var physicianNoteEntities = linqMetaData.CustomerEventTestPhysicianNote.Where(ce => ce.EventId == eventId).ToArray();

                return(_eventCustomerFindingFactory.Create(selectedEvent, customerRecieptModels, tests,
                                                           eventCustomerFindingEntities, physicianNoteEntities, customers, pod));
            }
        }
Esempio n. 9
0
        public IEnumerable <BloodworksLabelViewModel> GetBloodworksLabel(long eventId)
        {
            var eventCustomers = _eventCustomerRepository.GetbyEventId(eventId);

            eventCustomers = eventCustomers.Where(ec => ec.AppointmentId.HasValue).Select(ec => ec);
            if (eventCustomers.IsNullOrEmpty())
            {
                return(null);
            }

            var orderIdEventCustomerIdPairs = _orderRepository.GetOrderEventCustomerIdPairforEventCustomerIds(eventCustomers.Select(ec => ec.Id).ToArray()).ToArray();

            var orderIdEventTestIdPairs = _eventTestRepository.GetEventTestIdForOrders(orderIdEventCustomerIdPairs.Select(pair => pair.FirstValue).ToArray()).ToArray();

            var eventTests = _eventTestRepository.GetbyIds(orderIdEventTestIdPairs.Select(pair => pair.SecondValue).ToArray());

            var eventTestIds = eventTests.Where(et => et.TestId == (long)TestType.Liver || et.TestId == (long)TestType.Lipid).Select(et => et.Id).ToArray();

            var eventCustomerIdsFromTest = (from oet in orderIdEventTestIdPairs
                                            join oec in orderIdEventCustomerIdPairs on oet.FirstValue equals oec.FirstValue
                                            where eventTestIds.Contains(oet.SecondValue)
                                            select oec.SecondValue).ToArray();

            var orderIdEventPackageIdPairs = _eventPackageRepository.GetEventPackageIdsForOrder(orderIdEventCustomerIdPairs.Select(pair => pair.FirstValue).ToArray());

            var eventPackages = _eventPackageRepository.GetByIds(orderIdEventPackageIdPairs.Select(pair => pair.SecondValue).ToArray()).ToArray();

            var eventPackageIds = eventPackages.Where(ep => ep.Tests.Where(t => t.TestId == (long)TestType.Liver || t.TestId == (long)TestType.Lipid ||
                                                                           t.TestId == (long)TestType.Crp || t.TestId == (long)TestType.Thyroid || t.TestId == (long)TestType.Psa || t.TestId == (long)TestType.Testosterone).Count() > 0).Select(ep => ep.Id).ToArray();

            var eventCustomerIdsFromPackage = (from oep in orderIdEventPackageIdPairs
                                               join oec in orderIdEventCustomerIdPairs on oep.FirstValue equals
                                               oec.FirstValue
                                               where eventPackageIds.Contains(oep.SecondValue)
                                               select oec.SecondValue).ToArray();

            eventCustomers =
                eventCustomers.Where(
                    ec => eventCustomerIdsFromTest.Contains(ec.Id) || eventCustomerIdsFromPackage.Contains(ec.Id)).
                Select(ec => ec).ToArray();

            var customers = _customerRepository.GetCustomers(eventCustomers.Select(ec => ec.CustomerId).ToArray());

            var eventData = _eventRepository.GetById(eventId);

            return(_bloodworksLabelViewModelFactory.Create(customers, eventData));
        }
Esempio n. 10
0
        public ActionResult Edit(PodEditModel podEditModel)
        {
            try
            {
                podEditModel.Territories = _territoryRepository.GetAllTerritoriesIdNamePair(TerritoryType.Pod);
                podEditModel.Tests       = _testRepository.GetAll();
                if (ModelState.IsValid)
                {
                    var pod     = Mapper.Map <PodEditModel, Pod>(podEditModel);
                    var podInDb = _podRepository.GetById(pod.Id);
                    pod.DataRecorderMetaData = podInDb.DataRecorderMetaData;

                    pod.DataRecorderMetaData.DataRecorderModifier =
                        Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(_sessionContext.UserSession.CurrentOrganizationRole);
                    pod.DataRecorderMetaData.DateModified = DateTime.Now;

                    using (var scope = new TransactionScope())
                    {
                        pod = _podRepository.Save(pod);

                        var podTeam = new List <PodStaff>();
                        podEditModel.DefaultStaffAssigned.ToList().ForEach(dsa =>
                        {
                            var teamMember   = Mapper.Map <PodStaffEditModel, PodStaff>(dsa);
                            teamMember.PodId = pod.Id;
                            teamMember.DataRecorderMetaData = new DataRecorderMetaData()
                            {
                                DataRecorderCreator = Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(_sessionContext.UserSession.CurrentOrganizationRole),
                                DateCreated         = DateTime.Now
                            };
                            podTeam.Add(teamMember);
                        });

                        ((IPodRepository)_podRepository).SavePodTerritories(podEditModel.AssignedTerritories,
                                                                            pod.Id);

                        // Need to check the DefaultPodTeam Issue.
                        podTeam = _podStaffAssignmentRepository.SaveMultiple(podTeam, pod.Id).ToList();

                        _podService.SavePodRooms(podEditModel.Rooms, pod.Id);
                        scope.Complete();
                    }

                    var newModel = _podService.GetPodEditModel(podEditModel.Id);

                    newModel.FeedbackMessage =
                        FeedbackMessageModel.CreateSuccessMessage(
                            "The POD was edited successfully. You can edit it for more changes or close this page.");

                    return(View(newModel));
                }
                return(View(podEditModel));
            }
            catch (Exception exception)
            {
                podEditModel.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + exception);
                return(View(podEditModel));
            }
        }
Esempio n. 11
0
        public void PollForAppointmentBookExport()
        {
            try
            {
                if (_accountId <= 0)
                {
                    return;
                }

                var account = _corporateAccountRepository.GetById(_accountId);

                if (account == null)
                {
                    _logger.Info("Account can't be null");
                    return;
                }

                _logger.Info(string.Format("Generating AppointmentBooked for accountId {0} and account tag {1}. ", account.Id, account.Tag));

                var fromDate = DateTime.Now.Year > _cutOfDate.Date.Year ? new DateTime(DateTime.Now.Year, 1, 1) : _cutOfDate;

                var destinationPath = string.Format(_destinationAppointmentBookedReportPath, account.FolderName);
                destinationPath = Path.Combine(destinationPath, fromDate.Year.ToString());
                var appointmentSettings = string.Format(_appointmentReportSetingPath, account.Tag);
                var customSettings      = _customSettingManager.Deserialize(appointmentSettings);

                try
                {
                    var files = Directory.GetFiles(destinationPath);
                    if (files.Any())
                    {
                        foreach (var file in files)
                        {
                            File.Delete(file);
                        }
                    }
                }
                catch
                {
                }

                var toDate = DateTime.Now;

                CreateDistinationDirectory(destinationPath);

                var sourcePath = destinationPath + string.Format(@"\AppointmentBookedReport_{0}.csv", toDate.ToString("yyyyMMdd"));

                AppointmentsBooked(new CustomAppointmentsBookedListModelFilter {
                    FromDate = fromDate, ToDate = toDate.Date, AccountId = account.Id, Tag = account.Tag
                }, sourcePath);

                customSettings.LastTransactionDate = toDate;
                _customSettingManager.SerializeandSave(appointmentSettings, customSettings);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Main App: \n Error {0} \n Trace: {1} \n\n\n", ex.Message, ex.StackTrace));
            }
        }
        private void GenerateLabsInboundReport(LabsInboundFilter filter)
        {
            var dataGen = new ExportableDataGenerator <LabsInboundViewModel, LabsInboundFilter>(_labsInboundReportService.GetLabsInboundReportList, _logger);
            var model   = dataGen.GetData(filter);

            var account = _corporateAccountRepository.GetById(filter.AccountId);

            if (model != null && !model.Collection.IsEmpty())
            {
                var folder = string.Format(_settings.FloridaBlueInboundReportPath, account.FolderName, DateTime.Now.ToString("yyyy-MM-dd"));

                if (!Directory.Exists(folder))
                {
                    DirectoryOperationsHelper.CreateDirectory(folder);
                }

                _logger.Info("Directory Path :" + folder);

                var fileName = _pipeDelimitedReportHelper.GetReportName(ReportType.LabsInbound);

                if (model.Collection != null && model.Collection.Any())
                {
                    var filePath = folder + "\\" + fileName + ".txt";
                    if (File.Exists(filePath))
                    {
                        _logger.Info("file Deleteing"); File.Delete(filePath);
                    }

                    _pipeDelimitedReportHelper.Write(model.Collection, folder, fileName + ".txt");

                    _logger.Info("File Generated at :" + folder + " file Name: " + fileName);

                    if (_sendReportToSftp)
                    {
                        try
                        {
                            _logger.Info("Sending file to SFTP.");

                            var destinationPath = _destinationSftpPath + "\\" + account.FolderName + "\\Download\\Reports";
                            SendFilesToSftp(Path.Combine(folder, fileName), destinationPath, fileName);

                            _logger.Info("File sent to SFTP.");
                        }
                        catch (Exception ex)
                        {
                            _logger.Info("Error sending file to SFTP.");
                            _logger.Error("Message : " + ex.Message);
                            _logger.Error("Stack Trace : " + ex.StackTrace);
                        }
                    }
                }
            }
            else
            {
                _logger.Info("No record found for " + account.Tag);
            }
        }
Esempio n. 13
0
        public Testimonial GetTestimonial(long testimonialId)
        {
            var testimonial = GetById(testimonialId);

            if (testimonial.TestimonialVideo != null && testimonial.TestimonialVideo.Id > 0)
            {
                testimonial.TestimonialVideo = _fileRepository.GetById(testimonial.TestimonialVideo.Id);
            }
            return(testimonial);
        }
        public void ResultExport()
        {
            try
            {
                if (DateTime.Today.DayOfWeek != _bcbsMiGapResultExportIntervalDay)
                {
                    _logger.Info("Today is " + DateTime.Today.DayOfWeek + " while service is configured to run on " + _bcbsMiGapResultExportIntervalDay);
                    _logger.Info("Please set " + (int)DateTime.Today.DayOfWeek + " to run Service today");
                    return;
                }

                if (_accountId <= 0)
                {
                    return;
                }
                var account         = _corporateAccountRepository.GetById(_accountId);
                var destinationPath = string.Format(_bcbsmiResultExportDownloadPath, account.FolderName);
                try
                {
                    var resultExportSettings = string.Format(_resultExportSettings, account.Tag);

                    var customSettings = _customSettingManager.Deserialize(resultExportSettings);

                    var fromDate = customSettings.LastTransactionDate.HasValue ? customSettings.LastTransactionDate.Value : DateTime.Today.GetFirstDateOfYear();

                    var toDate = DateTime.Now;

                    CreateDistinationDirectory(destinationPath);

                    if (fromDate.Year == toDate.Year)
                    {
                        ResultExportForGapPatient(fromDate, toDate, account, fromDate.GetFirstDateOfYear(), fromDate.GetLastDateOfYear());
                    }
                    else if (fromDate.Year < DateTime.Today.Year)
                    {
                        toDate = new DateTime(fromDate.Year, 12, 31);
                        ResultExportForGapPatient(fromDate, toDate, account, fromDate.GetFirstDateOfYear(), fromDate.GetLastDateOfYear());

                        fromDate = new DateTime(DateTime.Now.Year, 1, 1);
                        ResultExportForGapPatient(fromDate, DateTime.Today, account, fromDate.GetFirstDateOfYear(), fromDate.GetLastDateOfYear());
                    }

                    customSettings.LastTransactionDate = toDate;
                    _customSettingManager.SerializeandSave(resultExportSettings, customSettings);
                }
                catch (Exception ex)
                {
                    _logger.Error(string.Format("Account Id {0} and account Tag {1}  Message: {2} \n Stack Trace: {3} ", account.Id, account.Tag, ex.Message, ex.StackTrace));
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message: {0} \n Stack Trace: {1} ", ex.Message, ex.StackTrace));
            }
        }
Esempio n. 15
0
        public ParticipationConsentSignatureModel GetParticipationConsentSignature(long eventCustomerId)
        {
            var participationConsentSignature = _participationConsentSignatureRepository.GetByEventCustomerId(eventCustomerId);

            if (participationConsentSignature == null)
            {
                return(new ParticipationConsentSignatureModel
                {
                    EventCustomerId = eventCustomerId,
                    InsuranceSignatureBytes = null,
                    SignatureBytes = null,
                });
            }

            var eventCustomer          = _eventCustomerRepository.GetById(eventCustomerId);
            var signatureFile          = _fileRepository.GetById(participationConsentSignature.SignatureFileId);
            var insuranceSignatureFile = _fileRepository.GetById(participationConsentSignature.InsuranceSignatureFileId);

            var signatureFileName          = signatureFile.Path;
            var insuranceSignatureFileName = insuranceSignatureFile.Path;
            var mediaLocation                      = _mediaRepository.GetParticipationConsentSignatureLocation(eventCustomer.EventId, eventCustomer.CustomerId);
            var signatureFilePath                  = Path.Combine(mediaLocation.PhysicalPath, signatureFileName);
            var insuranceSignatureFilePath         = Path.Combine(mediaLocation.PhysicalPath, insuranceSignatureFileName);
            var participationConsentSignatureModel = new ParticipationConsentSignatureModel
            {
                EventCustomerId = eventCustomerId
            };

            if (File.Exists(signatureFilePath))
            {
                var FileByte = File.ReadAllBytes(signatureFilePath);
                participationConsentSignatureModel.SignatureBytes = Convert.ToBase64String(FileByte);
            }
            if (File.Exists(insuranceSignatureFilePath))
            {
                var FileByte = File.ReadAllBytes(insuranceSignatureFilePath);
                participationConsentSignatureModel.InsuranceSignatureBytes = Convert.ToBase64String(FileByte);
            }


            return(participationConsentSignatureModel);
        }
Esempio n. 16
0
        public void GetByIdThrowsExceptionWhenObjectWithGivenIdNotFoundInPersistence()
        {
            const bool entityFound = false;

            ExpectGetDataAccessAdapterAndDispose();
            ExpectFetchEntityUsingUniqueConstraint(entityFound);

            _mocks.ReplayAll();
            _uniqueItemRepository.GetById(0);
            _mocks.VerifyAll();
        }
        public void PollForMemberStatusReport()
        {
            try
            {
                if (_accountId <= 0)
                {
                    _logger.Info("Corporate Account Id Not found");
                    return;
                }
                var today      = DateTime.Today;
                var dayOfMonth = new DateTime(today.Year, today.Month, _dayOfMonth);

                if (dayOfMonth != today)
                {
                    _logger.Info("Report is schedule to run on " + _dayOfMonth + " of every month");
                    _logger.Info("Today is " + today);
                    _logger.Info(string.Format("Set day of month to {0} to run today ", _dayOfMonth));
                    return;
                }

                var account = _corporateAccountRepository.GetById(_accountId);

                if (account == null)
                {
                    _logger.Info("Corporate Account Not found");
                    return;
                }

                _logger.Info("Starting Member Status Report for " + account.Tag);

                var filter = new MemberStatusListModelFilter
                {
                    EligibleStatus      = EligibleFilterStatus.OnlyEligible,
                    IncludeDoNotContact = true,
                    DoNotContactOnly    = false,
                    Tag  = account.Tag,
                    Year = today.Year,
                    CallAttemptFilter             = CallAttemptFilterStatus.All,
                    ConsiderEligibiltyFromHistory = true
                };

                GenerateMemberStatusListCsvByFilter(filter, account);

                _logger.Info("Completed Member Status Report for " + account.Tag);
            }
            catch (Exception ex)
            {
                _logger.Error("Some error occured on Member status Report account Id " + _accountId);
                _logger.Error("Exception: " + ex.Message);
                _logger.Error("Stack Trace: " + ex.StackTrace);
            }
        }
Esempio n. 18
0
        public ActionResult Edit(long id)
        {
            var tests   = _testRepository.GetAll();
            var package = _packageRepository.GetById(id);
            var model   = Mapper.Map <Package, PackageEditModel>(package);

            if (package.ForOrderDisplayFileId.HasValue && package.ForOrderDisplayFileId > 0)
            {
                model.ForOrderDisplayFile = _fileRepository.GetById(package.ForOrderDisplayFileId.Value);
            }

            model.AllTests = Mapper.Map <IEnumerable <Test>, IEnumerable <TestViewModel> >(tests);
            model.AllRoles = _userService.GetRoleswithRegistrationEnabled();

            model.SelectedRoles = _packageRepository.GetRoleswithGivenPackageAvailability(id);
            var packageTests     = _packageTestRepository.GetbyPackageId(id);
            var pacakgeTestModel = Mapper.Map <IEnumerable <PackageTest>, IEnumerable <PackageTestEditModel> >(packageTests);

            model.SelectedTests = GetDefaultSelectedTests(tests.Where(x => x.IsDefaultSelectionForPackage), pacakgeTestModel);

            return(View(model));
        }
Esempio n. 19
0
        public ActionResult MedicarePopupSessionCheck()
        {
            //this repo call is not required here, but to ensure that session do exist on API as medicare popup hits API and session must exist there.
            var ull = _userLoginLogUniqueItemRepository.GetById(_sessionContext.UserSession.UserLoginLogId);

            if (ull.LogOutDateTime.HasValue)
            {
                return(Json(bool.FalseString, JsonRequestBehavior.AllowGet));
            }

            //if it reach here then both API and WEBUI session exists for this user
            return(Json(bool.TrueString, JsonRequestBehavior.AllowGet));
        }
        public void PollForResultExport()
        {
            var account = _corporateAccountRepository.GetById(_accountId);

            _physicianPartnerResultExportService.ResultExport();

            var fileName = _destinationDirectory + string.Format(@"\ResultExport_{0}.csv", DateTime.Now.Date.ToString("yyyyMMdd"));

            if (System.IO.File.Exists(fileName))
            {
                _pgpFileEncryptionHelper.EncryptFile(account, fileName);
            }
        }
        private MemberTermByAbsenceFilter CreateFilter(CorporateUpload corporateUpload)
        {
            if (corporateUpload.AccountId.HasValue)
            {
                var account = _corporateAccountRepository.GetById(corporateUpload.AccountId.Value);
                return(new MemberTermByAbsenceFilter
                {
                    CorporateUploadId = corporateUpload.Id,
                    Tag = account.Tag
                });
            }

            _logger.Info("corporate account Id can not be null ");
            return(null);
        }
Esempio n. 22
0
        public MedicalVendorEditModel GetMedicalVendorCreateModel(long id)
        {
            var medicalVendor         = _medicalVendorRepository.GetMedicalVendor(id);
            var model                 = Mapper.Map <MedicalVendor, MedicalVendorEditModel>(medicalVendor);
            var organizationEditModel = GetOrganizationCreateModel(id);

            model.OrganizationEditModel = organizationEditModel;

            if (medicalVendor.ResultLetterCoBrandingFileId.HasValue && medicalVendor.ResultLetterCoBrandingFileId.Value > 0)
            {
                model.ResultLetterCoBrandingFile = _fileRepository.GetById(medicalVendor.ResultLetterCoBrandingFileId.Value);
            }
            if (medicalVendor.DoctorLetterFileId.HasValue && medicalVendor.DoctorLetterFileId.Value > 0)
            {
                model.DoctorLetterFile = _fileRepository.GetById(medicalVendor.DoctorLetterFileId.Value);
            }
            if (medicalVendor.IsHospitalPartner)
            {
                model.HospitalPartnerEditModel = MedicalVendorCreateModel(medicalVendor.Id);
            }


            return(model);
        }
Esempio n. 23
0
        public void PollForPdfDownload()
        {
            try
            {
                if (DateTime.Today.DayOfWeek != _settings.BcbsMiResultPdfDownloadIntervalDay)
                {
                    _logger.Info("Today is " + DateTime.Today.DayOfWeek + " while service is configured to run on " + _settings.BcbsMiResultPdfDownloadIntervalDay);
                    _logger.Info("Please set " + (int)DateTime.Today.DayOfWeek + " to run Service today");
                    return;
                }

                if (_accountId <= 0)
                {
                    return;
                }
                var corporateAccount = _corporateAccountRepository.GetById(_accountId);

                try
                {
                    _logger.Info(string.Format("Generating for accountId {0} and account tag {1}. ", corporateAccount.Id, corporateAccount.FolderName));

                    var customSettingFilePath = string.Format(_customSettingFile, corporateAccount.FolderName);
                    var customSettings        = _customSettingManager.Deserialize(customSettingFilePath);

                    var exportToTime   = DateTime.Now.AddHours(-1);
                    var exportFromTime = customSettings.LastTransactionDate ?? _cutOfDate;

                    var destinationFolderPdfPath = string.Format(_destinationFolderResultReportPath, corporateAccount.FolderName);

                    CreateDistinationDirectory(destinationFolderPdfPath);
                    DeleteIffileExist(destinationFolderPdfPath);

                    _logger.Info("Generating for Gap Patient");
                    PatientWithGapTag(exportToTime, exportFromTime, corporateAccount, DateTime.Today.GetFirstDateOfYear(), DateTime.Today.GetLastDateOfYear());

                    customSettings.LastTransactionDate = exportToTime;
                    _customSettingManager.SerializeandSave(customSettingFilePath, customSettings);
                }
                catch (Exception ex)
                {
                    _logger.Error(string.Format("some error occurred for AccountId: {0} and account tag: {1} Exception Message: \n{2}, \n stack Trace: \n\t {3} ", corporateAccount.Id, corporateAccount.Tag, ex.Message, ex.StackTrace));
                }
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("some error occurred Exception Message: \n{0}, \n stack Trace: \n\t {1} ", exception.Message, exception.StackTrace));
            }
        }
Esempio n. 24
0
        public string EncryptFile(CorporateAccount account, string sourcePath)
        {
            try
            {
                if (account.EnablePgpEncryption && account.PublicKeyFileId > 0)
                {
                    var publicKeyFile = string.Empty;
                    if (account.EnablePgpEncryption && account.PublicKeyFileId > 0)
                    {
                        File pgpPublicKey = _fileRepository.GetById(account.PublicKeyFileId);
                        publicKeyFile = GetPublicKeyFile(pgpPublicKey, _mediaRepository.GetPublicKeyFolderLocation());
                    }

                    if (System.IO.File.Exists(publicKeyFile))
                    {
                        var encryptedFileName = sourcePath + ".pgp";
                        if (System.IO.File.Exists(encryptedFileName))
                        {
                            System.IO.File.Delete(encryptedFileName);
                        }

                        _pgpFileEncryption.EncryptFile(encryptedFileName, sourcePath, publicKeyFile);

                        if (_deleteFileAfterEncryption)
                        {
                            System.IO.File.Delete(sourcePath);
                        }

                        sourcePath = encryptedFileName;
                        _logger.Info("pgp encryption done For file Path : " + sourcePath);
                    }
                    else
                    {
                        _logger.Info("No pgp file found for the account Id: " + account.Id);
                    }
                }
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format(" Some Error Occure while encryptiong file {0}", sourcePath));
                _logger.Error(string.Format(" Message:{0} stack trace: {1}", exception.Message, exception.StackTrace));
            }
            return(sourcePath);
        }
Esempio n. 25
0
        public void PollForAppointmentBookExport()
        {
            try
            {
                var account = _corporateAccountRepository.GetById(_accountId);

                if (account == null)
                {
                    _logger.Info("Account can't be null");
                    return;
                }

                _logger.Info(string.Format("Generating AppointmentBooked for accountId {0} and account tag {1}. ", account.Id, account.Tag));
                var toDate          = DateTime.Today;
                var fromDate        = toDate;
                var destinationPath = string.Format(_destinationAppointmentBookedReportPath, account.FolderName, fromDate.Year);

                CreateDestinationDirectory(destinationPath);

                var sourcePath = destinationPath + string.Format(@"\AppointmentBookedReport_{0}.csv", toDate.ToString("yyyyMMdd"));

                if (File.Exists(sourcePath))
                {
                    File.Delete(sourcePath);
                }

                AppointmentsBooked(new AppointmentsBookedListModelFilter {
                    FromDate = fromDate, ToDate = toDate.Date, AccountId = account.Id, Tag = account.Tag
                }, sourcePath);

                if (File.Exists(sourcePath))
                {
                    _pgpFileEncryptionHelper.EncryptFile(account, sourcePath);
                }

                _logger.Info(string.Format("AppointmentBooked for accountId {0} and account tag {1} completed. ", account.Id, account.Tag));
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Some Error occured. Message : {0} Stack Trace {1}", ex.Message, ex.StackTrace));
            }
        }
Esempio n. 26
0
        public ActivityLogViewModel CreateViewModel(ActivityLog mongoEntity)
        {
            var userLoginLog = mongoEntity.UserLogId > 0 ? _repositoryUserLoginLog.GetById(mongoEntity.UserLogId) : null;

            return(new ActivityLogViewModel
            {
                LogId = mongoEntity.Id.ToString(),
                Action = mongoEntity.Action,
                RequestType = mongoEntity.RequestType,
                Timestamp = mongoEntity.Timestamp,
                UrlAccessed = mongoEntity.UrlAccessed,
                AccessedBy = GetOrganizationRoleUserName(mongoEntity.AccessById),
                //UrlAlias = GetUrlAlias(mongoEntity.UrlAccessed),
                UrlAlias = mongoEntity.UrlAccessed,
                ClientBrowser = userLoginLog != null ? userLoginLog.BrowserName : string.Empty,
                ClientIp = userLoginLog != null ? userLoginLog.SessionIP : string.Empty,
                AccessedById = mongoEntity.AccessById,
                CustomerId = mongoEntity.CustomerId,
                Customer = GetOrganizationRoleUserName(mongoEntity.CustomerId)
            });
        }
Esempio n. 27
0
        public AwvPcpConsentViewModel GetAwvPcpConsentViewModel(long customerId, long eventId)
        {
            var customer  = _customerRepository.GetCustomer(customerId);
            var pcp       = _primaryCarePhysicianRepository.Get(customer.CustomerId);
            var eventData = _eventRepository.GetById(eventId);

            string   signatureUrl           = string.Empty;
            DateTime?signedDate             = null;
            var      eventCustomer          = _eventCustomerRepository.Get(eventId, customerId);
            var      mediaLocation          = _mediaRepository.GetPhysicianRecordRequestSignatureLocation(eventId, customerId);
            var      physicianRecordRequest = _physicianRecordRequestSignatureRepository.GetByEventCustomerId(eventCustomer.Id);

            if (physicianRecordRequest != null)
            {
                var signatureFile = _fileRepository.GetById(physicianRecordRequest.SignatureFileId);
                signatureUrl = mediaLocation.Url + signatureFile.Path;
                signedDate   = physicianRecordRequest.ConsentSignedDate;
            }

            return(GetAwvPcpConsentViewModel(customer, eventData, pcp, signatureUrl, signedDate));
        }
        public void PollForOutboundFileImport()
        {
            try
            {
                _logger.Info("entering in service");
                var accountIds = _accountIds.Split(',');

                foreach (var accountId in accountIds)
                {
                    var account = _corporateAccountRepository.GetById(Convert.ToInt32(accountId));

                    _logger.Info("Getting files for " + account.Tag);

                    var sourceLocation = string.Format(_settings.OutboundSourceFileLocation, account.FolderName);

                    var chaseOutboundFileLocation      = _mediaRepository.GetOutboundUploadMediaFileLocation(account.FolderName, "Chase");
                    var careCodingOutboundFileLocation = _mediaRepository.GetOutboundUploadMediaFileLocation(account.FolderName, "CareCoding");
                    var patientDetailFileLocation      = _mediaRepository.GetOutboundUploadMediaFileLocation(account.FolderName, "PatientDetail");
                    var diagnosisReportFileLocation    = _mediaRepository.GetOutboundUploadMediaFileLocation(account.FolderName, "DiagnosisReport");

                    var chaseFiles = Directory.GetFiles(sourceLocation, _pipeDelimitedReportHelper.GetReportName(ReportType.ChaseOutbound) + "*.txt");
                    UploadOutboundFiles(chaseFiles, chaseOutboundFileLocation.PhysicalPath, (long)OutboundUploadType.ChaseOutbound);

                    var careCodingFiles = Directory.GetFiles(sourceLocation, _pipeDelimitedReportHelper.GetReportName(ReportType.CareCodingOutbound) + "*.txt");
                    UploadOutboundFiles(careCodingFiles, careCodingOutboundFileLocation.PhysicalPath, (long)OutboundUploadType.CareCodingOutbound);

                    var patientDetailFiles = Directory.GetFiles(sourceLocation, "*" + _pipeDelimitedReportHelper.GetReportName(ReportType.PatientDetail) + "*.csv");
                    UploadOutboundFiles(patientDetailFiles, patientDetailFileLocation.PhysicalPath, (long)OutboundUploadType.PatientDetail);

                    var diagnosisReportFiles = Directory.GetFiles(sourceLocation, "*" + _pipeDelimitedReportHelper.GetReportName(ReportType.DiagnosisReport) + "*.csv");
                    UploadOutboundFiles(diagnosisReportFiles, diagnosisReportFileLocation.PhysicalPath, (long)OutboundUploadType.DiagnosisReport);
                }
            }
            catch (Exception exception)
            {
                _logger.Info("some exception occured while Importing File");
                _logger.Info("message " + exception.Message);
                _logger.Info("stack Trace " + exception.StackTrace);
            }
        }
Esempio n. 29
0
        public void PollForAppointmentBookExport()
        {
            try
            {
                if (_accountId <= 0)
                {
                    return;
                }

                var account = _corporateAccountRepository.GetById(_accountId);

                if (account == null)
                {
                    _logger.Info("Account can't be null");
                    return;
                }

                _logger.Info(string.Format("Generating AppointmentBooked for accountId {0} and account tag {1}. ", account.Id, account.Tag));

                var fromDate = DateTime.Today.GetFirstDateOfYear();
                var toDate   = DateTime.Today.GetLastDateOfYear();

                var destination = Path.Combine(string.Format(_destinationPath, FolderName), "Appointments");

                DirectoryOperationsHelper.CreateDirectoryIfNotExist(destination);

                var fileName = "AppointmentsBooked_" + FolderName + "_" + DateTime.Today.ToString("MMddyyyy") + ".csv";

                var sourcePath = Path.Combine(destination, fileName);

                AppointmentsBooked(new AppointmentsBookedListModelFilter {
                    EventFrom = fromDate, EventTo = toDate.Date, AccountId = account.Id, Tag = account.Tag, GroupName = _groupNameSettings
                }, sourcePath);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Main App: \n Error {0} \n Trace: {1} \n\n\n", ex.Message, ex.StackTrace));
            }
        }
Esempio n. 30
0
 private void UpdateProspectCustomer(TempCart tempCart, Customer customer)
 {
     if (tempCart.ProspectCustomerId.HasValue)
     {
         var prospectCustomer = _prospectCustomerRepository.GetById(tempCart.ProspectCustomerId.Value);
         prospectCustomer.CustomerId                 = customer.CustomerId;
         prospectCustomer.Tag                        = ProspectCustomerTag.OnlineSignup;
         prospectCustomer.IsConverted                = true;
         prospectCustomer.Status                     = (long)ProspectCustomerConversionStatus.Converted;
         prospectCustomer.ConvertedOnDate            = DateTime.Now;
         prospectCustomer.Address.StreetAddressLine1 = customer.Address.StreetAddressLine1;
         prospectCustomer.Address.StreetAddressLine2 = customer.Address.StreetAddressLine2;
         prospectCustomer.Address.City               = customer.Address.City;
         prospectCustomer.Address.State              = _stateRepository.GetState(customer.Address.StateId).Name;
         prospectCustomer.Address.ZipCode.Zip        = customer.Address.ZipCode.Zip;
         prospectCustomer.TagUpdateDate              = DateTime.Now;
         _prospectCustomerRepository.Save(prospectCustomer);
     }
     else
     {
         var prospectCustomer = ((IProspectCustomerRepository)_prospectCustomerRepository).GetProspectCustomerByCustomerId(customer.CustomerId);
         if (prospectCustomer != null)
         {
             prospectCustomer.CustomerId                 = customer.CustomerId;
             prospectCustomer.Tag                        = ProspectCustomerTag.OnlineSignup;
             prospectCustomer.IsConverted                = true;
             prospectCustomer.Status                     = (long)ProspectCustomerConversionStatus.Converted;
             prospectCustomer.ConvertedOnDate            = DateTime.Now;
             prospectCustomer.Address.StreetAddressLine1 = customer.Address.StreetAddressLine1;
             prospectCustomer.Address.StreetAddressLine2 = customer.Address.StreetAddressLine2;
             prospectCustomer.Address.City               = customer.Address.City;
             prospectCustomer.Address.State              = _stateRepository.GetState(customer.Address.StateId).Name;
             prospectCustomer.Address.ZipCode.Zip        = customer.Address.ZipCode.Zip;
             prospectCustomer.TagUpdateDate              = DateTime.Now;
             _prospectCustomerRepository.Save(prospectCustomer);
         }
     }
 }