public void IntitData() { tb_Sys_Menu menuInfo = appCacheService.GetItem("ParentMenu") as tb_Sys_Menu; tb_Sys_Roles role = appCacheService.GetItem("roles") as tb_Sys_Roles; //Guid MenuId = gridControl1.DataSource = menuService.GetMenusByRoleId(role.Id).Where(i => i.ParentMenuId == menuInfo.Id).OrderBy(i => i.SeqNo); }
/// <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); } }
/// <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)); } }
public void Createtb_Sys_Roles(tb_Sys_Roles tb_Sys_Roles) { tb_Sys_Roles.Validate(); tb_Sys_Roles.CreateTime = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; tb_Sys_Roles.CreateUser = tempUser.UserName; tb_Sys_Roles.Validate(); this.tb_Sys_RolesRepository.Add(tb_Sys_Roles); this.runtimeService.Commit(); }
////菜单表行改变事件 //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); } }
public void Updatetb_Sys_Roles(tb_Sys_Roles tb_Sys_Roles) { tb_Sys_Roles.ModifyTime = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; tb_Sys_Roles.ModifyUser = tempUser.UserName; tb_Sys_Roles.Validate(); var existstb_Sys_Menu = this.Gettb_Sys_RolesById(tb_Sys_Roles.Id); this.tb_Sys_RolesRepository.SetValues(tb_Sys_Roles, existstb_Sys_Menu); this.runtimeService.Commit(); }
private void OpenForm(string formText, string btnCommand) { tb_Sys_Roles temp = tbSysRolesBindingSource.Current as tb_Sys_Roles; SysRoleEditForm edit = new SysRoleEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { tbSysRolesBindingSource.CancelEdit(); } }
public override void InitData() { treeListDocIndx.ParentFieldName = "PreDocIndexId"; treeListDocIndx.KeyFieldName = "Id"; tb_Sys_Roles tempRole = appCacheService.GetItem("roles") as tb_Sys_Roles; if (tempRole.Roles_Name == "系统管理员") { this.eSOPDocIndexBindingSource.DataSource = docIndexService.GetDocIndex().OrderBy(a => a.SeqNo).ToList(); } else { List <Guid> roleList = docIndexService.GetDocIndexSec().Where(a => a.RoleId == tempRole.Id).Select(a => a.DocIndexId).ToList(); this.eSOPDocIndexBindingSource.DataSource = docIndexService.GetDocIndex().Where(i => roleList.Contains(i.Id)).OrderBy(a => a.SeqNo).ToList(); } }
/// <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); } }
//角色表行改变事件 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); } }
/// <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("保存成功"); } }
/// <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); } }
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); }
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("删除成功"); } } } }
/// <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("删除成功"); } } } }
/// <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("删除成功"); } } } } }
public SysRoleEditForm(tb_Sys_Roles rolesData) { InitializeComponent(); tbSysRolesBindingSource.DataSource = rolesData; }