public ActionResult OrderDetail(string ordernum) { VIEW_TG_order order = new VIEW_TG_order() { orderNum = CommonMethod.GetOrderNum(), trade_type = "ONLINE", orderTime = DateTime.Now, ThingNum = CommonMethod.GetCode(18) }; ViewBag.ReturnUrl = Request["returnurl"]; ViewBag.TYPE = "Update"; if (string.IsNullOrEmpty(ordernum)) { ViewBag.TYPE = "Add"; var list = sys_userlogin.LoadListBy(su => su.LOGIN_ID == OperateContext.Current.UsrId).Select(su => su.SLSORG_CD); ViewBag.MEMBERS = DataSelect.ToListViewModel(VIEW_YX_weiUser.ToListViewModel(userB.GetListBy(u => list.Contains(u.TREE_NODE_ID) && u.isfenxiao != 0, u => u.userRelname))); ViewBag.COMPANYS = DataSelect.ToListViewModel(VIEW_MST_SUPPLIER.ToListViewModel(supplierB.GetListBy(u => list.Contains(u.TREE_NODE_ID) && u.SYNCOPERATION != "D", u => u.SUPPLIER_ID))); } var model = orderB.Get(o => o.orderNum == ordernum); if (model != null) { order = VIEW_TG_order.ToViewModel(model); ViewBag.Things = VIEW_TG_Thing.ToListViewModel(thingB.GetListBy(t => t.orderNum == ordernum, t => t.createTim, false)); } return(View(order)); }
public ActionResult ROrderDetail(string orderid) { //----- noncestr = CommonMethod.GetCode(16); string jsapi_ticket = Js_sdk_Signature.IsExistjsapi_ticket(WeChatConfig.IsExistAccess_Token2()); timestamp = DateTime.Now.Ticks.ToString().Substring(0, 10);; string url = Request.Url.ToString().Replace("#", ""); JssdkSignature = Js_sdk_Signature.GetjsSDK_Signature(noncestr, jsapi_ticket, timestamp, url); ViewBag.Appid = WeChatConfig.GetKeyValue("appid"); ViewBag.Uri = WeChatConfig.GetKeyValue("shareurl"); ViewBag.noncestr = noncestr; ViewBag.jsapi_ticket = jsapi_ticket; ViewBag.timestamp = timestamp; ViewBag.PageFlag = "PayOrder"; if (string.IsNullOrEmpty(CommonMethod.getCookie("userid")) || string.IsNullOrEmpty(CommonMethod.getCookie("openid"))) { return(Content("对不起,请登陆系统!")); } var order = orderB.Get(o => o.orderNum == orderid); if (order == null) { return(Content("对不起,这个订单是错误的!")); } return(View(VIEW_TG_order.ToViewModel(order))); }
public ActionResult ReservationOrderDetail(string ordernum) { VIEW_TG_order order = new VIEW_TG_order(); ViewBag.ReturnUrl = Request["returnurl"]; ViewBag.TYPE = "Update"; if (string.IsNullOrEmpty(ordernum)) { ViewBag.TYPE = "Add"; } var model = orderB.Get(o => o.orderNum == ordernum); if (model != null) { order = VIEW_TG_order.ToViewModel(model); } return(View(order)); }
public ActionResult PayOrder(string orderid) { ViewBag.PageFlag = "PayOrder"; var openid = CommonMethod.getCookie("openid"); var userid = CommonMethod.getCookie("userid"); var user = weiUserM.GetModelWithOutTrace(u => u.userNum == userid && u.openid == openid); if (user == null) { return(Content("对不起,请登陆系统!")); } ViewBag.UserType = user.isfenxiao; ViewBag.userYongJin = user.userYongJin; ViewBag.Userid = userid; ViewBag.Openid = openid; var order = orderB.Get(o => o.orderNum == orderid); if (order == null) { return(Content("对不起,这个订单是错误的!")); } //----- noncestr = CommonMethod.GetCode(16); string jsapi_ticket = Js_sdk_Signature.IsExistjsapi_ticket(WeChatConfig.IsExistAccess_Token2()); timestamp = DateTime.Now.Ticks.ToString().Substring(0, 10);; string url = Request.Url.ToString().Replace("#", ""); JssdkSignature = Js_sdk_Signature.GetjsSDK_Signature(noncestr, jsapi_ticket, timestamp, url); ViewBag.Appid = WeChatConfig.GetKeyValue("appid"); ViewBag.Uri = WeChatConfig.GetKeyValue("shareurl"); ViewBag.noncestr = noncestr; ViewBag.jsapi_ticket = jsapi_ticket; ViewBag.timestamp = timestamp; //微信支付代码 // //httpContext var packageReqHandler = new RequestHandler(HttpContext); packageReqHandler.Init(); //时间戳 payTimeSamp = Senparc.Weixin.MP.TenPayLibV3.TenPayV3Util.GetTimestamp(); //随机字符串 sj = CommonMethod.GetCode(16) + "_" + userid; //设置参数 packageReqHandler.SetParameter("body", "商城-购买支付"); //商品信息 127字符 packageReqHandler.SetParameter("appid", PayConfig.AppId); packageReqHandler.SetParameter("mch_id", PayConfig.MchId); packageReqHandler.SetParameter("nonce_str", sj); packageReqHandler.SetParameter("notify_url", PayConfig.NotifyUrl); packageReqHandler.SetParameter("openid", openid); packageReqHandler.SetParameter("out_trade_no", orderid + "_" + CommonMethod.GetCode(4)); //商家订单号 packageReqHandler.SetParameter("spbill_create_ip", Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.SetParameter("total_fee", (Convert.ToDouble(order.yunPrice) * 100).ToString()); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.SetParameter("trade_type", "JSAPI"); packageReqHandler.SetParameter("attach", CommonMethod.GetCode(28)); //自定义参数 127字符 string sign = packageReqHandler.CreateMd5Sign("key", PayConfig.AppKey); //第一次签名结果 #region 获取package包====================== packageReqHandler.SetParameter("sign", sign); string data = packageReqHandler.ParseXML();//支付发送的数据 XML格式 string prepayXml = Senparc.Weixin.MP.AdvancedAPIs.TenPayV3.Unifiedorder(data); //string prepayXml = WeiXin.GetPage("https://api.mch.weixin.qq.com/pay/unifiedorder", data); var xdoc = new XmlDocument(); xdoc.LoadXml(prepayXml); XmlNode xn = xdoc.SelectSingleNode("xml"); LogHelper.WriteLog(prepayXml); try { string PrepayId = WeChatConfig.GetXMLstrByKey("prepay_id", xdoc); Package = string.Format("prepay_id={0}", PrepayId); LogHelper.WriteLog(Package); } catch (Exception ex) { LogHelper.WriteLog(ex.ToString()); Package = string.Format("prepay_id={0}", ""); } #endregion #region 设置支付参数 输出页面 该部分参数请勿随意修改 ============== var paySignReqHandler = new RequestHandler(HttpContext); paySignReqHandler.SetParameter("appId", PayConfig.AppId); paySignReqHandler.SetParameter("timeStamp", payTimeSamp); paySignReqHandler.SetParameter("nonceStr", sj); paySignReqHandler.SetParameter("package", Package); paySignReqHandler.SetParameter("signType", "MD5"); PaySign = paySignReqHandler.CreateMd5Sign("key", PayConfig.AppKey); #endregion //--------END ViewBag.payTimeSamp = payTimeSamp; ViewBag.sj = sj; ViewBag.Package = Package; ViewBag.PaySign = PaySign; return(View(VIEW_TG_order.ToViewModel(order))); }