protected void Page_Load(object sender, EventArgs e) { if (Request["type"] == "GetTrace") { MQueryParameter para = new MQueryParameter(); para.TypeCom = "申通快递"; para.OrderId = "3323401314893"; MResultMsg msg = ExpressageHelper.GetExpressageMessage(para); Response.Write(msg.JsonMessage); Response.End(); } if (!IsPostBack) { ((HtmlContainerControl)Master.FindControl("HTitle")).InnerText = IsCN ? "订单查询" : "Order Query"; } string acetoken = GetAccessToken(Session["APPID"].ToString(), Session["APPSECRET"].ToString()); timeStamp = TenpayUtil.getTimestamp(); string signal = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + acetoken + "&type=jsapi"; ReturnValue retValue = StreamReaderUtils.StreamReader(signal, Encoding.UTF8); string ticket = StringUtils.GetJsonValue(retValue.Message, "ticket").ToString(); string url = "jsapi_ticket=" + ticket + "&noncestr=Wm3WZYTPz0wzccnW×tamp=" + timeStamp + "&url=" + Request.Url.AbsoluteUri.ToString(); signalticket = SHA1_Hash(url); try { servCommfac = new ServiceCommon(base.factoryConnectionString); if (!IsPostBack) { if (Request["returnValue"] == null) { Session["returnValue"] = null; } } ccWhere.Clear(); ccWhere = querycontrol.GetCondtion(); //默认显示的是在厂的订单,不要显示已经出厂的订单 servCommfac.strOrderString = querycontrol.OrderString == "" ? " regtime desc " : querycontrol.OrderString; hddpnumbers = yeyRequest.Params("hpnumbers"); int iCount = 5; if (!string.IsNullOrEmpty(hddpnumbers)) { iCount = Convert.ToInt32(hddpnumbers); } iPageIndex = string.IsNullOrEmpty(Request["sPageID"]) ? 1 : Convert.ToInt32(Request["sPageID"]); int iPageCount = string.IsNullOrEmpty(Request["sPageNum"]) ? 0 : Convert.ToInt32(Request["sPageNum"]); if (Request["submitflg"] != null && Request["submitflg"] == "1") { iPageIndex = 1; this.pagecutID.iPageIndex = 1; iPageCount = 0; } string sortList = Request["sortList"]; if (Utils.IsNoSP == false) { ilist = servCommfac.GetList <ORDERS>(ORDERS.STRTABLENAME, "Order_ID,seller,sellerid,hospital,ModelNo,hospitalid,doctor,serial,patient,orderclass,indate,process," + "case when Hurry = 'Y' then 0 else '1' end as Hurry,case when TryPut = 'Y' then 0 else '1' end as TryPut,case when Slow = 'Y' then 0 else '1' end as Slow,preoutDate,case when preoutDate > GETDATE()then 1 else 0 end as expire ", ORDERS.STRKEYNAME, iCount, iPageIndex, iPageCount, ccWhere); this.pagecutID.iPageNum = servCommfac.PageCount; } else { int rowCount = servCommfac.GetCount("ORDERS", ccWhere); string filedshow = " row_number()over(order by Order_ID,serial) as rowIndex ,Order_ID, seller, sellerid, hospital, ModelNo, hospitalid, doctor, serial, patient, orderclass, indate, process,case when Hurry = 'Y' then 0 else '1' end as Hurry,case when TryPut = 'Y' then 0 else '1' end as TryPut,case when Slow = 'Y' then 0 else '1' end as Slow,preoutDate,case when preoutDate > GETDATE()then 1 else 0 end as expire"; DataTable dt = servCommfac.ExecuteSqlDatatable("select * from (select " + filedshow + " from ORDERS where 1=1 and " + ccWhere.sbComponent + ") t where rowIndex>=" + ((iPageIndex - 1) * iCount + 1).ToString() + " and rowIndex <=" + iPageIndex * iCount); ilist = Utils.ConvertTo <ORDERS>(dt); servCommfac.RowCount = rowCount; this.pagecutID.iPageNum = (rowCount - 1) / iCount + 1; } if (ilist.Count == 0) { servCommfac.PageCount = 0; } iPageAllCount = this.pagecutID.iPageNum; } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (Request.HttpMethod == "POST") { // 使用Dictionary保存参数 Hashtable myMap = new Hashtable(); NameValueCollection coll = Request.Form; string[] requestItem = coll.AllKeys; for (int i = 0; i < requestItem.Length; i++) { myMap.Add(requestItem[i], Request.Form[requestItem[i]]); } if (myMap.ContainsKey("MerId")) { chinapaysecure.SecssUtil obj = new chinapaysecure.SecssUtil(); ccWhere.Clear(); ccWhere.AddComponent("PayNoCardMerId", myMap["MerId"].ToString(), SearchComponent.Equals, SearchPad.NULL); int count = servComm.GetCount("JX_USERS", ccWhere); if (count > 0) { obj.init(Request.PhysicalApplicationPath + "ChinaPay/" + myMap["MerId"].ToString() + "/security.properties"); //初始化安全控件: } else { //B2C支付 //myMap.Add("BankInstNo", "700000000000010"); //myMap.Add("MerId", "481601512177911"); obj.init(Request.PhysicalApplicationPath + "ChinaPay/" + myMap["MerId"].ToString() + "/securityb2c.properties"); //初始化安全控件: } obj.verify(myMap); // 返回报文中不包含UPOG,表示Server端正确接收交易请求,则需要验证Server端返回报文的签名 if ("00" == obj.getErrCode()) { servComm.ExecuteSql("update W_NetPay set PayDateTime = getdate() ,PayStatus = 2 where OrderID = '" + myMap["MerOrderNo"].ToString() + "'"); //Response.Write("商户端验证返回报文签名成功\n"); //商户端根据返回报文内容处理自己的业务逻辑 ,DEMO此处只输出报文结果 //StringBuilder builder = new StringBuilder(); //builder.Append("<tr><td align=\"center\" colspan=\"2\"><b>商户端接收银联返回报文并按照表格形式输出结果</b></td></tr>"); //for (int i = 0; i < requestItem.Length; i++) //{ // builder.Append("<tr><td width=\"30%\" align=\"right\">" + requestItem[i] + "</td><td style='word-break:break-all'>" + Request.Form[requestItem[i]] + "</td></tr>"); //} //builder.Append("<tr><td width=\"30%\" align=\"right\">商户端验证银联返回报文结果</td><td>验证签名成功.</td></tr>"); //Response.Write(builder.ToString()); } else { servComm.ExecuteSql("update W_NetPay set PayDateTime = getdate() ,PayStatus = 9 where OrderID = '" + myMap["MerOrderNo"].ToString() + "'"); Response.Write("<tr><td width=\"30%\" align=\"right\">商户端验证银联返回报文结果</td><td>验证签名失败.</td></tr>"); } } } ccWhere.Clear(); ccWhere.AddComponent("UserID", CurrentUserID.ToString(), SearchComponent.Equals, SearchPad.NULL); if (!String.IsNullOrEmpty(Request["txtOrderNumner"])) { ccWhere.AddComponent("OrderID", Request["txtOrderNumner"], SearchComponent.Like, SearchPad.And); } hddpnumbers = Request["hpnumbers"]; int iCount = 10; if (!string.IsNullOrEmpty(hddpnumbers)) { iCount = Convert.ToInt32(hddpnumbers); } int iPageIndex = string.IsNullOrEmpty(Request["sPageID"]) ? 1 : Convert.ToInt32(Request["sPageID"]); int iPageCount = string.IsNullOrEmpty(Request["sPageNum"]) ? 0 : Convert.ToInt32(Request["sPageNum"]); servComm.strOrderString = " ID desc "; IList <WNetPay> ilist = servComm.GetList <WNetPay>(WNetPay.STRTABLENAME, "*", WNetPay.STRKEYNAME, iCount, iPageIndex, iPageCount, ccWhere); repUserList.DataSource = ilist; repUserList.DataBind(); pagecut1.iPageNum = servComm.PageCount; }