public AIA.Life.Models.Opportunity.LifeQuote SaveQuote(AIA.Life.Models.Opportunity.LifeQuote ObjQuote) { AIA.Life.Business.Quote.QuoteBusiness objQuoteBusiness = new AIA.Life.Business.Quote.QuoteBusiness(); return(objQuoteBusiness.SaveQuote(ObjQuote)); }
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); }