예제 #1
0
        public ActionResult GetNormalMaterialList()
        {
            GetMaterialListArgs args = RequestArgs <GetMaterialListArgs>();

            if (args == null)
            {
                return(RespondResult(false, "参数无效。"));
            }

            GetItemListResult <NormalMaterialEntity> result =
                _materialManager.GetNormalMaterialList(UserContext.User.Domain, DomainContext.AppId, args);

            return(RespondDataResult(result));
        }
예제 #2
0
        public GetItemListResult <NormalMaterialEntity> GetNormalMaterialList(Guid domainId, string appId, GetMaterialListArgs args)
        {
            GetItemListResult <NormalMaterialEntity> result = new GetItemListResult <NormalMaterialEntity>();

            List <AttachedWhereItem> attachedWhere = new List <AttachedWhereItem>();

            attachedWhere.Add(new AttachedWhereItem("Domain", domainId));
            attachedWhere.Add(new AttachedWhereItem("AppId", appId));
            attachedWhere.Add(new AttachedWhereItem("Type", EnumHelper.GetEnumMemberValue(args.Type)));

            SqlExpressionPagingArgs pagingArgs = new SqlExpressionPagingArgs();

            pagingArgs.Page     = args.Page;
            pagingArgs.PageSize = args.PageSize;

            result.ItemList  = _dataBase.Select <NormalMaterialEntity>(attachedWhere, pagingArgs);
            result.TotalPage = pagingArgs.TotalPage;
            result.Page      = pagingArgs.Page;

            if (result.ItemList.Count == 0 && result.Page > 1)
            {
                args.Page--;
                return(GetNormalMaterialList(domainId, appId, args));
            }
            else
            {
                return(result);
            }
        }