Esempio n. 1
0
 public List <DicReader> GetPlist(EntityTypeState entityType, Func <SqlFilter> filterCallback, PagingInput paging)
 {
     if (string.IsNullOrEmpty(entityType.TableName))
     {
         throw new GeneralException(entityType.Name + "未配置对应的数据库表");
     }
     return(this.GetPlist(string.Format("[{0}]", entityType.TableName), filterCallback, paging));
 }
Esempio n. 2
0
 public static EntityTypeTr Create(EntityTypeState entityType)
 {
     if (entityType == null)
     {
         return(null);
     }
     return(new EntityTypeTr(entityType.AcDomain)
     {
         Code = entityType.Code,
         Codespace = entityType.Codespace,
         IsCatalogued = entityType.IsCatalogued,
         CreateOn = entityType.CreateOn,
         DatabaseId = entityType.DatabaseId,
         DeveloperId = entityType.DeveloperId,
         Id = entityType.Id,
         Name = entityType.Name,
         SchemaName = entityType.SchemaName,
         SortCode = entityType.SortCode,
         TableName = entityType.TableName,
         ClrTypeFullName = entityType.Map.ClrType.FullName
     });
 }
Esempio n. 3
0
        public static IQueryable <IDsdSet> GetPlistDsdSets(this IAcDomain acDomain, GetPlistResult requestModel)
        {
            EntityTypeState roleEntityType = acDomain.GetEntityType(new Coder("Ac", "DsdSet"));

            foreach (var filter in requestModel.Filters)
            {
                PropertyState property;
                if (!roleEntityType.TryGetProperty(filter.field, out property))
                {
                    throw new ValidationException("意外的DsdSet实体类型属性" + filter.field);
                }
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize  = requestModel.PageSize;
            var queryable = acDomain.DsdSetSet.AsQueryable();

            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            requestModel.Total = queryable.Count();

            return(queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize));
        }
Esempio n. 4
0
        public static IQueryable <PropertyTr> GetPlistProperties(this IAcDomain acDomain, GetPlistProperties requestModel)
        {
            if (!requestModel.EntityTypeId.HasValue)
            {
                throw new ValidationException("entityTypeID是必须的");
            }
            EntityTypeState entityType = acDomain.GetEntityType(new Coder("Ac", "Property"));

            foreach (var filter in requestModel.Filters)
            {
                PropertyState property;
                if (!acDomain.EntityTypeSet.TryGetProperty(entityType, filter.field, out property))
                {
                    throw new ValidationException("意外的Property实体类型属性" + filter.field);
                }
            }
            if (!acDomain.EntityTypeSet.TryGetEntityType(requestModel.EntityTypeId.Value, out entityType))
            {
                throw new GeneralException("意外的实体类型标识" + requestModel.EntityTypeId.Value);
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize  = requestModel.PageSize;
            var queryable = acDomain.EntityTypeSet.GetProperties(entityType).Select(a => PropertyTr.Create(a.Value)).AsQueryable();

            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            if (!string.IsNullOrEmpty(requestModel.Key))
            {
                queryable = queryable.Where(a => a.Code.ToLower().Contains(requestModel.Key) || a.Name.ToLower().Contains(requestModel.Key));
            }
            requestModel.Total = queryable.Count();

            return(queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize));
        }
Esempio n. 5
0
        public static IQueryable <UiViewTr> GetPlistUiViews(this IAcDomain acDomain, GetPlistResult requestData)
        {
            EntityTypeState viewEntityType = acDomain.GetEntityType(new Coder("Ac", "UIView"));

            foreach (var filter in requestData.Filters)
            {
                PropertyState property;
                if (!viewEntityType.TryGetProperty(filter.field, out property))
                {
                    throw new ValidationException("意外的UIView实体类型属性" + filter.field);
                }
            }
            int pageIndex = requestData.PageIndex;
            int pageSize  = requestData.PageSize;
            var queryable = acDomain.UiViewSet.Select(UiViewTr.Create).AsQueryable();

            foreach (var filter in requestData.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            requestData.Total = queryable.Count();

            return(queryable.OrderBy(requestData.SortField + " " + requestData.SortOrder).Skip(pageIndex * pageSize).Take(pageSize));
        }
Esempio n. 6
0
 public UiViewController()
 {
     _functionEntityType = base.GetEntityType(new Coder("Ac", "Function"));
 }
Esempio n. 7
0
 public UiViewController()
 {
     _functionEntityType = base.GetEntityType(new Coder("Ac", "Function"));
 }
Esempio n. 8
0
 public static EntityTypeTr Create(EntityTypeState entityType)
 {
     if (entityType == null)
     {
         return null;
     }
     return new EntityTypeTr(entityType.AcDomain)
     {
         Code = entityType.Code,
         Codespace = entityType.Codespace,
         IsCatalogued = entityType.IsCatalogued,
         CreateOn = entityType.CreateOn,
         DatabaseId = entityType.DatabaseId,
         DeveloperId = entityType.DeveloperId,
         Id = entityType.Id,
         Name = entityType.Name,
         SchemaName = entityType.SchemaName,
         SortCode = entityType.SortCode,
         TableName = entityType.TableName,
         ClrTypeFullName = entityType.Map.ClrType.FullName
     };
 }