コード例 #1
0
        private static Random random = new Random((int)DateTime.Now.Ticks);//thanks to McAden

        public decimal GetPremiumDetail(MobileHome.Insure.Model.Rental.Quote quote, bool generatePolicy = false)
        {
            decimal premium = 0;

            //prepare XML file for sending and take the result from other service
            using (var cxt = new mhRentalContext())
            {
                //cxt.Configuration.ProxyCreationEnabled = false;
                var customerInfo  = cxt.Customers.FirstOrDefault(c => c.Id == quote.CustomerId);
                var amountCharged = 0M;
                // As per requirement, we are not sending the proc fee to aegis
                if (quote.InstallmentFee.HasValue)
                {
                    amountCharged = quote.PremiumChargedToday.Value + quote.InstallmentFee.Value;
                }

                XElement rootEle = new XElement("root",
                                                GetPolicyReturnInfo(generatePolicy, amountCharged),
                                                GetPropertyDealerInfo(string.IsNullOrEmpty(customerInfo.Park.Subproducer) ? ConfigurationManager.AppSettings["MHISubproducerCode"] : customerInfo.Park.Subproducer),
                                                GetPropertyInfo(customerInfo),
                                                new XElement("unitinfo", GetHouseUnitInfo(quote.PersonalProperty))
                                                );

                rootEle.Element("unitinfo").Add(new XElement("covinfo",
                                                             GetCoverItemInfo(CoverType.persprop, limit: quote.PersonalProperty),
                                                             GetCoverItemInfo(CoverType.deductible, deductible: quote.Deductible),
                                                             GetCoverItemInfo(CoverType.lou, limit: quote.LOU),
                                                             GetCoverItemInfo(CoverType.liability, limit: quote.Liability),
                                                             GetCoverItemInfo(CoverType.medpay, limit: quote.MedPay),
                                                             GetCoverItemInfo(CoverType.thirdpartydesignee)
                                                             ));
                if (quote.SendLandLord)
                {
                    rootEle.Element("unitinfo").Add(new XElement("addl_exposure",
                                                                 GetAdditionalExposure(customerInfo.Park)));
                }

                //Call service and get the result with Premium
                ServiceSoapClient sClient = new ServiceSoapClient(ConfigurationManager.AppSettings["ServiceConfigName"]);
                sClient.InnerChannel.OperationTimeout = new TimeSpan(0, 10, 0);

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(rootEle.ToString());
                XmlNode xnode = doc.FirstChild;

                XmlNode result = sClient.QuotePolicy(ConfigurationManager.AppSettings["PasskeyForAegisService"], xnode, "AGHO", AstecProcessingMode.SubmitOverride);

                if (result != null)
                {
                    var elements = result.SelectSingleNode("rtninfo");
                    if (elements != null && elements["returnc"].InnerText != "001")
                    {
                        quote.Premium        = premium = Convert.ToDecimal(elements["premwrit"].InnerText);
                        quote.ProposalNumber = elements["policynbr"].InnerText;
                    }
                }
            }
            return(premium);
        }
コード例 #2
0
        public ActionResult ExecuteQuote(int id)
        {
            var _serviceFacade = new RentalServiceFacade();

            MobileHome.Insure.Model.Rental.Quote quoteObject = _serviceFacade.GetQuoteById(id);
            Customer customerObject = null;
            DateTime creationDate   = DateTime.Now;

            if (quoteObject.CustomerId.HasValue)
            {
                customerObject = _serviceFacade.GetCustomerById(quoteObject.CustomerId.Value);
            }
            MobileHome.Insure.Model.Payment paymentResponse = _serviceFacade.GetPolicyReceiptById(quoteObject.Id);


            var rtn = new ExecuteQuoteViewModel
            {
                infoName       = customerObject.FirstName + " " + customerObject.LastName,
                infoAddress1   = customerObject.Address,
                infoAddress2   = "",
                infoCity       = customerObject.City,
                infoState      = customerObject.State.Name,
                infoZipCode    = customerObject.Zip,
                infoPhone      = customerObject.Phone,
                infoEmail      = customerObject.Email,
                infopolnbr     = quoteObject.ProposalNumber,
                infocopcod     = "Aegis",
                infoQuoteId    = quoteObject.Id,
                infomodeofpay  = paymentResponse == null ? "" :  paymentResponse.ModeOfPayment,
                infopmtid      = paymentResponse == null ? "" : paymentResponse.TransactionId,
                infopmtamt     = paymentResponse == null ? 0 : paymentResponse.Amount.Value,
                infopayopt     = Constants.InstallmentList[quoteObject.NoOfInstallments.Value],
                infotrndat     = creationDate.ToShortDateString(),
                infotrntim     = creationDate.ToShortTimeString(),
                infopmtinstfee = quoteObject != null && quoteObject.InstallmentFee.HasValue
                    ? quoteObject.InstallmentFee.Value
                    : 0,
                infopmtprocfee = quoteObject != null && quoteObject.ProcessingFee.HasValue
                    ? quoteObject.ProcessingFee.Value
                    : 0,
                infopmtamttotal = quoteObject != null && quoteObject.Premium.HasValue
                    ? quoteObject.Premium.Value
                    : 0,
                pmtamttoday = quoteObject != null && quoteObject.PremiumChargedToday.HasValue
                    ? quoteObject.PremiumChargedToday.Value
                    : 0,
                infonoofremainingpmt = quoteObject != null && quoteObject.Payments.Any()
                    ? quoteObject.NoOfInstallments.Value - 1
                    : 0
            };

            //return Json(rtn, JsonRequestBehavior.AllowGet);

            //return PartialView("~/areas/admin/views/customer/PolicyReceipt.cshtml", rtn.ToExpando());
            return(View(rtn.ToExpando()));
        }