Ejemplo n.º 1
0
        public void Updatetb_Sys_UserRole(tb_Sys_UserRole tb_Sys_UserRole)
        {
            var existstb_Sys_Menu = this.Gettb_Sys_UserRoleById(tb_Sys_UserRole.Id);

            this.tb_Sys_UserRoleRepository.SetValues(tb_Sys_UserRole, existstb_Sys_Menu);
            this.runtimeService.Commit();
        }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 public void Createtb_Sys_UserRole(tb_Sys_UserRole tb_Sys_UserRole)
 {
     this.tb_Sys_UserRoleRepository.Add(tb_Sys_UserRole);
     this.runtimeService.Commit();
 }