public EventAppointmentOnlineListModel GetEventAppointmentSlotOnline(string guid)
        {
            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid);

            if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid)
            {
                return new EventAppointmentOnlineListModel()
                       {
                           RequestValidationModel = onlineRequestValidationModel
                       }
            }
            ;

            var model = _onlineAppointmentService.GetEventAppointmentSlotOnline(onlineRequestValidationModel.TempCart);

            model.RequestValidationModel = onlineRequestValidationModel;

            var tempCart = onlineRequestValidationModel.TempCart;

            if (tempCart.EventId.HasValue && tempCart.EventId > 0 && tempCart.EventPackageId.HasValue)
            {
                var allAdditionalTests = _onlinePackageService.GetAdditionalTest(tempCart);

                model.IsAdditionalTestAvailable = allAdditionalTests != null && allAdditionalTests.Any();
                model.UpsellTestAvailable       = _onlinePackageService.IsUpsellTestAvailable(tempCart);
            }
            return(model);
        }
Exemplo n.º 2
0
        public OrderPlaceEditModel GetEventPackageList(string guid)
        {
            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid);

            if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid)
            {
                return new OrderPlaceEditModel()
                       {
                           RequestValidationModel = onlineRequestValidationModel
                       }
            }
            ;

            var tempCart = onlineRequestValidationModel.TempCart;

            var returnObj = _onlinePackageService.GetEventPackageList(tempCart);

            returnObj.RequestValidationModel = onlineRequestValidationModel;

            if (tempCart.EventId.HasValue && tempCart.EventId > 0 && !string.IsNullOrEmpty(tempCart.Gender) && tempCart.EventPackageId.HasValue)
            {
                returnObj.UpsellTestAvailable = _onlinePackageService.IsUpsellTestAvailable(tempCart);

                var allAdditionalTests = _onlinePackageService.GetAdditionalTest(tempCart);
                returnObj.IsAdditionalTestAvailable = allAdditionalTests != null && allAdditionalTests.Any();
            }

            return(returnObj);
        }
Exemplo n.º 3
0
        public List <string> FetchMarketingSourceByZip(string guid, string text)
        {
            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid);
            var model = new OnlineSchedulingCustomerInfoEditModel
            {
                RequestValidationModel = onlineRequestValidationModel
            };
            var    tempCart = onlineRequestValidationModel.TempCart;
            string zip      = "";
            var    customer = tempCart.CustomerId.HasValue ? _customerRepository.GetCustomer(tempCart.CustomerId.Value) : null;

            if (customer != null)
            {
                zip = customer.Address.ZipCode.Zip;
            }
            return(_marketingSourceService.FetchMarketingSourceByZip(zip, true).Where(x => x.ToLower().StartsWith(text.ToLower())).ToList());
        }
        public OnlineHealthAssessmentQuestionModel GetHealthAssessmentQuestion(string guid)
        {
            var requestValidatonModel = _tempcartService.ValidateOnlineRequest(guid);

            var model = new OnlineHealthAssessmentQuestionModel {
                RequestValidationModel = requestValidatonModel
            };

            var tempCart = model.RequestValidationModel.TempCart;

            if ((requestValidatonModel.RequestStatus != OnlineRequestStatus.Valid && requestValidatonModel.RequestStatus != OnlineRequestStatus.Completed) || tempCart == null || !(tempCart.EventId.HasValue && tempCart.CustomerId.HasValue))
            {
                return(model);
            }

            return(_onlineHealthAssessmentService.Get(model));;
        }
Exemplo n.º 5
0
        public OnlineEventListModel GetEvents([FromUri] OnlineSchedulingEventListModelFilter filter)
        {
            filter.CutOffHourstoMarkEventforOnlineSelection = _cutOffhoursbeforeEventSelection;

            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(filter.Guid);

            var model = new OnlineEventListModel {
                RequestValidationModel = onlineRequestValidationModel
            };

            if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid)
            {
                return(model);
            }

            int totalRecords = 0;

            if (!string.IsNullOrEmpty(filter.Guid))
            {
                filter = CompleteFilter(model.RequestValidationModel.TempCart, filter);
            }
            model.Events = _onlineEventService.GetEvents(filter, _maxNumberOfEventstoFetch, _pageSize, out totalRecords);

            model.TotalEvents = totalRecords;
            model.PagingModel = new PagingModel(filter.PageNumber, _pageSize, totalRecords, null);

            if (string.IsNullOrWhiteSpace(filter.InvitationCode))
            {
                return(model);
            }
            ;

            var theEvent = _eventRepository.GetEventByInvitationCode(filter.InvitationCode);

            if (theEvent != null)
            {
                var account = _corporateAccountRepository.GetbyEventId(theEvent.Id);
                if (account != null && account.CheckoutPhoneNumber != null && !string.IsNullOrWhiteSpace(account.CheckoutPhoneNumber.DomesticPhoneNumber))
                {
                    model.CheckoutPhoneNumber = account.CheckoutPhoneNumber.FormatPhoneNumber;
                }
            }
            return(model);
        }
Exemplo n.º 6
0
        public OnlineAppointmentConfirmation GetAppointmentConfirmation(string guid)
        {
            var model = new OnlineAppointmentConfirmation
            {
                RequestValidationModel = _tempcartService.ValidateOnlineRequest(guid)
            };

            if (model.RequestValidationModel.RequestStatus != OnlineRequestStatus.Completed)
            {
                return(model);
            }
            var tempCart = model.RequestValidationModel.TempCart;

            var eventData = _eventRepository.GetById(tempCart.EventId.Value);

            model.EventType = eventData.EventType;


            return(model);
        }
Exemplo n.º 7
0
        public UserLoginResponseModel ValidateUser(UserLoginModel userLoginModel, string guid)
        {
            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid);

            var model = new UserLoginResponseModel()
            {
                RequestValidationModel = onlineRequestValidationModel
            };

            if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid)
            {
                return(model);
            }

            if (!ModelState.IsValid)
            {
                throw new Exception("Please enter a valid Username/Password!");
            }

            var isValid = _userLoginRepository.ValidateUser(userLoginModel.UserName, userLoginModel.Password);

            if (!isValid)
            {
                GetLoginFailureMessage(userLoginModel);
            }

            var userLogin = _userLoginRepository.GetByUserName(userLoginModel.UserName);
            var customer  = _customerRepository.GetCustomerByUserId(userLogin.Id);

            model = new UserLoginResponseModel {
                CustomerId = customer.CustomerId, CustomerName = customer.NameAsString, IsValid = true, Message = "", RequestValidationModel = onlineRequestValidationModel
            };


            return(model);
        }
Exemplo n.º 8
0
        public OnlineSchedulingCustomerInfoEditModel GetPaymentInfo(string guid)
        {
            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid);

            if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid)
            {
                return new OnlineSchedulingCustomerInfoEditModel
                       {
                           RequestValidationModel = onlineRequestValidationModel
                       }
            }
            ;

            var tempCart = onlineRequestValidationModel.TempCart;
            var model    = new OnlineSchedulingCustomerInfoEditModel
            {
                ProcessAndCartViewModel        = _eventSchedulerService.GetOnlineCart(tempCart),
                EventCustomerOrderSummaryModel = _eventSchedulerService.GetEventCustomerOrderSummaryModel(guid),
                CustomerEditModel = new SchedulingCustomerEditModel {
                    EnableTexting = _enableTexting
                },
                SourceCodeApplyEditModel = _eventSchedulerService.GetSourceCodeApplied(tempCart),
                RequestValidationModel   = onlineRequestValidationModel
            };
            var newsletterprompt = Convert.ToBoolean(_configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableNewsletterPrompt));

            if (newsletterprompt && model.EventCustomerOrderSummaryModel != null &&
                model.EventCustomerOrderSummaryModel.EventType == EventType.Retail)
            {
                model.RequestForNewsLetterDescription =
                    _toolTipRepository.GetToolTipContentByTag(ToolTipType.OnlineNewsletterDescription);

                model.ShowNewsLetterPrompt = true;
            }

            model.EventCustomerOrderSummaryModel = _eventSchedulerService.GetEventCustomerOrderSummaryModel(guid);
            model.StateList = _stateRepository.GetAllStates().ToList().Select(x => new OrderedPair <long, string>(x.Id, x.Name));

            var customer = tempCart.CustomerId.HasValue ? _customerRepository.GetCustomer(tempCart.CustomerId.Value) : null;

            if (customer == null && tempCart.ProspectCustomerId.HasValue && tempCart.ProspectCustomerId.Value > 0)
            {
                model.CustomerEditModel = _prospectCustomerService.GetforProspectCustomerId(tempCart.ProspectCustomerId.Value);
            }
            else if (customer != null)
            {
                model.CustomerEditModel = Mapper.Map <Customer, SchedulingCustomerEditModel>(customer);
                model.CustomerEditModel.ShippingAddress            = Mapper.Map <Address, AddressEditModel>(customer.Address);
                model.CustomerEditModel.ConfirmationToEnablTexting = customer.EnableTexting;

                //model.CustomerEditModel.ShippingAddress.Id = tempCart.ShippingAddressId.HasValue ? tempCart.ShippingAddressId.Value : 0;
            }

            //payment
            if (model.PaymentEditModel == null)
            {
                model.PaymentEditModel = new PaymentEditModel
                {
                    PaymentFlow = PaymentFlow.In,
                    Amount      = model.EventCustomerOrderSummaryModel.AmountDue.HasValue ? model.EventCustomerOrderSummaryModel.AmountDue.Value : 0,
                    ShippingAddressSameAsBillingAddress = true
                };
            }


            if (customer != null && ((customer.BillingAddress != null && customer.BillingAddress.StreetAddressLine1 != OnlineAddress1) || (customer.Address != null && customer.Address.StreetAddressLine1 != OnlineAddress1)))
            {
                model.PaymentEditModel.ExistingBillingAddress    = Mapper.Map <Address, AddressEditModel>(customer.BillingAddress ?? customer.Address);
                model.PaymentEditModel.ExistingBillingAddress.Id = customer.BillingAddress != null ? customer.BillingAddress.Id : 0;

                model.PaymentEditModel.ExistingShippingAddress    = Mapper.Map <Address, AddressEditModel>(customer.BillingAddress ?? customer.Address);
                model.PaymentEditModel.ExistingShippingAddress.Id = customer.Address != null ? customer.Address.Id : 0;
            }

            model.RequestForNewsLetter = model.EventCustomerOrderSummaryModel != null && model.EventCustomerOrderSummaryModel.EventType == EventType.Retail;

            model.PaymentEditModel.AllowedPaymentTypes = new[] {
                new OrderedPair <long, string>(PaymentType.CreditCard.PersistenceLayerId, PaymentType.CreditCard.Name),
                new OrderedPair <long, string>(PaymentType.ElectronicCheck.PersistenceLayerId, PaymentType.ElectronicCheck.Name),
                new OrderedPair <long, string>(PaymentType.GiftCertificate.PersistenceLayerId, PaymentType.GiftCertificate.Name)
            };

            var payLaterOnlineRegistration = Convert.ToBoolean(_configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.PayLaterOnlineRegistration));

            if (payLaterOnlineRegistration)
            {
                var payLaterOption = new[] { new OrderedPair <long, string>(PaymentType.Onsite_Value, PaymentType.PayLater_Text) };
                model.PaymentEditModel.AllowedPaymentTypes = model.PaymentEditModel.AllowedPaymentTypes.Concat(payLaterOption);
            }

            var eventId      = model.EventCustomerOrderSummaryModel.EventId.HasValue ? model.EventCustomerOrderSummaryModel.EventId.Value : 0;
            var packageId    = model.SourceCodeApplyEditModel.Package != null ? model.SourceCodeApplyEditModel.Package.FirstValue : 0;
            var addOnTestIds = model.SourceCodeApplyEditModel.SelectedTests != null?model.SourceCodeApplyEditModel.SelectedTests.Select(st => st.FirstValue).ToArray() : null;

            var testCoveredByInsurance = _eligibilityService.CheckTestCoveredByinsurance(eventId, packageId, addOnTestIds);

            if (testCoveredByInsurance)
            {
                var insurancePaymentOption = new[] { new OrderedPair <long, string>(PaymentType.Insurance.PersistenceLayerId, PaymentType.Insurance.Name) };
                model.PaymentEditModel.AllowedPaymentTypes = model.PaymentEditModel.AllowedPaymentTypes.Concat(insurancePaymentOption);
            }

            if (model.EventCustomerOrderSummaryModel.AmountDue != null && model.EventCustomerOrderSummaryModel.AmountDue > 0)
            {
                if (payLaterOnlineRegistration)
                {
                    model.PaymentEditModel.Payments = new[]
                    {
                        new PaymentInstrumentEditModel
                        {
                            Amount      = model.EventCustomerOrderSummaryModel.AmountDue.Value,
                            PaymentType = Convert.ToInt32(PaymentType.Onsite_Value)
                        }
                    };
                }
                else
                {
                    model.PaymentEditModel.Payments = new[]
                    {
                        new PaymentInstrumentEditModel
                        {
                            Amount     = model.EventCustomerOrderSummaryModel.AmountDue.Value,
                            ChargeCard = new ChargeCardPaymentEditModel()
                            {
                                ChargeCard = (tempCart.ChargeCardId.HasValue && tempCart.ChargeCardId.Value > 0)
                                                                          ?_chargeCardRepository.GetById(tempCart.ChargeCardId.Value)
                                                                          :new ChargeCard()
                            }
                        }
                    };


                    if (testCoveredByInsurance && tempCart.EligibilityId.HasValue && tempCart.EligibilityId.Value > 0 && tempCart.ChargeCardId.HasValue && tempCart.ChargeCardId.Value > 0)
                    {
                        var insurancePayment = new[]
                        {
                            new PaymentInstrumentEditModel
                            {
                                Insurance = new InsurancePaymentEditModel
                                {
                                    EligibilityId = tempCart.EligibilityId.Value,
                                    ChargeCardId  = tempCart.ChargeCardId.Value
                                }
                            }
                        };
                        model.PaymentEditModel.Payments = model.PaymentEditModel.Payments.Concat(insurancePayment);
                    }
                }
            }
            else
            {
                model.PaymentEditModel.ShippingAddressSameAsBillingAddress = false;
            }

            return(model);
        }