public void UpdateLeadStatus(AVOAIALifeEntities Context, int leadNo, int status) { try { LeadStatus leadStatus = new LeadStatus(); leadStatus.samsLeadNumber = leadNo; leadStatus.status = status; leadStatus.statusDateTime = DateTime.Now.ToString("yyyy-MM-dd h:mm tt"); #region Log Input tbllogxml objlogxml = new tbllogxml(); objlogxml.Description = "Lead status request"; objlogxml.PolicyID = leadNo.ToString(); objlogxml.XMlData = Newtonsoft.Json.JsonConvert.SerializeObject(leadStatus); objlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(objlogxml); #endregion LeadResponse leadResponse = new LeadResponse(); InvokeApi <LeadStatus, LeadResponse>(leadStatus, "sams/update/status", ref leadResponse); #region Log output tbllogxml outlogxml = new tbllogxml(); outlogxml.Description = "Lead Update Response"; outlogxml.PolicyID = leadNo.ToString(); outlogxml.XMlData = Newtonsoft.Json.JsonConvert.SerializeObject(leadResponse); outlogxml.CreatedDate = DateTime.Now; Context.tbllogxmls.Add(outlogxml); #endregion } catch (Exception ex) { } }
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 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 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 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 = ""; } } }