protected void Page_Load(object sender, EventArgs e) { GoodsServer server = new GoodsServer(); SinglePayServer sinserver = new SinglePayServer(); //string goodid = ""; Log.Info(this.GetType().ToString(), "page load"); if (!IsPostBack) { //if (Request["GoodId"] != null){ // goodid=Request["GoodId"]; // goods = server.GetGoods(goodid); // string price = goods.GPrice.ToString(); // string name = goods.GName; // ViewState["goodsprice"] = price; // ViewState["name"] = name; //} //string GoodId = Request["GoodId"]; JsApiPay jsApiPay = new JsApiPay(this); //jsApiPay.QueryId = GoodId; try { //调用【网页授权获取用户信息】接口获取用户的openid和access_token jsApiPay.GetOpenidAndAccessToken(); //获取收货地址js函数入口参数 wxEditAddrParam = jsApiPay.GetEditAddressParameters(); ViewState["openid"] = jsApiPay.openid; //dic.Add(jsApiPay.openid,goodid); } catch (Exception ex) { Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面加载出错,请重试" + ex.Message + "</span>"); Button1.Visible = false; // Button2.Visible = false; Label1.Visible = false; // Label2.Visible = false; } if (Request["count"] != null && ViewState["openid"] != null && Request["GoodId"] != null) { SinglePay sin = new SinglePay(); sin.OpenID = ViewState["openid"].ToString(); sin.GID = Request["GoodId"].ToString(); sin.GCount = Convert.ToInt32(Request["count"].ToString()); Session["sid"] = sinserver.AddSinglePay(sin); goodid = Request["GoodId"]; ViewState["count"] = Request["count"]; goods = server.GetGoods(goodid); string price = goods.GPrice.ToString(); string name = goods.GName; ViewState["goodsprice"] = price; ViewState["name"] = name; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GoodsServer server = new GoodsServer(); goodslist_JYJ = server.GetGoodsList("JYJ"); JsApiPay jsApiPay = new JsApiPay(this); jsApiPay.GetOpenidAndAccessToken(); Session["openid"] = jsApiPay.openid; } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Id"] != null && Session["openid"] != null) { GoodsServer server = new GoodsServer(); string Id = Request["Id"].ToString(); goods = server.GetGoods(Id); } else { Response.Redirect("./Index.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { SinglePayServer sserver = new SinglePayServer(); GoodsServer gserver = new GoodsServer(); if (Session["openid"] != null) { string openid = Session["openid"].ToString(); List <FinalOrder> fin1 = server.QueryFinalOrderList(openid); fin = fin1; for (int i = 0; i < fin.Count; i++) { string trade = fin[i].orderId; string gid = sserver.QueryOrderGidByTrade(trade); Goods g = gserver.GetGoods(gid); GoodsList = new List <Goods>(); GoodsList.Add(g); } } else { Response.Write("./index.aspx"); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="goodsServer"></param> /// <param name="env"></param> public GoodsController(GoodsServer goodsServer, IHostingEnvironment env) { _goodsServer = goodsServer; this.env = env; }
/// <summary> /// 构造函数 /// </summary> /// <param name="goodsServer"></param> /// <param name="mapper"></param> /// <param name="orderServer"></param> public OrderController(GoodsServer goodsServer, IMapper mapper, OrderServer orderServer) { _goodsServer = goodsServer; _mapper = mapper; _orderServer = orderServer; }