"List of accounts is loaded too slow" issue fixed

This commit is contained in:
vfedosevich 2014-03-11 02:34:37 +03:00
parent 383319ee01
commit 991806473b
3 changed files with 39 additions and 34 deletions

View file

@ -2843,33 +2843,36 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.SearchExchangeAccountsByTypes(SecurityContext.User.UserId, itemId,
accountTypes, filterColumn, filterValue, sortColumn));
return tmpAccounts;
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
// on large lists is very slow
foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
{
bool bSuccess = false;
//List<ExchangeAccount> accounts = new List<ExchangeAccount>();
switch (tmpAccount.AccountType)
{
case ExchangeAccountType.SecurityGroup:
bSuccess = GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) != null;
break;
case ExchangeAccountType.DistributionList:
bSuccess = ExchangeServerController.GetDistributionListGeneralSettings(itemId, tmpAccount.AccountId) != null;
break;
default:
bSuccess = GetUserGeneralSettings(itemId, tmpAccount.AccountId) != null;
break;
}
//foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
//{
// bool bSuccess = false;
if (bSuccess)
{
accounts.Add(tmpAccount);
}
}
// switch (tmpAccount.AccountType)
// {
// case ExchangeAccountType.SecurityGroup:
// bSuccess = GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) != null;
// break;
// case ExchangeAccountType.DistributionList:
// bSuccess = ExchangeServerController.GetDistributionListGeneralSettings(itemId, tmpAccount.AccountId) != null;
// break;
// default:
// bSuccess = GetUserGeneralSettings(itemId, tmpAccount.AccountId) != null;
// break;
// }
return accounts;
// if (bSuccess)
// {
// accounts.Add(tmpAccount);
// }
//}
//return accounts;
}
}
}