Ejemplo n.º 1
0
        /// <summary>
        /// 添加对象
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddControl_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles         role    = GvRoles.GetFocusedRow() as tb_Sys_Roles;
            A004_RoleControlEdit frmedit = new A004_RoleControlEdit("AddControl", role.Id);

            if (frmedit.ShowDialog() == DialogResult.OK)
            {
                gridControlControl.DataSource = controlService.GetlistByRolesId(role.Id);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddUser_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles         role    = GvRoles.GetFocusedRow() as tb_Sys_Roles;
            A004_RoleControlEdit frmedit = new A004_RoleControlEdit("AddUser", role.Id);

            if (frmedit.ShowDialog() == DialogResult.OK)
            {
                List <Guid> listUserID = userRoleService.GetByRoleId(role.Id).Select(i => i.UserId).ToList();                 //ServiceHelper.Current.DbSession.Itb_Sys_UserRoleDAL.GetListBy(r => r.RoleID == role.RoleID).Select(r => r.UserID).ToList();
                gridcontrolUser.DataSource = userService.Gettb_Sys_UserList().Where(i => listUserID.Contains(i.Id)).ToList(); //ServiceHelper.Current.DbSession.Itb_Sys_UserDAL.GetListBy(r => listUserID.Contains(r.UserID));
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddMenu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles;

            if (role == null)
            {
                XtraMessageBox.Show("请先选择角色");
                return;
            }
            A004_RoleControlEdit frmedit = new A004_RoleControlEdit("AddMenu", role.Id);

            if (frmedit.ShowDialog() == DialogResult.OK)
            {
                GvRoles_FocusedRowChanged(this.GvRoles, null);
            }
        }
Ejemplo n.º 5
0
        //角色表行改变事件
        void GvRoles_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles;

            if (role != null)
            {
                //查出该权限下所有菜单
                //List<string> listmenuID = ServiceHelper.Current.DbSession.Itb_Sys_RoleModuleDAL.GetListBy(r => r.RoleID == role.RoleID).Select(r => r.ModuleID).ToList();
                treeMenu.DataSource = menuService.GetMenusByRoleId(role.Id); //ServiceHelper.Current.DbSession.Itb_Sys_ModuleDAL.GetListBy(m => listmenuID.Contains(m.ModuleID));

                //List<string> listUserID = ServiceHelper.Current.DbSession.Itb_Sys_UserRoleDAL.GetListBy(r => r.RoleID == role.RoleID).Select(r => r.UserID).ToList();
                gridcontrolUser.DataSource = userService.GetUserByRoleId(role.Id);//ServiceHelper.Current.DbSession.Itb_Sys_UserDAL.GetListBy(r => listUserID.Contains(r.UserID));

                gridControlControl.DataSource = controlService.GetlistByRolesId(role.Id);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 机台设备权限
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDeviceRole_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles;

            if (role == null)
            {
                XtraMessageBox.Show("请先选择角色");
                return;
            }
            ESOPRoleDevice frmedit = new ESOPRoleDevice(role.Id);

            frmedit.Tag = BtnCommandEnum.Edit;
            if (frmedit.ShowDialog() == DialogResult.OK)
            {
                XtraMessageBox.Show("保存成功");
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 添加按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles role   = GvRoles.GetFocusedRow() as tb_Sys_Roles;
            Guid?        menuId = this.treeMenu.FocusedNode.GetValue(treeListColumn1).ToString().ToGuidOrNull();

            if (menuId == null)
            {
                XtraMessageBox.Show("请先选择菜单模块");
                return;
            }
            A004_RoleControlEdit frmedit = new A004_RoleControlEdit("AddAction", role.Id, menuId ?? new Guid());

            if (frmedit.ShowDialog() == DialogResult.OK)
            {
                gridcontrolAction.DataSource = buttonService.GetButtonsByMenu(menuId ?? new Guid(), role.Id);
            }
        }
Ejemplo n.º 8
0
        private void btnDelControl_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles;

            if (gridViewControl.SelectedRowsCount >= 0)
            {
                tb_Sys_Controls control = gridViewControl.GetFocusedRow() as tb_Sys_Controls;
                if (control != null)
                {
                    tb_Sys_RolesControl roleControl = roleControlService.GetByRolesIdAndControlId(role.Id, control.Id);//ServiceHelper.Current.DbSession.Itb_Sys_RoleActionDAL.GetListBy(m => m.RoleID == role.RoleID && m.Mo
                    if (roleControl != null)
                    {
                        roleControlService.Delete(roleControl.Id);
                        this.gridviewAction.DeleteSelectedRows();
                        XtraMessageBox.Show("删除成功");
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelMenu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles;

            if (treeMenu.Focused)
            {
                //tb_Sys_Menu menu = gridviewMenu.GetFocusedRow() as tb_Sys_Menu;
                Guid?menuId = this.treeMenu.FocusedNode.GetValue(treeListColumn1).ToString().ToGuidOrNull();  //获取PermissionID
                if (menuId != null)
                {
                    //tb_Sys_RolesRight roleMenu = menuService// ServiceHelper.Current.DbSession.Itb_Sys_RoleModuleDAL.GetListBy(m => m.RoleID == role.RoleID && m.ModuleID == menu.ModuleID).FirstOrDefault();
                    tb_Sys_RolesRight roleMenu = rolesRightService.GetByMenuIdAndRolesId(role.Id, menuId ?? new Guid());
                    //int count = ServiceHelper.Current.DbSession.Itb_Sys_RoleModuleDAL.Del(roleMenu);
                    if (roleMenu != null)
                    {
                        rolesRightService.Deletetb_Sys_RolesRight(roleMenu.Id);
                        this.treeMenu.DeleteNode(this.treeMenu.FocusedNode);
                        XtraMessageBox.Show("删除成功");
                    }
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 删除按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tb_Sys_Roles role = GvRoles.GetFocusedRow() as tb_Sys_Roles;

            if (gridviewAction.SelectedRowsCount >= 0)
            {
                Guid?menuId = this.treeMenu.FocusedNode.GetValue(treeListColumn1).ToString().ToGuidOrNull();
                if (menuId != null)
                {
                    tb_Sys_Button action = gridviewAction.GetFocusedRow() as tb_Sys_Button;
                    if (action != null)
                    {
                        tb_Sys_RolesBtn roleBtn = rolesBtnService.GetByMenuId(role.Id, menuId ?? new Guid(), action.Id);//ServiceHelper.Current.DbSession.Itb_Sys_RoleActionDAL.GetListBy(m => m.RoleID == role.RoleID && m.MoudelID == module.ModuleID && m.ActionID == action.ActionID).FirstOrDefault();
                        if (roleBtn != null)
                        {
                            rolesBtnService.Deletetb_Sys_RolesBtn(roleBtn.Id);
                            this.gridviewAction.DeleteSelectedRows();
                            XtraMessageBox.Show("删除成功");
                        }
                    }
                }
            }
        }