public async Task <IList <ISiteRole> > GetRolesBySite( int siteId, string searchInput, int pageNumber, int pageSize, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); IList <ISiteRole> roles = new List <ISiteRole>(); using (DbDataReader reader = await dbRoles.GetPage( siteId, searchInput, pageNumber, pageSize, cancellationToken)) { while (reader.Read()) { SiteRole role = new SiteRole(); role.LoadFromReader(reader); role.MemberCount = Convert.ToInt32(reader["MemberCount"]); roles.Add(role); } } return(roles); }
public async Task <IList <ISiteRole> > GetRolesBySite( int siteId, string searchInput, int pageNumber, int pageSize) { if (multiTenantOptions.UseRelatedSitesMode) { siteId = multiTenantOptions.RelatedSiteId; } IList <ISiteRole> roles = new List <ISiteRole>(); using (DbDataReader reader = dbRoles.GetPage(siteId, searchInput, pageNumber, pageSize)) { while (reader.Read()) { SiteRole role = new SiteRole(); role.LoadFromReader(reader); role.MemberCount = Convert.ToInt32(reader["MemberCount"]); roles.Add(role); } } return(roles); }
public async Task <ISiteRole> FetchRole(int roleId) { using (DbDataReader reader = dbRoles.GetById(roleId)) { if (reader.Read()) { SiteRole role = new SiteRole(); role.LoadFromReader(reader); return(role); } } return(null); }
//public int GetRoleMemberCount(int roleId) //{ // // TODO: implement actual select count from db // // this is works but is not ideal // int count = 0; // using (DbDataReader reader = dbRoles.GetRoleMembers(roleId)) // { // while (reader.Read()) // { // count += 1; // } // } // return count; //} public async Task <ISiteRole> FetchRole(int roleId, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); using (DbDataReader reader = await dbRoles.GetById(roleId)) { if (reader.Read()) { SiteRole role = new SiteRole(); role.LoadFromReader(reader); return(role); } } return(null); }
public async Task <ISiteRole> FetchRole(int siteId, string roleName) { SiteRole role = null; using (DbDataReader reader = await dbRoles.GetByName(siteId, roleName)) { while (reader.Read()) { role = new SiteRole(); role.LoadFromReader(reader); } } return(role); }
public async Task <ISiteRole> FetchRole(int siteId, string roleName, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); SiteRole role = null; using (DbDataReader reader = await dbRoles.GetByName(siteId, roleName)) { if (reader.Read()) { role = new SiteRole(); role.LoadFromReader(reader); } } return(role); }
public async Task <ISiteRole> FetchRole(int siteId, string roleName) { if (multiTenantOptions.UseRelatedSitesMode) { siteId = multiTenantOptions.RelatedSiteId; } SiteRole role = null; using (DbDataReader reader = dbRoles.GetByName(siteId, roleName)) { if (reader.Read()) { role = new SiteRole(); role.LoadFromReader(reader); } } return(role); }
public IList <ISiteRole> GetRolesUserIsNotIn( int siteId, int userId) { if (multiTenantOptions.UseRelatedSitesMode) { siteId = multiTenantOptions.RelatedSiteId; } IList <ISiteRole> roles = new List <ISiteRole>(); using (DbDataReader reader = dbRoles.GetRolesUserIsNotIn(siteId, userId)) { SiteRole role = new SiteRole(); role.LoadFromReader(reader); roles.Add(role); } return(roles); }
public async Task <IList <ISiteRole> > GetRolesBySite( int siteId, string searchInput, int pageNumber, int pageSize) { IList <ISiteRole> roles = new List <ISiteRole>(); using (DbDataReader reader = await dbRoles.GetPage(siteId, searchInput, pageNumber, pageSize)) { while (reader.Read()) { SiteRole role = new SiteRole(); role.LoadFromReader(reader); role.MemberCount = Convert.ToInt32(reader["MemberCount"]); roles.Add(role); } } return(roles); }