Ejemplo n.º 1
0
        public AIA.Life.Models.Opportunity.LifeQuote CalculateQuotePremium(AIA.Life.Models.Opportunity.LifeQuote objLifeQuote)
        {

            #region Added for Benefit  OverView
            objLifeQuote.LstBenefitOverView = new List<Models.Common.BenifitDetails>();
            objLifeQuote.LstPremiumOverview = new List<Models.Common.BenifitDetails>();
            List<Models.Common.BenifitDetails> BenefitOverView = new List<Models.Common.BenifitDetails>();
            Models.Common.BenifitDetails BasicCover = new Models.Common.BenifitDetails();
            BasicCover.BenefitID = 0;
            BasicCover.BenifitName = "Basic Cover";
            BenefitOverView.Add(BasicCover);
            foreach (var Member in objLifeQuote.objQuoteMemberDetails)
            {
                BenefitOverView.AddRange(Member.ObjBenefitDetails);
            }
            BenefitOverView = BenefitOverView.DistinctBy(a => a.BenefitID).ToList();

            // To Get Total
            Models.Common.BenifitDetails Total = new Models.Common.BenifitDetails();
            Total.BenefitID = -2;
            Total.BenifitName = "Total";
            BenefitOverView.Add(Total);
            // Till here

            objLifeQuote.LstBenefitOverView.AddRange(BenefitOverView);
            #endregion
            #region Call API
            objLifeQuote = WebApiLogic.GetPostComplexTypeToAPI<AIA.Life.Models.Opportunity.LifeQuote>(objLifeQuote, "CalculateQuotePremium", "Policy");
            #endregion

            return objLifeQuote;
        }
Ejemplo n.º 2
0
 public AIA.Life.Models.Opportunity.LifeQuote CalculateQuotePremium(AIA.Life.Models.Opportunity.LifeQuote objLifeQuote)
 {
     AIA.Life.Business.Policy.PolicyBusiness obj = new AIA.Life.Business.Policy.PolicyBusiness();
     objLifeQuote = obj.CalculateQuotePremium(objLifeQuote);
     return(objLifeQuote);
 }
Ejemplo n.º 3
0
        public AIA.Life.Models.Opportunity.LifeQuote SaveQuote(AIA.Life.Models.Opportunity.LifeQuote ObjQuote)
        {
            TpServiceLog tpServiceLog = new TpServiceLog();

            tpServiceLog.ServiceRequest = Newtonsoft.Json.JsonConvert.SerializeObject(ObjQuote);
            TransactLog transactLog = new TransactLog();

            transactLog.SerivceTraceID = tpServiceLog.ServiceTraceID = ObjQuote.ServiceTraceID;
            transactLog.UserName       = ObjQuote.UserName;
            string Message = ValidateUserAuth(transactLog);

            if (Message != "" && Message != null)
            {
                ObjQuote.Message = Message;
                return(ObjQuote);
            }
            string ObjSuspect = Newtonsoft.Json.JsonConvert.SerializeObject(ObjQuote);

            #region Proposer Signature
            if (ObjQuote.Signature != null)
            {
                ObjQuote.ProspectSign = Convert.FromBase64String(ObjQuote.Signature);
                string Proposerfilename     = "Proposersignature.png";
                string ProposerdirectryPath = "";
                ProposerdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + ObjQuote.objProspect.ContactID);
                //ProposerdirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + ObjQuote.objProspect.ContactID);
                if (!Directory.Exists(ProposerdirectryPath))
                {
                    Directory.CreateDirectory(ProposerdirectryPath);
                }
                string Proposerfilepath = Path.Combine(ProposerdirectryPath, Proposerfilename);
                System.IO.File.WriteAllBytes(Proposerfilepath, ObjQuote.ProspectSign);
                ObjQuote.ProposerSignPath = Path.Combine("\\Policy", "ContactID_" + ObjQuote.objProspect.ContactID, Proposerfilename);
            }
            #endregion
            #region Spouse Signature
            if (ObjQuote.WPProposerSignature != null)
            {
                ObjQuote.WPSignature = Convert.FromBase64String(ObjQuote.WPProposerSignature);
                string WPfilename     = "WPProposersignature.png";
                string WPdirectryPath = "";
                //WPdirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + ObjQuote.objProspect.ContactID);
                WPdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + ObjQuote.objProspect.ContactID);
                if (!Directory.Exists(WPdirectryPath))
                {
                    Directory.CreateDirectory(WPdirectryPath);
                }
                string WPfilepath = Path.Combine(WPdirectryPath, WPfilename);
                System.IO.File.WriteAllBytes(WPfilepath, ObjQuote.WPSignature);
                ObjQuote.WPProposerSignPath = Path.Combine("\\Policy", "ContactID_" + ObjQuote.objProspect.ContactID, WPfilename);
            }
            #endregion
            AIA.Life.Business.Quote.QuoteBusiness objQuoteBusiness = new AIA.Life.Business.Quote.QuoteBusiness();
            ObjQuote = objQuoteBusiness.SaveQuote(ObjQuote);
            string QuoteFilePath = ConfigurationManager.AppSettings["QuoteFilePath"];
            if (ObjQuote.Message == "Success")
            {
                try
                {
                    ReportsController objReportController = new ReportsController();
                    var byteArray = objReportController.ReportQuotation(ObjQuote.QuoteNo, ObjQuote.objProductDetials.PlanCode, ObjQuote.objProductDetials.PreferredLangauage);

                    ObjQuote.QuotePDFPath = QuoteFilePath + ObjQuote.QuoteNo + "_Quote.pdf";
                    System.IO.File.WriteAllBytes(ObjQuote.QuotePDFPath, byteArray);
                    ObjQuote.ByteArray = byteArray;
                    objQuoteBusiness.SendEmailAndSMSNotificationOnQuoteCreation(ObjQuote);
                }
                catch (Exception e)
                {
                    log4net.GlobalContext.Properties["ErrorCode"] = ObjQuote.Error.ErrorCode = Codes.GetErrorCode();
                    Logger.Error(e);
                    ObjQuote.Error.ErrorMessage = "Please inform the IT HelpDesk on this application issue. Error Code is " + ObjQuote.Error.ErrorCode + ". Sorry for the inconvenience caused";
                }
            }

            tpServiceLog.ServiceResponse = Newtonsoft.Json.JsonConvert.SerializeObject(ObjQuote);
            commonBusiness.CreateServiceLog(tpServiceLog);
            return(ObjQuote);
        }