protected void Button1_Click(object sender, EventArgs e) { string result; long orderid;//= new bmp_PaymentBusiness().GenerateOrderId(); SetDefaultDateTime(); bmp_PaymentBusiness bmp = new bmp_PaymentBusiness(); PaymentGatewayImplService bpService = new PaymentGatewayImplService(); result = bmp.pay(1000, "99900999", out orderid, 0, 0); String[] resultArray = result.Split(','); string[] ReqIdArray = Session["ReqID"].ToString().Split(new char[] { ',' }); string[] PayID = Session["PayID"].ToString().Split(new char[] { ',' }); Session["ReqID"] = null; Session["PayID"] = null; if (resultArray[0] == "0") { ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + resultArray[1] + "');</script> ", false); } }
protected void btnPay_Click(object sender, EventArgs e) { try { string result; long orderid;// = new bmp_PaymentBusiness().GenerateOrderId(); PaymentDTO pay = new PaymentDTO(); bmp_PaymentBusiness bmp = new bmp_PaymentBusiness(); pay.Amount = Convert.ToInt64(Session["fee"].ToString()); //pay.PayDate = PayDate + "_" + PayTime; pay.stcode = Session[sessionNames.userID_StudentOstad].ToString(); pay.bankId = 2; pay.tterm = ConfigurationManager.AppSettings["Term"]; string additionalInfo = pay.stcode; PaymentGatewayImplService bpService = new PaymentGatewayImplService(); result = bmp.pay(pay.Amount, pay.stcode, out orderid, Convert.ToInt32(Session[sessionNames.appID_StudentOstad]), 0); pay.OrderId = orderid; Response.Write(result); String[] resultArray = result.Split(','); pay.ReqKey = resultArray[1]; pay.AppStatus = "none"; pay.TraceNumber = 0; pay.Result = -1; } catch (Exception) { // PayOutputLabel.Text = "Error: " + exp.Message; } }
protected void grd_GovahiRequestState_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { var cmnb = new CommonBusiness(); try { if (e.CommandName == "EditEraeBe") { var txtEditEraeBe = e.Item.FindControl("txt_EditEraeBe") as TextBox; if (txtEditEraeBe != null) { GovahiBusiness.UpdateEraeBe(txtEditEraeBe.Text, int.Parse(e.CommandArgument.ToString())); } business.UpdateStudentRequestLogID(Session[sessionNames.userID_StudentOstad].ToString(), 6, 3, int.Parse(e.CommandArgument.ToString())); GovahiBusiness.UpdateStudentPOstNumber(Session[sessionNames.userID_StudentOstad].ToString(), "", 3, int.Parse(e.CommandArgument.ToString())); cmnb.InsertIntoStudentLog(Session[sessionNames.userID_StudentOstad].ToString(), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_StudentOstad].ToString()), 19, "ویرایش محل ارائه"); var dtgo = GovahiBusiness.GetGovahiStatus(Session[sessionNames.userID_StudentOstad].ToString()); if (dtgo.Rows.Count > 0) { grd_GovahiRequestState.Visible = true; grd_GovahiRequestState.DataSource = dtgo; grd_GovahiRequestState.DataBind(); } } if (e.CommandName == "pay") { var dtbedehi = GovahiBusiness.GetBedehkar(Session[sessionNames.userID_StudentOstad].ToString()); var dts = GovahiBusiness.GetStRegisterd(Session[sessionNames.userID_StudentOstad].ToString()); var bedehi = Convert.ToDouble((dtbedehi.Rows[0]["bedehi"].ToString())); var dtmojazgovahi = GovahiBusiness.GetMojazGovahi(Session[sessionNames.userID_StudentOstad].ToString()); if (!GovahiBusiness.CanPay(Session[sessionNames.userID_StudentOstad].ToString())) { rwm_Validations.RadAlert("درخواست شما برای ترم کنونی نمی باشد لطفا درخواست ها رو حذف نمایید و مجددادرخواستی ثبت نمایید", 600, 100, "خطا", null); return; } if (dtmojazgovahi.Rows.Count == 0 && bedehi > 0) { rwm_Validations.RadAlert("به علت بدهکاری درخواست گواهی اشتغال به تحصیل مقدور نمی باشد ", 420, 100, "خطا", null); return; } else if (dts.Rows.Count == 0) { rwm_Validations.RadAlert("دانشجو در این ترم ثبت نام نکرده است", 300, 100, "خطا", null); return; } long orderid;//= new bmp_PaymentBusiness().GenerateOrderId(); SetDefaultDateTime(); var pay = new PaymentDTO(); var bmp = new bmp_PaymentBusiness(); var dt = GovahiBusiness.GetAmountForPay(Session[sessionNames.userID_StudentOstad].ToString()); grd_pay.DataSource = dt; pay.Amount = int.Parse(dt.Rows[0]["mablagh"].ToString()); pay.PayDate = PayDate + "_" + PayTime; pay.stcode = Session[sessionNames.userID_StudentOstad].ToString(); pay.bankId = 2; pay.tterm = ConfigurationManager.AppSettings["Term"]; var result = bmp.pay(pay.Amount, pay.stcode, out orderid, Convert.ToInt32(Session[sessionNames.appID_StudentOstad]), 0); pay.OrderId = orderid; var resultArray = result.Split(','); pay.ReqKey = resultArray[1]; pay.AppStatus = "none"; pay.TraceNumber = 0; pay.Result = -1; pay.PayType = 1; var reqIdArray = Session["ReqID"].ToString().Split(new char[] { ',' }); var payId = Session["PayID"].ToString().Split(new char[] { ',' }); for (var i = 0; i < reqIdArray.Length; i++) { if (i == 0) { pay.RequestId = int.Parse(reqIdArray[i]); GovahiBusiness.UpdatePymentDetail(pay.OrderId, pay.PayDate, int.Parse(payId[i]), 140000, pay.ReqKey); } else { pay.RequestId = int.Parse(reqIdArray[i]); GovahiBusiness.UpdatePymentDetail(pay.OrderId, pay.PayDate, int.Parse(payId[i]), 20000, pay.ReqKey); } } Session["ReqID"] = null; Session["PayID"] = null; if (resultArray[0] == "0") { ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + resultArray[1] + "');</script> ", false); } } if (e.CommandName == "Del") { var deloCommands = e.CommandArgument.ToString().Split(new char[] { ',' }); GovahiBusiness.DeleteGovahiRequest(int.Parse(deloCommands[0]), int.Parse(deloCommands[1])); business.InsertInToStudentLog(Session[sessionNames.userID_StudentOstad].ToString(), DateTime.Now.Date, DateTime.Now.ToShortTimeString(), 1); var dtgo = GovahiBusiness.GetGovahiStatus(Session[sessionNames.userID_StudentOstad].ToString()); if (dtgo.Rows.Count > 0) { grd_GovahiRequestState.Visible = true; grd_GovahiRequestState.DataSource = dtgo; grd_GovahiRequestState.DataBind(); } var dt = GovahiBusiness.GetAmountForPay(Session[sessionNames.userID_StudentOstad].ToString()); grd_pay.DataSource = dt; grd_pay.DataBind(); if (dt.Rows.Count > 0 && (int.Parse(dt.Rows[0]["amount"].ToString())) > 0) { grd_pay.Visible = true; } else { grd_pay.Visible = false; } } } catch (Exception exp) { Response.Write("Error: " + exp.Message); } }