using getepay_sdk; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Newdelhibarassocia { public partial class Paymentstatus : System.Web.UI.Page { Class1 obj = new Class1(); protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { //string excecao = HttpContext.Session.GetString("billno"); if (Request.Cookies["Siteid"] != null) { requery(); userdetails(); datak(); } } } private void requery() { if (Request.Cookies["Siteid"] != null) { HttpCookie nameCookie = new HttpCookie("Siteid"); nameCookie = Request.Cookies["Siteid"]; string valss = nameCookie.Value.Replace("Siteid=", ""); string qrajneeti = "select * from newdelhibar_bill where Billno='" + valss + "' order by id desc"; DataSet dsrajneeti = obj.ReturnDataSet(qrajneeti); string pidd = ""; string mm = ""; string ndmm = ""; if (dsrajneeti != null && dsrajneeti.Tables[0].Rows.Count > 0) { pidd = dsrajneeti.Tables[0].Rows[0]["payment_id"].ToString(); mm = dsrajneeti.Tables[0].Rows[0]["payment_id"].ToString(); } string qrajneetis = "select * from newdelhibar_bill where Billno='" + valss + "' order by id desc"; DataSet dsrajneetis = obj.ReturnDataSet(qrajneetis); if (dsrajneetis != null && dsrajneetis.Tables[0].Rows.Count > 0) { mm = dsrajneetis.Tables[0].Rows[0]["Mobile"].ToString(); ndmm= dsrajneetis.Tables[0].Rows[0]["NDBAno"].ToString(); } GetepayConfig config = new GetepayConfig(); config.mid = "1227227"; config.terminalId = "Getepay.merchant130734@icici"; config.key = "l3D6kcnp9IZNZiMQ8+C1kYEo0VNzffF+orKvE7uCMus="; config.iv = "dE34q4DiabaFq0r9XeWVaw=="; //config.url = "https://pay1.getepay.in:8443/getepayPortal/pg/invoiceStatus"; config.url = "https://portal.getepay.in:8443/getepayPortal/pg/invoiceStatus"; //https://portal.getepay.in:8443/getepayPortal/pg/pgPaymentResponse //Requery Reference GetepayRequery getepayRequery = new GetepayRequery(); getepayRequery.paymentId = pidd.ToString(); getepayRequery.terminalId = config.terminalId; getepayRequery.mid = config.mid; //added to solve ssl error for requery System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; GetepayRequeryResponse requeryResponse = Getepay.requeryRequest(config, getepayRequery); Literal10.Text = requeryResponse.txnStatus; if (requeryResponse.txnStatus == "SUCCESS") { string amm = requeryResponse.txnAmount.ToString(); string up = "update newdelhibar_bill set Status='SUCCESS' where Billno='" + valss + "'"; obj.SaveRecord(up); Panel1.Visible = true; string messag = "We confirm receipt of online payment made via NDBA for " + amm + " against Membership Renew Bill No: " + valss + ". - NDBA"; string SmsStatusMsg = string.Empty; WebClient client = new WebClient(); // mm = "9871482014"; string URL = "http://www.canlog.in/api/mt/SendSMS?user=NDBA1234&password=NDBA1234&senderid=NDBATM&channel=Trans&DCS=0&flashsms=0&number=" + mm + "&text=" + messag + "&route=2"; SmsStatusMsg = client.DownloadString(URL); if (SmsStatusMsg.Contains("
")) { SmsStatusMsg = SmsStatusMsg.Replace("
", ", "); } nameCookie.Expires = DateTime.Now.AddDays(-1); //Add the Cookie to Browser. Response.Cookies.Add(nameCookie); try { string qrdue = "select * from Membersduelist where Ndbano='" + ndmm + "' order by id desc"; DataSet dsdue = obj.ReturnDataSet(qrdue); string ddue = "0"; int k = 0; int kk = 0; if (dsdue != null && dsdue.Tables[0].Rows.Count > 0) { ddue = dsdue.Tables[0].Rows[0]["dues"].ToString(); DateTime dt2 = Convert.ToDateTime(dsdue.Tables[0].Rows[0]["Ndbadate"].ToString()); DateTime dt1 = DateTime.Now.AddDays(-1); var monthCount = dt1.Year != dt1.Year ? ((dt1.Year - dt2.Year - 1) * 12) + (13 - dt2.Month + dt1.Month) : dt1.Month - dt2.Month; k = 100 * monthCount; string qra = "select * from newdelhibar_bill where Billno='" + valss + "' and Status='SUCCESS'"; DataSet dsra = obj.ReturnDataSet(qra); if (dsra != null && dsra.Tables[0].Rows.Count > 0) { int dueson = 0; int amms = Convert.ToInt32(dsra.Tables[0].Rows[0]["totalamount"].ToString()); if (monthCount > 0) { dueson = Convert.ToInt32(ddue) + k; kk = Convert.ToInt32(dueson) - Convert.ToInt32(amms); } else { kk = Convert.ToInt32(ddue) - Convert.ToInt32(amms); } if (kk >= 0) { string updue = "update Membersduelist set dues='" + kk + "' where Ndbano='" + ndmm + "'"; obj.SaveRecord(updue); } else { int result = kk / 100; string kj = result.ToString().Replace("-", ""); dt2 = dt2.AddMonths(Convert.ToInt32(kj) + monthCount); string updue = "update Membersduelist set dues='0' , Ndbadate='" + dt2.ToString() + "' where Ndbano='" + ndmm + "'"; obj.SaveRecord(updue); } // HealthNewsdata(); // string updue = "update Membersduelist set dues='" + kk + "' where Ndbano='" + nd.Text + "'"; // obj.SaveRecord(updue); } } } catch { } } else { Literal11.Text = "Payment " + requeryResponse.txnStatus; string up = "update newdelhibar_bill set Status='"+ requeryResponse.txnStatus + "' where Billno='" + valss + "'"; obj.SaveRecord(up); } // Console.WriteLine("11", requeryResponse.txnStatus); } } void userdetails() { HttpCookie nameCookie = new HttpCookie("Siteid"); nameCookie = Request.Cookies["Siteid"]; string valss = nameCookie.Value.Replace("Siteid=", ""); string qras = "select * from newdelhibar_bill where Billno='" + valss + "'"; DataSet dss = obj.ReturnDataSet(qras); if (dss != null && dss.Tables[0].Rows.Count > 0) { Literal3.Text = dss.Tables[0].Rows[0]["Name"].ToString(); DateTime dateTime = Convert.ToDateTime(dss.Tables[0].Rows[0]["Daten"].ToString()); Literal2.Text = dateTime.ToString("dd/MM/yyyy").Replace("12:00:00 AM", ""); Literal4.Text = dss.Tables[0].Rows[0]["NDBAno"].ToString(); Literal1.Text = dss.Tables[0].Rows[0]["Billno"].ToString(); Literal4.Text = dss.Tables[0].Rows[0]["NDBAno"].ToString(); Literal5.Text = dss.Tables[0].Rows[0]["BCDno"].ToString(); Literal6.Text = dss.Tables[0].Rows[0]["Address"].ToString(); Literal7.Text = dss.Tables[0].Rows[0]["Headermessage"].ToString(); Literal9.Text = dss.Tables[0].Rows[0]["Footermessage"].ToString(); string q = "Select SUM(CAST(Amount as int)) from newdelhibar_rowbill where Billno='" + valss + "'"; DataSet ds = obj.ReturnDataSet(q); if (ds != null && ds.Tables[0].Rows.Count > 0) { Literal8.Text = ds.Tables[0].Rows[0][0].ToString(); } } } void datak() { HttpCookie nameCookie = new HttpCookie("Siteid"); nameCookie = Request.Cookies["Siteid"]; string valss = nameCookie.Value.Replace("Siteid=", ""); string qrajneeti = "select * from newdelhibar_rowbill where Billno='" + valss + "' order by id desc"; DataSet dsrajneeti = obj.ReturnDataSet(qrajneeti); if (dsrajneeti != null && dsrajneeti.Tables[0].Rows.Count > 0) { DataGrid5.Visible = true; DataGrid5.DataSource = dsrajneeti; DataGrid5.DataBind(); } else { DataGrid5.Visible = false; } } } }