/// <summary> /// 删除角色 /// </summary> /// <param name="roleNum"></param> /// <returns></returns> public int DeleteRole(string roleNum) { SysRoleEntity roleEntity = new SysRoleEntity(); roleEntity.IsDelete = (int)EIsDelete.Deleted; roleEntity.IncludeIsDelete(true); roleEntity.Where(a => a.RoleNum == roleNum); int line = this.SysRole.Update(roleEntity); if (line > 0) { CacheHelper.Remove(CacheKey.JOOSHOW_SYSROLE_CACHE); } return(line); }
/// <summary> /// 修改角色信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int UpdateRole(SysRoleEntity entity) { string key = string.Format(CacheKey.JOOSHOW_SYSROLE_CACHE, this.CompanyID); entity.IncludeRoleName(true).IncludeRemark(true); entity.Where(a => a.SnNum == entity.SnNum) .And(a => a.CompanyID == entity.CompanyID); int line = this.SysRole.Update(entity); if (line > 0) { CacheHelper.Remove(key); } return(line); }
/// <summary> /// 删除角色 /// </summary> /// <param name="SnNum"></param> /// <returns></returns> public int DeleteRole(string SnNum) { string key = string.Format(CacheKey.JOOSHOW_SYSROLE_CACHE, this.CompanyID); SysRoleEntity roleEntity = new SysRoleEntity(); roleEntity.IsDelete = (int)EIsDelete.Deleted; roleEntity.IncludeIsDelete(true); roleEntity.Where(a => a.SnNum == SnNum); int line = this.SysRole.Update(roleEntity); if (line > 0) { CacheHelper.Remove(key); } return(line); }
/// <summary> /// 删除角色信息 /// </summary> /// <param name="list"></param> /// <param name="CompanyID"></param> /// <returns></returns> public int DeleteRole(IEnumerable <string> list) { string key = string.Format(CacheKey.JOOSHOW_SYSROLE_CACHE, this.CompanyID); SysRoleEntity roleEntity = new SysRoleEntity(); roleEntity.IsDelete = (int)EIsDelete.Deleted; roleEntity.IncludeIsDelete(true); roleEntity.Where("SnNum", ECondition.In, list.ToArray()); roleEntity.And(a => a.CompanyID == CompanyID); int line = this.SysRole.Update(roleEntity); if (line > 0) { CacheHelper.Remove(key); } return(line); }
/// <summary> /// 获得所有角色信息 /// </summary> /// <returns></returns> public List <SysRoleEntity> GetList() { List <SysRoleEntity> list = CacheHelper.Get(CacheKey.JOOSHOW_SYSROLE_CACHE) as List <SysRoleEntity>; if (!list.IsNullOrEmpty()) { return(list); } SysRoleEntity sysRole = new SysRoleEntity(); sysRole.IncludeAll(); int isDelete = (int)EIsDelete.NotDelete; sysRole.Where(a => a.IsDelete == isDelete); list = this.SysRole.GetList(sysRole); if (!list.IsNullOrEmpty()) { CacheHelper.Insert(CacheKey.JOOSHOW_SYSROLE_CACHE, list); } return(list); }
/// <summary> /// 获得所有角色信息 /// </summary> /// <returns></returns> public List <SysRoleEntity> GetList() { string key = string.Format(CacheKey.JOOSHOW_SYSROLE_CACHE, this.CompanyID); string AdminRoleNum = ResourceManager.GetSettingEntity("Super_AdminRole").Value; List <SysRoleEntity> list = CacheHelper.Get(key) as List <SysRoleEntity>; if (!list.IsNullOrEmpty()) { return(list.Where(item => item.RoleNum != AdminRoleNum).ToList()); } SysRoleEntity sysRole = new SysRoleEntity(); sysRole.IncludeAll(); sysRole.Where <SysRoleEntity>(a => a.IsDelete == (int)EIsDelete.NotDelete) .And <SysRoleEntity>(a => a.CompanyID == this.CompanyID); sysRole.OrderBy(a => a.ID, EOrderBy.DESC); list = this.SysRole.GetList(sysRole); if (!list.IsNullOrEmpty()) { CacheHelper.Insert(key, list); } return(list.Where(item => item.RoleNum != AdminRoleNum).ToList()); }