Beispiel #1
0
        public static ODTO_Page <TTarget> ToODTOPage <TSource, TTarget>(this Tuple <List <TSource>, int> pageData, IDTO_Page pageParam, Func <TSource, TTarget> selector)
        {
            var dataList = pageData.Item1.Select(selector).ToList();

            var result = dataList.ToODTOPage(pageData.Item2, pageParam);

            return(result);
        }
Beispiel #2
0
        public static ODTO_Page <T> ToODTOPage <T>(this Tuple <List <T>, int> pageData, IDTO_Page pageParam)
        {
            var result = pageData.Item1.ToODTOPage(pageData.Item2, pageParam);

            return(result);
        }
Beispiel #3
0
        public static ODTO_Page <TTarget> ToODTOPage <TSource, TTarget>(this Tuple <List <TSource>, int> pageData, IDTO_Page pageParam)
        {
            var mapper   = ServiceContext.Resolve <IMapper>();
            var dataList = pageData.Item1.Select(o => mapper.Map <TTarget>(o)).ToList();

            var result = dataList.ToODTOPage(pageData.Item2, pageParam);

            return(result);
        }
Beispiel #4
0
        public static ODTO_Page <T> ToODTOPage <T>(this List <T> dataList, int rowQty, IDTO_Page pageParam)
        {
            ODTO_Page <T> result = new ODTO_Page <T>();

            result.PageSize     = pageParam.PageSize;
            result.PageIndex    = pageParam.PageIndex;
            result.TotalQty_Row = rowQty;
            result.Data         = dataList;

            result.TotalQty_Page = (result.TotalQty_Row / result.PageSize) + (result.TotalQty_Row % result.PageSize == 0 ? 0 : 1);

            return(result);
        }