protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { string openid = MyCommFun.RequestOpenid(); int id=MyCommFun.RequestInt("aid"); BLL.wx_purchase_customer customerbll = new BLL.wx_purchase_customer(); BLL.wx_purchase_base basebll = new BLL.wx_purchase_base(); customermodel = customerbll.GetModelopenid(openid); basemodel=basebll.GetModel(id); if (basemodel!=null) { totalCount = Convert.ToInt32(basemodel.totalCount); limitCount = Convert.ToInt32(basemodel.limitCount); count = totalCount- customerbll.GetRecordCount(id);//剩余 this.totalCount1.Value = totalCount.ToString(); this.limitCount1.Value = limitCount.ToString(); this.count1.Value = count.ToString(); huodname = basemodel.activityName; tuangj = Convert.ToInt32( basemodel.groupPrice); yg= customerbll.GetRecordyg(openid, id); int aa = limitCount - yg; if (aa<0) { aa = 0; } this.limit.Value = aa.ToString(); // } if (customermodel!=null && customermodel.status==0) { this.sndiv.Visible = true; this.sn.Visible = true; this.sn.Value = customermodel.sn; this.customerName.Value = customermodel.customerName; this.tel.Value = customermodel.tel; // this.customerNum.Value = customermodel.customerNum.ToString(); customerNum = customermodel.customerNum.ToString(); this.address.Value = customermodel.address; this.Remark.Value = customermodel.Remark; this.pwddiv.Visible = true; //this.pwd.Value = basemodel.shopsPwd; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string openid = MyCommFun.RequestOpenid(); int id = MyCommFun.RequestInt("aid"); BLL.wx_purchase_customer customerbll = new BLL.wx_purchase_customer(); BLL.wx_purchase_base basebll = new BLL.wx_purchase_base(); customermodel = customerbll.GetModelopenid(openid); basemodel = basebll.GetModel(id); if (basemodel != null) { totalCount = Convert.ToInt32(basemodel.totalCount); limitCount = Convert.ToInt32(basemodel.limitCount); count = totalCount - customerbll.GetRecordCount(id);//剩余 this.totalCount1.Value = totalCount.ToString(); this.limitCount1.Value = limitCount.ToString(); this.count1.Value = count.ToString(); huodname = basemodel.activityName; tuangj = Convert.ToInt32(basemodel.groupPrice); yg = customerbll.GetRecordyg(openid, id); int aa = limitCount - yg; if (aa < 0) { aa = 0; } this.limit.Value = aa.ToString(); // } if (customermodel != null && customermodel.status == 0) { this.sndiv.Visible = true; this.sn.Visible = true; this.sn.Value = customermodel.sn; this.customerName.Value = customermodel.customerName; this.tel.Value = customermodel.tel; // this.customerNum.Value = customermodel.customerNum.ToString(); customerNum = customermodel.customerNum.ToString(); this.address.Value = customermodel.address; this.Remark.Value = customermodel.Remark; this.pwddiv.Visible = true; //this.pwd.Value = basemodel.shopsPwd; } } }
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 = "抢购"; } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string _action = MyCommFun.QueryString("myact"); string shopsPwd = MyCommFun.QueryString("shopsPwd"); string sn = MyCommFun.QueryString("sn"); int id = MyCommFun.RequestInt("baseid"); int baseid = MyCommFun.RequestInt("baseid"); string customerName = MyCommFun.QueryString("customerName"); string tel = MyCommFun.QueryString("tel"); int customerNum = MyCommFun.RequestInt("customerNum"); string address = MyCommFun.QueryString("address"); string Remark = MyCommFun.QueryString("Remark"); BLL.wx_purchase_base basebll = new BLL.wx_purchase_base(); Dictionary <string, string> jsonDict = new Dictionary <string, string>(); BLL.wx_purchase_customer customerbll = new BLL.wx_purchase_customer(); Model.wx_purchase_customer model = new Model.wx_purchase_customer(); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid if (_action == "commit") { basemodel = basebll.GetModel(id); if (basemodel != null) { totalCount = Convert.ToInt32(basemodel.totalCount); limitCount = Convert.ToInt32(basemodel.limitCount); count = totalCount - customerbll.GetRecordAmount(id); //剩余的商品数量 yg = customerbll.GetRecordyg(openid, id); //个人剩余的可购买数量 if (shopsPwd == "" && sn == "") { #region //新增一次消费 if (count < customerNum) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } int aa = limitCount - yg; if (aa <= 0) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } baseid = MyCommFun.RequestInt("baseid"); customerName = MyCommFun.QueryString("customerName"); tel = MyCommFun.QueryString("tel"); customerNum = MyCommFun.RequestInt("customerNum"); address = MyCommFun.QueryString("address"); model.openid = openid; model.baseid = baseid; model.customerName = customerName; model.tel = tel; model.customerNum = customerNum; model.address = address; sn = Utils.Number(18); model.sn = sn; model.status = 0;//未消费 model.craeteTime = DateTime.Now; model.dateJoin = DateTime.Now; model.Remark = Remark; customerbll.Add(model); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "抢购成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } else { #region 确认消费 int oldNum = MyCommFun.RequestInt("oldNum"); //本次的原始消费数量 customerNum -= oldNum; yg -= oldNum; if (count < customerNum) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } int aa = limitCount - yg; if (aa <= 0) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } model = customerbll.GetModellist(id);//最近一条记录 if (shopsPwd == "") { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "请输入密码!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (basemodel == null || basemodel.shopsPwd != shopsPwd) { //JscriptMsg("消费密码不正确!", "back", "Error"); jsonDict.Add("ret", "fail"); jsonDict.Add("content", "密码错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; //消费 } model.baseid = id; model.status = 2; model.dateUse = DateTime.Now; customerbll.Update(model); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "消费成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } } } else { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "提交失败!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } }
protected void save_groupbase_Click(object sender, EventArgs e) { DateTime begin = DateTime.Parse(activityTimebegin.Text.Trim()); DateTime end = DateTime.Parse(activityTimeend.Text.Trim()); if (begin >= end) { JscriptMsg("开始时间必须小于结束时间", "back", "Error"); return; } if (id != 0) { Model.wx_userweixin weixin = GetWeiXinCode(); int wid = weixin.id; Model.wx_purchase_base purchasebase = new Model.wx_purchase_base(); purchasebase.wid = wid;// purchasebase.Id = id; //团购活动开始内容 purchasebase.activityName = this.activityName.Text.ToString(); purchasebase.activitySummary = this.activitySummary.InnerText.ToString(); purchasebase.activityTimebegin = Convert.ToDateTime(this.activityTimebegin.Text.ToString()); purchasebase.activityTimeend = Convert.ToDateTime(this.activityTimeend.Text.ToString()); purchasebase.email = this.email.Text.ToString(); purchasebase.emailPwd = this.emailPwd.Text.ToString(); purchasebase.smtp = this.smtp.Text.ToString(); purchasebase.shopsPwd = this.shopsPwd.Text.ToString(); purchasebase.activeDescription = this.activeDescription.InnerText.ToString(); purchasebase.specialRemind = this.specialRemind.InnerText.ToString(); if (this.imageUrl.Text != "" && this.imageUrl.Text != this.imgbeginPic.ImageUrl) { purchasebase.imageUrl = this.imageUrl.Text; } else { purchasebase.imageUrl = this.imgbeginPic.ImageUrl; } if (this.imageUrlend.Text != "" && this.imageUrlend.Text != this.imgendPic.ImageUrl) { purchasebase.imageUrlend = this.imageUrlend.Text; } else { purchasebase.imageUrlend = this.imgendPic.ImageUrl; } //团购活动结束内容 purchasebase.activityEndtitle = this.activityEndtitle.Text.ToString(); purchasebase.endExplanation = this.endExplanation.InnerText.ToString(); //商家信息设置 purchasebase.shopstel = this.shopstel.Text.ToString(); purchasebase.address = this.address.Text.ToString(); purchasebase.introduction = this.introduction.InnerText.ToString(); purchasebase.txtLatXPoint = Convert.ToDecimal(this.txtLatXPoint.Text); purchasebase.txtLngYPoint = Convert.ToDecimal(this.txtLngYPoint.Text); //团购设置 purchasebase.goodName = this.goodName.Text.ToString(); purchasebase.costPrice = Convert.ToInt32(this.costPrice.Text.ToString()); purchasebase.limitCount = Convert.ToInt32(this.limitCount.Text.ToString()); purchasebase.groupPrice = Convert.ToDecimal(this.groupPrice.Text.ToString()); purchasebase.totalCount = Convert.ToInt32(this.totalCount.Text.ToString()); purchasebase.groupPerson = Convert.ToInt32(this.groupPerson.Text.ToString()); purchasebase.virtualPerson = Convert.ToInt32(this.virtualPerson.Text.ToString()); purchasebase.copyrightSetup = this.copyrightSetup.InnerText.ToString(); purchasebase.createtime = DateTime.Now; basebll.Update(purchasebase); AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "修改活动设置id为:" + id); //记录日志 JscriptMsg("修改成功!", Utils.CombUrlTxt("group_list.aspx", "keywords={0}", ""), "Success"); } else { Model.wx_userweixin weixin = GetWeiXinCode(); int wid = weixin.id; Model.wx_purchase_base purchasebase = new Model.wx_purchase_base(); purchasebase.wid = wid;// //团购活动开始内容 purchasebase.activityName = this.activityName.Text.ToString(); purchasebase.activitySummary = this.activitySummary.InnerText.ToString(); purchasebase.activityTimebegin = Convert.ToDateTime(this.activityTimebegin.Text.ToString()); purchasebase.activityTimeend = Convert.ToDateTime(this.activityTimeend.Text.ToString()); purchasebase.email = this.email.Text.ToString(); purchasebase.emailPwd = this.emailPwd.Text.ToString(); purchasebase.smtp = this.smtp.Text.ToString(); purchasebase.shopsPwd = this.shopsPwd.Text.ToString(); purchasebase.activeDescription = this.activeDescription.InnerText.ToString(); purchasebase.specialRemind = this.specialRemind.InnerText.ToString(); if (this.imageUrl.Text != "" && this.imageUrl.Text != this.imgbeginPic.ImageUrl) { purchasebase.imageUrl = this.imageUrl.Text; } else { purchasebase.imageUrl = this.imgbeginPic.ImageUrl; } if (this.imageUrlend.Text != "" && this.imageUrlend.Text != this.imgendPic.ImageUrl) { purchasebase.imageUrlend = this.imageUrlend.Text; } else { purchasebase.imageUrlend = this.imgendPic.ImageUrl; } //团购活动结束内容 purchasebase.activityEndtitle = this.activityEndtitle.Text.ToString(); purchasebase.endExplanation = this.endExplanation.InnerText.ToString(); //商家信息设置 purchasebase.shopstel = this.shopstel.Text.ToString(); purchasebase.address = this.address.Text.ToString(); purchasebase.introduction = this.introduction.InnerText.ToString(); purchasebase.txtLatXPoint = Convert.ToDecimal(this.txtLatXPoint.Text.ToString()); purchasebase.txtLngYPoint = Convert.ToDecimal(this.txtLngYPoint.Text.ToString()); //团购设置 purchasebase.goodName = this.goodName.Text.ToString(); purchasebase.costPrice = Convert.ToInt32(this.costPrice.Text.ToString()); purchasebase.limitCount = Convert.ToInt32(this.limitCount.Text.ToString()); purchasebase.groupPrice = Convert.ToDecimal(this.groupPrice.Text.ToString()); purchasebase.totalCount = Convert.ToInt32(this.totalCount.Text.ToString()); purchasebase.groupPerson = Convert.ToInt32(this.groupPerson.Text.ToString()); purchasebase.virtualPerson = Convert.ToInt32(this.virtualPerson.Text.ToString()); purchasebase.copyrightSetup = this.copyrightSetup.InnerText.ToString(); purchasebase.createtime = DateTime.Now; int shopid = basebll.Add(purchasebase); AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "增加活动设置" + shopid); //记录日志 JscriptMsg("添加成功!", Utils.CombUrlTxt("group_list.aspx", "keywords={0}", ""), "Success"); } }
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/json"; string _action = MyCommFun.QueryString("myact"); string shopsPwd = MyCommFun.QueryString("shopsPwd"); string sn = MyCommFun.QueryString("sn"); int id = MyCommFun.RequestInt("baseid"); int baseid = MyCommFun.RequestInt("baseid"); string customerName = MyCommFun.QueryString("customerName"); string tel = MyCommFun.QueryString("tel"); int customerNum = MyCommFun.RequestInt("customerNum"); string address = MyCommFun.QueryString("address"); string Remark = MyCommFun.QueryString("Remark"); BLL.wx_purchase_base basebll = new BLL.wx_purchase_base(); Dictionary<string, string> jsonDict = new Dictionary<string, string>(); BLL.wx_purchase_customer customerbll = new BLL.wx_purchase_customer(); Model.wx_purchase_customer model = new Model.wx_purchase_customer(); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid if (_action == "commit") { basemodel = basebll.GetModel(id); if (basemodel != null) { totalCount = Convert.ToInt32(basemodel.totalCount); limitCount = Convert.ToInt32(basemodel.limitCount); count = totalCount - customerbll.GetRecordAmount(id);//剩余的商品数量 yg = customerbll.GetRecordyg(openid, id); //个人剩余的可购买数量 if (shopsPwd == "" && sn == "") { #region //新增一次消费 if (count < customerNum) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } int aa = limitCount - yg; if (aa <= 0) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } baseid = MyCommFun.RequestInt("baseid"); customerName = MyCommFun.QueryString("customerName"); tel = MyCommFun.QueryString("tel"); customerNum = MyCommFun.RequestInt("customerNum"); address = MyCommFun.QueryString("address"); model.openid = openid; model.baseid = baseid; model.customerName = customerName; model.tel = tel; model.customerNum = customerNum; model.address = address; sn = Utils.Number(18); model.sn = sn; model.status = 0;//未消费 model.craeteTime = DateTime.Now; model.dateJoin = DateTime.Now; model.Remark = Remark; customerbll.Add(model); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "抢购成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } else { #region 确认消费 int oldNum = MyCommFun.RequestInt("oldNum"); //本次的原始消费数量 customerNum -= oldNum; yg -= oldNum; if (count < customerNum) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } int aa = limitCount - yg; if (aa <= 0) { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "超过数量!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } model = customerbll.GetModellist(id);//最近一条记录 if (shopsPwd == "") { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "请输入密码!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; } if (basemodel == null || basemodel.shopsPwd != shopsPwd) { //JscriptMsg("消费密码不正确!", "back", "Error"); jsonDict.Add("ret", "fail"); jsonDict.Add("content", "密码错误!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); return; //消费 } model.baseid = id; model.status = 2; model.dateUse = DateTime.Now; customerbll.Update(model); jsonDict.Add("ret", "ok"); jsonDict.Add("content", "消费成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } } } else { jsonDict.Add("ret", "fail"); jsonDict.Add("content", "提交失败!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } }