AspnetUsersDTO Partial Class

A partial data object class for the “users” table in the ASP.NET 2.0 provider database. The relevant data transfer objects contain only the serializable data of a data object.

[csharp]
//*****************************************************************************
// This file is part of the data access layer example to the ASP.NET 2.0 provider database
// This file was written by Adam Buenz [WSS MVP] of ARB Security Solutions, LLC
// http://www.sharepointsecurity.com
//
// This file and its parts is free for re-distribution, for use in both free
// and commercial applications, however this header must remain intact for legal
// use. The data access layer example is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//*****************************************************************************
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Aspnet.Provider.Datalayer.Commands
{
///

/// A command factory class for AspnetUsers objects.
///

internal static partial class AspnetUsersCommands
{
///

/// Finds all AspnetUsers objects with a certain Applicationid value.
///

/// The Applicationid value. /// An IDbCommand that finds all AspnetUsers objects with a certain Applicationid value.
public static IDbCommand FindByApplicationid(Guid applicationid)
{
SqlCommand cmd;
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [ApplicationId] = @applicationid”);
cmd.Parameters.AddWithValue(“@applicationid”, applicationid);
return cmd;
}

///

/// Finds all AspnetUsers objects with a certain Username value.
///

/// The Username value (‘*’ can be used as a wildcard). /// An IDbCommand that finds all AspnetUsers objects with a certain Username value.
public static IDbCommand FindByUsername(string username)
{
SqlCommand cmd;
if (username == null)
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [UserName] is null”);
else
{
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [UserName] like @username”);
cmd.Parameters.AddWithValue(“@username”, username.Replace(“*”, “%”));
}
return cmd;
}

///

/// Finds all AspnetUsers objects with a certain Loweredusername value.
///

/// The Loweredusername value (‘*’ can be used as a wildcard). /// An IDbCommand that finds all AspnetUsers objects with a certain Loweredusername value.
public static IDbCommand FindByLoweredusername(string loweredusername)
{
SqlCommand cmd;
if (loweredusername == null)
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [LoweredUserName] is null”);
else
{
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [LoweredUserName] like @loweredusername”);
cmd.Parameters.AddWithValue(“@loweredusername”, loweredusername.Replace(“*”, “%”));
}
return cmd;
}

///

/// Finds all AspnetUsers objects with a certain Mobilealias value.
///

/// The Mobilealias value (‘*’ can be used as a wildcard). /// An IDbCommand that finds all AspnetUsers objects with a certain Mobilealias value.
public static IDbCommand FindByMobilealias(string mobilealias)
{
SqlCommand cmd;
if (mobilealias == null)
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [MobileAlias] is null”);
else
{
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [MobileAlias] like @mobilealias”);
cmd.Parameters.AddWithValue(“@mobilealias”, mobilealias.Replace(“*”, “%”));
}
return cmd;
}

///

/// Finds all AspnetUsers objects with a certain Isanonymous value.
///

/// The Isanonymous value. /// An IDbCommand that finds all AspnetUsers objects with a certain Isanonymous value.
public static IDbCommand FindByIsanonymous(bool isanonymous)
{
SqlCommand cmd;
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [IsAnonymous] = @isanonymous”);
cmd.Parameters.AddWithValue(“@isanonymous”, isanonymous);
return cmd;
}

///

/// Finds all AspnetUsers objects with a certain Lastactivitydate value.
///

/// The Lastactivitydate value. /// An IDbCommand that finds all AspnetUsers objects with a certain Lastactivitydate value.
public static IDbCommand FindByLastactivitydate(DateTime lastactivitydate)
{
SqlCommand cmd;
cmd = new SqlCommand(“select * from [dbo].[aspnet_Users] where [LastActivityDate] = @lastactivitydate”);
cmd.Parameters.AddWithValue(“@lastactivitydate”, lastactivitydate);
return cmd;
}

}
}

[/csharp]

Share

Leave a Reply

Your email address will not be published. Required fields are marked *