Exemplo n.º 1
0
        public ResponseInfoModel Positionlist([FromUri] GetPublicityCategoryListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                string keyword  = input.Keyword ?? "".Trim();
                int    pageSize = _systemConfigurationService.GetPageSize();
                int    limit    = pageSize;
                int    offset   = pageSize * (input.PageIndex - 1);
                int    total;

                var list = _publicityCategoryService.GetPageList(limit, offset, out total,
                                                                 a => (string.IsNullOrEmpty(keyword) || a.PublicityCategoryName.Contains(keyword)) &&
                                                                 (input.PublicityTypesID == 0 || a.PublicityTypesID == input.PublicityTypesID), true,
                                                                 a => a.OrderID).Include(a => a.PublicityType).ToList();
                var outputList = list.MapTo <List <GetPublicityCategoryListOutput> >();
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/positionlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Exemplo n.º 2
0
        public ResponseInfoModel List([FromUri] GetArticleListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                int pageSize           = _systemConfigurationService.GetPageSize();
                int limit              = pageSize;
                int offset             = pageSize * (input.PageIndex - 1);
                int total              = 0;
                var articleCategoryIds = _articleCategoryService.ChildInts(input.ArticleCategorysID);
                var outputList         = _articleService.GetArticleList(limit, offset, out total, input, articleCategoryIds);
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/list", LocalizationConst.QueryFail);
            }
            return(json);
        }
Exemplo n.º 3
0
        public ResponseInfoModel Getinfo([FromUri] GetLogInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                string keyword  = (input.Keyword ?? "").Trim();
                int    pageSize = _systemConfigurationService.GetPageSize();
                int    limit    = pageSize;
                int    offset   = pageSize * (input.pageIndex - 1);
                int    total;
                var    output = _logService.GetPageList(limit, offset, out total, a => (string.IsNullOrEmpty(keyword) || (a.User.UserName.Contains(keyword) || a.ActionContent.Contains(keyword))) && (input.LogUserID == 0 || a.LogUserID == input.LogUserID), false, a => a.LogTime).Include(a => a.User).ToList();

                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = output.MapTo <List <GetLogOutput> >()
                };;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/log/getinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Exemplo n.º 4
0
        public ResponseInfoModel List([FromUri] GetWildlifeManagementListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                int pageSize = _systemConfigurationService.GetPageSize();
                int limit    = pageSize;
                int offset   = pageSize * (input.Pageindex - 1);
                int total;
                var outputList = _wildlifeManagerService.GetList(limit, offset, out total, input.Keywords);
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/wildlifemanager/list", LocalizationConst.QueryFail);
            }
            return(json);
        }
Exemplo n.º 5
0
        public ResponseInfoModel List([FromUri] GetCategoryListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                int pageSize = _systemConfigurationService.GetPageSize();
                int limit    = pageSize;
                int offset   = pageSize * (input.PageIndex - 1);
                int total;
                List <ArticleCategory> categoryList = _articleCategoryService.GetPageList(limit, offset, out total, a => a.ParentID == input.ParentID &&
                                                                                          (string.IsNullOrEmpty((input.Keywords ?? "").Trim()) || a.Name.Contains((input.Keywords ?? "").Trim())), true, a => a.OrderID).ToList();
                var outputList = categoryList.MapTo <List <GetCategoryListOutput> >();
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = outputList
                };;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/list", LocalizationConst.QueryFail);
            }
            return(json);
        }
Exemplo n.º 6
0
        public ResponseInfoModel List([FromUri] GetRouteListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                string keywords = (input.Keywords ?? "").Trim();
                int    pageSize = _systemConfigurationService.GetPageSize();
                int    limit    = pageSize;
                int    offset   = pageSize * (input.PageIndex - 1);
                int    total;
                var    outputList = _routeService.GetPageList(limit, offset, out total,
                                                              a => string.IsNullOrEmpty(keywords) || a.RouteName.Contains(keywords), true,
                                                              a => a.OrderID).MapTo <List <GetRouteListOutput> >();
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/route/list", LocalizationConst.QueryFail);
            }
            return(json);
        }
Exemplo n.º 7
0
        public ResponseInfoModel List([FromUri] GetLeaveMessageListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                int pageSize = _systemConfigurationService.GetPageSize();
                int limit    = pageSize;
                int offset   = pageSize * (input.PageIndex - 1);
                int total;
                var roleList = _leaveMessageService.GetPageList(limit, offset, out total, a => string.IsNullOrEmpty((input.Keyword ?? "").Trim()) || (a.Name.Contains((input.Keyword ?? "").Trim()) || a.Contents.Contains(input.Keyword ?? "".Trim())), false, a => a.LeaveTime).ToList();
                var list     = roleList.MapTo <List <GetLeaveMessageListOuput> >();
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = list
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/advice/list", LocalizationConst.QueryFail);
            }
            return(json);
        }