Example #1
0
 public OnlineAppointmentService(IEventPackageSelectorService eventPackageSelectorService, IEventSchedulingSlotRepository eventSchedulingSlotRepository, EventPackageRepository eventPackageRepository,
                                 IEventSchedulingSlotService eventSchedulingSlotService, ITempcartService tempcartService, IEventRepository eventRepository, IEventAppointmentOnlineListModelFactory eventAppointmentOnlineListModelFactory,
                                 IEventTestRepository eventTestRepository, IOnlineShippingService onlineShippingService)
 {
     _eventPackageSelectorService   = eventPackageSelectorService;
     _eventSchedulingSlotRepository = eventSchedulingSlotRepository;
     _eventPackageRepository        = eventPackageRepository;
     _eventSchedulingSlotService    = eventSchedulingSlotService;
     _tempcartService = tempcartService;
     _eventRepository = eventRepository;
     _eventAppointmentOnlineListModelFactory = eventAppointmentOnlineListModelFactory;
     _eventTestRepository = eventTestRepository;
 }
Example #2
0
        public OrderedPair <List <Package>, List <Test> > GetPackagesAndTests(long eventId, long roleId)
        {
            IEventPackageRepository packageRepository = new EventPackageRepository();
            var eventPackages =
                packageRepository.GetPackagesForEventByRole(eventId, roleId).OrderByDescending(p => p.Price);
            var packages = eventPackages.Select(ep => ep.Package).ToList();

            IEventTestRepository eventTestRepository = new EventTestRepository();
            var eventTests = eventTestRepository.GetTestsForEventByRole(eventId, roleId);
            var tests      = eventTests.Select(et => et.Test).ToList();

            var packagesAndTests = new OrderedPair <List <Package>, List <Test> >(packages, tests);

            return(packagesAndTests);
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetTitle();
            if (!IsPostBack)
            {
                if (RegistrationFlow != null && RegistrationFlow.IsRetest)
                {
                    RetestNo.Checked  = false;
                    RetestYes.Checked = true;
                }
                else
                {
                    RetestNo.Checked  = true;
                    RetestYes.Checked = false;
                }

                if (RegistrationFlow != null && RegistrationFlow.SingleTestOverride)
                {
                    SingleTestOverrideYes.Checked = true;
                    SingleTestOverrideNo.Checked  = false;
                }
                else
                {
                    SingleTestOverrideYes.Checked = false;
                    SingleTestOverrideNo.Checked  = true;
                }

                if (Request.QueryString["EventID"] != null)
                {
                    EventId = long.Parse(Request.QueryString["EventID"]);
                }
                if (EventId != 0)
                {
                    // Hack: This is  done if the user hits back button on payment page, to get back to select package page.
                    if (SourceCodeId > 0 && !string.IsNullOrEmpty(SourceCode))
                    {
                        txtCouponCode.Text = SourceCode;
                    }
                }
                else
                {
                    const string message = "Sorry, Event detail not found. <a href=\"RegCustomerSearchEvent.aspx\">Click here</a> to search event again ";
                    DisplayErrorMessage(message);
                }
                //ItemCartControl.EventId = EventId;
                //ItemCartControl.RoleId = (long)Roles.Technician;
                //ItemCartControl.PackageId = PackageId;
                //ItemCartControl.TestIds = TestIds;
            }

            if (EventId > 0)
            {
                if (EventData != null)
                {
                    EventType = EventData.EventType;

                    var configurationSettingRepository = IoC.Resolve <IConfigurationSettingRepository>();
                    EnableAlaCarte = Convert.ToBoolean(configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableAlaCarte));
                    if (EnableAlaCarte)
                    {
                        EnableAlaCarte = EventData.EnableAlaCarteTechnician;
                    }
                }

                var eventCustomerQuestionAnswerService = IoC.Resolve <IEventCustomerQuestionAnswerService>();
                hfQuestionAnsTestId.Value = eventCustomerQuestionAnswerService.GetQuestionAnswerTestIdString(CustomerId, EventId);

                IEventPackageRepository packageRepository = new EventPackageRepository();
                var preApprovedPackageRepository          = IoC.Resolve <IPreApprovedPackageRepository>();

                if (AccountByEventId != null && AccountByEventId.AllowPreQualifiedTestOnly)
                {
                    long preApprovedPackageId = preApprovedPackageRepository.CheckPreApprovedPackages(CustomerId);
                    if (PackageId == 0 && preApprovedPackageId > 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest)))
                    {
                        var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep);

                        if (!eventPackages.IsNullOrEmpty())
                        {
                            var preApprovedPackage = eventPackages.FirstOrDefault(x => x.PackageId == preApprovedPackageId);
                            if (preApprovedPackage != null)
                            {
                                PackageId = preApprovedPackage.PackageId;
                                TestIds   = preApprovedPackage.Tests.Select(t => t.TestId).ToList();
                            }
                        }
                    }
                }

                if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.DisqualifiedTest) && string.IsNullOrWhiteSpace(hfDisqualifedTest.Value))
                {
                    hfDisqualifedTest.Value = RegistrationFlow.DisqualifiedTest;
                }

                if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.QuestionIdAnswerTestId) && string.IsNullOrWhiteSpace(hfQuestionAnsTestId.Value))
                {
                    hfQuestionAnsTestId.Value = RegistrationFlow.QuestionIdAnswerTestId;
                }

                /*if (!DisqualifiedTestIds.IsNullOrEmpty())
                 * {
                 *  TestIds = TestIds.Where(x => !DisqualifiedTestIds.Contains(x)).ToList();
                 * }*/


                ItemCartControl.EventId   = EventId;
                ItemCartControl.RoleId    = (long)Roles.Technician;
                ItemCartControl.PackageId = PackageId;
                ItemCartControl.TestIds   = TestIds;
            }

            ClientScript.RegisterStartupScript(typeof(string), "JsCode_WaitForPageLoad", " $('.package-list').toggle(); ", true);
            if (Request.Params["__EVENTTARGET"] == "NextButton" && Request.Params["__EVENTARGUMENT"] == "Click")
            {
                NextButtonClick();
            }
        }
        private void UpdateCustomerOrder(long eventId, long customerId, IEnumerable <long> testIds, long orgUserId)
        {
            var order = _orderRepository.GetOrder(customerId, eventId);

            if (order != null && !order.OrderDetails.IsEmpty())
            {
                var orderDetail = _orderController.GetActiveOrderDetail(order);

                var eventTestOrderDetails = order.OrderDetails.Where(od => od.OrderItem.OrderItemType == OrderItemType.EventTestItem).Select(od => od).ToArray();

                var packageId = 0L;
                if (orderDetail.OrderItem.OrderItemType == OrderItemType.EventPackageItem)
                {
                    var eventPackage = _eventPackageRepository.GetById(orderDetail.OrderItem.ItemId);
                    packageId = eventPackage.PackageId;
                }

                var orderables      = new List <IOrderable>();
                var selectedTestIds = testIds.ToList();



                if (packageId > 0)
                {
                    IEventPackageRepository eventPackageRepository = new EventPackageRepository();
                    var eventPackage = eventPackageRepository.GetByEventAndPackageIds(eventId, packageId);
                    orderables.Add(eventPackage);

                    RemoveTestsAlreadyInPackage(eventId, packageId, selectedTestIds);
                }

                if (!eventTestOrderDetails.IsNullOrEmpty())
                {
                    var eventTestIds     = eventTestOrderDetails.Select(od => od.OrderItem.ItemId).ToArray();
                    var eventTestInOrder = _eventTestRepository.GetbyIds(eventTestIds);

                    var testAlreadyInOrders = eventTestInOrder.Select(et => et.TestId).ToArray();
                    selectedTestIds = selectedTestIds.Where(x => !testAlreadyInOrders.Contains(x)).ToList();

                    if (testAlreadyInOrders.Any(x => AbiGroup.Contains(x)))
                    {
                        selectedTestIds.RemoveAll(AbiGroup.Contains);
                    }

                    if (testAlreadyInOrders.Any(x => DpnMonofilamentGroup.Contains(x)))
                    {
                        selectedTestIds.RemoveAll(DpnMonofilamentGroup.Contains);
                    }

                    var activeEventTestOrderDetails = order.OrderDetails.Where(od => od.OrderItem.OrderItemType == OrderItemType.EventTestItem && od.IsCompleted).Select(od => od).ToArray();
                    if (!activeEventTestOrderDetails.IsNullOrEmpty())
                    {
                        var activEventTestIds         = activeEventTestOrderDetails.Select(od => od.OrderItem.ItemId).ToArray();
                        var activeTestAlreadyInOrders = eventTestInOrder.Where(x => activEventTestIds.Contains(x.Id)).Select(et => et.TestId).ToArray();

                        selectedTestIds.AddRange(activeTestAlreadyInOrders);
                    }
                }

                if (!selectedTestIds.IsNullOrEmpty())
                {
                    var eventTests = _eventTestRepository.GetByEventAndTestIds(eventId, selectedTestIds);
                    if (AddMissingTestToEvent(eventId, selectedTestIds, eventTests))
                    {
                        eventTests = _eventTestRepository.GetByEventAndTestIds(eventId, selectedTestIds);
                    }

                    if (packageId > 0)
                    {
                        foreach (var eventTest in eventTests)
                        {
                            eventTest.Price = eventTest.WithPackagePrice;
                        }
                    }

                    orderables.AddRange(eventTests);

                    bool indentedLineItemsAdded = false;

                    foreach (var orderable in orderables)
                    {
                        if (!indentedLineItemsAdded && (orderable.OrderItemType == OrderItemType.EventPackageItem || orderable.OrderItemType == OrderItemType.EventTestItem))
                        {
                            _orderController.AddItem(orderable, 1, customerId, orgUserId, null, null, null, OrderStatusState.FinalSuccess, (long)OrderSource.Medicare);
                            indentedLineItemsAdded = true;
                        }
                        else
                        {
                            _orderController.AddItem(orderable, 1, customerId, orgUserId, OrderStatusState.FinalSuccess, (long)OrderSource.Medicare);
                        }
                    }

                    _orderController.PlaceOrder(order);
                }
            }
        }
