Ejemplo n.º 1
0
        private void couponList()
        {
            int pageindex   = this.GetFormValue("page", 1);//
            int pageSize    = this.GetFormValue("pagesize", 20);
            int recordCount = 0;

            CouponSearchWhere where = new CouponSearchWhere();
            where.key       = this.GetFormValue("name", "");
            where.id        = this.GetFormValue("shopid", 0);
            where.useStatus = this.GetFormValue("type", -1);
            where.startTime = this.GetFormValue("txtStartTime", "");
            where.endTime   = this.GetFormValue("txtEndTime", "");


            List <AttendUserModel> result = UserService.Instance.GetCouponList(customerid, pageindex, pageSize, out recordCount, where);
            int pageCount = recordCount / pageSize;

            if (recordCount % pageSize != 0)
            {
                ++pageCount;
            }
            this.Data["PageSize"]  = pageSize;
            this.Data["PageIndex"] = pageindex;
            this.Data["Total"]     = recordCount;
            this.Data["PageCount"] = pageCount;
            this.Data["Rows"]      = result;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取优惠券列表
 /// </summary>
 /// <param name="customerid"></param>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <param name="where"></param>
 /// <returns></returns>
 public List <AttendUserModel> GetCouponList(int customerid, int pageIndex, int pageSize, out int recordCount, CouponSearchWhere where)
 {
     return(dal.GetCouponList(customerid, pageIndex, pageSize, out recordCount, where));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取优惠券列表
        /// </summary>
        /// <param name="customerid"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public List <AttendUserModel> GetCouponList(int customerid, int pageIndex, int pageSize, out int recordCount, CouponSearchWhere where)
        {
            string sql = @"select * from Hot_AttendUser where isAttend=1 and customerid=@customerid";

            if (where != null)
            {
                if (!string.IsNullOrEmpty(where.key))
                {
                    sql += string.Format(" and (couponCode='{0}' or nickName like '%{0}%')", where.key);
                }

                if (where.id > 0)
                {
                    sql += string.Format(" and shopUserId={0} ", where.id);
                }

                if (where.useStatus != -1)
                {
                    sql += string.Format(" and useStatus={0} ", where.useStatus);
                }

                if (!string.IsNullOrEmpty(where.startTime))
                {
                    sql += string.Format(" and CONVERT(nvarchar(10),updateTime,121)>='{0}' ", where.startTime);
                }
                if (!string.IsNullOrEmpty(where.endTime))
                {
                    sql += string.Format(" and CONVERT(nvarchar(10),updateTime,121)<='{0}' ", where.endTime);
                }
            }

            SqlParameter[] parameters =
            {
                new SqlParameter("@customerid", customerid)
            };
            string querySql       = DbHelperSQL.buildPageSql(pageIndex, pageSize, sql, "updateTime", true);
            string recordCountSql = DbHelperSQL.buildRecordCountSql(sql);

            recordCount = Convert.ToInt32(DbHelperSQL.GetSingle(recordCountSql, parameters));
            List <AttendUserModel> lst = new List <AttendUserModel>();

            using (SqlDataReader dr = DbHelperSQL.ExecuteReader(querySql, parameters))
            {
                lst = DbHelperSQL.GetEntityList <AttendUserModel>(dr);
            }
            return(lst);
        }