Beispiel #1
0
        /// <summary>
        /// 移除角色成功
        /// </summary>
        /// <param name="systemCode">系统编号</param>
        /// <param name="organizationId">组织机构主键</param>
        /// <param name="roleId">角色主键</param>
        /// <returns>影响行数</returns>
        public int RemoveFromRole(string systemCode, string organizationId, string roleId)
        {
            var parameters = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>(BaseRoleOrganizationEntity.FieldRoleId, roleId),
                new KeyValuePair <string, object>(BaseRoleOrganizationEntity.FieldOrganizationId, organizationId)
            };
            var tableName = systemCode + "RoleOrganization";
            var manager   = new BaseRoleOrganizationManager(DbHelper, UserInfo, tableName);

            return(manager.Delete(parameters));
        }
Beispiel #2
0
        /// <summary>
        /// 清空组织机构
        /// </summary>
        /// <param name="systemCode">系统编码</param>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public int ClearOrganization(string systemCode, string roleId)
        {
            var result = 0;

            var tableName = systemCode + "RoleOrganization";
            var manager   = new BaseRoleOrganizationManager(DbHelper, UserInfo, tableName);

            result += manager.Delete(new List <KeyValuePair <string, object> > {
                new KeyValuePair <string, object>(BaseRoleOrganizationEntity.FieldRoleId, roleId)
            });

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// 为了提高授权的运行速度
        /// </summary>
        /// <param name="systemCode">系统编号</param>
        /// <param name="organizationId">组织机构主键</param>
        /// <param name="roleId">角色主键</param>
        /// <returns>主键</returns>
        public string AddToRole(string systemCode, string organizationId, string roleId)
        {
            var result = string.Empty;

            var entity = new BaseRoleOrganizationEntity
            {
                OrganizationId = organizationId.ToInt(),
                RoleId         = roleId.ToInt(),
                Enabled        = 1,
                Deleted        = 0
            };
            var tableName = systemCode + "RoleOrganization";
            var manager   = new BaseRoleOrganizationManager(DbHelper, UserInfo, tableName);

            return(manager.Add(entity));
        }