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 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)); } }