示例#1
0
        public ActionResult Index(QuoteViewModel vm)
        {
            try
            {
                // Determine eligibility
                EligibilityInfo eligibility = BusinessRulesClass.IsEligible(vm.Age, vm.stateInfo.Name, vm.tobacco, vm.health, null == vm.ReplacementPolicy ? false : vm.ReplacementPolicy.Value);

                // If eligible build XML and send to firelight
                if (eligibility.IsEligible)
                {
                    // Build XMLs
                    var client = new NewBusinessService.NewBusinessClient("CustomBinding_NewBusiness");
                    var txLife = Create103(vm);
                    NewBusinessService.TXLife response = client.SubmitNewBusinessApplication(txLife);

                    var code = response.TXLifeResponse[0].TransResult.ResultCode.Value; //response code??
                    if (code == "RESULT_SUCCESS")
                    {
                        //redirect to url
                        string url = String.Format("https://uat.firelighteapp.com/EGApp/PassiveCall.aspx?O=3138&C=D2C&refid={0}", response.TXLifeResponse[0].TransRefGUID ?? String.Empty);
                        return(Redirect(url));
                    }
                    else
                    {
                        //failed
                        var msg = response.TXLifeResponse[0].TransResult.ResultInfo[0].ResultInfoDesc;
                        vm.ViewMessages.Add("Web Service Returned a Failure Code: " + msg);
                        return(View(vm));
                    }
                }
                else
                {
                    TempData["ContactViewModel"] = new ContactViewModel {
                        DenialMessage = eligibility.EligibilityMessage, IsReplacementReject = eligibility.IsReplacememtReject, State = eligibility.State
                    };
                    return(RedirectToActionPermanent("Contact", "Contact"));
                }
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                var msg = "There was an error connecting to the application portal.";
                vm.ViewMessages.Add(msg);
                return(View(vm));
            }
        }
示例#2
0
        public ActionResult Index(QuoteViewModel vm)
        {
            try
            {
                //if coverage supplied, limit coverage to max of 1,000,000 based on age
                decimal maxCoverage = 0M;
                maxCoverage = QuoteViewModel.GetMaxCoverageBasedOnAge(vm.Age);

                vm.CoverageAmount = vm.CoverageAmount > maxCoverage ? maxCoverage : vm.CoverageAmount; //update coverage based on max

                /*
                 * //override coverage based on health and smoker status
                 * if ((vm.health == "OLI_UNWRITE_RATED" || vm.health == "OLI_UNWRITE_POOR") && vm.tobacco == "OLI_TOBACCO_CURRENT")
                 *  vm.CoverageAmount = 750000M;
                 */

                //override coverage based on risk class
                if (vm.Age < 56 && vm.CoverageAmount < 525000M && (vm.riskClass.TC == (int)QuoteViewModel.RiskClasses.RATED_TOBACCO ||
                                                                   vm.riskClass.TC == (int)QuoteViewModel.RiskClasses.RATED2_NONTOBACCO ||
                                                                   vm.riskClass.TC == (int)QuoteViewModel.RiskClasses.RATED2_TOBACCO))
                {
                    vm.CoverageAmount = 525000M;
                }

                // Determine eligibility
                EligibilityInfo eligibility = BusinessRulesClass.IsEligible(vm.Age, vm.stateInfo.Name, vm.tobacco, vm.health, null == vm.ReplacementPolicy ? false : vm.ReplacementPolicy.Value);

                // If eligible build XML and send to firelight
                if (eligibility.IsEligible)
                {
                    // Build XMLs
                    var client  = new NewBusinessService.NewBusinessClient("CustomBinding_NewBusiness");
                    var addrUri = client.Endpoint.Address.Uri;
                    var newUri  = String.Format(addrUri.ToString(), Session["GCId"] ?? "");

                    var newAddress = new System.ServiceModel.EndpointAddress(newUri);
                    client.Endpoint.Address = newAddress;

                    var txLife = Create103(vm);
                    NewBusinessService.TXLife response = client.SubmitNewBusinessApplication(txLife);

                    var code = response.TXLifeResponse[0].TransResult.ResultCode.Value; //response code??
                    if (code == "RESULT_SUCCESS")
                    {
                        //redirect to url
#if DEBUG
                        string url = String.Format("https://staging.firelighteapp.com/egapp/PassiveCall.aspx?O=3138&C=D2C&refid={0}", response.TXLifeResponse[0].TransRefGUID ?? String.Empty, Session["GCId"] ?? String.Empty);
#else
                        string url = String.Format("https://www.firelighteapp.com/EGApp/PassiveCall.aspx?O=3138&C=D2C&refid={0}&GAT=UA-97044577-1&GAC={1}", response.TXLifeResponse[0].TransRefGUID ?? String.Empty, Session["GCId"] ?? String.Empty);
#endif
                        return(Redirect(url));
                    }

                    else
                    {
                        //failed
                        var msg = response.TXLifeResponse[0].TransResult.ResultInfo[0].ResultInfoDesc;
                        vm.ViewMessages.Add("Web Service Returned a Failure Code: " + msg);
                        return(View(vm));
                    }
                }
                else
                {
                    TempData["ContactViewModel"] = new Models.ContactModel {
                        denialMessage = eligibility.EligibilityMessage, isReplacementReject = eligibility.IsReplacememtReject, state = eligibility.State
                    };
                    return(RedirectToActionPermanent("Contact", "Contact"));
                }
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                var msg = "There was an error connecting to the application portal.";
                vm.ViewMessages.Add(msg);
                return(View(vm));
            }
        }