Exemplo n.º 1
0
        ////菜单表行改变事件
        //void gridviewMenu_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        //{
        //    tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles;
        //    tb_Sys_Menu menu = treeMenu.get as tb_Sys_Menu;
        //    if (role != null && menu != null)
        //    {
        //        //查出该权限所在菜单下的所有按钮
        //       // List<string> listactionID =  // ServiceHelper.Current.DbSession.Itb_Sys_RoleActionDAL.GetListBy(r => r.RoleID == role.RoleID && r.MoudelID == module.ModuleID).Select(r => r.ActionID).ToList();
        //        gridcontrolAction.DataSource = buttonService.GetButtonsByMenu(menu.Id, role.Id);

        //    }
        //}
        //2016-03-10更改
        //菜单表行改变事件
        private void treeMenu_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            tb_Sys_Roles role   = GvRoles.GetFocusedRow() as tb_Sys_Roles;
            Guid?        menuId = e.Node.GetValue(treeListColumn1).ToString().ToGuidOrNull(); //获取PermissionID

            if (role != null && menuId != null)
            {
                //查出该权限所在菜单下的所有按钮
                // List<string> listactionID =  // ServiceHelper.Current.DbSession.Itb_Sys_RoleActionDAL.GetListBy(r => r.RoleID == role.RoleID && r.MoudelID == module.ModuleID).Select(r => r.ActionID).ToList();
                gridcontrolAction.DataSource = buttonService.GetButtonsByMenu(menuId ?? new Guid(), role.Id);
            }
        }
Exemplo n.º 2
0
        private void OpenMenu(tb_Sys_Menu menuInfo)
        {
            if (SelecedTabByName(menuInfo.MenuName))
            {
                return;
            }
            //var m = this.MdiChildren.Where(i => i.Text ==menuInfo.MenuName).FirstOrDefault();
            //if (m != null)
            //{
            //    //m.WindowState = FormWindowState.Maximized;
            //    m.Show();
            //    return;
            //}
            if (string.IsNullOrWhiteSpace(menuInfo.NameSpeace))
            {
                return;
            }
            if (menuInfo.MenuName == "权限管理")
            {
                A004_RoleControl frm = new A004_RoleControl();
                frm.MdiParent = this;
                frm.Text      = menuInfo.MenuName;
                frm.Show();
                return;
            }
            Type type = Type.GetType(menuInfo.NameSpeace);

            if (type == null)
            {
                throw new AppException("没有对应的窗体类型,创建失败");
            }
            ListForm     obj       = (ListForm)Activator.CreateInstance(type);
            tb_Sys_Roles rolesData = appCacheService.GetItem("roles") as tb_Sys_Roles;
            //Guid roleId = rolesDataXml.Element("Id").Value.ToGuid();
            var buttonList = buttonService.GetButtonsByMenu(menuInfo.Id, rolesData.Id);

            obj.Text = menuInfo.MenuName;
            obj.Tag  = menuInfo;
            obj.CreateToolBar(buttonList);
            obj.MdiParent = this;
            //obj.WindowState = FormWindowState.Maximized;
            obj.Show();
            //obj.ShowDig(this,menuInfo.MenuName);
        }
Exemplo n.º 3
0
 //绑定数据
 private void BindData()
 {
     if (toolCommand == "AddMenu")
     {
         this.Text = "添加菜单";
         treeListColumn1.FieldName = "Id";
         treeListColumn2.FieldName = "MenuName";
         treeList1.ParentFieldName = "ParentMenuId";
         treeList1.KeyFieldName    = "Id";
         listmenuID = roleRightService.Gettb_Sys_RolesRightList().Where(i => i.Roles_Id == sys_roleid).Select(i => i.Menu_Id).ToList(); //ServiceHelper.Current.DbSession.Itb_Sys_RoleModuleDAL.GetListBy(r => r.RoleID == sys_roleid).Select(r => r.ModuleID).ToList();
         this.treeList1.DataSource = this.menuService.Gettb_Sys_MenuList();                                                             //ServiceHelper.Current.DbSession.Itb_Sys_ModuleDAL.GetListBy(m => m.State != false);
         this.treeList1.ExpandAll();
         foreach (TreeListNode node in treeList1.Nodes)
         {
             Guid moduleId = node.GetValue(treeListColumn1).ToStr().ToGuid(); //获取PermissionID
             if (listmenuID.Contains(moduleId))
             {
                 node.Checked = true;
                 SetTreeListChecks(node);
             }
             else
             {
                 node.Checked = false;
                 SetTreeListChecks(node);
             }
         }
     }
     else if (toolCommand == "AddAction")
     {
         this.Text = "添加按钮";
         treeListColumn1.FieldName = "Id";
         treeListColumn2.FieldName = "Btn_Name";
         listmenuID = buttonService.GetButtonsByMenu(sys_roleid, sys_moduleId).Select(i => i.Id).ToList();
         this.treeList1.DataSource = buttonService.Gettb_Sys_ButtonList(); // ServiceHelper.Current.DbSession.Itb_Sys_ActionDAL.GetListBy(m => m.ActionID != null );
         foreach (TreeListNode node in treeList1.Nodes)
         {
             Guid buttonId = node.GetValue(treeListColumn1).ToStr().ToGuid(); //获取PermissionID
             if (listmenuID.Contains(buttonId))
             {
                 node.Checked = true;
                 SetTreeListChecks(node);
             }
             else
             {
                 node.Checked = false;
                 SetTreeListChecks(node);
             }
         }
     }
     else if (toolCommand == "AddUser")
     {
         this.Text = "添加按钮";
         treeListColumn1.FieldName = "Id";
         treeListColumn2.FieldName = "UserName";
         this.treeList1.DataSource = userService.Gettb_Sys_UserList();//ServiceHelper.Current.DbSession.Itb_Sys_UserDAL.GetListBy(m => m.State != false);
     }
     else if (toolCommand == "AddControl")
     {
         this.Text = "添加Control";
         treeListColumn1.FieldName = "Id";
         treeListColumn2.FieldName = "Windows";
         treeListColumn3.FieldName = "Control";
         treeListColumn4.FieldName = "CValue";
         treeListColumn3.Visible   = true;
         treeListColumn4.Visible   = true;
         this.treeList1.DataSource = controlService.GetList();//ServiceHelper.Current.DbSession.Itb_Sys_UserDAL.GetListBy(m => m.State != false);
     }
 }