コード例 #1
0
ファイル: SysMenuController.cs プロジェクト: sowill/renshi
        public ActionResult GetAllMetadata(string id)
        {
            SysMenuBLL           m_BLL = new SysMenuBLL();
            IQueryable <SysMenu> rows  = m_BLL.GetAllMetadata(id);

            if (rows.Any())
            {//是否可以省
                return(Json(new treegrid
                {
                    rows = rows.Select(s =>
                                       new
                    {
                        Id = s.Id
                        , Name = s.Name
                        , _parentId = s.ParentId
                        , state = s.SysMenu1.Any(a => a.ParentId == s.Id) ? "closed" : null
                        , Url = s.Url
                        , iconCls = s.Iconic
                        , Sort = s.Sort
                        , Remark = s.Remark
                        , State = s.State
                        , CreatePerson = s.CreatePerson
                        , CreateTime = s.CreateTime
                        , UpdateTime = s.UpdateTime
                        , UpdatePerson = s.UpdatePerson
                    }
                                       ).OrderBy(o => o.Id)
                }));
            }
            return(Content("[]"));
        }
コード例 #2
0
        public ActionResult GetAllMetadata(string id)
        {
            SysMenuBLL        m_BLL      = new SysMenuBLL();
            List <SysMenuSef> collection = m_BLL.GetAllMetadata(id);

            if (collection != null && collection.Count > 0)
            {
                Metadata metadata = new Metadata();
                metadata.rows = collection;
                return(Json(metadata));
            }
            return(Json(""));
        }
コード例 #3
0
        public ActionResult GetAllMetadata2(string id)
        {
            SysMenuBLL m_BLL = new SysMenuBLL();
            var        rows  = m_BLL.GetAllMetadata().ToList().Select(s =>
                                                                      new
            {
                Id = s.Id
                ,
                Name = s.Name
                ,
                _parentId = s.ParentId
                ,
                isCheck = string.Join(",", s.SysOperation.Select(t => t.Id + "^" + t.Name))
                ,
                iconCls = s.Iconic
            }
                                                                      ).OrderBy(o => o.Id);

            return(Json(new treegrid()
            {
                rows = rows
            }));
        }