Пример #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 void sendNotificationForPark(Park parkObj, bool isEdit)
        {
            List <string> emailNotification = null;
            string        body = "";

            if (!isEdit)
            {
                emailNotification = _context.ParkNotifies.Where(x => x.Zip == parkObj.PhysicalZip.ToString() && x.IsNotified == false).Select(y => y.Email).ToList();
                body = "New Park for your Zip is Added <br /> Park Name: " + parkObj.ParkName + " <br / > Address: " + parkObj.PhysicalAddress + " " + parkObj.PhysicalAddress2 + " <br /> Park City: " + parkObj.PhysicalCity + "<br /> Park County: " + parkObj.PhysicalCounty + "<br /> Park State: " + parkObj.PhysicalState.Name + "<br /> Park Zip: " + parkObj.PhysicalZip;
            }
            else
            {
                _rentalcontext    = new mhRentalContext();
                emailNotification = _rentalcontext.Customers.Where(x => x.Zip == parkObj.PhysicalZip.ToString() && x.IsActive == true).Select(y => y.Email).ToList();
                body = "Your park information has been edited. Here are the details: <br /> Park Name: " + parkObj.ParkName + " <br / > Address: " + parkObj.PhysicalAddress + " " + parkObj.PhysicalAddress2 + " <br /> Park City: " + parkObj.PhysicalCity + "<br /> Park County: " + parkObj.PhysicalCounty + "<br /> Park State: " + parkObj.PhysicalState.Name + "<br /> Park Zip: " + parkObj.PhysicalZip;
            }
            _genralServiceFacade.sendMail("*****@*****.**", "*****@*****.**", "", body, emailNotification);
        }
Пример #3
0
 public ServiceFacade()
 {
     _context       = new mhappraisalContext();
     _rentalContext = new mhRentalContext();
 }
 public RentalServiceFacade()
 {
     _context = new mhRentalContext();
 }