protected void Page_Load(object sender, EventArgs e) { if (Session["openid"] != null) { string openid = Session["openid"].ToString(); ShoppingCarServer server = new ShoppingCarServer(); Carlist = server.QueryShoppingCar(openid); Goodslist = server.QueryGoods(openid); } else { Response.Redirect("./index.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { Log.Info(this.GetType().ToString(), "page load"); if (!IsPostBack) { //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; string openid = jsApiPay.openid; ShoppingCarServer server = new ShoppingCarServer(); Carlist = server.QueryShoppingCar(openid); Goodslist = server.QueryGoods(openid); //dic.Add(jsApiPay.openid,goodid); CartOrder car = new CartOrder(); car.Openid = ViewState["openid"].ToString(); CartOrderServer server1 = new CartOrderServer(); Session["glid"] = server1.GetGLid(car); } 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; } } }