private void EditAddr() { string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid string name = MyCommFun.QueryString("name"); int wid = MyCommFun.RequestInt("wid"); string sprovince = MyCommFun.QueryString("pvid"); string scity = MyCommFun.QueryString("ctid"); string regionId = MyCommFun.QueryString("regionId"); string address = MyCommFun.QueryString("address"); string mobile = MyCommFun.QueryString("mobile"); BLL.wx_shop_user_addr addrBll = new BLL.wx_shop_user_addr(); List <WechatBuilder.Model.wx_shop_user_addr> addrlist = addrBll.GetOpenidAddr(openid, wid); WechatBuilder.Model.wx_shop_user_addr addr = new Model.wx_shop_user_addr(); bool isAdd = true; if (addrlist == null || addrlist.Count <= 0) { //添加 isAdd = true; } else { //修改 addr = addrlist[0]; isAdd = false; } addr.addrDetail = address; addr.wid = wid; addr.openid = openid; addr.province = sprovince; addr.city = scity; addr.area = regionId; addr.tel = mobile; addr.contractPerson = name; addr.createDate = DateTime.Now; if (isAdd) { addrBll.Add(addr); } else { addrBll.Update(addr); } string frompage = MyCommFun.QueryString("frompage"); if (frompage != "") { Response.Redirect(frompage + "?wid=" + wid + "&openid=" + openid); } else { Response.Redirect("editaddr.aspx?wid=" + wid + "&openid=" + openid); } }
private void EditAddr() { string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid string name = MyCommFun.QueryString("name"); int wid = MyCommFun.RequestInt("wid"); string sprovince = MyCommFun.QueryString("pvid"); string scity = MyCommFun.QueryString("ctid"); string regionId = MyCommFun.QueryString("regionId"); string address = MyCommFun.QueryString("address"); string mobile = MyCommFun.QueryString("mobile"); BLL.wx_shop_user_addr addrBll = new BLL.wx_shop_user_addr(); List<WechatBuilder.Model.wx_shop_user_addr> addrlist = addrBll.GetOpenidAddr(openid, wid); WechatBuilder.Model.wx_shop_user_addr addr = new Model.wx_shop_user_addr(); bool isAdd = true; if (addrlist == null || addrlist.Count <= 0) { //添加 isAdd = true; } else { //修改 addr = addrlist[0]; isAdd = false; } addr.addrDetail = address; addr.wid = wid; addr.openid = openid; addr.province = sprovince; addr.city = scity; addr.area = regionId; addr.tel = mobile; addr.contractPerson = name; addr.createDate = DateTime.Now; if (isAdd) { addrBll.Add(addr); } else { addrBll.Update(addr); } string frompage = MyCommFun.QueryString("frompage"); if (frompage != "") { Response.Redirect(frompage + "?wid=" + wid + "&openid=" + openid); } else { Response.Redirect("editaddr.aspx?wid=" + wid + "&openid=" + openid); } }
protected void Page_Load(object sender, EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } //1获得模版基本信息 BLL.wx_module_templates tBll = new BLL.wx_module_templates(); templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid); if (templateFileName == null || templateFileName.Trim() == "") { errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!"; Response.Write(errInitTemplates); Response.End(); return; } //授权 int orderId = MyCommFun.RequestInt("orderid"); BLL.wx_userweixin bll = new BLL.wx_userweixin(); Model.wx_userweixin wxModel = bll.GetModel(wid); string thisUrl = MyCommFun.getWebSite() + "/shop/order_detail.aspx?wid=" + wid + "&orderid=" + orderId; OAuth2BaseProc(wxModel, "order_detail", thisUrl); //授权结束 BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr(); IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid); if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0) { //该微信用户没有添加地址 Response.Redirect("/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx"); // MessageBox.ResponseScript(this, "window.location.href =/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx"); return; } serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/order_detail.html"; ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid); template.tType = TemplateType.orderDetail; template.openid = openid; template.OutPutHtml(wid); }
/// <summary> /// 修改地址的页面 /// </summary> public void editAddrPage() { string frompage = MyCommFun.QueryString("frompage"); this.Document.SetValue("frompage", frompage); BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr(); IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid); if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0) { } else { this.Document.SetValue("addrinfo", uaddrList[0]); } }
protected void Page_Load(object sender, EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } string openid = MyCommFun.RequestOpenid(); BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr(); IList<Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid); if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0) { //该微信用户没有添加地址 Response.Redirect("/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx"); // MessageBox.ResponseScript(this, "window.location.href =/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx"); return; } //1获得模版基本信息 BLL.wx_module_templates tBll = new BLL.wx_module_templates(); templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid); if (templateFileName == null || templateFileName.Trim() == "") { errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!"; Response.Write(errInitTemplates); Response.End(); return; } serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/order_detail.html"; ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid); template.tType = TemplateType.orderDetail; template.openid = MyCommFun.RequestOpenid(); template.OutPutHtml(wid); }
protected void Page_Load(object sender, EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } //1获得模版基本信息 BLL.wx_module_templates tBll = new BLL.wx_module_templates(); templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid); if (templateFileName == null || templateFileName.Trim() == "") { errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!"; Response.Write(errInitTemplates); Response.End(); return; } //授权 BLL.wx_userweixin bll = new BLL.wx_userweixin(); Model.wx_userweixin wxModel = bll.GetModel(wid); string openid = ""; string code = MyCommFun.QueryString("code"); if (code == null || code.Trim() == "") { // openid = MyCommFun.RequestOpenid(); int orderId = MyCommFun.RequestInt("orderid"); string thisUrl = MyCommFun.getWebSite() + "/shop/confirmOrder.aspx?wid=" + wid; string newUrl = OAuth.GetAuthorizeUrl(wxModel.AppId, thisUrl, "confirmOrder", OAuthScope.snsapi_base); Response.Redirect(newUrl); } else { var result = OAuth.GetAccessToken(wxModel.AppId, wxModel.AppSecret, code); openid = result.openid; } //授权结束 BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr(); IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid); if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0) { //该微信用户没有添加地址 Response.Redirect("/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx"); // MessageBox.ResponseScript(this, "window.location.href =/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx"); return; } serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/confirmOrder.html"; ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid); template.tType = TemplateType.confirmOrder; template.openid = openid; template.OutPutHtml(wid); }
/// <summary> /// 修改地址的页面 /// </summary> public void editAddrPage() { string frompage = MyCommFun.QueryString("frompage"); this.Document.SetValue("frompage", frompage); BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr(); IList<Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid); if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0) { } else { this.Document.SetValue("addrinfo", uaddrList[0]); } }