本文整理汇总了C#中System.Web.Profile.ProfileInfoCollection类的典型用法代码示例。如果您正苦于以下问题:C# ProfileInfoCollection类的具体用法?C# ProfileInfoCollection怎么用?C# ProfileInfoCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProfileInfoCollection类属于System.Web.Profile命名空间,在下文中一共展示了ProfileInfoCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
if (profiles == null)
{
throw new ArgumentNullException("profiles");
}
if (profiles.Count < 1)
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ProviderResources.Parameter_collection_empty, new object[] { "profiles" }), "profiles");
}
int num = 0;
using (MembershipContext context = ModelHelper.CreateMembershipContext(this.ConnectionString))
{
foreach (ProfileInfo info in profiles)
{
ProfileEntity entity = QueryHelper.GetProfile(context, this.ApplicationName, info.UserName);
if (entity != null)
{
num++;
context.Profiles.Remove(entity);
}
}
context.SaveChanges();
}
return num;
}
示例2: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
return DeleteProfiles(profiles
.Cast<ProfileInfo>()
.Select(profile => profile.UserName)
.ToArray());
}
示例3: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
foreach (var prof in profiles)
{
NHibernateHelper.Delete(prof);
}
return profiles.Count;
}
示例4: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
string[] usernames = new string[profiles.Count];
int i = 0;
foreach(ProfileInfo profile in profiles)
{
usernames[i++] = profile.UserName;
}
return DeleteProfiles(usernames);
}
示例5: DeleteProfiles
/// <summary>
/// Deletes profile properties and information for the supplied list of profiles.
/// </summary>
/// <param name="profiles">A System.Web.Profile.ProfileInfoCollection of information about profiles that are to be deleted.</param>
/// <returns>The number of profiles deleted from the data source.</returns>
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
int deleteCount = 0;
foreach (ProfileInfo p in profiles)
if (DeleteProfile(p.UserName))
deleteCount++;
return deleteCount;
}
示例6: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
List<string> userNames = new List<string>();
foreach (ProfileInfo profile in profiles)
{
userNames.Add(profile.UserName);
}
return this.DeleteProfiles(userNames.Distinct<string>().ToArray<string>());
}
示例7: CreateEmptyCollection
/// <summary>
/// Erzeugt eine leere Auflistung für Benutzerprofile.
/// </summary>
/// <param name="totalRecords">Meldet die gesamte Anzahl von Einträgen.</param>
/// <returns>Eine neue, leere Auflistung.</returns>
private ProfileInfoCollection CreateEmptyCollection( out int totalRecords )
{
// Create collection
var result = new ProfileInfoCollection();
// None
totalRecords = 0;
// Finish
return result;
}
示例8: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
if (profiles == null) {
throw TraceException("DeleteProfiles", new ArgumentNullException("profiles"));
}
if (profiles.Count == 0) {
return 0;
}
return DeleteProfiles(profiles.Cast<ProfileInfo>().Select(p => p.UserName).ToArray());
}
示例9: FindProfilesByUserName
public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{
ProfileInfoCollection profiles = new ProfileInfoCollection();
User u = Bridge.GetUser(usernameToMatch);
if (u != null)
{
totalRecords = 1;
if(pageIndex == 0 && pageSize > 0)
profiles.Add(CreateProfile(u));
}
totalRecords = 0;
return profiles;
}
示例10: GetAllProfiles
public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
{
ProfileInfoCollection profiles = new ProfileInfoCollection();
UserList users = Bridge.GetUserContainer(false);
if (users != null)
{
totalRecords = users.Children.Count;
foreach(User u in users.GetChildren(new Collections.CountFilter(pageIndex * pageSize, pageSize)))
profiles.Add(CreateProfile(u));
}
totalRecords = 0;
return profiles;
}
示例11: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
var deleteCount = 0;
try {
deleteCount = profiles.Cast<ProfileInfo>().Count(p => DeleteProfile(p.UserName));
} catch (Exception ex) {
if (WriteExceptionsToEventLog) {
WriteToEventLog(ex, "DeleteProfiles(ProfileInfoCollection)");
throw new ProviderException(exceptionMessage);
}
throw;
}
return deleteCount;
}
示例12: DeleteProfiles
/// <summary>
/// When overridden in a derived class, deletes profile properties and information for the supplied list of profiles.
/// </summary>
/// <returns>The number of profiles deleted from the data source.</returns>
/// <param name="profiles">A <see cref="T:System.Web.Profile.ProfileInfoCollection" /> of information about profiles that are to be deleted.</param>
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
if (profiles == null)
{
throw new ArgumentNullException("profiles");
}
if (profiles.Count < 1)
{
throw new ArgumentException("profiles");
}
string[] usernames = profiles.Cast<ProfileInfo>().Select(p => p.UserName).ToArray();
return DeleteProfiles(usernames);
}
示例13: DeleteProfiles
public static int DeleteProfiles(ProfileInfoCollection profiles)
{
if (profiles == null)
{
throw new ArgumentNullException("profiles");
}
if (profiles.Count < 1)
{
throw new ArgumentException(System.Web.SR.GetString("Parameter_collection_empty", new object[] { "profiles" }), "profiles");
}
foreach (ProfileInfo info in profiles)
{
SecUtility.CheckParameter(ref info.UserName, true, true, true, 0, "UserName");
}
return Provider.DeleteProfiles(profiles);
}
示例14: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
Condition.Requires(profiles, "profiles").IsNotNull();
int i;
using (var db = this.ConnectToDatabase())
{
DeleteUserInRoles(db, profiles);
DeleteOAuthMembership(db, profiles);
DeleteMembership(db, profiles);
i =
profiles.Cast<ProfileInfo>()
.Sum(profile => db.Execute(this.sqlQueryBuilder.DeleteProfile, profile.UserName));
}
return i;
}
示例15: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
XElement perfilesXml = new XElement("Perfiles");
foreach (ProfileInfo profileInfo in profiles)
{
perfilesXml.Add(new XElement("Perfil", new XAttribute("Login", profileInfo.UserName)));
}
SqlDatabase sqlDatabase = new SqlDatabase(_connectionString);
DbCommand dbCommand = sqlDatabase.GetStoredProcCommand("adm.NlayerSP_EliminarPerfil");
sqlDatabase.AddInParameter(dbCommand, "Aplicacion", DbType.String, _applicationName);
sqlDatabase.AddInParameter(dbCommand, "Perfiles", DbType.Xml, perfilesXml.ToString());
sqlDatabase.ExecuteNonQuery(dbCommand);
return profiles.Count;
}