public void Bind() { int pageCount = 0; int Counts = 0; //每页显示的数据设置 if (this.txtPageSize.Value.ToString() != "") { if (this.txtPageSize.Value.Trim().Length >= 5) { Pager.PageSize = 20; this.txtPageSize.Value = "20"; } else { Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0); } } List <Hi.Model.Pay_Service> ServiceList = new Hi.BLL.Pay_Service().GetList(Pager.PageSize, Pager.CurrentPageIndex, "CreateDate", true, SearchWhere(), out pageCount, out Counts); this.ServiceList.DataSource = ServiceList; this.ServiceList.DataBind(); Pager.RecordCount = Counts; page = Pager.CurrentPageIndex.ToString(); }
public void Bind() { decimal price = 0; Hi.Model.Pay_Service orderM = new Hi.BLL.Pay_Service().GetModel(KeyID); price = orderM.PayedPrice; this.PayedAmount.InnerHtml = price.ToString("0.00"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataBinds(); List <Hi.Model.Pay_Service> ServiceList = new Hi.BLL.Pay_Service().GetList(" top 5 *", " isnull(dr,0)=0 and IsAudit=1 and CompID=" + KeyID + " ", " OutData desc"); this.ServiceList.DataSource = ServiceList; this.ServiceList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { object obj = Request["action"]; if (obj != null) { //选中的商品 if (obj.ToString() == "Pay") { string type = Request["type"] + ""; Response.Write(AddOrder(type)); Response.End(); } } if (!IsPostBack) { LoginModel logUser = Session["UserModel"] as LoginModel; if (logUser != null) { Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Convert.ToInt32(logUser.CompID)); if (comp != null) { if (comp.EnabledEndDate.ToString() == "0001/1/1 0:00:00") { //没有任何服务记录 } else if (comp.EnabledEndDate < DateTime.Now.AddDays(1)) { //服务已过期 // Msg.InnerHtml = "您的服务期限已过,请尽快购买服务"; } else { //服务日期有效 // Msg.InnerHtml = "您当前服务期限:"+ comp.EnabledEndDate.ToString("yyyy-MM-dd") + ""; } } //绑定支付记录 List <Hi.Model.Pay_Service> deleteList = new Hi.BLL.Pay_Service().GetList("*", " CompID=" + logUser.CompID + " and IsAudit=1 ", " createdate desc"); Services.DataSource = deleteList; Services.DataBind(); } } }
/// <summary> /// 购买服务 /// </summary> /// <param name="type">服务种类</param> /// <returns></returns> public string AddOrder(string type) { try { LoginModel logUser = Session["UserModel"] as LoginModel; List <Hi.Model.Pay_Service> deleteList = new Hi.BLL.Pay_Service().GetList("*", " CompID=" + logUser.CompID + " and PayedPrice=0 and IsAudit=2 ", " createdate desc"); if (deleteList.Count > 0) { foreach (var item in deleteList) { new Hi.BLL.Pay_Service().Delete(item.ID); } } string outdata = "0"; //判断是否已经存在有效的服务(获取已存在的服务过期日期) string CreateDate = "0"; //同上 Hi.Model.Pay_Service service = new Hi.Model.Pay_Service(); service.CompID = logUser.CompID; service.CompName = logUser.CompName; outdata = Common.GetCompService(logUser.CompID.ToString(), out CreateDate);// 存在有效服务 有效日期累加 //List<Hi.Model.Pay_Service> serviceord = new Hi.BLL.Pay_Service().GetList("*", " compid=" + logUser.CompID + " and isaudit=1 and outofdata=0 and OutData>'" + DateTime.Now.ToString("yyyy-MM-dd") + "' ", " OutData desc"); //if (serviceord.Count>0) //{ // outdata = serviceord[0].OutData.ToString();//存在有效服务 有效日期累加 // CreateDate= serviceord[0].CreateDate.ToString(); //} if (type == "1") //月服务 { service.ServiceType = 2; //服务类别 2:月 1:年 service.OutData = outdata == "0"?DateTime.Now.AddMonths(1):Convert.ToDateTime(outdata).AddMonths(1); //服务到期日期 service.Price = 499; //服务金额 } else//年服务 { service.ServiceType = 1; //服务类别 2:月 1:年 service.OutData = outdata == "0" ? DateTime.Now.AddYears(1): Convert.ToDateTime(outdata).AddYears(1); // 服务到期日期 service.Price = 4999; } service.CreateDate = CreateDate == "0"? DateTime.Now:Convert.ToDateTime(CreateDate); service.CreateUser = logUser.UserID; service.OutOfData = 0; //是否过期 0否 1是 service.PayedPrice = 0; //已经支付金额 service.IsAudit = 2; //支付状态 1成功 2失败 service.ts = DateTime.Now; service.dr = 0; service.modifyuser = logUser.UserID; int OrderId = new Hi.BLL.Pay_Service().Add(service); KeyID = Common.DesEncrypt(OrderId.ToString(), Common.EncryptKey); if (OrderId > 0) { return("{\"rel\":\"OK\",\"Orderid\":\"" + KeyID + "\"}"); } else { return("{\"rel\":\"NO\",\"Msg\":\"网络异常 请稍后再试\"}"); } //return "{\"rel\":\"OK\",\"Orderid\":\"2\"}"; } catch (Exception e) { return("{\"rel\":\"NO\",\"Msg\":\"" + e.Message + "\"}"); throw; } }
public void Bind() { Hi.Model.Pay_Service service = new Hi.BLL.Pay_Service().GetModel(KeyID); Price = service.Price; //orderModel = new Hi.BLL.DIS_Order().GetModel(KeyID); //decimal payPrice = orderModel.AuditAmount + orderModel.OtherAmount - orderModel.PayedAmount; //this.lblOrderNO.InnerText = orderModel.ReceiptNo.Trim().ToString(); ////账单支付链接 //if (orderModel.Otype == 9) // this.lblOrderNO.HRef = "../OrderZDInfo.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey); //else //this.lblOrderNO.HRef = "../neworder/orderdetail.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey); string outdata;//服务起始日期 //List<Hi.Model.Pay_Service> serviceord = new Hi.BLL.Pay_Service().GetList("*", " compid=" + this.CompID + " and isaudit=1 and outofdata=0 ", " createdate desc"); //if (serviceord.Count > 0) //{ // outdata = serviceord[0].OutData.ToString("yyyy-MM-dd");//存在有效服务 获取购买服务起始日期 //} //else //{ // string CreateDate = string.Empty; // //获取购买服务的起始日期 // Common.GetCompService(CompID.ToString(),out outdata); // if (outdata=="0") // { // outdata = DateTime.Now.ToString("yyyy-MM-dd"); // } //} Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Convert.ToInt32(CompID)); if (comp.EnabledEndDate.ToString() == "0001/1/1 0:00:00") { //没有任何服务记录 if (service.ServiceType == 1) { outdata = Convert.ToDateTime(service.OutData).AddYears(-1).ToString(); } else { outdata = Convert.ToDateTime(service.OutData).AddMonths(-1).ToString(); } } else if (comp.EnabledEndDate < DateTime.Now.AddDays(1)) { //服务已过期 if (service.ServiceType == 1) { outdata = Convert.ToDateTime(service.OutData).AddYears(-1).ToString(); } else { outdata = Convert.ToDateTime(service.OutData).AddMonths(-1).ToString(); } } else { //服务日期有效 if (service.ServiceType == 1) { outdata = Convert.ToDateTime(service.OutData).AddYears(-1).AddDays(1).ToString(); } else { outdata = Convert.ToDateTime(service.OutData).AddMonths(-1).AddDays(1).ToString(); } } Data.InnerHtml = Convert.ToDateTime(outdata).ToString("yyyy-MM-dd"); DataEnd.InnerHtml = service.OutData.ToString("yyyy-MM-dd"); this.hidOrderid.Value = KeyID.ToString(); //this.lblPricePay.InnerText = service.Price.ToString("0.00"); this.hidPricePay.Value = service.Price.ToString("0.00"); //this.lblPriceO.InnerText = service.Price.ToString("0.00"); if (this.txtPayOrder.Value == "") { this.txtPayOrder.Value = service.Price.ToString("0.00"); } else { this.txtPayOrder.Value = Convert.ToDecimal(this.txtPayOrder.Value).ToString("0.00"); } this.hidUserName.Value = this.UserName; //decimal sumPrice = new Hi.BLL.PAY_PrePayment().sums(orderModel.DisID, orderModel.CompID); //this.lblSumPrice.InnerText = sumPrice.ToString("0.00"); this.hidSumPrice.Value = service.Price.ToString("0.00"); //string strWhere = " 1=1 "; //if (this.DisID != 0) //{ // strWhere += " and DisID = " + this.DisID; //} //strWhere += " and Start = 1 and vdef6 = 0 and isnull(dr,0)=0"; //List<Hi.Model.PAY_FastPayMent> fastList = new Hi.BLL.PAY_FastPayMent().GetList("", strWhere, ""); //this.rptQpay.DataSource = fastList; //this.rptQpay.DataBind(); List <Hi.Model.PAY_BankInfo> BankL = new Hi.BLL.PAY_BankInfo().GetList("", " vdef1=0", ""); this.rptOtherBank.DataSource = BankL; this.rptOtherBank.DataBind(); }
/// <summary> /// 订单支付 /// </summary> /// <param name="orderid">订单ID</param> /// <param name="txtPayOrder">支付金额</param> /// <param name="price">企业钱包金额</param> /// <param name="yfk">预付款</param> /// <param name="payPas"></param> public Wxpay_Url PayOrder(int orderid, decimal txtPayOrder, decimal price, int yfk, string payPas) { //使用企业钱包 serviceOrder = new Hi.BLL.Pay_Service().GetModel(orderid); #region 界面上显示 this.lblOrderNO.InnerText = serviceOrder.ID.ToString();; this.fee.InnerText = "医伴金服";//收款方 #endregion 界面上显示 decimal payPrice = serviceOrder.Price;//支付金额 #region 插入支付表记录 Hi.Model.PAY_Payment payModel = new Hi.Model.PAY_Payment(); string orderNo = WebConfigurationManager.AppSettings["OrgCode"] + DateTime.Now.ToString("yyyyMMdd");//支付订单号前半部分 string guid = Guid.NewGuid().ToString().Replace("-", ""); payModel.OrderID = serviceOrder.ID; // orderid; payModel.DisID = 0; payModel.Type = 0; // isDBPay; payModel.PayUser = this.CompName; payModel.PayPrice = payPrice; payModel.IsAudit = 2; payModel.guid = Common.Number_repeat(guid); payModel.vdef3 = "3"; //1,订单支付,2,预付款充值、汇款 3购买服务 payModel.vdef4 = orderNo; payModel.CreateDate = DateTime.Now; payModel.CreateUserID = this.UserID; payModel.ts = DateTime.Now; payModel.modifyuser = this.UserID; payModel.PrintNum = 1; //支付宝支付无需结算 //判断账户类型,判断支付渠道 payModel.Channel = "7"; //1,快捷支付,2,银联支付 ,3,网银支付,4,B2B网银支付,5,线下支付,6,支付宝支付 7,微信支付 payModel.State = 0; //手续费收取方 payModel.vdef5 = "0.00"; //支付手续费 payid = new Hi.BLL.PAY_Payment().Add(payModel); //if (prepayid > 0) //{ // Hi.Model.PAY_PrePayment prepayMent = new Hi.BLL.PAY_PrePayment().GetModel(prepayid); // prepayMent.vdef4 = payid.ToString();//与企业钱包关联 // new Hi.BLL.PAY_PrePayment().Update(prepayMent); //} Hi.Model.PAY_RegisterLog regModel = new Hi.Model.PAY_RegisterLog(); regModel.OrderId = serviceOrder.ID;// orderid; regModel.Ordercode = orderNo + payid.ToString(); regModel.number = payModel.guid; regModel.Price = payPrice; regModel.Payuse = "订单支付"; regModel.PayName = this.CompName; regModel.DisID = 0; regModel.PayTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); regModel.Remark = "厂商购买服务";// orderModel.Remark; regModel.DisName = this.CompName; regModel.BankID = "微信支付"; regModel.CreateUser = this.UserID; regModel.CreateDate = DateTime.Now; regModel.LogType = 1311; int regid = new Hi.BLL.PAY_RegisterLog().Add(regModel); serviceOrder.IsAudit = 1; serviceOrder.PayedPrice = payPrice; bool serid = new Hi.BLL.Pay_Service().Update(serviceOrder); if (payid <= 0 || regid <= 0 || !serid) { Response.Redirect("Error.aspx", false); } ; #endregion int amount = Convert.ToInt32(payPrice * 100);//支付金额(单位:分) //隐藏域赋值 this.hidguid.Value = payModel.guid; this.hidprice.Value = payPrice.ToString(); this.hidordid.Value = payModel.OrderID.ToString(); this.hidpid.Value = payid.ToString(); this.hidppid.Value = prepayid.ToString(); // btnWxPay_Click(payModel.guid, orderid.ToString(), amount); Wxpay_Url wxpaymodel = new Wxpay_Url(); wxpaymodel.Guid = payModel.guid; wxpaymodel.OrderID = orderid.ToString(); wxpaymodel.Amount = amount; wxpaymodel.Hidguid = payModel.guid; wxpaymodel.Hidprice = payModel.PayPrice.ToString(); wxpaymodel.Hidordid = payModel.OrderID.ToString(); wxpaymodel.Hidpid = payid.ToString(); wxpaymodel.Hidppid = prepayid.ToString(); return(wxpaymodel); }
protected void Page_Load(object sender, EventArgs e) { int orderid = 0; if (!IsPostBack) { try { // 1.取得参数 if (Request["hidOid"] == "") { orderid = 0; } else { KeyID = Common.DesDecrypt(Request["hidOid"], Common.EncryptKey).ToInt(0); orderid = KeyID; } //if (!Common.PageDisOperable("Order", orderid, this.DisID)) //{ // Response.Redirect("../../NoOperable.aspx", true); // return; //} decimal txtPayOrder = Convert.ToDecimal(Request["hidPayOrder"]);//本次支付总金额 //decimal price = Convert.ToDecimal(Request.Form["hidPrice"]);//使用企业钱包金额 //int yfk = Convert.ToInt32(Request.Form["hidIsPre"]);//是否使用企业钱包 1:是 0:否 //int isDBPay = Convert.ToInt32(Request["hidIsDBPay"]);//是否是担保支付 1:是 0:否 string bankid = Common.NoHTML(Convert.ToString(Request["hidBankNo"])); //银行编号 string AccountType = Request["hidAccountType"]; //账户类型 //string payPas = Common.NoHTML(Convert.ToString(Request.Form["hidPayPas"]));//企业钱包密码 //Hi.Model.BD_Distributor disModel = new Hi.BLL.BD_Distributor().GetModel(this.DisID); //if (disModel == null) //{ // err = true; // ErrMessage("数据异常"); // return; //} //decimal sumPrice = new Hi.BLL.PAY_PrePayment().sums(disModel.ID, disModel.CompID);//剩余企业钱包 //int disid = this.DisID;//代理商ID //string password = disModel.Paypwd; //if (yfk == 1) //{ // if (payPas == null || payPas.Trim().ToString() == "") // { // err = true; // ErrMessage("企业钱包密码不能为空"); // return; // } // payPas = payPas.Trim().ToString(); // if (password == Util.md5("123456")) // { // err = true; // ErrMessage("请先修改企业钱包支付密码"); // return; // } // else // { // if (payPas == "") // { // //string Josn = "{\"error\":\"1\",\"msg\":\"密码不能为空!\"}"; // err = true; // ErrMessage("密码不能为空"); // return; // } // } //} Hi.Model.Pay_Service orderModel = new Hi.BLL.Pay_Service().GetModel(orderid); txtPayOrder = orderModel.Price;//需要支付的金额 if (orderModel == null) { err = true; ErrMessage("数据有误"); return; } decimal payPrice = 0; if (txtPayOrder == 0) { err = true; ErrMessage("支付金额不能为0"); return; } payPrice = txtPayOrder; //if (yfk == 1 && txtPayOrder < price) //{ // err = true; // ErrMessage("使用企业钱包大于支付金额!"); // return; //} //if (yfk == 1) // payPrice = txtPayOrder - price; //else // payPrice = txtPayOrder; if (orderid <= 0) { //string Josn = "{\"error\":\"1\",\"msg\":\"操作有误!\"}"; err = true; ErrMessage("数据有误"); return; } //if (txtPayOrder > orderModel.AuditAmount + orderModel.OtherAmount - orderModel.PayedAmount) //{ // err = true; // ErrMessage("支付金额大于未支付金额,不能支付!"); // return; //} //if (!(( // (orderModel.Otype == (int)Enums.OType.赊销订单 && (orderModel.OState != (int)Enums.OrderState.退回 && orderModel.OState != (int)Enums.OrderState.未提交 && orderModel.OState != (int)Enums.OrderState.待审核) && (orderModel.PayState == (int)Enums.PayState.未支付 || orderModel.PayState == (int)Enums.PayState.部分支付)) || // (orderModel.Otype != (int)Enums.OType.赊销订单 && orderModel.Otype != (int)Enums.OType.推送账单 && (orderModel.OState == (int)Enums.OrderState.已审 || orderModel.OState == (int)Enums.OrderState.已发货 || orderModel.OState == (int)Enums.OrderState.已到货) && (orderModel.PayState == (int)Enums.PayState.未支付 || orderModel.PayState == (int)Enums.PayState.部分支付)) || // (orderModel.Otype == (int)Enums.OType.推送账单 && orderModel.OState == (int)Enums.OrderState.已审 && (orderModel.PayState == (int)Enums.PayState.部分支付 || orderModel.PayState == (int)Enums.PayState.未支付)) // ) // && orderModel.OState != (int)Enums.OrderState.已作废)) //{ // if (orderModel.Otype == (int)Enums.OType.推送账单) // { // err = true; // ErrMessage("账单异常,不能支付"); // } // else // { // err = true; // ErrMessage("订单异常,不能支付"); // } // return; //} int prepayid = 0; //if (yfk == 1 && price > 0) //{ // //企业钱包处理 // if (sumPrice < price) // { // err = true; // ErrMessage("企业钱包余额不足"); // return; // } // if (disModel.Paypwd != Util.md5(payPas)) // { // err = true; // ErrMessage("支付密码不正确"); // return; // } // Hi.Model.PAY_PrePayment prepayModel = new Hi.Model.PAY_PrePayment(); // prepayModel.CompID = disModel.CompID; // prepayModel.DisID = disModel.ID; // prepayModel.OrderID = orderid; // prepayModel.Start = 2; // prepayModel.PreType = 5; // prepayModel.price = price * -1; // prepayModel.Paytime = DateTime.Now; // prepayModel.CreatDate = DateTime.Now; // prepayModel.CrateUser = this.UserID; // prepayModel.AuditState = 2; // prepayModel.IsEnabled = 1; // prepayModel.ts = DateTime.Now; // prepayModel.modifyuser = this.UserID; // prepayModel.guid = Common.Number_repeat(Guid.NewGuid().ToString().Replace("-", "")); // // prepayModel.vdef1 = "订单支付"; // prepayid = new Hi.BLL.PAY_PrePayment().Add(prepayModel); // int prepay = 0; // int order = 0; // if (prepayid > 0 && payPrice == 0)//payPrice(网银支付金额)= 0 ,只用企业钱包支付,修改状态 // { // SqlConnection con = new SqlConnection(LocalSqlServer); // con.Open(); // SqlTransaction sqlTrans = con.BeginTransaction(); // try // { // prepay = new Hi.BLL.PAY_PrePayment().updatePrepayState(con, prepayid, sqlTrans);//修改企业钱包状态 // order = new Hi.BLL.DIS_Order().UpdateOrderPstate(con, orderid, price, sqlTrans);//修改订单状态 // if (prepay > 0 && order > 0) // sqlTrans.Commit(); // else // sqlTrans.Rollback(); // } // catch // { // prepay = 0; // order = 0; // sqlTrans.Rollback(); // } // finally // { // con.Close(); // } // if (prepay > 0 && order > 0) // { // try // { // if (orderModel.Otype == (int)Enums.OType.推送账单) // Utils.AddSysBusinessLog(disModel.CompID, "Order", orderid.ToString(), "账单支付", "支付:" + price.ToString("0.00") + "元(企业钱包支付)", this.UserID.ToString()); // else // Utils.AddSysBusinessLog(disModel.CompID, "Order", orderid.ToString(), "订单支付", "支付:" + price + "元(企业钱包支付)", this.UserID.ToString()); // if (orderModel.Otype != 9) // { // OrderInfoType.AddIntegral(this.CompID, this.DisID, "1", 1, orderid, price, "订单支付", "", this.UserID); // } // new Common().GetWxService("2", orderid.ToString(), "1", price); // } // catch (Exception ex) { throw ex; } // if (orderModel.Otype == (int)Enums.OType.推送账单) // { // err = true;//阻止进入网银支付 // Response.Redirect("PaySuccess.aspx?type=" + Common.DesEncrypt("2", Common.EncryptKey) + "&KeyID=" + Common.DesEncrypt(orderid.ToString(), Common.EncryptKey) + "&Pid=" + Common.DesEncrypt("0".ToString(), Common.EncryptKey) + "&PPid=" + Common.DesEncrypt(prepayid.ToString(), Common.EncryptKey) + "&IsRef=Y", false); // } // else // { // err = true;//阻止进入网银支付 // Response.Redirect("PaySuccess.aspx?type=" + Common.DesEncrypt("1", Common.EncryptKey) + "&KeyID=" + Common.DesEncrypt(orderid.ToString(), Common.EncryptKey) + "&Pid=" + Common.DesEncrypt("0".ToString(), Common.EncryptKey) + "&PPid=" + Common.DesEncrypt(prepayid.ToString(), Common.EncryptKey) + "&IsRef=Y", false); // } // return; // } // else // { // err = true; // ErrMessage("支付失败"); // return; // } // } //} //if (payPrice <= 0) //{ // err = true; // ErrMessage("数据有误"); // return; //} #region 计算支付手续费 start string sxfsq = "-1"; decimal sxf = 0; // 获取手续费 begin string[] Json = Common.GetSxf(this.CompID, AccountType, bankid, payPrice); string strMsg = Json[2].ToString(); if (!string.IsNullOrEmpty(strMsg)) { ErrMessage(strMsg); return; } else { sxfsq = Json[1].ToString(); sxf = Convert.ToDecimal(Json[0]); } // 获取手续费 end //支付总金额(含手续费) decimal UNIT = 0.01M; payPrice = payPrice + Common.Round(sxf, UNIT); #endregion 计算支付手续费 end int payid = 0; int regid = 0; Hi.Model.PAY_Payment payModel = new Hi.Model.PAY_Payment(); string orderNo = WebConfigurationManager.AppSettings["OrgCode"] + DateTime.Now.ToString("yyyyMMdd");//支付订单号前半部分 string guid = Guid.NewGuid().ToString().Replace("-", ""); payModel.OrderID = orderid; payModel.DisID = 0; payModel.Type = 0; /*isDBPay*/; payModel.PayUser = this.CompName; payModel.PayPrice = payPrice; payModel.IsAudit = 2; payModel.guid = Common.Number_repeat(guid); payModel.vdef3 = "3"; payModel.vdef4 = orderNo; payModel.CreateDate = DateTime.Now; payModel.CreateUserID = this.UserID; payModel.ts = DateTime.Now; payModel.modifyuser = this.UserID; //判断账户类型,判断支付渠道,然后赋值 if (AccountType == "11") { if (bankid == "888") { payModel.Channel = "2"; } else { payModel.Channel = "3"; } }//信用卡支付 else if (AccountType == "13") { payModel.Channel = "8"; } else//网银支付 { payModel.Channel = "4"; } payModel.State = Convert.ToInt32(sxfsq); //手续费收取方 payModel.vdef5 = sxf.ToString("0.00"); //支付手续费 payModel.vdef9 = "1"; //默认支付 payid = new Hi.BLL.PAY_Payment().Add(payModel); //if (prepayid > 0) //{ // Hi.Model.PAY_PrePayment prepayMent = new Hi.BLL.PAY_PrePayment().GetModel(prepayid); // prepayMent.vdef4 = payid.ToString();//与企业钱包关联 // new Hi.BLL.PAY_PrePayment().Update(prepayMent); //} Hi.Model.PAY_RegisterLog regModel = new Hi.Model.PAY_RegisterLog(); regModel.OrderId = orderid; regModel.Ordercode = orderNo + payid.ToString(); regModel.number = payModel.guid; regModel.Price = payPrice; regModel.Payuse = "订单支付"; regModel.PayName = this.CompName; regModel.DisID = 0; regModel.PayTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); regModel.Remark = "厂商购买服务"; regModel.DisName = this.CompName; regModel.BankID = bankid; regModel.CreateUser = this.UserID; regModel.CreateDate = DateTime.Now; regModel.LogType = 1311; regid = new Hi.BLL.PAY_RegisterLog().Add(regModel); if (payid <= 0 || regid <= 0) { err = true; ErrMessage("数据有误"); return; } string configPath = WebConfigurationManager.AppSettings["payment.config.path"]; try { PaymentEnvironment.Initialize(configPath); } catch (Exception ex) { //string Josn = "{\"error\":\"1\",\"msg\":\"支付配置有误,请联系系统管理员!\"}"; err = true; ErrMessage("支付配置有误,请联系系统管理员"); return; } String institutionID = WebConfigurationManager.AppSettings["PayOrgCode"]; //机构代码 long amount = Convert.ToInt64(payPrice * 100); //支付金额(单位:分) long fee = 0; String usage = "服务订单"; String remark = "厂商购买服务"; String notificationURL = ""; //"http://www.my1818.com/Company/Pay/ReceiveNoticePage.ashx";//Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + if (WebConfigurationManager.AppSettings["PayType"] == "0") { notificationURL = Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + "/Company/Pay/ReceiveNoticePage.ashx"; } else { notificationURL = "http://www.my1818.com/Company/Pay/ReceiveNoticePage.ashx";//回调页面地址 } String payees = this.CompName; //判断支付接口 string Pay_type = WebConfigurationManager.AppSettings["PayType"]; String bankID = string.Empty; if (Pay_type == "0") //测试接口 { bankID = "700"; //bankid;// } else { bankID = bankid;//正式接口 } int accountType = Convert.ToInt32(AccountType); // 2.创建交易请求对象 Tx1311Request tx1311Request = new Tx1311Request(); tx1311Request.setInstitutionID(institutionID); //机构号码 tx1311Request.setOrderNo(orderNo + payid.ToString()); //订单号 tx1311Request.setPaymentNo(payModel.guid); //支付交易流水号 tx1311Request.setAmount(amount); //支付金额 单位分 tx1311Request.setFee(fee); //支付服务手续费 单位分 tx1311Request.setPayerID(""); //付款人注册ID tx1311Request.setPayerName(""); //付款方名称 tx1311Request.setUsage(usage); //资金用途 tx1311Request.setRemark(remark); //备注 tx1311Request.setNotificationURL(notificationURL); //机构接收支付通知的URL tx1311Request.addPayee(""); //收款方名称 if (accountType == 13) { tx1311Request.setAccountType(11); //付款方帐号类型 tx1311Request.setCardType("02"); //银行卡类型(01=借记卡、02=贷记卡) } else if (accountType == 11) { tx1311Request.setAccountType(accountType); //付款方帐号类型 tx1311Request.setCardType("01"); //银行卡类型(01=借记卡、02=贷记卡) } else if (accountType == 12) { tx1311Request.setAccountType(accountType); //付款方帐号类型 } tx1311Request.setBankID(bankID); //付款银行标识 // 3.执行报文处理 tx1311Request.process(); try { Hi.Model.PAY_RegisterLog regM = new Hi.BLL.PAY_RegisterLog().GetModel(regid); regM.PlanMessage = tx1311Request.getRequestPlainText(); new Hi.BLL.PAY_RegisterLog().Update(regM); } catch (Exception ex) { throw ex; } //跳转的url地址 HttpContext.Current.Items["action"] = PaymentEnvironment.PaymentURL; //中金返回信息 HttpContext.Current.Items["message"] = tx1311Request.getRequestMessage(); //中金签名信息 HttpContext.Current.Items["signature"] = tx1311Request.getRequestSignature(); } catch (Exception ex) { err = true; ErrMessage(ex.Message); return; } finally { if (!err) { Context.Server.Transfer("DoSubmit.aspx", false); } } } }