コード例 #1
0
        public static EntityListDefinition GetEntityList(EntityCode entityId)
        {
            var entityList = DBService.Query("select * from t_entitylist where entityid=@entityid", new { entityid = entityId.Code });

            if (entityList.Count() > 0)
            {
                var l  = new EntityListDefinition();
                var db = entityList.First();
                l.EntityId      = db.Get("entityid", 0);
                l.Name          = db.Get("name", "");
                l.ItemIdField   = db.Get("idfield", "");
                l.ItemViewField = db.Get("viewfield", "");
                l.PageSize      = db.Get("recordlimit", 0);

                var orderby = db.Get("orderby", "");
                if (!string.IsNullOrEmpty(orderby))
                {
                    l.OrderByField = orderby.Split(',').ToList();
                }

                var additional = db.Get("additional", "");
                if (!string.IsNullOrEmpty(additional))
                {
                    l.AdditionalFields = additional.Split(',').ToList();
                }

                var layoutjson = db.Get("layoutjson", "");
                if (!string.IsNullOrEmpty(layoutjson))
                {
                    var tlist = TList.ParseFromJSON(layoutjson);
                    l.Layout = tlist;
                }

                l.DataSource = new FieldDataSource()
                {
                    Type   = DataSourceType.Entity,
                    Entity = l.EntityId
                };

                var filterpolicy = db.Get("filterpolicy", "");
                if (!string.IsNullOrEmpty(filterpolicy))
                {
                    l.FilterPolicy = FilterExpression.BuildFromJson(l.EntityId, filterpolicy);
                }

                return(l);
            }

            return(null);
        }
コード例 #2
0
ファイル: DBEntity.cs プロジェクト: vipsingh/StackAppCore
        protected EntityListDefinition PrepareEntityListDefin()
        {
            var defn = new EntityListDefinition()
            {
                EntityId      = this.EntityId,
                Name          = "Default",
                ItemIdField   = this.IDField,
                ItemViewField = this.TextField,
                OrderByField  = new List <string>()
                {
                    this.TextField
                },
            };

            defn.DataSource = new FieldDataSource()
            {
                Type   = DataSourceType.Entity,
                Entity = this.EntityId
            };

            return(defn);
        }