⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userrole.cs

📁 高校 学籍管理、成绩、收费、网上教学
💻 CS
字号:
//************************************************************
//项目:学生学籍管理系统        
//版权:Copyright(c) ,TZZ               
//模块名:基础数据模块
//说明:UserRole基础类
//版本:1.0
//修改历史:
//	2006-6-7 BY Gawain
//			初始版本
//*****************************************************************
using System;
using System.Collections.Generic;
using System.Text;

using QSEDUNET.COMMAND;
using QSEDUNET.DATALABLE.BaseInfo;
using QSEDUNET.MODEL.BaseInfo;

namespace QSEDUNET.BL.BaseInfo
{
    public class UserRole : SqlDBBaseConnection
    {
        public UserRole()
        { 
            
        }

        /// <summary>
        /// 增加用户角色
        /// </summary>
        /// <param name="userRoleModel">用户角色实体类</param>
        /// <returns></returns>
        public bool CreateRole(UserRoleModel userRoleModel)
        {
            try
            {
                Connection();
                BeginTranse();
                bool groupValue = false;
                UserRoleDB objUserRole = new UserRoleDB(conn, objTranse);
                if (objUserRole.NewUserRole(userRoleModel) < 1)
                    groupValue = true;
                CommitTranse();
                return groupValue;
            }
            catch (Exception ex)
            {
                RollbackTranse();
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
        }

        /// <summary>
        /// 修改角色
        /// </summary>
        /// <param name="userRoleModel">用户角色实体类</param>
        /// <returns></returns>
        public bool UpRole(UserRoleModel userRoleModel)
        {
            try
            {
                Connection();
                BeginTranse();
                bool groupValue = false;
                UserRoleDB objUserRole = new UserRoleDB(conn, objTranse);
                groupValue = objUserRole.UpUserRole(userRoleModel);

                CommitTranse();

                return groupValue;
            }
            catch (Exception ex)
            {
                RollbackTranse();
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
        }

        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="userRoleModel">用户角色实体类</param>
        /// <returns></returns>
        public bool DelRole(UserRoleModel userRoleModel)
        {
            try
            {
                bool reValue = false;
                Connection();
                BeginTranse();
                UserRoleDB objUserRole = new UserRoleDB(conn, objTranse);
                UserGroupRoleDB objGroupRole = new UserGroupRoleDB(conn, objTranse);

                objGroupRole.DelUserGroupRole(userRoleModel.UserRole_ID,"Role");
                reValue = objUserRole.DelUserRole(userRoleModel);
                CommitTranse();
                return reValue;
            }
            catch (Exception ex)
            {
                RollbackTranse();
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -