Пример #1
0
        /// <summary>
        /// 根据条件获取惠源币的列表
        /// </summary>
        /// <param name="pageIndex">分页索引</param>
        /// <param name="customersysno">客户编号</param>
        /// <param name="type">类型</param>
        /// <param name="beginTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns>惠源币列表</returns>
        /// <remarks>2013-08-21 苟治国 创建</remarks>
        public PagedList <Model.CrExperienceCoinLog> SeachPager(int pageIndex, int customersysno, int type, DateTime beginTime, DateTime endTime)
        {
            var list  = new PagedList <CrExperienceCoinLog>();
            var pager = new Pager <CrExperienceCoinLog>();

            var exp = new ParaCrExperienceCoinLogFilter();

            exp.CustomerSysNo = customersysno;
            exp.BeginDate     = beginTime;
            exp.EndDate       = endTime;
            exp.Type          = type;

            pager.CurrentPage = pageIndex;
            pager.PageSize    = list.PageSize;
            pager             = ICrExperienceCoinLogDao.Instance.SeachPager(pager, exp);
            list = new PagedList <CrExperienceCoinLog>
            {
                Data             = pager.Rows,
                CurrentPageIndex = pager.CurrentPage,
                TotalItemCount   = pager.TotalRows,
                IsLoading        = false,
                Style            = PagedList.StyleEnum.WebSmall
            };

            return(list);
        }
Пример #2
0
        /// <summary>
        /// 根据条件获取惠源币的列表
        /// </summary>
        /// <param name="pager">分页属性</param>
        /// <param name="exp">惠源币查询条件</param>
        /// <returns>惠源币列表</returns>
        /// <remarks>2013-08-21 苟治国 创建</remarks>
        public override Pager <Model.CrExperienceCoinLog> SeachPager(Pager <CrExperienceCoinLog> pager, ParaCrExperienceCoinLogFilter exp)
        {
            #region 测试SQL
            /*增加惠源币*/
            //select * from CrExperienceCoinLog ce where customersysno=1004 and Increased > 0
            /*减少惠源币*/
            //select * from CrExperienceCoinLog ce where customersysno=1004 and Decreased > 0
            #endregion

            #region sql条件
            string sqlWhere = "";
            if (exp.Type == 0)
            {
                sqlWhere = @"(@CustomerSysNo=-1 or ce.CustomerSysNo =@CustomerSysNo) and (@beginTime is null or ce.CreatedDate>=@beginTime) and (@endTime is null or ce.CreatedDate<=@endTime)";
            }
            else if (exp.Type == 10)
            {
                sqlWhere = @"(@CustomerSysNo=-1 or ce.CustomerSysNo =@CustomerSysNo) and (@beginTime is null or ce.CreatedDate>=@beginTime) and (@endTime is null or ce.CreatedDate<=@endTime) and ce.Increased > 0";
            }
            else if (exp.Type == 20)
            {
                sqlWhere = @"(@CustomerSysNo=-1 or ce.CustomerSysNo =@CustomerSysNo) and (@beginTime is null or ce.CreatedDate>=@beginTime) and (@endTime is null or ce.CreatedDate<=@endTime) and ce.Decreased <> 0";
            }
            #endregion

            using (var _context = Context.UseSharedConnection(true))
            {
                pager.Rows = _context.Select <CrExperienceCoinLog>("ce.*")
                             .From("CrExperienceCoinLog ce")
                             .Where(sqlWhere)
                             .Parameter("customersysno", exp.CustomerSysNo)
                             .Parameter("beginTime", exp.BeginDate)
                             .Parameter("endTime", exp.EndDate)
                             .Paging(pager.CurrentPage, pager.PageSize).OrderBy("ce.CreatedDate desc").QueryMany();

                pager.TotalRows = _context.Select <int>("count(1)")
                                  .From("CrExperienceCoinLog ce")
                                  .Where(sqlWhere)
                                  .Parameter("customersysno", exp.CustomerSysNo)
                                  .Parameter("beginTime", exp.BeginDate)
                                  .Parameter("endTime", exp.EndDate)
                                  .QuerySingle();
            }
            return(pager);
        }
Пример #3
0
 /// <summary>
 /// 根据条件获取惠源币的列表
 /// </summary>
 /// <param name="pager">分页属性</param>
 /// <param name="exp">惠源币查询条件</param>
 /// <returns>惠源币列表</returns>
 /// <remarks>2013-08-21 苟治国 创建</remarks>
 public abstract Pager <Model.CrExperienceCoinLog> SeachPager(Pager <CrExperienceCoinLog> pager, ParaCrExperienceCoinLogFilter exp);