/// <summary>
        /// 初始化应用菜单信息
        /// </summary>
        /// <param name="app">应用信息</param>
        /// <param name="menu">菜单信息</param>
        protected virtual void InitMenu(SYSApp app, SYSMenu menu)
        {
            if (!(menu.ID > 0))
            {
                menu.AppID    = app.ID;
                menu.ParentID = 0;
                menu.Path     = ",";
                menu.Layer    = 0;
            }

            menu.MenuCode  = app.AppCode;
            menu.ShortName = menu.MenuName = app.AppName;
            menu.PageRoute = app.AppCode;
            menu.Sequence  = app.Sequence;
            menu.Remarks   = app.Remark;

            if (string.IsNullOrEmpty(menu.DisplayMode))
            {
                menu.DisplayMode = "默认";
            }

            if (!menu.DisplayModeID.HasValue)
            {
                menu.DisplayModeID = 0;
            }

            if (!menu.IsShow.HasValue)
            {
                menu.IsShow = false;
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bo"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        protected virtual bool Save(IRepository <SYSMenu> bo, SYSMenu info)
        {
            if (info.ParentID > 0)
            {
                var pInfo = GetInfo(info.ID.Value);

                if (pInfo != null)
                {
                    info.Path = string.Concat(pInfo.Path, ",", pInfo.ID.ToString(), ",");

                    info.Layer = ++pInfo.Layer;
                }
            }

            return(info.ID > 0 ? _menuBO.Modify(info) : _menuBO.Add(info));
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public virtual long Save(SYSMenu info)
        {
            if (info.ParentID > 0)
            {
                var pInfo = GetInfo(info.ID.Value);

                if (pInfo != null)
                {
                    info.Path = string.Concat(pInfo.Path, ",", pInfo.ID.ToString(), ",");

                    info.Layer = ++pInfo.Layer;
                }
            }

            return((info.ID > 0 ? _menuBO.Modify(info) : _menuBO.Add(info)) ? info.ID.Value : 0);
        }