Пример #1
0
        //找到指定的按钮信息
        private UserMenuButton LoadMenuButtonById(string id)
        {
            UserMenuButton ret          = null;
            var            userRoleMenu = GetSessionInfo(SessionInfo.USER_MENUS /*用户的权限和菜单等信息*/) as UserRoleMenuInfo;

            if (userRoleMenu != null)
            {
                var isfind = false;
                for (int index = 0; index < userRoleMenu.AllMenu.Count; index++)
                {
                    if (isfind)
                    {
                        break;
                    }
                    else
                    {
                        foreach (var button in userRoleMenu.AllMenu[index].Buttons)
                        {
                            if (button.ID.ToString() == id)
                            {
                                ret    = button;
                                isfind = true;
                                break;
                            }
                        }
                    }
                }
            }
            return(ret);
        }
Пример #2
0
        //更新会话中的按钮
        private void UpdateSessionMenuButton(UserMenuButton m)
        {
            var userRoleMenu = GetSessionInfo(SessionInfo.USER_MENUS /*用户的权限和菜单等信息*/) as UserRoleMenuInfo;

            if (userRoleMenu != null)
            {
                var isfind = false;
                for (int index = 0; index < userRoleMenu.AllMenu.Count; index++)
                {
                    if (isfind)
                    {
                        break;
                    }
                    else
                    {
                        for (int innerindex = 0; innerindex < userRoleMenu.AllMenu[index].Buttons.Count; innerindex++)
                        {
                            if (userRoleMenu.AllMenu[index].Buttons[innerindex].ID == m.ID)
                            {
                                userRoleMenu.AllMenu[index].Buttons[innerindex] = m;
                                isfind = true;
                                break;
                            }
                        }
                    }
                }
                SetSessionInfo(SessionInfo.USER_MENUS /*用户的权限和菜单等信息*/, userRoleMenu);
            }
            else
            {
                throw new Domain.DomainInfoException("没有从会话中找到对应的按钮,请联系管理员");
            }
        }
Пример #3
0
        /// <summary>
        /// 编辑按钮
        /// </summary>
        public void EditButton()
        {
            EHECD_MenuButtonDTO editbutton = JSONHelper.GetModel <EHECD_MenuButtonDTO>(RequestParameters.dataStr);

            CreateSyslogInfo();
            editbutton = DI.DIEntity.GetInstance().GetImpl <IMenuManager>().EditButton(editbutton, RequestParameters.dynamicData);

            if (editbutton != null)
            {
                var ret = new UserMenuButton
                {
                    ID          = editbutton.ID,
                    iOrder      = editbutton.iOrder,
                    sButtonName = editbutton.sButtonName,
                    sDataID     = editbutton.sDataID,
                    sIcon       = editbutton.sIcon
                };
                result.Data /*构建返回的按钮节点数据*/ = new
                {
                    id         = ret.ID,
                    @checked   = true,
                    attributes = new { type = "btn" },
                    text       = ret.sButtonName,
                    iconCls    = ret.sIcon,
                    state      = "closed"
                };
                UpdateSessionMenuButton(ret /*更新用户会话信息中的按钮信息*/);
                result.Succeeded = true;
            }
            else
            {
                result.Succeeded = false;
                result.Msg       = "编辑菜单按钮失败,请联系管理员";
            }
        }
Пример #4
0
        /// <summary>
        /// 获取编辑按钮的页面
        /// </summary>
        public PartialViewResult ToEditButton(string id)
        {
            UserMenuButton btn = LoadMenuButtonById(id);

            return(PartialView("EditButton", btn));
        }