Example #5
0
        public bool ChangePackage(long eventId, long customerId, IEnumerable <long> testIds)
        {
            var patientOrder = GetOrder(customerId, eventId);

            if (patientOrder != null && !patientOrder.OrderDetails.IsEmpty())
            {
                var creatorOrganizationRoleUser = GetCreatorOrganizationRoleUser();

                var forOrganizationRoleUser = GetForOrganizationRoleUser(customerId);

                var orderDetail = _orderController.GetActiveOrderDetail(patientOrder);

                var eventTestOrderDetails = patientOrder.OrderDetails.Where(od => od.OrderItem.OrderItemType == OrderItemType.EventTestItem && od.IsCompleted && (od.SourceId.HasValue && od.SourceId.Value != (long)OrderSource.Medicare)).Select(od => od).ToArray();

                var packageId = 0L;
                if (orderDetail.OrderItem.OrderItemType == OrderItemType.EventPackageItem)
                {
                    var eventPackage = _eventPackageRepository.GetById(orderDetail.OrderItem.ItemId);
                    packageId = eventPackage.PackageId;
                }

                var orderables      = new List <IOrderable>();
                var selectedTestIds = testIds.ToList();

                if (packageId > 0)
                {
                    IEventPackageRepository eventPackageRepository = new EventPackageRepository();
                    var eventPackage = eventPackageRepository.GetByEventAndPackageIds(eventId, packageId);
                    orderables.Add(eventPackage);

                    RemoveTestsAlreadyInPackage(eventId, packageId, selectedTestIds);
                }

                IEventTestRepository eventTestRepository = new EventTestRepository();
                if (!eventTestOrderDetails.IsNullOrEmpty())
                {
                    var eventTestIds          = eventTestOrderDetails.Select(od => od.OrderItem.ItemId).ToArray();
                    var nonMedicareEventTests = eventTestRepository.GetbyIds(eventTestIds);
                    orderables.AddRange(nonMedicareEventTests);
                    var nonMedicareEventTestIds = nonMedicareEventTests.Select(et => et.TestId).ToArray();
                    selectedTestIds = selectedTestIds.Where(x => !nonMedicareEventTestIds.Contains(x)).ToList();
                }

                if (!selectedTestIds.IsNullOrEmpty())
                {
                    var eventTests = eventTestRepository.GetByEventAndTestIds(eventId, selectedTestIds);

                    if (packageId > 0)
                    {
                        foreach (var eventTest in eventTests)
                        {
                            eventTest.Price = eventTest.WithPackagePrice;
                        }
                    }
                    orderables.AddRange(eventTests);
                }

                var eventCustomer = UpdateEventCustomer(orderDetail, false);
                if (eventCustomer == null)
                {
                    return(false);
                }

                bool indentedLineItemsAdded = false;

                foreach (var orderable in orderables)
                {
                    if (!indentedLineItemsAdded && (orderable.OrderItemType == OrderItemType.EventPackageItem || orderable.OrderItemType == OrderItemType.EventTestItem))
                    {
                        _orderController.AddItem(orderable, 1, forOrganizationRoleUser.Id, creatorOrganizationRoleUser.Id, null, null, null, OrderStatusState.FinalSuccess, (long)OrderSource.Medicare);
                        indentedLineItemsAdded = true;
                    }
                    else
                    {
                        _orderController.AddItem(orderable, 1, forOrganizationRoleUser.Id, creatorOrganizationRoleUser.Id, OrderStatusState.FinalSuccess, (long)OrderSource.Medicare);
                    }
                }

                _orderController.PlaceOrder(patientOrder);
            }
            return(true);
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RegistrationFlow.CanSaveConsentInfo = false;
            SetTitle();
            bool defaultBasePackage = false;

            FillClinicialQuestionnaireDiv.Visible = false;
            ClinicalQuestionTemplateId            = 0;
            IsClinicalQuestionaireFilled          = false;


            if (EventId > 0)
            {
                if (EventData != null)
                {
                    EventType = EventData.EventType;

                    var configurationSettingRepository = IoC.Resolve <IConfigurationSettingRepository>();
                    EnableAlaCarte = Convert.ToBoolean(configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableAlaCarte));
                    if (EnableAlaCarte)
                    {
                        EnableAlaCarte = EventData.EnableAlaCarteCallCenter;
                    }
                }

                if (AccountByEventId != null)
                {
                    if (AccountByEventId.AskClinicalQuestions && AccountByEventId.ClinicalQuestionTemplateId.HasValue)
                    {
                        FillClinicialQuestionnaireDiv.Visible = true;
                        ClinicalQuestionTemplateId            = AccountByEventId.ClinicalQuestionTemplateId.Value;
                        GetRecommendationText();
                    }
                    defaultBasePackage = AccountByEventId.DefaultSelectionBasePackage;

                    // for penguin integartion
                    var settings = IoC.Resolve <ISettings>();

                    QuestionnaireType questionnaireType = QuestionnaireType.None;
                    if (AccountByEventId != null && AccountByEventId.IsHealthPlan && EventData != null)
                    {
                        var accountHraChatQuestionnaireHistoryServices = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>();
                        questionnaireType = accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(AccountByEventId.Id, EventData.EventDate);
                    }

                    if (questionnaireType == QuestionnaireType.HraQuestionnaire)
                    {
                        var userSession = IoC.Resolve <ISessionContext>().UserSession;
                        var token       =
                            (Session.SessionID + "_" + userSession.UserId + "_" +
                             userSession.CurrentOrganizationRole.RoleId + "_" +
                             userSession.CurrentOrganizationRole.OrganizationId).Encrypt();


                        HraQuestionerAppUrlWithoutVisit = settings.HraQuestionerAppUrl + "?userToken=" +
                                                          HttpUtility.UrlEncode(token) + "&customerId=" + CustomerId + "&orgName=" +
                                                          settings.OrganizationNameForHraQuestioner + "&tag=" + AccountByEventId.Tag;
                        HraQuestionerAppUrl = HraQuestionerAppUrlWithoutVisit + "&visitId=" + (RegistrationFlow.AwvVisitId.HasValue ? RegistrationFlow.AwvVisitId.Value : 0);

                        ChatQuestionerAppUrl = string.Empty;
                    }
                    else if (questionnaireType == QuestionnaireType.ChatQuestionnaire)
                    {
                        ChatQuestionerAppUrl = settings.HraQuestionerAppUrl;
                        HraQuestionerAppUrl  = string.Empty;
                    }
                }
            }


            if (!IsPostBack)
            {
                if (RegistrationFlow != null && RegistrationFlow.IsRetest)
                {
                    RetestNo.Checked  = false;
                    RetestYes.Checked = true;
                }
                else
                {
                    RetestNo.Checked  = true;
                    RetestYes.Checked = false;
                }

                if (RegistrationFlow != null && RegistrationFlow.SingleTestOverride)
                {
                    SingleTestOverrideYes.Checked = true;
                    SingleTestOverrideNo.Checked  = false;
                }
                else
                {
                    SingleTestOverrideYes.Checked = false;
                    SingleTestOverrideNo.Checked  = true;
                }

                if (EventId != 0)
                {
                    // Hack: This is  done if the user hits back button on payment page, to get back to select package page.
                    if (SourceCodeId > 0 && !string.IsNullOrEmpty(SourceCode))
                    {
                        txtCouponCode.Text = SourceCode;
                    }
                    else if (RegistrationFlow != null)
                    {
                        txtCouponCode.Text = RegistrationFlow.CallSourceCode;
                    }

                    hfEventID.Value = EventId.ToString();

                    var eventCustomerQuestionAnswerService = IoC.Resolve <IEventCustomerQuestionAnswerService>();
                    hfQuestionAnsTestId.Value = eventCustomerQuestionAnswerService.GetQuestionAnswerTestIdString(CustomerId, EventId);
                }
                else
                {
                    const string message = "Sorry, Event detail not found. <a href=\"RegCustomerSearchEvent.aspx\">Click here</a> to search event again ";
                    DisplayErrorMessage(message);
                }

                if (CurrentProspectCustomer != null && CurrentProspectCustomer.Id > 0 && CurrentProspectCustomer.SourceCodeId != null && CurrentProspectCustomer.SourceCodeId.Value > 0)
                {
                    ISourceCodeRepository sourceCodeRepository = new SourceCodeRepository();
                    var sourceCode = sourceCodeRepository.GetSourceCodeById(CurrentProspectCustomer.SourceCodeId.Value);
                    if (sourceCode != null)
                    {
                        txtCouponCode.Text = sourceCode.CouponCode;
                    }
                }
                IEventPackageRepository packageRepository = new EventPackageRepository();
                var preApprovedPackageRepository          = IoC.Resolve <IPreApprovedPackageRepository>();

                if (AccountByEventId != null && AccountByEventId.AllowPreQualifiedTestOnly)
                {
                    long preApprovedPackageId = preApprovedPackageRepository.CheckPreApprovedPackages(CustomerId);
                    if (PackageId == 0 && preApprovedPackageId > 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest)))
                    {
                        var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep);

                        if (!eventPackages.IsNullOrEmpty())
                        {
                            var preApprovedPackage = eventPackages.FirstOrDefault(x => x.PackageId == preApprovedPackageId);
                            if (preApprovedPackage != null)
                            {
                                PackageId = preApprovedPackage.PackageId;
                                TestIds   = preApprovedPackage.Tests.Select(t => t.TestId).ToList();
                            }
                        }
                    }
                }


                if (defaultBasePackage && PackageId == 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest)))
                {
                    var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep)
                                        .OrderBy(p => p.Price);
                    if (!eventPackages.IsNullOrEmpty())
                    {
                        var lowestPricePackage = eventPackages.First();
                        PackageId = lowestPricePackage.PackageId;
                        TestIds   = lowestPricePackage.Tests.Select(t => t.TestId).ToList();
                    }
                }

                if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.DisqualifiedTest) && string.IsNullOrWhiteSpace(hfDisqualifedTest.Value))
                {
                    hfDisqualifedTest.Value = RegistrationFlow.DisqualifiedTest;
                }

                if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.QuestionIdAnswerTestId) && string.IsNullOrWhiteSpace(hfQuestionAnsTestId.Value))
                {
                    hfQuestionAnsTestId.Value = RegistrationFlow.QuestionIdAnswerTestId;
                }

                /*if (!DisqualifiedTestIds.IsNullOrEmpty())
                 * {
                 *  TestIds = TestIds.Where(x => !DisqualifiedTestIds.Contains(x)).ToList();
                 * }*/

                ItemCartControl.EventId   = EventId;
                ItemCartControl.RoleId    = (long)Roles.CallCenterRep;
                ItemCartControl.PackageId = PackageId;
                ItemCartControl.TestIds   = TestIds;

                if (Request.QueryString["Call"] != null && Request.QueryString["Call"] == "No")
                {
                    divCall.Style.Add(HtmlTextWriterStyle.Display, "none");
                    divCall.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");
                }
                else
                {
                    var repository = new CallCenterCallRepository();
                    hfCallStartTime.Value = repository.GetCallStarttime(CallId);
                }

                if (Request.UrlReferrer != null)
                {
                    ViewState["UrlReferer"] = Request.UrlReferrer.PathAndQuery;
                }
            }
            if (Request.Params["__EVENTTARGET"] == "NextButton" && Request.Params["__EVENTARGUMENT"] == "Click")
            {
                NextButtonClick();
            }
        }