public AIA.Life.Models.Policy.Policy LoadProposalBenefits(AIA.Life.Models.Policy.Policy objProposal) { #region Call API objProposal = WebApiLogic.GetPostComplexTypeToAPI <AIA.Life.Models.Policy.Policy>(objProposal, "LoadProposalBenefits", "Policy"); #endregion return(objProposal); }
public AIA.Life.Models.Policy.Policy LoadMastersForProposalDetails(AIA.Life.Models.Policy.Policy objLifeQuote) { #region Call API objLifeQuote = WebApiLogic.GetPostComplexTypeToAPI <AIA.Life.Models.Policy.Policy>(objLifeQuote, "LoadMastersForProposalDetails", "Policy"); #endregion return(objLifeQuote); }
public AIA.Life.Models.Policy.Policy LoadProposalReAllocate(AIA.Life.Models.Policy.Policy objPolicy) { AIA.Life.Models.Policy.Policy objProposalReAllocate = new Models.Policy.Policy(); #region Call API objProposalReAllocate = WebApiLogic.GetPostComplexTypeToAPI <AIA.Life.Models.Policy.Policy>(objProposalReAllocate, "LoadProposalReAllocate", "Policy"); #endregion return(objProposalReAllocate); }
public AIA.Life.Models.Policy.Policy LoadPendingRequirements(AIA.Life.Models.Policy.Policy objPolicy) { AIA.Life.Models.Policy.Policy objPolicyPendingRequirements = new Models.Policy.Policy(); #region Call API objPolicyPendingRequirements = WebApiLogic.GetPostComplexTypeToAPI <AIA.Life.Models.Policy.Policy>(objPolicyPendingRequirements, "LoadPendingRequirements", "Policy"); #endregion return(objPolicyPendingRequirements); }
public AIA.Life.Models.Policy.Policy LoadSubmittedProposals(AIA.Life.Models.Policy.Policy objPolicy) { AIA.Life.Models.Policy.Policy objPolicySubmittedProposals = new Models.Policy.Policy(); #region Call API objPolicySubmittedProposals = WebApiLogic.GetPostComplexTypeToAPI <AIA.Life.Models.Policy.Policy>(objPolicySubmittedProposals, "LoadSubmittedProposals", "Policy"); #endregion return(objPolicySubmittedProposals); }
public AIA.Life.Models.Policy.Policy SavePolicyUploadDocuments(AIA.Life.Models.Policy.Policy ObjPolicy) { try { AVOAIALifeEntities Context = new AVOAIALifeEntities(); //string objLstDoc = ""; string DepartmentCode = "", AgentCode = "", DocumentCode = ""; if (ObjPolicy.ProposalNo == "") { ObjPolicy.ProposalNo = "PBBBQ123456"; } string UserName = ObjPolicy.UserName; AgentCode = Context.tblMasIMOUsers.Where(a => a.UserID == UserName).Select(a => a.AgentCode).FirstOrDefault(); //DepartmentCode = GetMaritialStatus(); List <DocumentUploadFile> LstDocumentUpload = new List <DocumentUploadFile>(); List <DocumentUploadFile> RequestDoc = new List <DocumentUploadFile>(); string FileName = ""; Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings(); RequestDoc = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DocumentUploadFile> >(ObjPolicy.HdnDocumentDetails, settings); string StrWriteException = string.Empty; for (var i = 0; i < RequestDoc.Count(); i++) { if (string.IsNullOrEmpty(RequestDoc[i].FilePath)) { if (Request.Files[RequestDoc[i].Key] != null) { string Key = RequestDoc[i].Key; DocumentUploadFile objUpload = new DocumentUploadFile(); Random rnd = new Random(); int num = rnd.Next(1, 9999); FileName = Request.Files[Key].FileName; objUpload.FileName = RequestDoc[i].DocName; //objUpload.DOCID = RequestDoc[i].DOCID; FileName = FileName.Replace(".", "_" + num.ToString() + "."); var FileStreamBytes = Request.Files[Key].InputStream; HttpPostedFileBase file = Request.Files[Key]; var DocumentNames = RequestDoc[i].DocName; DocumentCode = Context.tblMasDocuments.Where(a => a.DocumentName == DocumentNames).Select(a => a.DocumentCode).FirstOrDefault(); DepartmentCode = Context.tblMasDocuments.Where(a => a.DocumentName == DocumentNames).Select(a => a.DocumentType).FirstOrDefault(); // DepartmentCode = "UW"; if (RequestDoc[i].DocName == "SpouseImage") { DocumentCode = "PRD012"; } if (DocumentCode == null) { DocumentCode = "PRD011"; } if (file.ContentLength <= 4000000) { var ext = Path.GetExtension(FileName); string _Contact = Convert.ToString(ObjPolicy.ContactID); string _DepartmentCode = Convert.ToString(DepartmentCode); string _AgentCode = Convert.ToString(AgentCode); string _ProposalNo = Convert.ToString(ObjPolicy.ProposalNo); //string _DepartmentCode = DepartmentCode; string _DocumentCode = DocumentCode; DocumentUpload(file, FileName, _AgentCode, _ProposalNo, _DocumentCode); } else { ObjPolicy.Error.ErrorMessage = "File Size Exceeded"; return(ObjPolicy); } string directryPath = ConfigurationManager.AppSettings["FileUpload"] + "\\" + AgentCode + "\\" + ObjPolicy.ProposalNo; var exts = Path.GetExtension(FileName); exts = exts.ToLower(); if (exts == ".png" || exts == ".jpeg" || exts == ".jpg") { exts = ".pdf"; } FileName = Path.Combine(directryPath, DocumentCode + "" + exts); objUpload.FilePath = FileName; objUpload.ItemType = RequestDoc[i].ItemType; objUpload.MemberType = RequestDoc[i].MemberType; objUpload.Index = i; LstDocumentUpload.Add(objUpload); } } else { DocumentUploadFile objUpload = new DocumentUploadFile(); objUpload.FilePath = RequestDoc[i].FilePath; objUpload.FileName = RequestDoc[i].DocName; objUpload.ItemType = RequestDoc[i].ItemType; objUpload.MemberType = RequestDoc[i].MemberType; objUpload.Index = i; LstDocumentUpload.Add(objUpload); } } ObjPolicy.HdnDocumentDetails = JsonConvert.SerializeObject(LstDocumentUpload); ObjPolicy.Error.ErrorMessage = "Success"; return(ObjPolicy); } catch (Exception ex) { ObjPolicy.Error.ErrorMessage = ex.Message; return(ObjPolicy); } }
public string PushReceiptInfoToCore(AIA.Life.Models.Policy.Policy objpolicy) { try { ReceiptRequest objReceiptRequest = new ReceiptRequest(); PolicyIntegration objpolicyIntegration = new PolicyIntegration(); Agent objAgentInfo = objpolicyIntegration.FetchAgentBranch(objpolicy.UserName); objReceiptRequest.userId = objpolicy.UserName; // objReceiptRequest.userId = "TEST"; // test foreach (var Instrument in objpolicy.objPaymentInfo.objInstrumentDetails) { WsTemporaryProposalReceiptHdr objhdr = new WsTemporaryProposalReceiptHdr(); if (objAgentInfo != null) { objhdr.branchCode = objAgentInfo.BranchCode; // test objhdr.agentCode = objAgentInfo.AgentCode; // test } else { objhdr.branchCode = "SIF"; // test objhdr.agentCode = "AGE000000000158"; // test } objhdr.policyNo = string.Empty; objhdr.modeOfPayment = "Q"; objhdr.proposalNo = objpolicy.ProposalNo.ToUpper(); objhdr.tempReceiptNo = Convert.ToString(Instrument.InstumentID); objhdr.totalAmount = Convert.ToString(Instrument.InstrumentAmount); objhdr.createBy = objpolicy.UserName.ToUpper(); // objhdr.createBy = "TEST"; //test objhdr.createDt = DateTime.Now.Date.ToShortDateString(); objhdr.insuredCode = Convert.ToString(objpolicy.ContactID); objhdr.firstName = objpolicy.objProspectDetails.FirstName.ToUpper(); objhdr.middleName = objpolicy.objProspectDetails.MiddleName != null?objpolicy.objProspectDetails.MiddleName.ToUpper() : ""; objhdr.productPlan = objpolicy.PlanCode.ToUpper(); objhdr.surName = objpolicy.objProspectDetails.LastName.ToUpper(); objhdr.proposalDate = DateTime.Now.Date.ToShortDateString(); objhdr.receiptNo = string.Empty; objhdr.quotationNo = objpolicy.QuoteNo.ToUpper(); WsTemporaryProposalReceiptDet objReceiptDetail = new WsTemporaryProposalReceiptDet(); objReceiptDetail.proposalNo = objpolicy.ProposalNo.ToUpper(); #region Set Instrument Type if (Instrument.PaymentMode == "Cheque") { objReceiptDetail.instrumentType = "CHEQUE"; } else if (Instrument.PaymentMode == "Cash") { objReceiptDetail.instrumentType = "CASH"; } else if (Instrument.PaymentMode == "DD") { objReceiptDetail.instrumentType = "DRAFT"; } else { objReceiptDetail.instrumentType = string.Empty; } #endregion objReceiptDetail.currency = "LKR"; objReceiptDetail.currency = objReceiptDetail.currency.ToUpper(); objReceiptDetail.amount = Convert.ToString(Instrument.InstrumentAmount); objReceiptDetail.instrumentNumber = Instrument.InstrumentNo; objReceiptDetail.instrumentDate = Instrument.InstrumentDate.Value.Date.ToShortDateString(); // For PG objReceiptDetail.eopPgCurrencyno = string.Empty; objReceiptDetail.eopPgTransid = string.Empty; objReceiptDetail.eopPgStatusCode = string.Empty; objReceiptDetail.eopPgErrorDetail = string.Empty; objReceiptDetail.eopPgErrorMsg = string.Empty; // Till here // Test Purpose objReceiptDetail.bankCode = "7278"; //test objReceiptDetail.bankCode = objReceiptDetail.bankCode.ToUpper(); objReceiptDetail.bankBranchCode = "168"; //test objReceiptDetail.bankBranchCode = objReceiptDetail.bankBranchCode.ToUpper(); objReceiptRequest.wsTemporaryProposalReceiptHdr.Add(objhdr); objReceiptRequest.wsTemporaryProposalReceiptDet.Add(objReceiptDetail); } string URl = "http://secure.AIA.com:8080/Life_Agent_Saving/jersey/"; string result = GetPostParametersToAPI("Receipting", "SaveProposalReceptDetails", URl, objReceiptRequest); ReceiptResponse objReceiptResponse = new ReceiptResponse(); Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings(); objReceiptResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <ReceiptResponse>(result, settings); if (objReceiptResponse.Status == "Success") { objpolicy.Message = "Success"; } else { objpolicy.Message = "Error"; } } catch (Exception ex) { objpolicy.Message = "Error"; } return(objpolicy.Message); }
public AIA.Life.Models.Policy.Policy GetProposalIllustration(AIA.Life.Models.Policy.Policy objpolicy) { //string xmlStr = MapQuotePremiumObjectFOrUW(new AIA.Life.Repository.AIAEntity.AVOAIALifeEntities(), objProposal); string xmlStr = string.Empty; #region Log Input AVOAIALifeEntities entities = new AVOAIALifeEntities(); tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "PolicyIllustration xml"; objlogxml.PolicyID = Convert.ToString(objpolicy.PolicyID); objlogxml.UserID = objpolicy.UserName; objlogxml.XMlData = xmlStr; objlogxml.CreatedDate = DateTime.Now; entities.tbllogxmls.Add(objlogxml); entities.SaveChanges(); #endregion System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); con.Open(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_GetIllustration"; cmd.Parameters.Add("@XmlStr", SqlDbType.VarChar); cmd.Parameters.Add("@QuoteNo", SqlDbType.VarChar); cmd.Parameters[0].Value = xmlStr; cmd.Parameters[1].Value = objpolicy.ProposalNo; DataSet ds = new DataSet(); System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd); da.Fill(ds); objpolicy.LstIllustation = new List <Illustation>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Illustation ill = new Illustation(); ill.PolicyYear = Convert.ToInt32(ds.Tables[0].Rows[i]["PolicyYear"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["PolicyYear"]); ill.BasicPremium = Convert.ToInt32(ds.Tables[0].Rows[i]["BasicPremium"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["BasicPremium"]); ill.MainBenefitsPremium = Convert.ToInt32(ds.Tables[0].Rows[i]["MainBenefitsPremium"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["MainBenefitsPremium"]); ill.AdditionalBenefitsPremiums = Convert.ToInt32(ds.Tables[0].Rows[i]["AdditionalBenefitsPremiums"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["AdditionalBenefitsPremiums"]); ill.TotalPremium = Convert.ToInt32(ds.Tables[0].Rows[i]["TotalPremium"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["TotalPremium"]); ill.FundBalanceDiv4 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv4"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv4"]); ill.SurrenderValueDiv4 = Convert.ToInt64(ds.Tables[0].Rows[i]["SurrenderValueDiv4"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["SurrenderValueDiv4"]); ill.DrawDownDiv4 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv4"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv4"]); ill.PensionBoosterDiv4 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv4_Pensionbooster"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv4_Pensionbooster"]); ill.FundBalanceDiv8 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv8"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv8"]); ill.SurrenderValueDiv8 = Convert.ToInt64(ds.Tables[0].Rows[i]["SurrenderValueDiv8"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["SurrenderValueDiv8"]); ill.DrawDownDiv8 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv8"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv8"]); ill.PensionBoosterDiv8 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv8_Pensionbooster"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv8_Pensionbooster"]); ill.FundBalanceDiv12 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv12"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv12"]); ill.SurrenderValueDiv12 = Convert.ToInt64(ds.Tables[0].Rows[i]["SurrenderValueDiv12"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["SurrenderValueDiv12"]); ill.DrawDownDiv12 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv12"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv12"]); ill.PensionBoosterDiv12 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv12_Pensionbooster"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv12_Pensionbooster"]); ill.PensionBoosterDiv12 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv12_Pensionbooster"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv12_Pensionbooster"]); ill.FundBalanceDiv5 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv5"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv5"]); ill.FundBalanceDiv6 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv6"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv6"]); ill.FundBalanceDiv7 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv7"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv7"]); ill.FundBalanceDiv9 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv9"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv9"]); ill.FundBalanceDiv10 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv10"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv10"]); ill.FundBalanceDiv11 = Convert.ToInt64(ds.Tables[0].Rows[i]["FundBalanceDiv11"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["FundBalanceDiv11"]); ill.DrawDownDiv5 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv5"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv5"]); ill.DrawDownDiv6 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv6"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv6"]); ill.DrawDownDiv7 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv7"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv7"]); ill.DrawDownDiv9 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv9"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv9"]); ill.DrawDownDiv10 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv10"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv10"]); ill.DrawDownDiv11 = Convert.ToInt64(ds.Tables[0].Rows[i]["DrawDownDiv11"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv11"]); ill.UnAllocatedPremium = Convert.ToInt64(ds.Tables[0].Rows[i]["UnAllocatedPremium"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["UnAllocatedPremium"]); objpolicy.LstIllustation.Add(ill); } return(objpolicy); }
public PaymentModel AckPaymentandProcess(AVOAIALifeEntities Context, PaymentModel objPaymentModel, tblPolicy objtblpolicy) { SMSIntegration objSMSIntegration = new SMSIntegration(); SMSDetails objSMSDetails = new SMSDetails(); Common.CommonBusiness objCommonBusiness = new Common.CommonBusiness(); #region UW deviations UWRuleLogic objLogic = new UWRuleLogic(); PolicyLogic objPolicyLogic = new PolicyLogic(); objPaymentModel.Message = string.Empty; bool dataUpdated = false; var ilData = Context.tblLogILUpdates.Where(a => a.ProposalNo == objPaymentModel.ProposalNo).FirstOrDefault(); if (ilData != null) { if (ilData.ServiceStatus == "SUCC" && ilData.ServiceName == "ModifyProposal") { dataUpdated = true; } } if (dataUpdated) { //S003 var CustomerDetails = objtblpolicy.tblPolicyRelationships.FirstOrDefault().tblPolicyClient; //var Title = Context.tblMasCommonTypes.Where(a => a.Code == CustomerDetails.Title).Select(a => a.ShortDesc).FirstOrDefault(); //objSMSDetails.Salutation = objCommonBusiness.ConverttoTitlecase(Title); string Sal = CustomerDetails.Title; var Salutation = Context.tblMasCommonTypes.Where(a => a.Code == Sal && a.MasterType == "Salutation").Select(a => a.ShortDesc).FirstOrDefault(); var Salu = Context.tblMasCommonTypes.Where(a => a.Description == Sal && a.MasterType == "Salutation").Select(a => a.ShortDesc).FirstOrDefault(); if (!String.IsNullOrEmpty(Salutation)) { objSMSDetails.Salutation = Salutation; } else if (!String.IsNullOrEmpty(Salu)) { objSMSDetails.Salutation = Salu; } else { objSMSDetails.Salutation = Sal; } var Name = ""; if (CustomerDetails.FullName == "CORP") { Name = CustomerDetails.CorporateName; } else { Name = CustomerDetails.LastName; } objSMSDetails.Name = objCommonBusiness.ConverttoTitlecase(Name); objSMSDetails.SMSTemplate = "S003"; objSMSDetails.ProposalNumber = objPaymentModel.ProposalNo; objSMSDetails.MobileNumber = CustomerDetails.MobileNo; objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]); if (!String.IsNullOrEmpty(objSMSDetails.MobileNumber)) { objSMSIntegration.SMSNotification(objSMSDetails); } objPaymentModel = (PaymentModel)IL.RecieptEnquiry(objPaymentModel); } if ((objPaymentModel.PayingAmount) >= (Convert.ToDecimal(objPaymentModel.PayableAmount) - 100) || System.Web.Configuration.WebConfigurationManager.AppSettings["PublishEnvironment"] == "SIT") { AIA.Life.Models.Policy.Policy objPolicy = new AIA.Life.Models.Policy.Policy(); objPolicy.ProposalFetch = true; objPolicy.ProposalNo = objPaymentModel.ProposalNo; objPolicy.QuoteNo = objtblpolicy.QuoteNo; objPolicy = objPolicyLogic.FetchProposalInfo(objPolicy); // //S012 if (objPaymentModel.SelectedPayment == "othertypes") { var createdBy = Context.tblPolicies.Where(a => a.ProposalNo == objPolicy.ProposalNo).Select(a => a.Createdby).FirstOrDefault(); objSMSDetails.MobileNumber = Context.tblUserDetails.Where(a => a.UserID.ToString() == createdBy).Select(a => a.ContactNo).FirstOrDefault(); //objSMSDetails.MobileNumber = Context.tblMasIMOUsers.Where(a => a.UserID == objPolicy.AgentCode).Select(a => a.MobileNo).FirstOrDefault(); objSMSDetails.SMSTemplate = "S012"; objSMSDetails.PolicyNo = objPaymentModel.ProposalNo; objSMSDetails.Premium = String.Format(CultureInfo.GetCultureInfo(1033), "{0:n0}", objPolicy.AnnualPremium); //Convert.ToString(objPolicy.AnnualPremium); objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]); objSMSIntegration.SMSNotification(objSMSDetails); } string Message = string.Empty; if (objtblpolicy.PolicyStageStatusID != 2376)/// Counter offer Case { Message = objLogic.ValidateDeviation(objPolicy); } tblPayment tblPayment = objtblpolicy.tblPolicyPaymentMaps.OrderByDescending(a => a.PolicyPaymentMapID).FirstOrDefault().tblPayment; tblPayment.ChequeSubmission = true; tblPayment.ReceiptNo = "ACK"; string leadNo = Context.tblLifeQQs.Where(a => a.QuoteNo == objtblpolicy.QuoteNo).Select(a => a.tblContact).FirstOrDefault().LeadNo; if (dataUpdated) { objPaymentModel = (PaymentModel)IL.ProposalPreIssueValidation(objPaymentModel); } if (!string.IsNullOrEmpty(Message.Trim()) || objtblpolicy.PolicyStageStatusID == 2376)// Or Counter offer Case { objPaymentModel.Message = "Success"; if (objtblpolicy != null) { objtblpolicy.PolicyRemarks = Message; objtblpolicy.PolicyStageStatusID = 193; // UW objtblpolicy.IsAllocated = false; // Pending for Allocation objtblpolicy.ProposalSubmitDate = DateTime.Now; if (!string.IsNullOrEmpty(leadNo)) { SamsClient samsClient = new SamsClient(); samsClient.UpdateLeadStatus(Context, Convert.ToInt32(leadNo), 9); } //SMS S005 var createdBy = Context.tblPolicies.Where(a => a.ProposalNo == objPolicy.ProposalNo).Select(a => a.Createdby).FirstOrDefault(); objSMSDetails.MobileNumber = Context.tblUserDetails.Where(a => a.UserID.ToString() == createdBy).Select(a => a.ContactNo).FirstOrDefault(); //objSMSDetails.WPMobileNumber= Context.tblMasIMOUsers.Where(a => a.UserID == objPolicy.UserName).Select(a => a.MobileNo).FirstOrDefault(); objSMSDetails.SMSTemplate = "S005"; objSMSDetails.PolicyNo = objPaymentModel.ProposalNo; objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]); objSMSIntegration.SMSNotification(objSMSDetails); } objPaymentModel.UWMessage = "" + Message; Context.SaveChanges(); return(objPaymentModel); } #endregion if (!string.IsNullOrEmpty(objPaymentModel.ProposalNo) && dataUpdated) { //objPaymentModel = (PaymentModel)IL.ProposalPreIssueValidation(objPaymentModel); if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage) && (objPaymentModel.PreIssueValidations.Count <= 1)) { if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage)) { Thread.Sleep(5000); objPaymentModel = (PaymentModel)IL.ProposalUWApproval(objPaymentModel); if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage)) { objPaymentModel = (PaymentModel)IL.QualityControl(objPaymentModel); if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage)) { objPaymentModel = (PaymentModel)IL.ProposalIssuance(objPaymentModel); if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage)) { objtblpolicy.PolicyNo = objPaymentModel.ProposalNo = objPolicy.ProposalNo; objtblpolicy.PolicyStageStatusID = 192;// Issued DateTime today = DateTime.Now; int[] exceptionDays = new int[3] { 29, 30, 31 }; if (exceptionDays.Contains(today.Day)) { today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 28); } objtblpolicy.PolicyIssueDate = today; objtblpolicy.PolicyStartDate = today; objtblpolicy.PolicyEndDate = today.AddYears(Convert.ToInt32(objtblpolicy.PolicyTerm)); objPaymentModel.Message = "Success"; } } } } } else { if (dataUpdated) { if (!string.IsNullOrEmpty(leadNo)) { SamsClient samsClient = new SamsClient(); samsClient.UpdateLeadStatus(Context, Convert.ToInt32(leadNo), 9); } objtblpolicy.PolicyStageStatusID = 193;// UW objtblpolicy.IsAllocated = false; objtblpolicy.ProposalSubmitDate = DateTime.Now; objPaymentModel.UWMessage = "Your proposal has been forwarded to underwriter for further processing."; } else { objPaymentModel.UWMessage = "Payment is Successful. Your proposal is under processing, you will be notified soon."; } } Context.SaveChanges(); } } else { if (objPaymentModel.PayingAmount == 0) { objPaymentModel.UWMessage = "Payment is Successful. Your proposal is under processing, you will be notified soon."; } else { objPaymentModel.UWMessage = "Your payment is successful. Payment reference number is " + objPaymentModel.TransactionNo; } } return(objPaymentModel); }