예제 #1
0
        public void Create(tb_Sys_RolesControl tb_Sys_RolesControl)
        {
            tb_Sys_RolesControl.CreateDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            tb_Sys_RolesControl.CreateUser = tempUser.UserName;
            tb_Sys_RolesControl.Validate();
            this.tb_Sys_RolesControlRepository.Add(tb_Sys_RolesControl);
            this.runtimeService.Commit();
        }
예제 #2
0
        public void Update(tb_Sys_RolesControl tb_Sys_RolesControl)
        {
            tb_Sys_RolesControl.ModifyDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            tb_Sys_RolesControl.ModifyUser = tempUser.UserName;
            tb_Sys_RolesControl.Validate();
            var existstb_Sys_Menu = this.GetById(tb_Sys_RolesControl.Id);

            this.tb_Sys_RolesControlRepository.SetValues(tb_Sys_RolesControl, existstb_Sys_Menu);
            this.runtimeService.Commit();
        }
예제 #3
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("删除成功");
                    }
                }
            }
        }
예제 #4
0
 //保存
 private void btnSave_Click(object sender, EventArgs e)
 {
     //保存菜单
     if (toolCommand == "AddMenu")
     {
         //roleRightService.DeleteRolesId(sys_roleid);
         foreach (TreeListNode node in treeList1.Nodes)
         {
             Guid menuId = node.GetValue(treeListColumn1).ToString().ToGuid(); //获取PermissionID
             if (node.CheckState == CheckState.Checked && !listmenuID.Contains(menuId))
             {
                 tb_Sys_Menu       module     = menuService.Gettb_Sys_MenuById(menuId);//ServiceHelper.Current.DbSession.Itb_Sys_ModuleDAL.GetListBy(m => m.ModuleID == moduleId).FirstOrDefault();
                 tb_Sys_RolesRight rolesRight = new tb_Sys_RolesRight {
                     Roles_Id = sys_roleid, Menu_Id = module.Id
                 };
                 roleRightService.Createtb_Sys_RolesRight(rolesRight);
             }
             else if (node.CheckState != CheckState.Checked && listmenuID.Contains(menuId))
             {
                 roleRightService.GetByMenuIdAndRolesId(sys_roleid, menuId);
             }
             SaveTreeList(node);
         }
     }
     else if (toolCommand == "AddAction")//保存按钮
     {
         foreach (TreeListNode node in treeList1.Nodes)
         {
             if (node.CheckState == CheckState.Checked)
             {
                 // tb_Sys_Roles role = role//ServiceHelper.Current.DbSession.Itb_Sys_RoleDAL.GetListBy(r => r.RoleID == sys_roleid).FirstOrDefault();
                 Guid            btnId      = node.GetValue(treeListColumn1).ToString().ToGuid(); //获取PermissionID
                 tb_Sys_RolesBtn roleAction = new tb_Sys_RolesBtn {
                     Roles_Id = sys_roleid, Menu_Id = sys_moduleId, Btn_Id = btnId
                 };
                 rolesBtnService.Createtb_Sys_RolesBtn(roleAction);
             }
         }
     }
     else if (toolCommand == "AddUser")
     {
         foreach (TreeListNode node in treeList1.Nodes)
         {
             if (node.CheckState == CheckState.Checked)
             {
                 Guid            userId   = node.GetValue(treeListColumn1).ToString().ToGuid(); //获取PermissionID
                 tb_Sys_UserRole roleuser = new tb_Sys_UserRole {
                     RoleId = sys_roleid, UserId = userId
                 };
                 //int row = ServiceHelper.Current.DbSession.Itb_Sys_UserRoleDAL.Add(roleuser);
                 userRoleService.Createtb_Sys_UserRole(roleuser);
             }
         }
     }
     else if (toolCommand == "AddControl")
     {
         foreach (TreeListNode node in treeList1.Nodes)
         {
             if (node.CheckState == CheckState.Checked)
             {
                 Guid controlID = node.GetValue(treeListColumn1).ToString().ToGuid(); //获取ControlID
                 tb_Sys_RolesControl rolecontrol = new tb_Sys_RolesControl {
                     Roles_Id = sys_roleid, ControlId = controlID
                 };
                 //int row = ServiceHelper.Current.DbSession.Itb_Sys_UserRoleDAL.Add(roleuser);
                 roleControlService.Create(rolecontrol);
             }
         }
     }
     MessageBox.Show("保存成功");
     DialogResult = System.Windows.Forms.DialogResult.OK;
 }