protected void CouPonDataBind() { DataTable dt = new Chain.BLL.Coupon().GetList("CouponEnd >= getDate() or CouponStart is null").Tables[0]; if (dt.Rows.Count > 0) { this.Rpt_WeiXinCoupon.DataSource = dt; this.Rpt_WeiXinCoupon.DataBind(); } else { this.noProduct.Style.Add("display", "\"\""); } }
protected void btnCouponExcel_Click(object sender, EventArgs e) { Chain.BLL.CouponList bllcoupon = new Chain.BLL.CouponList(); int Counts = this.NetPagerParameter.RecordCount; string strSql = this.QueryCondition(); strSql = strSql + " and CouPonID=" + this.spCouponID.InnerText; DataTable db = bllcoupon.GetListSP(1000000, 1, out Counts, new string[] { strSql }).Tables[0]; int CouponID = int.Parse(this.spCouponID.InnerText); Chain.BLL.Coupon coupon = new Chain.BLL.Coupon(); Chain.Model.Coupon model = coupon.GetModel(CouponID); DataExcelInfo.Coupon(db, this._UserName, model); }
public string GetCouponTime(object id) { string result = ""; Chain.BLL.Coupon bllcoupon = new Chain.BLL.Coupon(); if (id != null) { Chain.Model.Coupon modelCoupon = bllcoupon.GetModel(int.Parse(id.ToString())); if (modelCoupon.CouponEffective == 1) { result = DateTime.Parse(modelCoupon.CouponStart.ToString()).ToString("yyyy.MM.dd") + "--" + DateTime.Parse(modelCoupon.CouponEnd.ToString()).ToString("yyyy.MM.dd"); } else { result = "永久有效"; } } return(result); }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["MemID"] != null) { int MemID = int.Parse(this.Session["MemID"].ToString()); this.txtMemID.Value = MemID.ToString(); Chain.BLL.Coupon bllCoupon = new Chain.BLL.Coupon(); DataTable dt = bllCoupon.GetList(" IsGet=1 and ID not in(select CouPonID from CouponList where CouPonMID= " + MemID + ")").Tables[0]; this.rptCoupon.DataSource = dt; this.rptCoupon.DataBind(); if (dt.Rows.Count == 0) { this.divMsg.Visible = true; } } else { base.Response.Redirect("login.aspx"); } }
public void BindCouponData() { int Gid = int.Parse(base.Request["Gid"]); this.spCouponID.InnerText = Gid.ToString(); Chain.BLL.Coupon coupon = new Chain.BLL.Coupon(); Chain.Model.Coupon model = coupon.GetModel(Gid); this.txtCouponTitle.Text = model.CouponTitle; this.txtCouponNumber.Text = model.CouponNumber.ToString(); this.txtCouponDayNum.Text = model.CouponDayNum.ToString(); this.txtCouponMinMoney.Text = model.CouponMinMoney.ToString("0.00"); this.txtCouponPredictNu.Text = model.CouponPredictNu.ToString(); this.txtCouponSY.Text = model.CouponSY.ToString(); this.txtCouponYF.Text = model.CouponYF.ToString(); if (model.CouponType > 0) { this.txtCouponType.Text = "折扣券"; this.spNumber.InnerText = "折扣比例:"; } else { this.txtCouponType.Text = "代金券"; this.spNumber.InnerText = "优惠金额:"; } if (model.CouponEffective > 0) { this.lblCouponYX.Visible = true; this.txtCouponStart.Text = Convert.ToDateTime(model.CouponStart).ToShortDateString(); this.txtCouponEnd.Text = Convert.ToDateTime(model.CouponEnd).ToShortDateString(); this.txtCouponEnd.Visible = true; } else { this.txtCouponStart.Text = "永久有效"; } this.CouponGetList(this.QueryCondition()); }
protected void SendCoupon() { int flag = 0; try { string strMemID = new Chain.BLL.Mem().GetMemByWeiXinCard(this.MemWeiXinCard).MemID.ToString(); int intNumber = 1; int intCouponID = int.Parse(base.Request["CouponID"].ToString()); Chain.BLL.Coupon bllCoupon = new Chain.BLL.Coupon(); Chain.Model.Coupon modelCoupon = new Chain.Model.Coupon(); modelCoupon = bllCoupon.GetModel(intCouponID); if (modelCoupon.CouponPredictNu - modelCoupon.CouponYF < intNumber) { flag = 1; } else { Chain.BLL.CouponList bllCouponList = new Chain.BLL.CouponList(); DataRow row = bllCouponList.GetList(intNumber, " CouPonID=" + intCouponID + " and CouPonYF='False' ", " CID ").Tables[0].Rows[0]; string strSql = string.Concat(new string[] { "update CouponList set CouPonYF='True',CouPonMID=", strMemID, ",ConPonSendTime='", DateTime.Now.ToString(), "'" }); object obj = strSql; strSql = string.Concat(new object[] { obj, " where Coupon = '", row["CouPon"], "'" }); if (bllCouponList.DataUpdateTran(new ArrayList { strSql })) { modelCoupon.CouponYF += intNumber; bllCoupon.Update(modelCoupon); } flag = 2; } } catch { flag = -1; } finally { base.Response.Redirect(string.Concat(new object[] { "WeiXinCoupon.aspx?MemWeiXinCard=", this.MemWeiXinCard, "&flag=", flag })); } }