public void BindData(int id) { BLL.wx_product hdBll = new BLL.wx_product(); Model.wx_product huodong = hdBll.GetModel(id); Page.Title = huodong.hdName; litTheme.Text = huodong.pSubject; litCreateDate.Text = huodong.createDate == null ? "" : huodong.createDate.Value.ToString("yyyy-MM-dd"); if (huodong.extStr2 == null || huodong.extStr2.ToString().Trim() == "") { imgPic.Style.Add("display", "none"); } else { imgPic.ImageUrl = huodong.extStr2; } StringBuilder detailSB = new StringBuilder(); if (isNotNullFun(huodong.beginDate)) { detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); detailSB.Append("时间 :" + huodong.beginDate.Value.ToShortDateString() + " ~ "); if (isNotNullFun(huodong.endDate)) { detailSB.Append(huodong.endDate.Value.ToShortDateString()); } detailSB.Append(" </div></li>\r\n"); } if (isNotNullFun(huodong.addr)) { detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); detailSB.Append("地点 :" + huodong.addr); detailSB.Append(" </div></li>\r\n"); } if (isNotNullFun(huodong.pContent)) { //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); //detailSB.Append("活动内容 :"); //detailSB.Append(" </div></li>\r\n"); //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); //detailSB.Append(" " + huodong.hdContent); //detailSB.Append(" </div></li>\r\n"); litContent.Text = huodong.pContent; } litDetail.Text = detailSB.ToString(); //底部菜单设置 int wid = MyCommFun.RequestInt("wid"); string openid = MyCommFun.RequestOpenid(); BLL.wx_product_type hdtypeBll = new BLL.wx_product_type(); Model.wx_product_type type = hdtypeBll.GetModel(huodong.typeId.Value); StringBuilder bottomMenu = new StringBuilder(""); int num_dh = 0; if (isNotNullFun(type.tel)) { num_dh++; bottomMenu.Append(" <li> <a href=\"tel:" + type.tel + "\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/181.png\"><label>联系电话</label></a></li>"); } if (isNotNullFun(type.daohangurl)) { num_dh++; bottomMenu.Append(" <li> <a href=\"" + type.daohangurl + "\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/131.png\"><label>一键导航</label></a> </li>"); } if (isNotNullFun(type.showDefault) && type.showDefault) { bottomMenu.Append(" <li class=\"home\"><a href=\"/index.aspx?wid=" + wid + "&openid=" + openid + "\"></a></li>"); } num_dh++; if (isNotNullFun(huodong.url)) { num_dh++; string yudingName = "在线预定"; if (isNotNullFun(huodong.btnName)) { yudingName = huodong.btnName; } bottomMenu.Append(" <li> <a href=\"" + huodong.url + "\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/127.png\"><label>" + yudingName + "</label></a> </li>"); } if (num_dh == 4) { bottomMenu.Append("<li> <a href=\"http://m.baidu.com\">"); bottomMenu.Append("<img src=\"/images/templates/bottommenu/43.png\"><label>百度搜索</label></a> </li>"); } litdaohang.Text = bottomMenu.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { openid = MyCommFun.RequestOpenid(); wid = MyCommFun.RequestInt("wid"); id = MyCommFun.RequestInt("aid"); BLL.wx_purchase_base gbll = new BLL.wx_purchase_base(); BLL.wx_purchase_customer customerbll = new BLL.wx_purchase_customer(); // DataSet ds = gbll.GetList(id); model = gbll.GetModel(id); if (model.activityTimebegin.Value > DateTime.Now)//活动未开始 { TimeSpan ts3 = new TimeSpan(Convert.ToDateTime(model.activityTimebegin).Ticks); TimeSpan ts4 = new TimeSpan(DateTime.Now.Ticks); TimeSpan endtime = ts3.Subtract(ts4).Duration(); //活动未开始 Response.Write("距离团购开始还有" + endtime.Days.ToString() + "天" + endtime.Hours.ToString() + "小时" + endtime.Minutes.ToString() + "分" + endtime.Seconds.ToString() + "秒"); Response.End(); return; } if (model.activityTimeend.Value < DateTime.Now)//活动结束 { introduction = model.introduction; this.specialRemind.Text = model.specialRemind; this.activeDescription.Text = model.activeDescription; shopstel = model.shopstel; address = model.address; if (model.txtLatXPoint != null && model.txtLngYPoint != null) { txtLatXPoint = (float)model.txtLatXPoint; txtLatYPoint = (float)model.txtLngYPoint; } tel = model.shopstel; activityName = model.activityName; days = ""; groupPrice = Convert.ToInt32(model.groupPrice); costPrice = Convert.ToInt32(model.costPrice); copyrightSetup = model.copyrightSetup; imageUrl = model.imageUrl; status = "团购已结束"; return; } purchaseCount = customerbll.GetRecordCount(id); // chengtuanCount = customerbll.GetRecord(id); chengtuanCount = Convert.ToInt32(model.virtualPerson); introduction = model.introduction; this.specialRemind.Text = model.specialRemind; this.activeDescription.Text = model.activeDescription; shopstel = model.shopstel; address = model.address; if (model.txtLatXPoint != null && model.txtLngYPoint != null) { txtLatXPoint = (float)model.txtLatXPoint; txtLatYPoint = (float)model.txtLngYPoint; } tel = model.shopstel; activityName = model.activityName; TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(model.activityTimeend).Ticks); TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(model.activityTimebegin).Ticks); TimeSpan endtime1 = ts1.Subtract(ts2).Duration(); days = "团购结束还有" + endtime1.Days.ToString() + "天" + endtime1.Hours.ToString() + "小时" + endtime1.Minutes.ToString() + "分" + endtime1.Seconds.ToString() + "秒"; groupPrice = Convert.ToInt32(model.groupPrice); costPrice = Convert.ToInt32(model.costPrice); copyrightSetup = model.copyrightSetup; imageUrl = model.imageUrl; //if (customerbll.Exists(openid)) //{ // status = "每人限购" + model.limitCount + "件"; //} customermodel = customerbll.GetModelSN(openid); if (customermodel != null) { if (customermodel.status == 0)//未消费 { status = customermodel.sn; } else if (customermodel.status == 2) { int count = customerbll.GetRecordCount(openid, id); status = "已经抢购" + count + "件" + " " + "继续抢购"; } } else { status = "抢购"; } } }
protected void Page_Load(object sender, EventArgs e) { id = MyCommFun.RequestInt("id"); if (!IsPostBack) { if (id != 0) { Model.wx_purchase_base model = basebll.GetModel(id); //团购活动开始内容 this.activityName.Text = model.activityName; this.activitySummary.InnerText = model.activitySummary; this.activityTimebegin.Text = model.activityTimebegin.ToString(); this.activityTimeend.Text = model.activityTimeend.ToString(); this.email.Text = model.email; this.emailPwd.Text = model.emailPwd; this.smtp.Text = model.smtp; this.shopsPwd.Text = model.shopsPwd; this.activeDescription.InnerText = model.activeDescription; this.specialRemind.InnerText = model.specialRemind; if (model.imageUrl != "" && model.imageUrl != "/weixin/groupbuy/images/Groupbuying-Start.jpg") { this.imageUrl.Text = model.imageUrl; imgbeginPic.ImageUrl = model.imageUrl; } else { this.imageUrl.Text = this.imgbeginPic.ImageUrl; } if (model.imageUrlend != "" && model.imageUrlend != "/weixin/groupbuy/images/activity-coupon-end.jpg") { this.imageUrlend.Text = model.imageUrlend; imgendPic.ImageUrl = model.imageUrlend; } else { this.imageUrlend.Text = this.imgendPic.ImageUrl; } //团购活动结束内容 this.activityEndtitle.Text = model.activityEndtitle; this.endExplanation.InnerText = model.endExplanation; //商家信息设置 this.shopstel.Text = model.shopstel; this.address.Text = model.address; this.introduction.InnerText = model.introduction; this.txtLatXPoint.Text = model.txtLatXPoint.ToString(); this.txtLngYPoint.Text = model.txtLngYPoint.ToString(); ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript'> $(\"#baiduframe\").attr(\"src\", \"../lbs/MapSelectPoint.aspx?yjindu=" + model.txtLngYPoint.Value.ToString() + "&xweidu=" + model.txtLatXPoint.Value.ToString() + "\");</script>"); //团购设置 this.goodName.Text = model.goodName; this.costPrice.Text = model.costPrice.ToString(); this.limitCount.Text = model.limitCount.ToString(); this.groupPrice.Text = model.groupPrice.ToString(); this.totalCount.Text = model.totalCount.ToString(); this.groupPerson.Text = model.groupPerson.ToString(); this.virtualPerson.Text = model.virtualPerson.ToString(); this.copyrightSetup.InnerText = model.copyrightSetup; } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; BLL.wx_shop_cart cartBll = new BLL.wx_shop_cart(); string _action = MyCommFun.QueryString("myact"); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid Dictionary <string, string> jsonDict = new Dictionary <string, string>(); if (_action == "LoadProduct") { #region 择排序,改变商品列表 string sortColumn = MyCommFun.RequestParam("sortColumn"); int wid = MyCommFun.RequestInt("wid"); int id = MyCommFun.RequestInt("cid"); string name = MyCommFun.RequestParam("name"); string flog = MyCommFun.RequestParam("flog"); string gd = MyCommFun.RequestParam("gd"); DataSet ds = null; BLL.wx_shop_product proBll = new BLL.wx_shop_product(); StringBuilder jsonStr = new StringBuilder(); if (id != 0) { if (sortColumn == "priceDesc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " order by marketPrice desc "); } if (sortColumn == "priceDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and productName like " + "'%" + name + "%'" + "order by marketPrice desc "); } if (sortColumn == "priceAsc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " order by marketPrice asc "); } if (sortColumn == "priceAsc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and productName like " + "'%" + name + "%'" + "order by marketPrice asc "); } if (sortColumn == "newDesc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and latest=" + 1 + " order by latest desc "); } if (sortColumn == "newDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and latest=" + 1 + " and productName like " + "'%" + name + "%'" + "order by latest desc "); } if (sortColumn == "saleDesc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and hotsale=" + 1 + " order by hotsale desc "); } if (sortColumn == "saleDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and hotsale=" + 1 + " and productName like " + "'%" + name + "%'" + "order by hotsale desc "); } } else { if (sortColumn == "priceDesc") { ds = proBll.GetList(wid, 20, "1=1 order by marketPrice desc "); } if (sortColumn == "priceDesc" && flog == "true") { ds = proBll.GetList(wid, 20, " productName like " + "'%" + name + "%'" + "order by marketPrice desc "); } if (sortColumn == "priceAsc") { ds = proBll.GetList(wid, 20, " 1=1 order by marketPrice asc "); } if (sortColumn == "priceAsc" && flog == "true") { ds = proBll.GetList(wid, 27, " productName like " + "'%" + name + "%'" + "order by marketPrice asc "); } if (sortColumn == "newDesc") { ds = proBll.GetList(wid, 20, " latest=" + 1 + " order by latest desc "); } if (sortColumn == "newDesc" && flog == "true") { ds = proBll.GetList(wid, 20, " latest=" + 1 + "productName like " + "'%" + name + "%'" + "order by latest desc "); } if (sortColumn == "saleDesc") { ds = proBll.GetList(wid, 20, "hotsale=" + 1 + " order by hotsale desc "); } if (sortColumn == "saleDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "hotsale=" + 1 + " and productName like " + "'%" + name + "%'" + "order by hotsale desc "); } } if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (id != 0) { if (gd == "") { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span></p> </div>"); } jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>"); } else { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">"); jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评"); jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>"); } } } else { if (gd == "") { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span></p> </div>"); } jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>"); } else { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">"); jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评"); jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>"); } } } } context.Response.Write(jsonStr); #endregion } else if (_action == "sousuo") { #region 择商品名称,改变商品列表 string name = MyCommFun.RequestParam("name"); int wid = MyCommFun.RequestInt("wid"); DataSet ds = null; BLL.wx_shop_product proBll = new BLL.wx_shop_product(); StringBuilder jsonStr = new StringBuilder(); ds = proBll.GetList(wid, 20, " productName like " + "'%" + name + "%'" + ""); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span>1534人评价,96%好评</p> </div>"); } jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>"); } context.Response.Write(jsonStr); #endregion } else if (_action == "gengduo") { #region 查看更多 int wid = MyCommFun.RequestInt("wid"); int id = MyCommFun.RequestInt("cid"); DataSet ds = null; BLL.wx_shop_product proBll = new BLL.wx_shop_product(); StringBuilder jsonStr = new StringBuilder(); if (id != 0) { ds = proBll.GetList(wid, -1, "categoryId=" + id + " and p.hotsale=" + 1 + " order by p.hotsale desc "); } else { ds = proBll.GetList(wid, -1, "p.hotsale=" + 1 + " order by p.hotsale desc "); } if (ds != null && ds.Tables[0] != null) { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">"); jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评"); jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>"); } } context.Response.Write(jsonStr); #endregion } else if (_action == "checkid") { #region 是否存在该商品 jsonDict = new Dictionary <string, string>(); int wid = MyCommFun.RequestInt("wid"); int id = MyCommFun.RequestInt("id"); BLL.wx_shop_product proBll = new BLL.wx_shop_product(); DataSet ds = null; ds = proBll.GetList("wid=" + wid + " and id=" + id + ""); BLL.wx_shop_sku skuBll = new BLL.wx_shop_sku(); Model.wx_shop_sku skuModel = skuBll.GetModel(id); if (ds != null && ds.Tables[0].Rows.Count > 0) { jsonDict.Add("data", ds.Tables[0].Rows[0]["stock"].ToString()); } context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid if (_action == "jingcai") { try { #region 提交竞猜信息 int bisaiId = MyCommFun.RequestInt("bisaiId"); //比赛表id int jcRetType = MyCommFun.RequestInt("jcRetType"); //选择类型 int wid = MyCommFun.RequestInt("wid"); if (wid == 0 || bisaiId == 0 || jcRetType == 0) { context.Response.Write("{\"msg\":\"提交出现异常!!\",\"success\":\"0\"}"); return; } BLL.wx_sjb_users uBll = new BLL.wx_sjb_users(); Model.wx_sjb_users user = new Model.wx_sjb_users(); int uid = 0; if (!uBll.ExistsByOpenid(openid, wid)) { //不存在 user.openid = openid; user.wid = wid; user.succTimes = 0; user.failTimes = 0; uid = uBll.Add(user); } else { //存在 user = uBll.GetModelList("openid='" + openid + "'")[0]; uid = user.id; } BLL.wx_sjb_jcDetail dBll = new BLL.wx_sjb_jcDetail(); Model.wx_sjb_jcDetail detail = new Model.wx_sjb_jcDetail(); detail.uid = uid; detail.bsId = bisaiId; detail.jcRetType = jcRetType; detail.createDate = DateTime.Now; dBll.Add(detail); context.Response.Write("{\"msg\":\"提交成功!\",\"success\":\"1\"}"); return; #endregion } catch { context.Response.Write("{\"msg\":\"提交出现异常!!\",\"success\":\"0\"}"); return; } } }
public string Apply_refund() { int orderId = MyCommFun.RequestInt("orderid"); int wid = MyCommFun.RequestInt("wid"); string code = MyCommFun.RequestParam("code"); string state = MyCommFun.RequestParam("state"); BLL.wx_payment_wxpay wxPayBll = new BLL.wx_payment_wxpay(); Model.wx_payment_wxpay paymentInfo = wxPayBll.GetModelByWid(wid); BLL.wx_userweixin wx = new BLL.wx_userweixin(); Model.wx_userweixin wxModel = wx.GetModel(wid); BLL.orders otBll = new BLL.orders(); Model.orders orderEntity = otBll.GetModel(orderId, wid); litout_trade_no = orderEntity.order_no; amount = orderEntity.order_amount.ToString(); string nonceStr = TenPayV3Util.GetNoncestr(); RequestHandler packageReqHandler = new RequestHandler(null); //设置package订单参数 packageReqHandler.SetParameter("appid", paymentInfo.appId); //公众账号ID packageReqHandler.SetParameter("mch_id", paymentInfo.partnerId); //商户号 packageReqHandler.SetParameter("out_trade_no", orderEntity.order_no); //填入商家订单号 packageReqHandler.SetParameter("out_refund_no", orderEntity.order_no); //填入退款订单号 packageReqHandler.SetParameter("total_fee", amount); //填入总金额 packageReqHandler.SetParameter("refund_fee", amount); //填入退款金额 packageReqHandler.SetParameter("op_user_id", paymentInfo.partnerId); //操作员Id,默认就是商户号 packageReqHandler.SetParameter("nonce_str", nonceStr); //随机字符串 string sign = packageReqHandler.CreateMd5Sign("key", paymentInfo.paySignKey); packageReqHandler.SetParameter("sign", sign); //签名 //退款需要post的数据 string data = packageReqHandler.ParseXML(); //退款接口地址 string url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; //本地或者服务器的证书位置(证书在微信支付申请成功发来的通知邮件中) string cert = MyCommFun.GetRootPath() + paymentInfo.CertInfoPath; //私钥(在安装证书时设置) string password = paymentInfo.partnerPwd; ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); //调用证书 X509Certificate2 cer = new X509Certificate2(cert, password, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet); #region 发起post请求 HttpWebRequest webrequest = (HttpWebRequest)HttpWebRequest.Create(url); webrequest.ClientCertificates.Add(cer); webrequest.Method = "post"; byte[] postdatabyte = Encoding.UTF8.GetBytes(data); webrequest.ContentLength = postdatabyte.Length; Stream stream; stream = webrequest.GetRequestStream(); stream.Write(postdatabyte, 0, postdatabyte.Length); stream.Close(); HttpWebResponse httpWebResponse = (HttpWebResponse)webrequest.GetResponse(); StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()); string responseContent = streamReader.ReadToEnd(); #endregion var res = XDocument.Parse(responseContent); string openid = res.Element("xml").Element("out_refund_no").Value; return(openid); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string username = MyCommFun.QueryString("username"); string parssword = MyCommFun.QueryString("parssword"); string id = MyCommFun.QueryString("id"); openid = MyCommFun.QueryString("openid"); string state = MyCommFun.QueryString("state"); goodsData = QueryString("goodsData"); shopid = MyCommFun.RequestInt("shopid"); BLL.wx_diancai_dianyuan dianyuanbll = new BLL.wx_diancai_dianyuan(); BLL.wx_diancai_dingdan_manage manage = new BLL.wx_diancai_dingdan_manage(); Model.wx_diancai_dingdan_manage managemodel = new Model.wx_diancai_dingdan_manage(); if (_action == "login") { if (dianyuanbll.Exists(username, parssword)) { jsonDict.Add("ret", "ok"); jsonDict.Add("content", "登录成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "密码错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "setstatus") { //id if (manage.Updatestatus(id, state)) { managemodel = manage.GetModel(MyCommFun.Str2Int(id)); BLL.wx_diancai_member menbll = new BLL.wx_diancai_member(); if (state == "1") { menbll.Update(managemodel.openid); } if (state == "2") { menbll.Updatefail(managemodel.openid); } jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (_action == "addcaidan") { var orderProcessResult = this.ProcessOrder(); if (!orderProcessResult.IsSuccess) { this.jsonDict.Add("ret", "err"); this.jsonDict.Add("content", orderProcessResult.Message); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } var order = orderProcessResult.BusinessData as Model.wx_diancai_dingdan_manage; if (order != null) { //this.jsonDict.Add("ret", "ok"); //this.jsonDict.Add("content", orderProcessResult.Message); //this.jsonDict.Add("orderid", order.id.ToString()); //this.jsonDict.Add("ordercode", order.orderNumber); //this.jsonDict.Add("openid", openid); //this.jsonDict.Add("payamount", order.payAmount.ToString()); //this.jsonDict.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName); //this.jsonDict.Add("wid", order.wid.ToString()); //this.jsonDict.Add("orderNumber", order.orderNumber); //context.Response.Write(MyCommFun.getJsonStr(this.jsonDict)); var shopInfo = new BLL.wx_diancai_shopinfo().GetModel(this.shopid); var entity = new UnifiedOrderEntity { OrderId = order.id.ToString(), wid = order.wid, total_fee = order.payAmount == null ? 0 : (int)order.payAmount, out_trade_no = order.orderNumber, openid = openid, body = string.Format("订单编号{0} {1}", order.orderNumber, shopInfo.hotelName), PayModuleID = (int)PayModuleEnum.Restaurant, PayComplete = "../restaurant/AfterPay.aspx" }; entity.Extra.Add("content", orderProcessResult.Message); entity.Extra.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName); entity.Extra.Add("shopid", shopid.ToString()); entity.Extra.Add("wid", shopInfo.wid.ToString()); var ticket = EncryptionManager.CreateIV(); var payData = EncryptionManager.AESEncrypt(entity.ToJson(), ticket); context.Response.Write(AjaxResult.Success(PayHelper.GetPayUrl(payData, ticket))); } context.Response.End(); } else if (_action == "productDetail") { var productId = MyCommFun.QueryString("productId"); if (!string.IsNullOrEmpty(productId)) { var model = new BLL.wx_diancai_caipin_manage().GetModel(int.Parse(productId)); String useRange = string.Empty; if (model.beginDate.HasValue || model.endDate.HasValue) { useRange = string.Format("{0}至{1}", model.beginDate.HasValue ? model.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty, model.endDate.HasValue ? model.endDate.Value.ToString("yyyy-MM-dd") : string.Empty); } var data = new { shopIntroduction = model.shopIntroduction, detailContent = model.detailContent, instructions = model.instructions, chargeback = model.chargeback, useRange = useRange }; context.Response.Write(AjaxResult.Success(data).ToCamelString()); } context.Response.End(); } else if (_action == "caipinDetail") { var caipinId = MyCommFun.RequestInt("caipinId"); var caipinModel = new BLL.wx_diancai_caipin_manage().GetModel(caipinId); String useRange = string.Empty; if (caipinModel.beginDate.HasValue || caipinModel.endDate.HasValue) { useRange = string.Format("{0}至{1}", caipinModel.beginDate.HasValue ? caipinModel.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty, caipinModel.endDate.HasValue ? caipinModel.endDate.Value.ToString("yyyy-MM-dd") : string.Empty); } String jianjie = caipinModel.shopIntroduction; String tuidanRule = caipinModel.chargeback; string pictureUrl = caipinModel.picUrl; var result = new { Name = caipinModel.cpName, Url = MapUrl(pictureUrl), Range = useRange, Intruduce = jianjie, Rule = tuidanRule, suoming = caipinModel.detailContent, shopIntroduction = caipinModel.shopIntroduction }; context.Response.Write(AjaxResult.Success(result)); context.Response.End(); } }
//设置分页数量 protected void txtPageNum_TextChanged(object sender, EventArgs e) { int _pagesize; if (int.TryParse(txtPageNum.Text.Trim(), out _pagesize)) { if (_pagesize > 0) { Utils.WriteCookie("ggkAwardUser_page_size", _pagesize.ToString(), 14400); } } Response.Redirect(Utils.CombUrlTxt("ggkAwardUser.aspx", "id={0}&keywords={1}", MyCommFun.RequestInt("id").ToString(), this.keywords)); }
//关健字查询 protected void btnSearch_Click(object sender, EventArgs e) { Response.Redirect(Utils.CombUrlTxt("sttAwardUser.aspx?id=" + MyCommFun.RequestInt("id"), "keywords={0}", txtKeywords.Text)); }
private void RptBind(string _strWhere, string _orderby) { int aid = MyCommFun.RequestInt("id"); _strWhere = "actid=" + aid + " " + _strWhere; this.page = MXRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; DataSet ds = ubll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataSource = ds; this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("ggkAwardUser.aspx", "id={0}&keywords={1}&page={2}", MyCommFun.RequestInt("id").ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//关健字查询 protected void btnSearch_Click(object sender, EventArgs e) { Response.Redirect(Utils.CombUrlTxt("ggkAwardUser.aspx", "id={0}&keywords={1}", MyCommFun.RequestInt("id").ToString(), txtKeywords.Text)); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { // ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (ubll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除刮刮卡活动信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("ggkAwardUser.aspx", "id={0}&keywords={1}", MyCommFun.RequestInt("id").ToString(), this.keywords), "Success"); }
/// <summary> /// 绑定控件 /// </summary> /// <param name="id"></param> private void BindControlers(int id) { string openid = MyCommFun.RequestOpenid(); int wid = MyCommFun.RequestInt("wid"); //设置控件的string wx_yy_control yyctBll = new wx_yy_control(); IList <Model.wx_yy_control> controllist = yyctBll.GetModelList("formId=" + id + " order by seq asc"); if (controllist == null || controllist.Count <= 0) { return; } StringBuilder sbControl = new StringBuilder(""); StringBuilder sbJs = new StringBuilder("<script type=\"text/javascript\">\r\n $(document).ready(function () {\r\n"); //必填项的js验证 sbJs.Append(" $(\"#showcard\").click(function () {\r\n"); StringBuilder sbValueJs = new StringBuilder("var submitData = {wid: '" + wid + "',\r\n openid: '" + openid + "',\r\n formid:" + id + ",\r\n"); for (int i = 0; i < controllist.Count; i++) { sbControl.Append(" <li class=\"nob\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"kuang\">\r\n<tr>"); sbControl.Append("<th>" + controllist[i].cName + "</th>\r\n<td>"); if (controllist[i].cType == "0") { //文本 if (controllist[i].sysControlerType == "date") { sbControl.Append("\r\n<input name=\"control_" + controllist[i].id + "\" class=\"px datetimepicker\" id=\"control_" + controllist[i].id + "\" value=\"\" type=\"text\" placeholder=\"请输入" + controllist[i].cName + "\">\r\n"); } else { sbControl.Append("\r\n<input name=\"control_" + controllist[i].id + "\" class=\"px\" id=\"control_" + controllist[i].id + "\" value=\"\" type=\"text\" placeholder=\"请输入" + controllist[i].cName + "\">\r\n"); } } if (controllist[i].cType == "1") { //下拉菜单 sbControl.Append("\r\n<select name=\"control_" + controllist[i].id + "\" id=\"control_" + controllist[i].id + "\" class=\"InputType\">\r\n"); string[] items = selectItem(controllist[i].defaultValue); for (int j = 0; j < items.Length; j++) { if (items[j].Trim() != "") { sbControl.Append("<option value=\"" + items[j].Trim() + "\">" + items[j].Trim() + "</option>\r\n"); } } sbControl.Append("</select>\r\n"); } sbControl.Append("</td></tr></table>\r\n</li>\r\n\r\n"); if (controllist[i].isBiTian) { sbJs.Append(" if ($(\"#control_" + controllist[i].id + "\").val() == '') { alert('" + controllist[i].cName + "不能为空'); return; }\r\n"); } if (i != (controllist.Count - 1)) { sbValueJs.Append("control_" + +controllist[i].id + ":$(\"#control_" + controllist[i].id + "\").val(),\r\n"); } else { sbValueJs.Append("control_" + +controllist[i].id + ":$(\"#control_" + controllist[i].id + "\").val()\r\n"); } }//end for sbValueJs.Append("};\r\n"); sbJs.Append(sbValueJs.ToString()); sbJs.Append(" $.post('yuyueApi.ashx', submitData, function (data) {\r\n"); sbJs.Append("if (data.success == \"true\") { alert(\"信息已经提交!请耐心等待!\");\r\n"); sbJs.Append("setTimeout(\"window.location.reload()\", 2000);"); sbJs.Append("return; } \r\n else { alert(data.msg || \"保存失败\"); } }, \"json\");\r\n"); sbJs.Append("oLay.style.display = \"block\"; }); });\r\n"); sbJs.Append(" </script>"); litJs.Text = sbJs.ToString(); litFormStr.Text = sbControl.ToString(); }
protected void Page_Load(object sender, EventArgs e) { string Token = "";//与微信公众账号后台的Token设置保持一致,区分大小写。 int wid = 0; wid = MyCommFun.RequestInt("apiid"); if (wid <= 0) { WriteContent("参数非法"); return; } wx_userweixin wbll = new wx_userweixin(); Token = wbll.GetWeiXinToken(wid); if (Token == null || string.IsNullOrEmpty(Token)) { WriteContent("不存在该微信号!"); return; } // Token = "uweixin"; string signature = Request["signature"]; string timestamp = Request["timestamp"]; string nonce = Request["nonce"]; string echostr = Request["echostr"]; if (Request.HttpMethod == "GET") { //get method - 仅在微信后台填写URL验证时触发 if (CheckSignature.Check(signature, timestamp, nonce, Token)) { WriteContent(echostr); //返回随机字符串则表示验证通过 } else { WriteContent("failed:" + signature + ",token:" + Token + " " + CheckSignature.GetSignature(timestamp, nonce, Token) + "。" + "如果你在浏览器中看到这句话,说明此地址可以被作为微信公众账号后台的Url,请注意保持Token一致。"); } Response.End(); } else { //post method - 当有用户想公众账号发送消息时触发 //本地测试的时候注释掉 ----start ----- if (!CheckSignature.Check(signature, timestamp, nonce, Token)) { WriteContent("参数错误!"); return; } //本地测试的时候注释掉 ----end ----- //v4.2.2之后的版本,可以设置每个人上下文消息储存的最大数量,防止内存占用过多,如果该参数小于等于0,则不限制 var maxRecordCount = 10; //自定义MessageHandler,对微信请求的详细判断操作都在这里面。 var messageHandler = new CustomMessageHandler(Request.InputStream, maxRecordCount); try { //测试时可开启此记录,帮助跟踪数据,使用前请确保App_Data文件夹存在,且有读写权限。 //messageHandler.RequestDocument.Save( // Server.MapPath("~/App_Data/" + DateTime.Now.Ticks + "_Request_" + // messageHandler.RequestMessage.FromUserName + ".txt")); //执行微信处理过程 messageHandler.Execute(); //测试时可开启,帮助跟踪数据 //messageHandler.ResponseDocument.Save( // Server.MapPath("~/App_Data/" + DateTime.Now.Ticks + "_Response_" + // messageHandler.ResponseMessage.ToUserName + ".txt")); WriteContent(messageHandler.ResponseDocument.ToString()); return; } catch (Exception ex) { using (TextWriter tw = new StreamWriter(Server.MapPath("~/App_Data/Error_" + DateTime.Now.Ticks + ".txt"))) { tw.WriteLine(ex.Message); tw.WriteLine(ex.InnerException.Message); if (messageHandler.ResponseDocument != null) { tw.WriteLine(messageHandler.ResponseDocument.ToString()); } tw.Flush(); tw.Close(); } WriteContent(""); } finally { Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { openid = MyCommFun.QueryString("openid"); shopid = MyCommFun.RequestInt("shopid"); if (!Page.IsPostBack) { shopinfo = shopBll.GetModel(shopid); if (shopinfo == null) { return; } kcType = shopinfo.kcType; sendPrice = Convert.ToDecimal(shopinfo.sendPrice); radius = shopinfo.radius; sendArea = shopinfo.sendArea; notice = shopinfo.notice; tel = shopinfo.tel; xplace = Convert.ToDecimal(shopinfo.xplace); yplace = Convert.ToDecimal(shopinfo.yplace); hotelName = shopinfo.hotelName; rename = shopinfo.dcRename; address = shopinfo.address; hotelintroduction = shopinfo.hotelintroduction; hoteltimeBegin = shopinfo.hoteltimeBegin.Value.ToString("HH:mm"); hoteltimeEnd = shopinfo.hoteltimeEnd.Value.ToString("HH:mm"); yingye1 = "<tr><td>营业时间:" + hoteltimeBegin + "-" + hoteltimeEnd + "</td></tr>"; int stats = 0; if (DateTime.Compare(Convert.ToDateTime(hoteltimeEnd), DateTime.Now) < 0 || DateTime.Compare(Convert.ToDateTime(hoteltimeBegin), DateTime.Now) > 0) { } else { stats += 1; } if (shopinfo.hoteltimeEnd1 != null && shopinfo.hoteltimeBegin1 != null) { if (DateTime.Compare(Convert.ToDateTime(shopinfo.hoteltimeEnd1), Convert.ToDateTime("2100-1-1 " + DateTime.Now.ToShortTimeString())) < 0 || DateTime.Compare(Convert.ToDateTime(shopinfo.hoteltimeBegin1), Convert.ToDateTime("2100-1-1 " + DateTime.Now.ToShortTimeString())) > 0) { } else { stats += 1; } } if (shopinfo.hoteltimeEnd2 != null && shopinfo.hoteltimeBegin2 != null) { if (DateTime.Compare(Convert.ToDateTime(shopinfo.hoteltimeEnd2), Convert.ToDateTime("2100-1-1 " + DateTime.Now.ToShortTimeString())) < 0 || DateTime.Compare(Convert.ToDateTime(shopinfo.hoteltimeBegin2), Convert.ToDateTime("2100-1-1 " + DateTime.Now.ToShortTimeString())) > 0) { } else { stats += 1; } } if (stats > 0) { status = "<tr><td width=\"70\">店铺状态:<em class=\"ok\">营业中</em> </tr>"; } else { status = "<tr><td width=\"70\">店铺状态:<em class=\"no\">未营业</em> </tr>"; } if (shopinfo.hoteltimeBegin1 != null && shopinfo.hoteltimeEnd1 != null) { hoteltimeBegin1 = shopinfo.hoteltimeBegin1.Value.ToString("HH:mm"); hoteltimeEnd1 = shopinfo.hoteltimeEnd1.Value.ToString("HH:mm"); yingye2 = "<tr><td>营业时间1:" + hoteltimeBegin1 + "-" + hoteltimeEnd1 + "</td></tr>"; } if (shopinfo.hoteltimeBegin2 != null && shopinfo.hoteltimeEnd2 != null) { hoteltimeBegin2 = shopinfo.hoteltimeBegin2.Value.ToString("HH:mm"); hoteltimeEnd2 = shopinfo.hoteltimeEnd2.Value.ToString("HH:mm"); yingye3 = "<tr><td>营业时间2:" + hoteltimeBegin2 + "-" + hoteltimeEnd2 + "</td></tr>"; } //if (hoteltimeEnd<DateTime.Now.ToString("HH:mm")) //{ //} } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid Dictionary <string, string> jsonDict = new Dictionary <string, string>(); //黑名单权限openid BLL.wx_message_blacklist blackBll = new BLL.wx_message_blacklist(); if (_action == "commit") { //留言 if (blackBll.ExistsByOpenid(openid)) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "留言失败"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } else { int wid = MyCommFun.RequestInt("wid"); string nickname = MyCommFun.QueryString("nickname"); string info = MyCommFun.QueryString("info"); bool hasSH = Convert.ToBoolean(MyCommFun.QueryString("hasSH")); BLL.wx_message_list mBll = new BLL.wx_message_list(); Model.wx_message_list message = new Model.wx_message_list(); message.wid = wid; message.title = info; message.userName = nickname; message.createDate = DateTime.Now; message.openId = openid; message.parentId = 0; if (hasSH) { message.hasSH = false; } else { message.hasSH = true; } mBll.Add(message); //AddAdminLog(MXEnums.ActionEnum.Add.ToString(), ""); //记录日志 jsonDict.Add("ret", "ok"); jsonDict.Add("content", "留言成功"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } //回复 if (_action == "setly") { if (blackBll.ExistsByOpenid(openid)) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "留言失败"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } else { int wid = MyCommFun.RequestInt("wid"); string info = MyCommFun.QueryString("info"); bool hasSH = Convert.ToBoolean(MyCommFun.QueryString("hasSH")); int parentid = MyCommFun.RequestInt("parentid"); string nickname = MyCommFun.QueryString("nickname"); BLL.wx_message_list mBll = new BLL.wx_message_list(); Model.wx_message_list message = new Model.wx_message_list(); message.wid = wid; message.title = info; message.userName = nickname; message.createDate = DateTime.Now; message.openId = openid; message.parentId = parentid; if (hasSH) { message.hasSH = false; } else { message.hasSH = true; } mBll.Add(message); //AddAdminLog(MXEnums.ActionEnum.Add.ToString(), ""); //记录日志 jsonDict.Add("ret", "ok"); jsonDict.Add("content", "回复成功"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } }
public void ProcessRequest(HttpContext context) { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); BLL.wx_hotel_dingdan dingdanbll = new BLL.wx_hotel_dingdan(); Model.wx_hotel_dingdan dingdan = new Model.wx_hotel_dingdan(); string hotelid = MyCommFun.QueryString("hotelid"); string roomid = MyCommFun.QueryString("roomid"); string openid = MyCommFun.QueryString("openid"); string oderName = MyCommFun.QueryString("oderName"); string tel = MyCommFun.QueryString("tel"); if (_action == "dingdan") { dingdan.hotelid = Convert.ToInt32(hotelid); dingdan.roomid = Convert.ToInt32(roomid); dingdan.openid = openid; dingdan.oderName = oderName; dingdan.tel = tel; dingdan.orderStatus = 0; if (Convert.ToDateTime(MyCommFun.QueryString("arriveTime")) < DateTime.Now.AddDays(-1)) { jsonDict.Add("ret", "faile"); jsonDict.Add("content", "入住时间不能小于今天时间!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (Convert.ToDateTime(MyCommFun.QueryString("arriveTime")) > Convert.ToDateTime(MyCommFun.QueryString("leaveTime"))) { jsonDict.Add("ret", "faile"); jsonDict.Add("content", "入住时间必须小于离店时间!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (MyCommFun.QueryString("arriveTime") != "") { dingdan.arriveTime = Convert.ToDateTime(MyCommFun.QueryString("arriveTime")); } if (MyCommFun.QueryString("leaveTime") != "") { dingdan.leaveTime = Convert.ToDateTime(MyCommFun.QueryString("leaveTime")); } dingdan.roomType = MyCommFun.QueryString("roomType"); dingdan.createDate = DateTime.Now; dingdan.orderTime = DateTime.Now; dingdan.orderNum = MyCommFun.RequestInt("orderNum"); dingdan.isDelete = 0; dingdan.price = MyCommFun.Str2Decimal(MyCommFun.QueryString("price")); dingdan.yuanjia = MyCommFun.Str2Decimal(MyCommFun.QueryString("yuanjia")); dingdan.remark = MyCommFun.QueryString("remark"); dingdanbll.Add(dingdan); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "提交成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (_action == "dingdanedite") { dingdan.id = MyCommFun.RequestInt("dingdanidnum"); dingdan.oderName = MyCommFun.QueryString("truename"); dingdan.tel = MyCommFun.QueryString("tel"); if (Convert.ToDateTime(MyCommFun.QueryString("dateline")) < DateTime.Now.AddDays(-1)) { jsonDict.Add("ret", "faile"); jsonDict.Add("content", "入住时间不能小于今天时间!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (MyCommFun.QueryString("dateline") != "") { dingdan.arriveTime = Convert.ToDateTime(MyCommFun.QueryString("dateline")); } dingdan.orderNum = MyCommFun.RequestInt("nums"); dingdan.price = Convert.ToDecimal(MyCommFun.QueryString("xianjianum")); dingdan.yuanjia = Convert.ToDecimal(MyCommFun.QueryString("yuanjianum")); dingdan.remark = MyCommFun.QueryString("info"); dingdanbll.Updatehotel(dingdan); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "修改成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (_action == "dingdandelete") { int ddid = MyCommFun.RequestInt("dingdanidnum"); dingdanbll.Update(ddid); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "删除成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } }
protected void Page_Load(object sender, EventArgs e) { try { wid = MyCommFun.RequestInt("wid"); //授权 BLL.wx_userweixin bll = new BLL.wx_userweixin(); Model.wx_userweixin wxModel = bll.GetModel(wid); string code = MyCommFun.QueryString("code"); if (code == null || code.Trim() == "") { //logBll.AddLog("【微支付】微信预定", "paypage.aspx Page_Load", "code==null code.trim==kong", 1); // openid = MyCommFun.RequestOpenid(); string thisUrl = MyCommFun.getTotalUrl(); string newUrl = OAuth.GetAuthorizeUrl(wxModel.AppId, thisUrl, "fukuan", OAuthScope.snsapi_base); Response.Redirect(newUrl); } else { var result = OAuth.GetAccessToken(wxModel.AppId, wxModel.AppSecret, code); openid = result.openid; } //授权结束 // logBll.AddLog("【微支付】微信预定", "paypage.aspx Page_Load", " 授权结束openid= " + openid, 1); int otid = MyCommFun.RequestInt("orderid"); otid_str = otid.ToString(); expireMinute = MyCommFun.RequestInt("expireminute"); if (expireMinute == 0) { expireMinute = 30; } else if (expireMinute == -1) { //如果为-1,则有限期间为1年 expireMinute = 60 * 12 * 365; } if (openid == "" || otid == 0 || wid == 0) { return; } BLL.orders otBll = new BLL.orders(); Model.orders orderEntity = otBll.GetModel(otid, wid); logBll.AddLog("【微支付】微信预定", "paypage.aspx Page_Load", "orderEntity.order_no: " + orderEntity.order_no + "|orderEntity.order_amount:" + orderEntity.order_amount, 1); litout_trade_no.Text = orderEntity.order_no; litMoney.Text = orderEntity.order_amount.ToString(); litDate.Text = orderEntity.add_time.ToString(); //WxPayData(orderEntity.order_amount, orderEntity.id.ToString(), orderEntity.order_no, code);//老的接口 WxPayDataV3(orderEntity.order_amount, orderEntity.id.ToString(), orderEntity.order_no, code); } catch (Exception ex) { logBll.AddLog("【微支付】微信预定", "paypage.aspx Page_Load", "ex: " + ex.Message, 1); MessageBox.ShowAndRedirect(this, "支付有问题:" + ex.Message, "/shop/index.aspx?wid=" + wid); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); int aid = MyCommFun.RequestInt("aid"); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid if (_action == "choujiang") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); try { //抽奖 Model.wx_dzpActionInfo dzpAction = new Model.wx_dzpActionInfo(); BLL.wx_dzpAwardItem itemBll = new BLL.wx_dzpAwardItem(); #region 判断 int wid = MyCommFun.RequestInt("wid"); if (aid == 0 || wid == 0 || openid.Trim() == "") { jsonDict.Add("error", "sys"); jsonDict.Add("content", "参数错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } dzpAction = actbll.GetModel(aid); if (dzpAction == null) { jsonDict.Add("error", "sys"); jsonDict.Add("content", "参数错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (dzpAction.endDate <= DateTime.Now) { //说明活动已经结束 //非活动期间 jsonDict.Add("error", "end"); jsonDict.Add("content", "活动已结束"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } else if (dzpAction.beginDate > DateTime.Now) { //活动未开始 //非活动期间 jsonDict.Add("error", "nostart"); jsonDict.Add("content", "活动未开始"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } int dayMaxTimes = dzpAction.dayMaxTimes == null ? 0 : dzpAction.dayMaxTimes.Value; int perMaxTimes = dzpAction.personMaxTimes == null ? 0 : dzpAction.personMaxTimes.Value; //判断每人最大抽奖次数,是否超过了 if (personCJTimes(openid, aid) >= dzpAction.personMaxTimes) { jsonDict.Add("error", "notimes"); jsonDict.Add("content", "您已抽过奖了,欢迎下次再来!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (isTodayOverSum(aid, openid, dayMaxTimes)) { jsonDict.Add("error", "notimes"); jsonDict.Add("content", "每人每天只有" + dayMaxTimes.ToString() + "次抽奖机会。"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } Model.wx_dzpAwardUser award = ubll.getZJinfoByOpenid(aid, openid); if (award != null) { //您中奖了 jsonDict.Add("error", "notimes"); jsonDict.Add("content", "您已奖了,欢迎下次再来!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } #endregion #region 计算中奖信息 /// 处理是否中奖 /// hidStatus 状态为-1:不能抽奖,直接跳转到end.aspx页面; /// 0:抽奖次数超过设置的最高次数; /// 1:还可以继续抽奖; /// 2:中奖了; List <Model.wx_dzpAwardItem> itemlist = itemBll.GetModelList("actId=" + aid);//该活动的所有奖项信息 int ttJpNum = 0; for (int i = 0; i < itemlist.Count; i++) { ttJpNum += itemlist[i].jpRealNum.Value; } IList <Model.wx_dzpAwardUser> auserlist = ubll.getHasZJList(aid);//已经中奖的人列表 int ZhongJiangNum = 0; if (auserlist != null) { ZhongJiangNum = auserlist.Count; //已经中奖的人数 } int syZjNum = ttJpNum - ZhongJiangNum; //剩余的奖品数量 if (syZjNum <= 0) { //说明已经没有奖品了 jsonDict.Add("error", "-1"); jsonDict.Add("content", dzpAction.cfcjhf); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } dzpAction.personNum = MyCommFun.Obj2Int(dzpAction.personNum, 1); dzpAction.personMaxTimes = MyCommFun.Obj2Int(dzpAction.personMaxTimes, 1); int fenmo = dzpAction.personNum.Value * dzpAction.personMaxTimes.Value; Random rd = new Random((int)DateTime.Now.Ticks); int radNum = rd.Next(0, fenmo);//从0到fenmo里随机出一个值 if (radNum < syZjNum) { //中奖了,再从剩余奖品里抽取一个奖品 Model.wx_dzpAwardItem dajiang = getZJItem(itemlist, auserlist); if (dajiang != null) { //这是中的中奖了 string snumber = Get_snumber(aid); int uId = ubll.Add(aid, "", "", openid, dajiang.jxName, dajiang.jpName, snumber); jsonDict.Add("error", "succ"); jsonDict.Add("content", "恭喜你中奖了!"); jsonDict.Add("sortid", dajiang.sort_id.Value.ToString()); jsonDict.Add("jxname", dajiang.jxName); jsonDict.Add("jpname", dajiang.jpName); jsonDict.Add("uid", uId.ToString()); jsonDict.Add("sn", snumber); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } else { //奖品已经全部中完了 jsonDict.Add("error", "-1"); jsonDict.Add("content", dzpAction.cfcjhf); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } } else { //这个条件说明:未中奖 //抛出未中奖的数据 jsonDict.Add("error", "-1"); jsonDict.Add("content", dzpAction.cfcjhf); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } #endregion } catch (Exception ex) { jsonDict.Add("error", "sys"); jsonDict.Add("content", "计算抽奖出现未知错误,请联系管理员!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } } else if (_action == "update") { try { #region 提交手机 /// 提交手机号码 string tel = MyCommFun.QueryString("tel"); string pwd = MyCommFun.QueryString("pwd"); string snumber = MyCommFun.QueryString("snumber"); int id = MyCommFun.RequestInt("id"); if (aid == 0 || id == 0 || snumber == "" || tel == "") { context.Response.Write("{\"msg\":\"提交出现异常!!\",\"success\":\"0\"}"); return; } if ((pwd.Length > 0) && (!actbll.ExistsPwd(aid, pwd))) { context.Response.Write("{\"msg\":\"商家兑换密码错误!!\",\"success\":\"0\"}"); return; } BLL.wx_dzpAwardUser ubll = new BLL.wx_dzpAwardUser(); Model.wx_dzpAwardUser model = ubll.GetModel(id); if (model == null) { context.Response.Write("{\"msg\":\"提交出现异常2!!\",\"success\":\"0\"}"); return; } model.uTel = tel; if (pwd.Length > 0) { model.hasLingQu = true; } else { model.hasLingQu = false; } ubll.Update(model); context.Response.Write("{\"msg\":\"提交成功!\",\"success\":\"1\"}"); return; #endregion } catch { context.Response.Write("{\"msg\":\"提交出现异常!!\",\"success\":\"0\"}"); return; } } }
protected void Page_Load(object sender, EventArgs e) { string Token = "";//与微信公众账号后台的Token设置保持一致,区分大小写。 int wid = 0; wid = MyCommFun.RequestInt("apiid"); if (wid <= 0) { WriteContent("参数非法"); return; } wx_userweixin wbll = new wx_userweixin(); Token = wbll.GetWeiXinToken(wid); if (Token == null || string.IsNullOrEmpty(Token)) { WriteContent("不存在该微信号或账号已过期或已被禁用!"); return; } // Token = "uweixin"; string signature = Request["signature"]; string timestamp = Request["timestamp"]; string nonce = Request["nonce"]; string echostr = Request["echostr"]; if (Request.HttpMethod == "GET") { //get method - 仅在微信后台填写URL验证时触发 if (CheckSignature.Check(signature, timestamp, nonce, Token)) { WriteContent(echostr); //返回随机字符串则表示验证通过 } else { WriteContent("failed:" + signature + ",token:" + Token + " " + CheckSignature.GetSignature(timestamp, nonce, Token) + "。" + "如果你在浏览器中看到这句话,说明此地址可以被作为微信公众账号后台的Url,请注意保持Token一致。"); } Response.End(); } else { //本地测试的时候注释掉 ----start ----- //if (!CheckSignature.Check(signature, timestamp, nonce, Token)) //{ // WriteContent("参数错误!"); // return; //} //本地测试的时候注释掉 ----end ----- //post method - 当有用户想公众账号发送消息时触发 Model.wx_userweixin uweixin = wbll.GetModel(wid); var postModel = new PostModel() { Signature = Request.QueryString["signature"], Msg_Signature = Request.QueryString["msg_signature"], Timestamp = Request.QueryString["timestamp"], Nonce = Request.QueryString["nonce"], //以下保密信息不会(不应该)在网络上传播,请注意 Token = Token, EncodingAESKey = uweixin.extStr, //根据自己后台的设置保持一致 AppId = uweixin.AppId //根据自己后台的设置保持一致 }; //v4.2.2之后的版本,可以设置每个人上下文消息储存的最大数量,防止内存占用过多,如果该参数小于等于0,则不限制 var maxRecordCount = 10; //自定义MessageHandler,对微信请求的详细判断操作都在这里面。 var messageHandler = new CustomMessageHandler(Request.InputStream, postModel, maxRecordCount); try { //测试时可开启此记录,帮助跟踪数据,使用前请确保App_Data文件夹存在,且有读写权限。 messageHandler.RequestDocument.Save( Server.MapPath("~/App_Data/" + DateTime.Now.Ticks + "_Request_" + messageHandler.RequestMessage.FromUserName + ".txt")); //执行微信处理过程 messageHandler.Execute(); //测试时可开启,帮助跟踪数据 messageHandler.ResponseDocument.Save( Server.MapPath("~/App_Data/" + DateTime.Now.Ticks + "_Response_" + messageHandler.ResponseMessage.ToUserName + ".txt")); //为了解决官方微信5.0软件换行bug暂时添加的方法,平时用下面一个方法即可 begin string lastStr = ""; if (messageHandler != null && messageHandler.ResponseDocument != null && messageHandler.ResponseDocument.ToString().Trim() != "") { lastStr = messageHandler.ResponseDocument.ToString().Replace("\r\n", "\n"); } else { lastStr = messageHandler.ResponseDocument.ToString(); } // WriteContent( messageHandler.ResponseDocument.ToString()); //为了解决官方微信5.0软件换行bug暂时添加的方法,平时用下面一个方法即可 end //如果自动回复已经关闭,则不返回内容,start 1220 WeiXCommFun wxcomm = new WeiXCommFun(); int apiid = wxcomm.getApiid(); if (!wxcomm.wxCloseKW(apiid)) { lastStr = ""; } //如果自动回复已经关闭,则不返回内容,end 1220 WriteContent(lastStr); return; } catch (Exception ex) { using (TextWriter tw = new StreamWriter(Server.MapPath("~/App_Data/Error_" + DateTime.Now.Ticks + ".txt"))) { tw.WriteLine(ex.Message); tw.WriteLine(ex.InnerException.Message); if (messageHandler.ResponseDocument != null) { tw.WriteLine(messageHandler.ResponseDocument.ToString()); } tw.Flush(); tw.Close(); } WriteContent(""); } finally { Response.End(); } } }
protected void save_setup_Click(object sender, EventArgs e) { editetype = MyCommFun.QueryString("type"); Model.wx_userweixin weixin = GetWeiXinCode(); int wid = weixin.id; shopid = MyCommFun.RequestInt("shopid"); //修改 #region DataSet dr = setupBll.Getsetup(shopid); if (dr.Tables[0].Rows.Count > 0) { int setupid = MyCommFun.Obj2Int(dr.Tables[0].Rows[0]["id"]); //赋值 setup.id = setupid; setup.wid = wid; setup.unionManage = this.unionManage.InnerText; setup.unionTel = this.unionTel.Text; setup.shopid = shopid; setupBll.Update(setup); //广告图片 guanggBll.Delete(setupid); //guanggBll.Delete(); for (int i = 1; i <= 6; i++) { advertisementName = this.FindControl("advertisementName" + i) as TextBox; sortid = this.FindControl("sortid" + i) as TextBox; picUrl = this.FindControl("picUrl" + i) as TextBox; websetUrl = this.FindControl("websetUrl" + i) as TextBox; // isdisplay=this.FindControl("isdisplay" + i) as CheckBox; if (advertisementName.Text.Trim() != "" && sortid.Text.Trim() != "") { guangg.setupid = setupid; guangg.advertisementName = advertisementName.Text.ToString(); guangg.sortid = MyCommFun.Str2Int(sortid.Text.ToString()); guangg.picUrl = picUrl.Text.ToString(); guangg.websetUrl = websetUrl.Text.ToString(); guangg.createDate = DateTime.Now.ToString(); // guangg.isdisplay= Convert.ToBoolean(isdisplay.Text.ToString()); guanggBll.Add(guangg);; } } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改商家设置,主键为" + setupid); //记录日志 JscriptMsg("修改成功!", "shop_list.aspx", "Success"); return; } #endregion //新增 #region editetype = MyCommFun.QueryString("type"); if (editetype == "add") { setup.wid = wid; setup.unionManage = this.unionManage.InnerText; setup.unionTel = this.unionTel.Text; setup.shopid = shopid; int id = setupBll.Add(setup); for (int i = 1; i <= 6; i++) { advertisementName = this.FindControl("advertisementName" + i) as TextBox; sortid = this.FindControl("sortid" + i) as TextBox; picUrl = this.FindControl("picUrl" + i) as TextBox; websetUrl = this.FindControl("websetUrl" + i) as TextBox; // isdisplay=this.FindControl("isdisplay" + i) as CheckBox; if (advertisementName.Text.Trim() != "" && sortid.Text.Trim() != "") { guangg.setupid = id; guangg.advertisementName = advertisementName.Text.ToString(); guangg.sortid = MyCommFun.Str2Int(sortid.Text.ToString()); guangg.picUrl = picUrl.Text.ToString(); guangg.websetUrl = websetUrl.Text.ToString(); guangg.createDate = DateTime.Now.ToString(); // guangg.isdisplay= Convert.ToBoolean(isdisplay.Text.ToString()); guanggBll.Add(guangg);; } } AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加商城设置,主键为" + id); //记录日志 JscriptMsg("添加成功!", Utils.CombUrlTxt("shop_list.aspx", "keywords={0}", ""), "Success"); } #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { aid = MyCommFun.RequestInt("aid"); shopid = MyCommFun.RequestInt("shopid"); categoryid = MyCommFun.RequestInt("categoryid"); shopinfo = shopBll.GetModel(shopid); hotelName = shopinfo.hotelName; openid = MyCommFun.QueryString("openid"); if (categoryid != 0)//选择加载 { //分类 manageString = ""; cateString = ""; categories = "{"; DataSet category1 = categorybll.GetList(shopid); if (category1.Tables[0].Rows.Count > 0) { for (int i = 0; i < category1.Tables[0].Rows.Count; i++) { if (categoryid == Convert.ToInt32(category1.Tables[0].Rows[i]["id"].ToString()))//选择的一条 { cateString += "<dd class=\"active\"><a style=\"width: 100%;\" href=\"index.aspx?categoryid=" + category1.Tables[0].Rows[i]["id"].ToString() + "&openid=" + openid + "&shopid=" + shopid + "&aid=" + aid + "\">" + category1.Tables[0].Rows[i]["categoryName"].ToString() + "</a></dd>"; } else { cateString += "<dd ><a style=\"width: 100%;\" href=\"index.aspx?categoryid=" + category1.Tables[0].Rows[i]["id"].ToString() + "&openid=" + openid + "&shopid=" + shopid + "&aid=" + aid + "\">" + category1.Tables[0].Rows[i]["categoryName"].ToString() + "</a></dd>"; } categories += "\"" + category1.Tables[0].Rows[i]["id"].ToString() + "\"" + ":" + "\"" + category1.Tables[0].Rows[i]["categoryName"].ToString() + "\"" + ","; } } categories = categories.Substring(0, categories.Length - 1); categories += "}"; //菜品 DataSet manage1 = managebll.GetList(categoryid);//分类id if (manage1.Tables[0].Rows.Count > 0) { for (int j = 0; j < manage1.Tables[0].Rows.Count; j++) { manageString += "<dd> "; manageString += "<span class=\"count_zero\" id=\"num_" + manage1.Tables[0].Rows[j]["id"].ToString() + "_1\" onClick=\"addProduct('" + manage1.Tables[0].Rows[j]["id"].ToString() + "','1','" + manage1.Tables[0].Rows[j]["cpName"].ToString() + "','18.0','" + categoryid + "',1);\">0</span>"; manageString += " <div class=\"tupian\"><img src=" + manage1.Tables[0].Rows[j]["picUrl"].ToString() + " onClick=\"htmlit('http:','" + manage1.Tables[0].Rows[j]["cpName"].ToString() + "'," + manage1.Tables[0].Rows[j]["id"].ToString() + ")\">"; manageString += "<a href=\"javascript:addProduct('" + manage1.Tables[0].Rows[j]["id"].ToString() + "','1','" + manage1.Tables[0].Rows[j]["cpName"].ToString() + "','" + manage1.Tables[0].Rows[j]["zkPrice"].ToString() + "','" + categoryid + "',1);\" class=\"add\" data-foodid=\"" + manage1.Tables[0].Rows[j]["id"].ToString() + "_1\">"; manageString += "<h3>" + manage1.Tables[0].Rows[j]["cpName"].ToString() + "</h3>"; manageString += " <em>" + manage1.Tables[0].Rows[j]["zkPrice"].ToString() + "元/件<del>" + manage1.Tables[0].Rows[j]["cpPrice"].ToString() + "元/件</del></em>"; manageString += " <p class=\"dpNum\">" + manage1.Tables[0].Rows[j]["scan"].ToString() + "</p></a> "; manageString += " <a href=\"javascript:reduceProduct('" + manage1.Tables[0].Rows[j]["id"].ToString() + "','1',1);\" class=\"reduce\" id=\"del_" + manage1.Tables[0].Rows[j]["id"].ToString() + "_1\" style=\"display:none;\"><b class=\"ico_reduce\">减一份</b></a>"; manageString += " </div></dd>"; } } return; } //初始加载 DataSet category = categorybll.GetList(shopid); if (category.Tables[0].Rows.Count > 0)//分类 { manageString = ""; cateString = ""; categories = "{"; for (int i = 0; i < category.Tables[0].Rows.Count; i++) { if (i == 0) { cateString += "<dd class=\"active\"><a style=\"width: 100%;\" href=\"index.aspx?categoryid=" + category.Tables[0].Rows[i]["id"].ToString() + "&openid=" + openid + "&shopid=" + shopid + "&aid=" + aid + "\">" + category.Tables[0].Rows[i]["categoryName"].ToString() + "</a></dd>"; DataSet manage = managebll.GetList(Convert.ToInt32(category.Tables[0].Rows[i]["id"].ToString())); //分类id if (manage.Tables[0].Rows.Count > 0) //菜品 { for (int j = 0; j < manage.Tables[0].Rows.Count; j++) { manageString += "<dd> "; manageString += "<span class=\"count_zero\" id=\"num_" + manage.Tables[0].Rows[j]["id"].ToString() + "_1\" onClick=\"addProduct('" + manage.Tables[0].Rows[j]["id"].ToString() + "','1','" + manage.Tables[0].Rows[j]["cpName"].ToString() + "','18.0','" + category.Tables[0].Rows[i]["id"].ToString() + "',1);\">0</span>"; manageString += " <div class=\"tupian\"><img src=" + manage.Tables[0].Rows[j]["picUrl"].ToString() + " onClick=\"htmlit('http:','" + manage.Tables[0].Rows[j]["cpName"].ToString() + "'," + manage.Tables[0].Rows[j]["id"].ToString() + ")\">"; manageString += "<a href=\"javascript:addProduct('" + manage.Tables[0].Rows[j]["id"].ToString() + "','1','" + manage.Tables[0].Rows[j]["cpName"].ToString() + "','" + manage.Tables[0].Rows[j]["zkPrice"].ToString() + "','" + category.Tables[0].Rows[i]["id"].ToString() + "',1);\" class=\"add\" data-foodid=\"" + manage.Tables[0].Rows[j]["id"].ToString() + "_1\">"; manageString += "<h3>" + manage.Tables[0].Rows[j]["cpName"].ToString() + "</h3>"; manageString += " <em>" + manage.Tables[0].Rows[j]["zkPrice"].ToString() + "元/件<del>" + manage.Tables[0].Rows[j]["cpPrice"].ToString() + "元/件</del></em>"; manageString += " <p class=\"dpNum\">" + manage.Tables[0].Rows[j]["scan"].ToString() + "</p></a> "; manageString += " <a href=\"javascript:reduceProduct('" + manage.Tables[0].Rows[j]["id"].ToString() + "','1',1);\" class=\"reduce\" id=\"del_" + manage.Tables[0].Rows[j]["id"].ToString() + "_1\" style=\"display:none;\"><b class=\"ico_reduce\">减一份</b></a>"; manageString += " </div></dd>"; } } } else { cateString += "<dd ><a style=\"width: 100%;\" href=\"index.aspx?categoryid=" + category.Tables[0].Rows[i]["id"] + "&openid=" + openid + "&shopid=" + shopid + "&aid=" + aid + "\">" + category.Tables[0].Rows[i]["categoryName"] + "</a></dd>"; } categories += "\"" + category.Tables[0].Rows[i]["id"].ToString() + "\"" + ":" + "\"" + category.Tables[0].Rows[i]["categoryName"].ToString() + "\"" + ","; } categories = categories.Substring(0, categories.Length - 1); categories += "}"; } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid if (_action == "update") { try { #region 提交手机 /// 提交手机号码 string tel = MyCommFun.QueryString("tel"); string pwd = MyCommFun.QueryString("pwd"); string snumber = MyCommFun.QueryString("snumber"); int id = MyCommFun.RequestInt("id"); int aid = MyCommFun.RequestInt("aid"); if (aid == 0 || id == 0 || snumber == "" || tel == "") { context.Response.Write("{\"msg\":\"提交出现异常!!\",\"success\":\"0\"}"); return; } BLL.wx_ggkActionInfo actBll = new BLL.wx_ggkActionInfo(); if (pwd.Trim().Length > 0 && (!actBll.ExistsPwd(aid, pwd))) { context.Response.Write("{\"msg\":\"商家兑换密码错误!!\",\"success\":\"0\"}"); return; } BLL.wx_ggkAwardUser ubll = new BLL.wx_ggkAwardUser(); Model.wx_ggkAwardUser model = ubll.GetModel(id); if (model == null) { context.Response.Write("{\"msg\":\"提交出现异常2!!\",\"success\":\"0\"}"); return; } model.uTel = tel; if (pwd.Trim().Length > 0) { model.hasLingQu = true; } else { model.hasLingQu = false; } ubll.Update(model); context.Response.Write("{\"msg\":\"提交成功!\",\"success\":\"1\"}"); return; #endregion } catch { context.Response.Write("{\"msg\":\"提交出现异常!!\",\"success\":\"0\"}"); return; } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string action = MXRequest.GetQueryString("myact"); #region 根据品牌得到车系 if (action == "chexi") { BLL.wx_wq_chexi cxBll = new BLL.wx_wq_chexi(); int pid = MyCommFun.RequestInt("pid"); int wid = MyCommFun.RequestInt("wid"); List <Model.wx_wq_chexi> cxList = cxBll.GetModelList(string.Format(" wid={0} and pid={1}", wid, pid)); context.Response.Write(MyCommFun.SwitchToJson <Model.wx_wq_chexi>(cxList)); return; } #endregion #region 根据车系得到车型 if (action == "chexing") { BLL.wx_wq_chexing cxBll = new BLL.wx_wq_chexing(); int xid = MyCommFun.RequestInt("xid"); int wid = MyCommFun.RequestInt("wid"); List <Model.wx_wq_chexing> cxList = cxBll.GetModelList(string.Format(" wid={0} and xid={1}", wid, xid)); context.Response.Write(MyCommFun.SwitchToJson <Model.wx_wq_chexing>(cxList)); return; } #endregion #region 添加预约订单 if (action == "addorder") { Dictionary <string, string> jsondict = new Dictionary <string, string>(); BLL.wx_wq_yyOrder yoBll = new BLL.wx_wq_yyOrder(); Model.wx_wq_yyOrder yoModel = new Model.wx_wq_yyOrder(); try { int wid = MyCommFun.RequestInt("wid"); string name = MyCommFun.QueryString("truename"); string openid = MyCommFun.QueryString("openid"); string tel = MyCommFun.QueryString("tel"); string date = MyCommFun.QueryString("dateline"); string part = MyCommFun.QueryString("timepart"); string xid = MyCommFun.QueryString("xid"); string pid = MyCommFun.QueryString("pid"); int type = MyCommFun.RequestInt("type"); string carnum = MyCommFun.QueryString("carnum"); string km = MyCommFun.QueryString("km"); string remark = MyCommFun.QueryString("info"); yoModel.Name = name; yoModel.remark = remark; yoModel.sort_id = 99; yoModel.telephone = tel; yoModel.xid = MyCommFun.Str2Int(xid); yoModel.pid = MyCommFun.Str2Int(pid); yoModel.wid = wid; yoModel.yid = type; yoModel.km = MyCommFun.Str2Decimal(km); yoModel.carnum = carnum; yoModel.yydate = MyCommFun.Obj2DateTime(date); yoModel.yytime = part; yoModel.openid = openid; yoModel.ddstatus = "待回复"; yoModel.createdate = DateTime.Now; int res = yoBll.Add(yoModel); if (res < 1) { jsondict.Add("errno", "1"); context.Response.Write(MyCommFun.getJsonStr(jsondict)); return; } jsondict.Add("errno", "0"); context.Response.Write(MyCommFun.getJsonStr(jsondict)); return; } catch (Exception) { jsondict.Add("errno", "1"); context.Response.Write(MyCommFun.getJsonStr(jsondict)); return; } } #endregion #region 除订单 if (action == "delorder") { Dictionary <string, string> jsondict = new Dictionary <string, string>(); int id = MyCommFun.RequestInt("id"); int wid = MyCommFun.RequestInt("wid"); BLL.wx_wq_yyOrder yoBll = new BLL.wx_wq_yyOrder(); yoBll.Delete(id); return; } #endregion if (action == "addChezhu") { Dictionary <string, string> jsondict = new Dictionary <string, string>(); BLL.wx_wq_chezhu czBll = new BLL.wx_wq_chezhu(); try { int pid = MyCommFun.RequestInt("car_model"); int wid = MyCommFun.RequestInt("wid"); int xid = MyCommFun.RequestInt("car_type"); int xingid = MyCommFun.RequestInt("car_xing"); string car_no = MyCommFun.QueryString("car_no"); string tel = MyCommFun.QueryString("tel"); string car_userName = MyCommFun.QueryString("car_userName"); string car_startTime = MyCommFun.QueryString("car_startTime"); string car_buyTime = MyCommFun.QueryString("car_buyTime"); string openid = MyCommFun.QueryString("openid"); int res = czBll.GetRecordCount(" openid='" + openid + "' and wid=" + wid); Model.wx_wq_chezhu czModel = new Model.wx_wq_chezhu(); if (res > 0) { czModel = czBll.GetModelList(" openid='" + openid + "' and wid=" + wid)[0]; } czModel.cpNum = car_no; czModel.cxingid = xingid; czModel.gcdate = MyCommFun.Obj2DateTime(car_buyTime); czModel.Name = car_userName; czModel.ppid = pid; czModel.cxid = xid; czModel.cxingid = xingid; czModel.spdate = MyCommFun.Obj2DateTime(car_startTime); czModel.teltephone = tel; czModel.sort_id = 99; czModel.wid = wid; czModel.createdate = DateTime.Now; czModel.openid = openid; if (res > 0) { czBll.Update(czModel); jsondict.Add("content", "修改车主信息成功"); context.Response.Write(MyCommFun.getJsonStr(jsondict)); return; } else { czBll.Add(czModel); jsondict.Add("content", "添加车主信息成功"); context.Response.Write(MyCommFun.getJsonStr(jsondict)); return; } } catch (Exception) { jsondict.Add("content", "操作失败!"); context.Response.Write(MyCommFun.getJsonStr(jsondict)); return; } } }
protected void save_qiudui_Click(object sender, EventArgs e) { Model.wx_userweixin weixin = GetWeiXinCode(); wid = weixin.id; qiuduiid = MyCommFun.RequestInt("id"); if (type == "edite") { qiudui.id = qiuduiid; qiudui.wid = wid; qiudui.qdName = this.qdName.Text; qiudui.qdPic = this.qdPic.Text; qiudui.remark = this.remark.InnerText; if (this.succTimes.Text.ToString() != "") { qiudui.succTimes = Convert.ToInt32(this.succTimes.Text.ToString()); } else { qiudui.succTimes = 0; } if (this.failTimes.Text.ToString() != "") { qiudui.failTimes = Convert.ToInt32(this.failTimes.Text.ToString()); } else { qiudui.failTimes = 0; } if (this.sort_id.Text.ToString() != "") { qiudui.sort_id = Convert.ToInt32(this.sort_id.Text.ToString()); } else { qiudui.sort_id = 0; } qiuduibll.Update(qiudui); AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改球队设置,主键为" + qiuduiid); //记录日志 JscriptMsg("修改成功!", "qiudui_list.aspx", "Success"); } if (type == "add") { qiudui.wid = wid; qiudui.qdName = this.qdName.Text; qiudui.qdPic = this.qdPic.Text; qiudui.remark = this.remark.InnerText; qiudui.succTimes = Convert.ToInt32(this.succTimes.Text.ToString()); if (this.succTimes.Text.ToString() != "") { qiudui.succTimes = Convert.ToInt32(this.succTimes.Text.ToString()); } else { qiudui.succTimes = 0; } if (this.failTimes.Text.ToString() != "") { qiudui.failTimes = Convert.ToInt32(this.failTimes.Text.ToString()); } else { qiudui.failTimes = 0; } if (this.sort_id.Text.ToString() != "") { qiudui.sort_id = Convert.ToInt32(this.sort_id.Text.ToString()); } else { qiudui.sort_id = 0; } qiudui.createDate = DateTime.Now; int id = qiuduibll.Add(qiudui); AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加球队设置,主键为" + id); //记录日志 JscriptMsg("添加成功!", "qiudui_list.aspx", "Success"); } }
/// <summary> /// 列表页面独有的数据 /// </summary> public void ArticleClassPage() { int category_id = MyCommFun.RequestInt("cid"); //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====-- Model.article_category category = tDal.GetCategoryByWid(wid, category_id); this.Document.SetValue("category", category); //--=====end: 将这个列表(文章类别)的基本信息展示出来 ====-- Tag orderByTag = this.Document.GetChildTagById("norderby"); string orderby = orderByTag.Attributes["value"].Value.ToString(); Tag pagesizeTag = this.Document.GetChildTagById("npagesize"); string pagesizeStr = pagesizeTag.Attributes["value"].Value.ToString(); int currPage = 1; //当前页面 int recordCount = 0; //总记录数 int totPage = 1; //总页数 int pageSize = MyCommFun.Str2Int(pagesizeStr); //每页的记录数 if (pageSize <= 0) { pageSize = 10; } if (MyCommFun.RequestInt("page") > 0) { currPage = MyCommFun.RequestInt("page"); } DataSet artlist = new DataSet(); if (category_id != 0) { DAL.article artDal = new DAL.article(); artlist = artDal.GetList("news", category_id, pageSize, currPage, "wid=" + wid, orderby, out recordCount); if (artlist != null && artlist.Tables.Count > 0 && artlist.Tables[0].Rows.Count > 0) { DataRow dr; for (int i = 0; i < artlist.Tables[0].Rows.Count; i++) { dr = artlist.Tables[0].Rows[i]; if (dr["link_url"] != null && dr["link_url"].ToString().Trim().Length > 0) { dr["link_url"] = MyCommFun.urlAddOpenid(dr["link_url"].ToString().Trim(), openid); } else { dr["link_url"] = MyCommFun.urlAddOpenid("detail.aspx?wid=" + wid + "&aid=" + dr["id"].ToString(), openid); } artlist.AcceptChanges(); } totPage = recordCount / pageSize; int yushu = recordCount % pageSize; if (yushu > 0) { totPage += 1; } if (totPage < 1) { totPage = 1; } } if (currPage > totPage) { currPage = totPage; } } else { currPage = 1; recordCount = 0; totPage = 1; } this.Document.SetValue("totPage", totPage); //总页数 this.Document.SetValue("currPage", currPage); //当前页 this.Document.SetValue("newslist", artlist); //文章列表 string beforePageStr = ""; //上一页 string nextPageStr = ""; //下一页 string bgrey = "c-p-grey"; string ngrey = "c-p-grey"; if (currPage <= 1) { beforePageStr = ""; bgrey = "c-p-grey"; } else { beforePageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage - 1)); beforePageStr = "href=\"" + beforePageStr + "\""; bgrey = ""; } if (currPage >= totPage) { nextPageStr = ""; ngrey = " c-p-grey"; } else { nextPageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage + 1)); nextPageStr = "href=\"" + nextPageStr + "\""; ngrey = ""; } this.Document.SetValue("bpage", beforePageStr); //上一页 this.Document.SetValue("npage", nextPageStr); //下一页 this.Document.SetValue("bgrey", bgrey); //上一页灰色的样式 this.Document.SetValue("ngrey", ngrey); //下一页灰色的样式 }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { // ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (rcbll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除图文回复信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", "tuwenMgr.aspx?rid=" + MyCommFun.RequestInt("rid"), "Success"); }
override protected void OnInit(EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } //1获得模版基本信息04e11d01b9df2865 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 type = MyCommFun.QueryString("type"); if (type != "") { type = "&type=new"; } string thisUrl = MyCommFun.getWebSite() + "/shop/list.aspx?wid=" + wid + "&cid=" + MyCommFun.RequestInt("cid") + type; OAuth2BaseProc(wxModel, "list", thisUrl); //授权结束 serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/list.html"; ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid); template.tType = TemplateType.Class; template.openid = openid; template.OutPutHtml(wid); DataSet ds = new DataSet(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.wx_cards gbll = new BLL.wx_cards(); Model.wx_cards cards = new Model.wx_cards(); BLL.wx_cards_gl countgbll = new BLL.wx_cards_gl(); Model.wx_cards_gl cardscountg = new Model.wx_cards_gl(); id = MyCommFun.RequestInt("aid"); openid = MyCommFun.RequestOpenid(); wid = MyCommFun.RequestInt("wid"); this.hkid.Value = id.ToString(); cards = gbll.GetModel(id); //name = cards.name; createDate = cards.createDate.ToString(); copyRight = cards.copyRight; zfCount = Convert.ToInt32(cards.zfCount); url = cards.backPic; title = cards.title; this.backimage.Value = cards.backPic; buttonCharacter = cards.buttonCharacter; imageback = cards.backPic; music = cards.backMusic; if (MyCommFun.RequestInt("dh") != 0) { dhId = MyCommFun.RequestInt("dh"); } else { dhId = MyCommFun.Obj2Int(cards.backCartoon); } if (MyCommFun.QueryString("name") != "") { name = MyCommFun.QueryString("name"); } else { name = cards.name; } if (MyCommFun.QueryString("characters") != "") { characters = MyCommFun.QueryString("characters"); } else { characters = cards.characters; } //查看次数 gbll.updateck(id); } }
public void userinfoAdd() { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); //取值 int? wid = MyCommFun.RequestInt("wid", 0); int aid = MyCommFun.RequestInt("aid"); string openid = MyCommFun.RequestOpenid(); string atitle = MyCommFun.QueryString("atitle"); string usersum = MyCommFun.QueryString("usersum"); bool ISnum = true; if (wid == 0 || aid == 0 || openid == "" || usersum == "") { jsonDict.Add("re", "err"); jsonDict.Add("content", "参数错误!"); jsonDict.Add("isnum", "false"); content.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } BLL.wx_dati_user userBLL = new BLL.wx_dati_user(); // Model.wx_dati_user usermodel = userBLL.GetModel(" openid='" + openid + "' "); int getcont = userBLL.GetRecordCount(" openid='" + openid + "' "); if (getcont == 3) { jsonDict.Add("re", "err"); jsonDict.Add("content", "你已参加过了"); jsonDict.Add("isnum", "false"); content.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } int sy = 2 - getcont; BLL.wx_dati_base baseBLL = new BLL.wx_dati_base(); Model.wx_dati_base baseModel = baseBLL.GetModel(aid); int?jf = 0; int jftype = baseModel.jftype; int jfval = baseModel.jfval; if (jftype == 0) { jf = 0; } else if (jftype == 1) { jf = jfval; } else if (jftype == 2) { jf = int.Parse(usersum); } BLL.wx_dati_user dxBLL = new BLL.wx_dati_user(); Model.wx_dati_user dxmodel = new Model.wx_dati_user(); dxmodel.wid = wid; dxmodel.openid = openid; dxmodel.aid = aid; dxmodel.atitle = atitle; dxmodel.usersum = usersum; dxmodel.score = jf; dxmodel.addtime = DateTime.Now; dxBLL.Add(dxmodel); //得分 if (jf == 5) { jsonDict.Add("re", "OK"); jsonDict.Add("cjscore", jf.ToString()); jsonDict.Add("content", "你获得了一次红包机会!"); jsonDict.Add("isnum", "false"); content.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } else { jsonDict.Add("re", "OK"); jsonDict.Add("cjscore", jf.ToString()); jsonDict.Add("content", "答卷提交成功!(" + sy + ")次机会"); jsonDict.Add("isnum", "true"); content.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } }