Beispiel #1
0
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="t"></param>
        public PagerViewModel <T> GetPageList(TViewModel viewModel, QueryTermViewModel queryTermViewModel, IDbConnection conn = null, IDbTransaction tran = null)
        {
            return(CommonAction <BaseViewModel, PagerViewModel <T> >(viewModel, conn, tran, (o, con, tr) =>
            {
                if (null == queryTermViewModel.SortList || queryTermViewModel.SortList.Count == 0)
                {
                    queryTermViewModel.SortList = new List <ISort>()
                    {
                        new Sort()
                        {
                            Ascending = false, PropertyName = "ID"
                        }
                    };
                }

                var list = con.GetPage <T>(queryTermViewModel.PredGroup, queryTermViewModel.SortList, viewModel.PageIndex - 1, viewModel.PageCount, tr);

                var count = con.Count <T>(queryTermViewModel.PredGroup, tr);

                var pager = new PagerViewModel <T>()
                {
                    TotalCount = count
                };

                if (null != list)
                {
                    pager.ItemList = list.ToList <T>();
                }

                return pager;
            }));
        }
Beispiel #2
0
        /// <summary>
        /// 谓词动态查询条件
        /// </summary>
        /// <param name="predGroup"></param>
        /// <returns></returns>
        public IList <T> GetList(QueryTermViewModel queryTermViewModel, IDbConnection conn = null, IDbTransaction tran = null)
        {
            return(CommonAction <QueryTermViewModel, IList <T> >(queryTermViewModel, conn, tran, (o, con, tr) =>
            {
                if (null == queryTermViewModel.SortList || queryTermViewModel.SortList.Count == 0)
                {
                    queryTermViewModel.SortList = new List <ISort>()
                    {
                        new Sort()
                        {
                            Ascending = true, PropertyName = "ID"
                        }
                    };
                }

                var list = con.GetList <T>(o.PredGroup, o.SortList, tr);

                if (null != list && list.Count() > 0)
                {
                    return list.ToList <T>();
                }

                return null;
            }));
        }
        public override IList <ContractsInfo> GetList(ContractsInfoViewModel viewModel)
        {
            var queryTermViewModel = new QueryTermViewModel()
            {
            };

            var pg = new PredicateGroup {
                Operator = GroupOperator.And, Predicates = new List <IPredicate>()
            };

            return(SingleHepler <ContractsInfoDAL> .Instance.GetList(queryTermViewModel));
        }
Beispiel #4
0
        public override IList <GroupInfo> GetList(BaseViewModel viewModel)
        {
            var queryTermViewModel = new QueryTermViewModel()
            {
            };

            queryTermViewModel.SortList = new List <ISort>()
            {
                new Sort()
                {
                    Ascending = false, PropertyName = "ID"
                }
            };

            return(SingleHepler <GroupInfoDAL> .Instance.GetList(queryTermViewModel));
        }