Esempio n. 1
0
 public void CouponGetList(string strSql)
 {
     Chain.BLL.CouponList bllcoupon = new Chain.BLL.CouponList();
     int Counts = this.NetPagerParameter.RecordCount;
     strSql = strSql + " and CouPonID=" + this.spCouponID.InnerText;
     DataTable db = bllcoupon.GetListSP(this.NetPagerParameter.PageSize, this.NetPagerParameter.CurrentPageIndex, out Counts, new string[]
     {
         strSql
     }).Tables[0];
     this.NetPagerParameter.RecordCount = Counts;
     this.gvCouponList.DataSource = db;
     this.gvCouponList.DataBind();
     PageBase.BindSerialRepeater(this.gvCouponList, this.NetPagerParameter.PageSize * (this.NetPagerParameter.CurrentPageIndex - 1));
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (this.Session["MemID"] != null)
         {
             int MemID = int.Parse(this.Session["MemID"].ToString());
             Chain.BLL.CouponList bllCoupon = new Chain.BLL.CouponList();
             this.rptCoupon.DataSource = bllCoupon.GetCouponDetailNew(" Coupon.ID=CouponList.CouPonID and CouPonMID= " + MemID);
             this.rptCoupon.DataBind();
         }
         else
         {
             base.Response.Redirect("login.aspx");
         }
     }
 }
Esempio n. 4
0
 protected void Rpt_WeiXinCoupon_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         DataRowView        row            = (DataRowView)e.Item.DataItem;
         string             CouponType     = row["CouponType"].ToString();
         string             CouponStart    = row["CouponStart"].ToString();
         string             CouponEnd      = row["CouponEnd"].ToString();
         string             CouponMinMoney = row["CouponMinMoney"].ToString();
         string             CouponNumber   = row["CouponNumber"].ToString();
         string             ID             = row["ID"].ToString();
         HtmlGenericControl spDesc         = (HtmlGenericControl)e.Item.FindControl("spDesc");
         HtmlGenericControl spTime         = (HtmlGenericControl)e.Item.FindControl("spTime");
         if (CouponType == "0")
         {
             if (CouponStart == "")
             {
                 spTime.InnerText = "永久有效";
                 spTime.Style.Add("color", "Red");
             }
             else
             {
                 spTime.InnerText = DateTime.Parse(CouponStart).ToString("yyyy-MM-dd") + "至" + DateTime.Parse(CouponEnd).ToString("yyyy-MM-dd");
             }
             if (CouponMinMoney == "0")
             {
                 spDesc.InnerText = "优惠¥" + decimal.Parse(CouponNumber).ToString("F2");
             }
             else
             {
                 spDesc.InnerText = "最低消费¥" + decimal.Parse(CouponMinMoney).ToString("F2") + "可优惠¥" + decimal.Parse(CouponNumber).ToString("F2");
             }
         }
         else if (CouponType == "1")
         {
             if (CouponStart == "")
             {
                 spTime.InnerText = "永久有效";
                 spTime.Style.Add("color", "Red");
             }
             else
             {
                 spTime.InnerText = DateTime.Parse(CouponStart).ToString("yyyy-MM-dd") + "至" + DateTime.Parse(CouponEnd).ToString("yyyy-MM-dd");
             }
             spDesc.InnerText = string.Concat(new string[]
             {
                 "最低消费¥",
                 decimal.Parse(CouponMinMoney).ToString("F2"),
                 "可打",
                 CouponNumber,
                 "折"
             });
         }
         Chain.Model.Mem mem = new Chain.BLL.Mem().GetMemByWeiXinCard(this.MemWeiXinCard);
         if (mem != null)
         {
             int           MemID    = mem.MemID;
             StringBuilder strWhere = new StringBuilder();
             strWhere.Append("CouPonID = " + ID);
             strWhere.Append(" and CouPonMID = " + MemID);
             strWhere.Append(" and CouPonSY = 0 ");
             DataTable          dt       = new Chain.BLL.CouponList().GetList(1, strWhere.ToString(), "CID").Tables[0];
             HtmlGenericControl spCouPon = (HtmlGenericControl)e.Item.FindControl("spCouPon");
             if (dt.Rows.Count > 0)
             {
                 spCouPon.InnerHtml = "优惠券号:<span style='color:Red'>" + dt.Rows[0]["CouPon"].ToString() + "</span>";
             }
             else
             {
                 int CouponPredictNu = int.Parse(row["CouponPredictNu"].ToString());
                 int CouponYF        = int.Parse(row["CouponYF"].ToString());
                 if (CouponYF >= CouponPredictNu)
                 {
                     spCouPon.InnerText = "该优惠券已发完";
                     spCouPon.Style.Add("color", "Red");
                 }
                 else
                 {
                     spCouPon.InnerHtml = "<span style='color:Red'>点击申请</span>";
                     HtmlAnchor application = (HtmlAnchor)e.Item.FindControl("application");
                     application.HRef = "WeiXinCoupon.aspx?MemWeiXinCard=" + this.MemWeiXinCard + "&CouPonID=" + ID;
                 }
             }
         }
     }
 }
Esempio n. 5
0
        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
                }));
            }
        }