예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        private SysMenusExt GetMenuChildsEasyuiGridData(SysMenusExt model, List <SysMenusExt> source)
        {
            var childs = source.Where(s => s.PMenuId == model.MenuId);

            if (childs.Count() > 0)
            {
                model.Childs = new List <SysMenusExt>();
                childs.Each(t =>
                {
                    model.Childs.Add(GetMenuChildsEasyuiGridData(t, source));
                });
            }
            return(model);
        }
예제 #2
0
        /// <summary>
        /// 构造菜单下拉树子集数据
        /// </summary>
        /// <param name="menu"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        private EasyuiTree GetMenusChildsEasyuiTreeData(SysMenusExt menu, List <SysMenusExt> source)
        {
            var model = new EasyuiTree {
                id = menu.MenuId.ToString(), text = menu.Title
            };
            var childs = source.Where(s => s.PMenuId == menu.MenuId && s.Status == true);

            if (childs.Count() > 0)
            {
                model.children = new List <EasyuiTree>();
                childs.Each(t =>
                {
                    model.children.Add(GetMenusChildsEasyuiTreeData(t, source));
                });
            }
            return(model);
        }
예제 #3
0
        /// <summary>
        /// 根据菜单Id获得菜单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        internal SysMenusExt GetExtModel(int id)
        {
            SysMenusExt obj = null;

            SqlParameter[] parms =
            {
                new SqlParameter("@id", id)
            };

            string sql  = "select Id,MenuId,PMenuId,SortOrder,Title,URL,Status from SysMenus where [Id]=@id";
            var    objs = DbHelper.DataTableText <SysMenusExt>(sql, parms);

            if (objs != null && objs.Count > 0)
            {
                obj = objs[0];
            }
            return(obj);
        }
예제 #4
0
        /// <summary>
        /// 根据Id获得菜单
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pobjid"></param>
        /// <returns></returns>
        public SysMenusExt GetModel(int id, int pobjid)
        {
            SysMenusExt obj = _dal.GetExtModel(id);

            if (obj == null)
            {
                obj = new SysMenusExt();
            }
            if (pobjid != 0)
            {
                var pobj = _dal.GetByColumn(pobjid, "MenuId");
                if (pobj != null)
                {
                    obj.PMenuId = pobj.MenuId;
                    obj.PTitle  = pobj.Title;
                }
            }
            return(obj);
        }