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 Chain.Model.CouponList GetModel(string CouPon) { Chain.Model.CouponList clist = this.dal.GetModel(CouPon); Coupon coupon = new Coupon(); Chain.Model.Coupon model = coupon.GetModel(Convert.ToInt32(clist.CouPonID)); clist.CouponMinMoney = model.CouponMinMoney; clist.CouponNumber = model.CouponNumber; clist.CouponStart = model.CouponStart; clist.CouponEnd = model.CouponEnd; clist.CouponDayNum = model.CouponDayNum; clist.CouponType = model.CouponType; clist.CouponEffective = model.CouponEffective; return(clist); }
public List <Chain.Model.Coupon> DataTableToList(DataTable dt) { List <Chain.Model.Coupon> modelList = new List <Chain.Model.Coupon>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.Coupon model = this.dal.DataRowToModel(dt.Rows[i]); if (model != null) { modelList.Add(model); } } } return(modelList); }
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); }
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 })); } }
public bool Update(Chain.Model.Coupon model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.Coupon model) { return(this.dal.Add(model)); }