public AspnetRoleCollection FetchByQuery(Query qry) { AspnetRoleCollection coll = new AspnetRoleCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public AspnetRoleCollection FetchAll() { AspnetRoleCollection coll = new AspnetRoleCollection(); Query qry = new Query(AspnetRole.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public static Public.AspnetRoleCollection GetAspnetRoleCollection(Guid varUserId) { SubSonic.QueryCommand cmd = new SubSonic.QueryCommand("SELECT * FROM [dbo].[aspnet_Roles] INNER JOIN [aspnet_UsersInRoles] ON [aspnet_Roles].[RoleId] = [aspnet_UsersInRoles].[RoleId] WHERE [aspnet_UsersInRoles].[UserId] = @UserId", AspnetUser.Schema.Provider.Name); cmd.AddParameter("@UserId", varUserId, DbType.Guid); IDataReader rdr = SubSonic.DataService.GetReader(cmd); AspnetRoleCollection coll = new AspnetRoleCollection(); coll.LoadAndCloseReader(rdr); return(coll); }
public static void SaveAspnetRoleMap(Guid varUserId, AspnetRoleCollection items) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM [aspnet_UsersInRoles] WHERE [aspnet_UsersInRoles].[UserId] = @UserId", AspnetUser.Schema.Provider.Name); cmdDel.AddParameter("@UserId", varUserId, DbType.Guid); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (AspnetRole item in items) { AspnetUsersInRole varAspnetUsersInRole = new AspnetUsersInRole(); varAspnetUsersInRole.SetColumnValue("UserId", varUserId); varAspnetUsersInRole.SetColumnValue("RoleId", item.GetPrimaryKeyValue()); varAspnetUsersInRole.Save(); } }
public AspnetRoleCollection FetchByID(object RoleId) { AspnetRoleCollection coll = new AspnetRoleCollection().Where("RoleId", RoleId).Load(); return(coll); }