public string SendDialogOnlinePremium(PaymentModel paymentModel) { AIAOnlinePremiumService.LifeClient lifeClient = new AIAOnlinePremiumService.LifeClient(); string instType = ConfigurationManager.AppSettings["OPSINSTTYPE"].ToString(); string clientID = ConfigurationManager.AppSettings["OPSCLIENTID"].ToString(); string password = ConfigurationManager.AppSettings["OPSPWD"].ToString(); using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { #region Log Input tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "online reciept request"; objlogxml.PolicyID = paymentModel.ProposalNo; objlogxml.XMlData = paymentModel.ProposalNo + "|" + instType + "|" + paymentModel.TransactionNo + "|" + paymentModel.PayableAmount + "|" + clientID + "|" + password; objlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(objlogxml); Context.SaveChanges(); #endregion string receipt = lifeClient.uploadPayment(paymentModel.ProposalNo, instType, paymentModel.TransactionNo, Convert.ToDouble(paymentModel.PayableAmount), clientID, password); #region Log Output tbllogxml objlogxml1 = new tbllogxml(); objlogxml1.Description = "online reciept response"; objlogxml1.PolicyID = paymentModel.ProposalNo; objlogxml1.XMlData = receipt; objlogxml1.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(objlogxml1); Context.SaveChanges(); #endregion return(receipt); } }
public bool PayUtilitiesDirect(Models.Payment.PaymentModel paymentModel) { McashRequest mcash = new McashRequest(); mcash.merchant_data.merchant_id = _mcashMerchantID; mcash.merchant_data.merchant_transaction_id = paymentModel.TransactionNo; mcash.merchant_data.pin_code = paymentModel.McashPin; mcash.merchant_data.mobile_number = paymentModel.McashMobile; mcash.utility_data.customer_mobile_number = paymentModel.Mobile; mcash.utility_data.merchant_outlet_code = "AIA outlet"; mcash.utility_data.transaction_amount = Convert.ToDecimal(paymentModel.PayableAmount); mcash.utility_data.utility_account_number = paymentModel.ProposalNo; mcash.utility_data.utility_code = _mcashUtilityCode; mcash.utility_data.note = "Nexgen ipos transaction"; var jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(mcash); jsonData = jsonData.Replace('_', '-'); AVOAIALifeEntities Context = new AVOAIALifeEntities(); #region Log Input tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "MCash request"; objlogxml.PolicyID = paymentModel.ProposalNo; objlogxml.UserID = paymentModel.UserName; objlogxml.XMlData = jsonData; objlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(objlogxml); Context.SaveChanges(); #endregion string result = McashBase.InvokeApi(jsonData); #region Log output tbllogxml outlogxml = new tbllogxml(); outlogxml.Description = "MCash response"; outlogxml.PolicyID = paymentModel.ProposalNo; outlogxml.UserID = paymentModel.UserName; outlogxml.XMlData = result; outlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(outlogxml); Context.SaveChanges(); #endregion Dictionary <string, string> res = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(result); string responseCode = res.Where(a => a.Key == "response-code").Select(a => a.Value).FirstOrDefault(); if (responseCode == "1000") { return(true); } else { paymentModel.Message = "Error"; paymentModel.Error.ErrorMessage = res.Where(a => a.Key == "response").Select(a => a.Value).FirstOrDefault(); return(false); } }
public string AUthenticateImo(User user) { AVOAIALifeEntities Context = new AVOAIALifeEntities(); #region Log Input tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "Imo Login Request"; objlogxml.PolicyID = user.userName; objlogxml.XMlData = Newtonsoft.Json.JsonConvert.SerializeObject(user); objlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(objlogxml); Context.SaveChanges(); #endregion Error error = AuthenticateSams(user); #region Log output tbllogxml outlogxml = new tbllogxml(); outlogxml.Description = "Imo Login Response"; outlogxml.PolicyID = user.userName; outlogxml.XMlData = Newtonsoft.Json.JsonConvert.SerializeObject(error); outlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(outlogxml); Context.SaveChanges(); #endregion if (error != null) { switch (error.errorCode) { case "200": return("Success"); case "401": return("Invalid username or password. Please enter correct credentials"); case "402": return("Invalid username or password. Your account will be locked next time"); case "403": return("Your iMO account is locked. Please reset the password from iMO and try again"); case "405": return("Invalid user account. Please contact the IT HelpDesk"); default: return("Invalid username or password. Please enter correct credentials"); } } else { return("Invalid username or password. Please enter correct credentials"); } }
public ManualAllocation SaveManualAllocation(ManualAllocation objAllocationModel) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { foreach (var Item in objAllocationModel.objLstAllocationProposals.Where(a => a.ISSelected == true).ToList()) { if (!string.IsNullOrEmpty(Item.AssignTo)) { DateTime Date = DateTime.Now; var policy = Context.tblPolicies.Where(a => a.ProposalNo == Item.ProposalNo).FirstOrDefault(); if (policy != null) { decimal PolicyID = policy.PolicyID; var PolicyAllocation = Context.tblPolicyUWAllocations.Where(a => a.PolicyID == PolicyID).FirstOrDefault(); if (PolicyAllocation != null) { PolicyAllocation.AllocatedFrom = PolicyAllocation.AllocatedTo; PolicyAllocation.AllocatedTo = Item.AssignTo.ToUpper(); PolicyAllocation.AllocatedDate = Date; policy.IsAllocated = true; policy.ModifiedDate = Date; } else { tblPolicyUWAllocation objPolicyUWAllocation = new tblPolicyUWAllocation(); objPolicyUWAllocation.PolicyID = PolicyID; objPolicyUWAllocation.AllocatedFrom = string.Empty; objPolicyUWAllocation.AllocatedTo = Item.AssignTo; objPolicyUWAllocation.AllocatedDate = Date; objPolicyUWAllocation.Remarks = string.Empty; objPolicyUWAllocation.CreatedDate = Date; Context.tblPolicyUWAllocations.Add(objPolicyUWAllocation); policy.IsAllocated = true; policy.ModifiedDate = Date; } } Context.SaveChanges(); } } } objAllocationModel.Message = "Success"; } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objAllocationModel.Message = "Error"; } return(objAllocationModel); }
public static object BizDate(object obj) { if (_enableIL) { AVOAIALifeEntities Context = new AVOAIALifeEntities(); var accMonth = Context.tblILIntegrations.Where(a => a.ColumnName == "ACCTMN").FirstOrDefault(); var accYear = Context.tblILIntegrations.Where(a => a.ColumnName == "ACCTYR").FirstOrDefault(); accMonth.FieldValue = (DateTime.Now.Month).ToString().PadLeft(2, '0'); accYear.FieldValue = DateTime.Now.Year.ToString(); Context.SaveChanges(); string responseText = integrator.GeneratePlainText(obj, "BIZDateRequest", "BIZDateResponse"); if (responseText != null && responseText.ToUpper().Contains("ACCT PERD OUTSIDE RANGE")) { var accMonth2 = Context.tblILIntegrations.Where(a => a.ColumnName == "ACCTMN").FirstOrDefault(); var accYear2 = Context.tblILIntegrations.Where(a => a.ColumnName == "ACCTYR").FirstOrDefault(); accMonth2.FieldValue = (DateTime.Now.Month - 1).ToString().PadLeft(2, '0'); accYear2.FieldValue = DateTime.Now.Year.ToString(); Context.SaveChanges(); string responseText1 = integrator.GeneratePlainText(obj, "BIZDateRequest", "BIZDateResponse"); if (responseText != null && responseText1.ToUpper().Contains("ACCT PERD OUTSIDE RANGE")) { var accMonth1 = Context.tblILIntegrations.Where(a => a.ColumnName == "ACCTMN").FirstOrDefault(); var accYear1 = Context.tblILIntegrations.Where(a => a.ColumnName == "ACCTYR").FirstOrDefault(); accMonth1.FieldValue = (DateTime.Now.Month - 1).ToString().PadLeft(2, '0'); accYear1.FieldValue = (DateTime.Now.Year - 1).ToString(); Context.SaveChanges(); string responseText2 = integrator.GeneratePlainText(obj, "BIZDateRequest", "BIZDateResponse"); obj = integrator.ReadResponseString(responseText2, obj, "BIZDateResponse"); } else { obj = integrator.ReadResponseString(responseText1, obj, "BIZDateResponse"); } } else { obj = integrator.ReadResponseString(responseText, obj, "BIZDateResponse"); } } return(obj); }
public static void UpdateILStatusLog(ILStatus iLStatus) { using (AVOAIALifeEntities context = new AVOAIALifeEntities()) { tblLogILUpdate logILUpdate = new tblLogILUpdate(); logILUpdate.CreatedDate = DateTime.Now; logILUpdate.ProposalNo = iLStatus.ProposalNo; logILUpdate.ServiceName = iLStatus.ServiceName; logILUpdate.ServiceStatus = iLStatus.ServiceStatus; logILUpdate.UpdatedDate = DateTime.Now; context.tblLogILUpdates.Add(logILUpdate); context.SaveChanges(); } }
public static void CreateServiceLog(TpServiceLog tpServiceLog) { using (AVOAIALifeEntities context = new AVOAIALifeEntities()) { tblLogTPService logTPService = new tblLogTPService(); logTPService.CreatedDate = DateTime.Now; logTPService.ServiceRequest = tpServiceLog.ServiceRequest; logTPService.ServiceTraceID = tpServiceLog.ServiceTraceID; logTPService.UpdatedDate = DateTime.Now; logTPService.ServiceResponse = tpServiceLog.ServiceResponse; context.tblLogTPServices.Add(logTPService); context.SaveChanges(); } }
public string SendMessage(string mobileNo, string message) { AVOAIALifeEntities Context = new AVOAIALifeEntities(); MessageRequest messageRequest = new MessageRequest(); messageRequest.destination = mobileNo; messageRequest.message = message; #region Log Input tblLogSM objLogSMS = new tblLogSM(); objLogSMS.Description = "SMS Request"; objLogSMS.CreatedDate = DateTime.Now; objLogSMS.Message = Newtonsoft.Json.JsonConvert.SerializeObject(messageRequest); objLogSMS.Number = mobileNo; Context.tblLogSMS.Add(objLogSMS); Context.SaveChanges(); #endregion MessageResponse messageResponse = new MessageResponse(); InvokeApi <MessageRequest, MessageResponse>(messageRequest, "sms-management/save-message", ref messageResponse); if (messageResponse.errorCode == "200") { #region Log output tblLogSM outobjLogSMS = new tblLogSM(); outobjLogSMS.Description = "SMS Response"; outobjLogSMS.CreatedDate = DateTime.Now; outobjLogSMS.Message = Newtonsoft.Json.JsonConvert.SerializeObject(messageResponse); outobjLogSMS.Number = mobileNo; Context.tblLogSMS.Add(outobjLogSMS); Context.SaveChanges(); #endregion return("success"); } else { return(messageResponse.errorDescription); } }
public PaymentModel SavePGTransaction(PaymentModel objPaymentModel) { try { AVOAIALifeEntities Context = new AVOAIALifeEntities(); tblPolicy objtblpolicy = new tblPolicy(); objtblpolicy = Context.tblPolicies.Where(a => a.ProposalNo == objPaymentModel.ProposalNo).FirstOrDefault(); if (objtblpolicy != null) { tblPolicyPaymentMap policyPaymentMap = new tblPolicyPaymentMap(); policyPaymentMap.CreatedDate = DateTime.Now; tblPayment payment = new tblPayment(); payment.CreatedDate = DateTime.Now; payment.TxnNo = objPaymentModel.TransactionNo; payment.PaidAmount = Convert.ToDecimal(objPaymentModel.PayableAmount); payment.ChequeSubmission = false; payment.ReceiptNo = "NOTACK"; payment.PayerType = objPaymentModel.ReqId; if (payment.PaymentID == decimal.Zero) { Context.tblPayments.Add(payment); } policyPaymentMap.Premium = objtblpolicy.tblProposalPremiums.FirstOrDefault().AnnualPremium; policyPaymentMap.PaidAmount = 0; policyPaymentMap.PendingAmount = policyPaymentMap.Premium - policyPaymentMap.PaidAmount; policyPaymentMap.tblPayment = payment; policyPaymentMap.tblPolicy = objtblpolicy; if (policyPaymentMap.PolicyPaymentMapID == decimal.Zero) { Context.tblPolicyPaymentMaps.Add(policyPaymentMap); } } Context.SaveChanges(); return(objPaymentModel); } catch (Exception ex) { throw ex; } }
public void GetDrawDownDetails(LifeQuote objLifeQuote) { AVOAIALifeEntities Context = new AVOAIALifeEntities(); string xmlStr = MapQuotePremiumObject(new AIA.Life.Repository.AIAEntity.AVOAIALifeEntities(), objLifeQuote); #region Log Input AVOAIALifeEntities entities = new AVOAIALifeEntities(); tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "DrawDown xml"; objlogxml.PolicyID = Convert.ToString(objLifeQuote.objProspect.ContactID); objlogxml.UserID = objLifeQuote.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.Text; cmd.CommandText = "exec usp_GetDrawDownDetails '" + xmlStr + "'"; //cmd.Parameters.Add("@XmlStr", SqlDbType.VarChar); //cmd.Parameters[0].Value = xmlStr; DataSet ds = new DataSet(); System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd); da.Fill(ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //DrawDownDetails ddd = new DrawDownDetails(); tblQuoteDrawDownDetail objtblQuoteDrawDownDetail = new tblQuoteDrawDownDetail(); objtblQuoteDrawDownDetail.LifeQQID = objLifeQuote.LifeQQID; objtblQuoteDrawDownDetail.PaymentFequency = Convert.ToInt32(ds.Tables[0].Rows[i]["PaymentFequency"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["PaymentFequency"]); objtblQuoteDrawDownDetail.DrawDownDiv4 = Convert.ToDecimal(ds.Tables[0].Rows[i]["DrawDownDiv4"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv4"]); objtblQuoteDrawDownDetail.DrawDownDiv8 = Convert.ToDecimal(ds.Tables[0].Rows[i]["DrawDownDiv8"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv8"]); objtblQuoteDrawDownDetail.DrawDownDiv12 = Convert.ToDecimal(ds.Tables[0].Rows[i]["DrawDownDiv12"] == DBNull.Value ? 0 : ds.Tables[0].Rows[i]["DrawDownDiv12"]); Context.tblQuoteDrawDownDetails.Add(objtblQuoteDrawDownDetail); } Context.SaveChanges(); }
public void DeleteExisitingAllocationInfo() { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { var LstUWAllocation = Context.tblUWAllocations.ToList(); Context.tblUWAllocations.RemoveRange(LstUWAllocation); var LstChannelAllocation = Context.tblChannelAllocations.ToList(); Context.tblChannelAllocations.RemoveRange(LstChannelAllocation); var LstUserAvailability = Context.tblUserAvalibilities.ToList(); Context.tblUserAvalibilities.RemoveRange(LstUserAvailability); Context.SaveChanges(); } } catch (Exception ex) { } }
public PaymentModel SaveProposalPaymentInfo(PaymentModel objPaymentModel) { try { AVOAIALifeEntities Context = new AVOAIALifeEntities(); tblPolicy objtblpolicy = new tblPolicy(); objtblpolicy = Context.tblPolicies.Where(a => a.ProposalNo == objPaymentModel.ProposalNo).FirstOrDefault(); if (objtblpolicy != null) { var proposalPremium = objtblpolicy.tblProposalPremiums.FirstOrDefault(); decimal?actualPremium = proposalPremium.AnnualPremium + proposalPremium.AdditionalPremium; decimal?payablePremium = Convert.ToDecimal(objPaymentModel.PayableAmount); if (proposalPremium.AdditionalPremium != null && proposalPremium.AdditionalPremium != 0) { payablePremium = payablePremium + proposalPremium.AnnualPremium; } if (payablePremium < (actualPremium - 100) || (!string.IsNullOrEmpty(objPaymentModel.ChequeNo) && objPaymentModel.chequeAmount < (actualPremium - 100))) { objPaymentModel.Error.ErrorMessage = "Please check the Payable premium and entered amount."; } else { objPaymentModel.QuoteNo = objtblpolicy.QuoteNo; tblPolicyPaymentMap policyPaymentMap = objtblpolicy.tblPolicyPaymentMaps.FirstOrDefault(); if (policyPaymentMap == null) { policyPaymentMap = new tblPolicyPaymentMap(); policyPaymentMap.CreatedDate = DateTime.Now; } tblPayment payment = policyPaymentMap.tblPayment; if (payment == null) { payment = new tblPayment(); payment.CreatedDate = DateTime.Now; } tblPaymentInstrumentDetail tblPaymentInstrument = new tblPaymentInstrumentDetail(); payment.TxnNo = objPaymentModel.TransactionNo; payment.PaidAmount = Convert.ToDecimal(objPaymentModel.PayableAmount); payment.ChequeSubmission = false; payment.ReceiptNo = "NOTACK"; if (payment.PaymentID == decimal.Zero) { Context.tblPayments.Add(payment); } tblPaymentInstrument.InstrumentAmount = Convert.ToDecimal(objPaymentModel.PayableAmount); if (objPaymentModel.SelectedPayment == "othertypes") { tblPaymentInstrument.PaymentMode = objPaymentModel.PaymentChanel; tblPaymentInstrument.InstrumentNo = objPaymentModel.ChequeNo; tblPaymentInstrument.BankBranch = objPaymentModel.BranchName; } else { tblPaymentInstrument.PaymentMode = objPaymentModel.SelectedPayment; } tblPaymentInstrument.InstrumentDate = DateTime.Now; tblPaymentInstrument.UpdatedDate = DateTime.Now; tblPaymentInstrument.tblPayment = payment; Context.tblPaymentInstrumentDetails.Add(tblPaymentInstrument); policyPaymentMap.Premium = objtblpolicy.tblProposalPremiums.FirstOrDefault().AnnualPremium; policyPaymentMap.PaidAmount = Convert.ToDecimal(objPaymentModel.PayableAmount); policyPaymentMap.PendingAmount = policyPaymentMap.Premium - policyPaymentMap.PaidAmount; policyPaymentMap.tblPayment = payment; policyPaymentMap.tblPolicy = objtblpolicy; if (policyPaymentMap.PolicyPaymentMapID == decimal.Zero) { Context.tblPolicyPaymentMaps.Add(policyPaymentMap); } Context.SaveChanges(); objPaymentModel.PayableAmount = Convert.ToString(actualPremium); objPaymentModel = AckPaymentandProcess(Context, objPaymentModel, objtblpolicy); } } return(objPaymentModel); } catch (Exception ex) { Logger.Error(ex); throw ex; } }
public void UpdateLead(AVOAIALifeEntities Context, Prospect prospect) { try { LeadCreation leadCreation = new LeadCreation(); if (!string.IsNullOrEmpty(prospect.AssignedTo)) { leadCreation.AgentCode = prospect.AssignedTo; } else { leadCreation.AgentCode = Context.tblMasIMOUsers.Where(a => a.UserID == prospect.UserName).Select(a => a.AgentCode).FirstOrDefault(); } leadCreation.AvoLeadNumber = prospect.ContactID.ToString(); int Type = Context.tblMasCommonTypes.Where(a => a.Description == prospect.Type).Select(a => a.CommonTypesID).FirstOrDefault(); if (Type == 0) { Type = Convert.ToInt32(prospect.Type); } leadCreation.AvoLeadType = Context.tblMasCommonTypes.Where(a => a.CommonTypesID == Type && (a.MasterType == "Type" || a.MasterType == "BancaType")).Select(a => a.Code).FirstOrDefault(); string role = Context.usp_GetCurrentUserRole(leadCreation.AgentCode).FirstOrDefault(); if (role == "FPC-Banca") { leadCreation.Channel = "BA"; } else { leadCreation.Channel = "AG"; } if (string.IsNullOrEmpty(prospect.SamsLeadNumber)) { leadCreation.Flag = "NEW"; } else { leadCreation.Flag = "UPDATE"; } //int titleId = Convert.ToInt32(prospect.Title); leadCreation.LeadTitle = Context.tblMasCommonTypes.Where(a => a.Description == prospect.Salutation && a.MasterType == "Salutation").Select(a => a.Code).FirstOrDefault(); if (string.IsNullOrEmpty(leadCreation.LeadTitle)) { leadCreation.LeadTitle = prospect.Salutation; } leadCreation.LeadFirstName = prospect.Name; leadCreation.LeadLastName = prospect.LastName; leadCreation.LeadContactNumber = prospect.Mobile; leadCreation.NIC = prospect.NIC; leadCreation.LeadEmail = prospect.Email; leadCreation.UserId = Context.tblMasIMOUsers.Where(a => a.UserID == prospect.UserName).Select(a => a.AgentCode).FirstOrDefault();; leadCreation.LeadPlace = prospect.Place; leadCreation.LeadContactOffice = prospect.Work; leadCreation.LeadContactResident = prospect.Home; leadCreation.Address1 = prospect.objAddress.Address1; leadCreation.Address2 = prospect.objAddress.Address2; leadCreation.Address3 = prospect.objAddress.Address3; leadCreation.MaritalStatus = prospect.MaritalStatus; leadCreation.Gender = prospect.Gender; leadCreation.DOB = Convert.ToDateTime(prospect.DateofBirth).ToString("yyyy-MM-dd"); leadCreation.SamsLeadNumber = Convert.ToInt32(prospect.SamsLeadNumber); leadCreation.LeadIntroducer = string.IsNullOrEmpty(prospect.IntroducerCode) == false?prospect.IntroducerCode.TrimEnd() : ""; //leadCreation.AssignedTo = prospect.AssignedTo; //AuthenticateSams(); #region Log Input tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "Sams Lead Update request"; objlogxml.PolicyID = leadCreation.AvoLeadNumber; objlogxml.UserID = prospect.CreatedBy; objlogxml.XMlData = Newtonsoft.Json.JsonConvert.SerializeObject(leadCreation); objlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(objlogxml); Context.SaveChanges(); #endregion LeadResponse leadResponse = new LeadResponse(); InvokeApi <LeadCreation, LeadResponse>(leadCreation, "sams/", ref leadResponse); #region Log output tbllogxml outlogxml = new tbllogxml(); outlogxml.Description = "Sams Lead Update response"; outlogxml.PolicyID = leadCreation.AvoLeadNumber; outlogxml.UserID = prospect.CreatedBy; outlogxml.XMlData = Newtonsoft.Json.JsonConvert.SerializeObject(leadResponse); outlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(outlogxml); Context.SaveChanges(); #endregion if (leadResponse.body != null) { if (!string.IsNullOrEmpty(leadResponse.body.SamsLeadNumber) && leadResponse.body.SamsLeadNumber != "0") { prospect.SamsLeadNumber = leadResponse.body.SamsLeadNumber; } } } catch (Exception ex) { if (string.IsNullOrEmpty(prospect.SamsLeadNumber)) { prospect.SamsLeadNumber = ""; } } }
public LifeQuote GetIllustration(LifeQuote objLifeQuote) { string xmlStr = MapQuotePremiumObject(new AIA.Life.Repository.AIAEntity.AVOAIALifeEntities(), objLifeQuote); #region Log Input AVOAIALifeEntities entities = new AVOAIALifeEntities(); tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "Illustration xml"; objlogxml.PolicyID = Convert.ToString(objLifeQuote.objProspect.ContactID); objlogxml.UserID = objLifeQuote.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[0].Value = xmlStr; DataSet ds = new DataSet(); System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd); da.Fill(ds); 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.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"]); objLifeQuote.LstIllustation.Add(ill); } return(objLifeQuote); }
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); }
public PaymentModel UpdatePGTransaction(PaymentModel objPaymentModel) { try { AVOAIALifeEntities Context = new AVOAIALifeEntities(); tblPayment payment = Context.tblPayments.Where(a => a.PayerType == objPaymentModel.ReqId).FirstOrDefault(); if (payment != null) { tblPolicyPaymentMap policyPaymentMap = payment.tblPolicyPaymentMaps.FirstOrDefault(); tblPaymentInstrumentDetail tblPaymentInstrument = new tblPaymentInstrumentDetail(); objPaymentModel.TransactionNo = payment.TxnNo; payment.UpdatedDate = DateTime.Now; tblPaymentInstrument.InstrumentAmount = Convert.ToDecimal(objPaymentModel.PayableAmount); tblPaymentInstrument.PaymentMode = objPaymentModel.SelectedPayment; tblPaymentInstrument.PGResponse = objPaymentModel.PGResponse; tblPaymentInstrument.RGIPaymentStatus = objPaymentModel.Message; tblPaymentInstrument.InstrumentDate = DateTime.Now; tblPaymentInstrument.UpdatedDate = DateTime.Now; tblPaymentInstrument.tblPayment = payment; Context.tblPaymentInstrumentDetails.Add(tblPaymentInstrument); policyPaymentMap.PaidAmount = Convert.ToDecimal(objPaymentModel.PayableAmount); policyPaymentMap.PendingAmount = policyPaymentMap.Premium - policyPaymentMap.PaidAmount; Context.SaveChanges(); if (ConfigurationManager.AppSettings["PublishEnvironment"].ToString() == "SIT" || ConfigurationManager.AppSettings["PublishEnvironment"].ToString() == "UAT") { objPaymentModel.PayableAmount = Convert.ToString(policyPaymentMap.Premium); } tblPolicy objtblpolicy = policyPaymentMap.tblPolicy; string responseCode = string.Empty; string responseText = string.Empty; if (!string.IsNullOrEmpty(objPaymentModel.PGResponse)) { var resp = objPaymentModel.PGResponse.Split('|'); if (resp.Length > 1) { responseCode = resp[0]; responseText = resp[1]; } } if (objtblpolicy != null && responseCode == "00") { objPaymentModel.QuoteNo = objtblpolicy.QuoteNo; objPaymentModel.ProposalNo = objtblpolicy.ProposalNo; DialogReceipt dialogReceipt = new DialogReceipt(); dialogReceipt.SendDialogOnlinePremium(objPaymentModel); Thread.Sleep(60000); objPaymentModel = AckPaymentandProcess(Context, objPaymentModel, objtblpolicy); } else { objPaymentModel.Error.ErrorMessage = "Your payment was unsuccessful, please check the accuracy of your details and try again " + responseText; } } return(objPaymentModel); } catch (Exception ex) { throw ex; } }
public AllocationModel SaveAllocation(AllocationModel objAllocationModel) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { DeleteExisitingAllocationInfo(); #region Add Allocation Info foreach (var UWDetails in objAllocationModel.objUWdetails) { tblUWAllocation objUWAllocation = new tblUWAllocation(); objUWAllocation.UWName = UWDetails.UWName; objUWAllocation.Availability = UWDetails.Availabiliy; Context.tblUWAllocations.Add(objUWAllocation); var UserInfo = Context.AspNetUsers.Where(a => a.UserName == UWDetails.UWName).FirstOrDefault(); if (UserInfo != null) { Guid _Guid = new Guid(UserInfo.Id); var UserDetails = Context.tblUserDetails.Where(a => a.UserID == _Guid).FirstOrDefault(); tblUserAvalibility objUserAvailability = new tblUserAvalibility(); objUserAvailability.NodeId = UserDetails.NodeID; objUserAvailability.UserAvailability = UWDetails.Availabiliy; Context.tblUserAvalibilities.Add(objUserAvailability); } } foreach (var ChannelDetails in objAllocationModel.objChannelDetails) { tblChannelAllocation objChannelAllocation = new tblChannelAllocation(); objChannelAllocation.ChannelName = ChannelDetails.ChannelName; objChannelAllocation.Availability = ChannelDetails.Availabiliy; Context.tblChannelAllocations.Add(objChannelAllocation); } Context.SaveChanges(); #endregion #region Call Allocation List <AllocationSummary> Result = Context.Database.SqlQuery <AllocationSummary>( "exec usp_AllocateProposals").ToList(); if (Result != null) { objAllocationModel.objAllocationSummary = new List <AllocationSummary>(); objAllocationModel.objAllocationSummary = Result; } #endregion objAllocationModel.Message = "Success"; return(objAllocationModel); } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objAllocationModel.Message = "Error"; return(objAllocationModel); } }