예제 #1
0
        private BlockJsonResponse LoadFromMetablock(TapestryDesignerMetablock parent, int level, string selectedBlockName)
        {
            BlockJsonResponse item = new BlockJsonResponse()
            {
                Name        = parent.Name,
                Value       = "",
                Selected    = false,
                IsMetablock = true,
                Level       = level,
                ChildBlocks = new List <BlockJsonResponse>()
            };

            foreach (TapestryDesignerBlock block in parent.Blocks.OrderBy(b => b.Name))
            {
                item.ChildBlocks.Add(new BlockJsonResponse()
                {
                    Name        = block.Name,
                    Value       = block.Name,
                    Selected    = block.Name == selectedBlockName,
                    IsMetablock = false,
                    Level       = level + 1,
                    ChildBlocks = null
                });
            }
            foreach (TapestryDesignerMetablock mBlock in parent.Metablocks.OrderBy(m => m.Name))
            {
                item.ChildBlocks.Add(LoadFromMetablock(mBlock, level + 1, selectedBlockName));
            }

            return(item);
        }
예제 #2
0
        public ActionResult LoadBlockList(int appId, string selectedBlockName)
        {
            DBEntities e = COREobject.i.Context;
            TapestryDesignerMetablock root = e.TapestryDesignerMetablocks.Where(b => b.ParentAppId == appId && b.ParentMetablock_Id == null).FirstOrDefault();

            BlockJsonResponse blockList = LoadFromMetablock(root, 0, selectedBlockName);

            return(Json(blockList));
        }