Exemplo n.º 1
0
        public AspnetRoleCollection FetchByQuery(Query qry)
        {
            AspnetRoleCollection coll = new AspnetRoleCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Exemplo n.º 2
0
        public AspnetRoleCollection FetchAll()
        {
            AspnetRoleCollection coll = new AspnetRoleCollection();
            Query qry = new Query(AspnetRole.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
        public AspnetRoleCollection FetchByID(object RoleId)
        {
            AspnetRoleCollection coll = new AspnetRoleCollection().Where("RoleId", RoleId).Load();

            return(coll);
        }