"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

@ -618,21 +618,23 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.SearchExchangeAccountsByTypes(SecurityContext.User.UserId, itemId,
accountTypes, filterColumn, filterValue, sortColumn));
return tmpAccounts;
List<ExchangeAccount> exAccounts = new List<ExchangeAccount>();
// on large lists is very slow
foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
{
if (tmpAccount.AccountType == ExchangeAccountType.SecurityGroup || tmpAccount.AccountType == ExchangeAccountType.DefaultSecurityGroup
? OrganizationController.GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) == null
: OrganizationController.GetUserGeneralSettings(itemId, tmpAccount.AccountId) == null)
continue;
//List<ExchangeAccount> exAccounts = new List<ExchangeAccount>();
exAccounts.Add(tmpAccount);
}
//foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
//{
// if (tmpAccount.AccountType == ExchangeAccountType.SecurityGroup || tmpAccount.AccountType == ExchangeAccountType.DefaultSecurityGroup
// ? OrganizationController.GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) == null
// : OrganizationController.GetUserGeneralSettings(itemId, tmpAccount.AccountId) == null)
// continue;
return exAccounts;
// exAccounts.Add(tmpAccount);
//}
//return exAccounts;
}
protected static SystemFilesPaged GetEnterpriseFoldersPagedInternal(int itemId, string filterValue, string sortColumn, int startRow, int maximumRows)

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;
}
}
}

View file

@ -300,14 +300,14 @@ namespace WebsitePanel.Portal.ExchangeServer
enterpriseStorageSpaceStats.QuotaUsedValue = stats.UsedEnterpriseStorageSpace;
if (stats.AllocatedEnterpriseStorageSpace != -1) enterpriseStorageSpaceStats.QuotaAvailable = tenantStats.AllocatedEnterpriseStorageSpace - tenantStats.UsedEnterpriseStorageSpace;
lnkBESUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_folders",
lnkEnterpriseStorageSpace.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_folders",
"SpaceID=" + PanelSecurity.PackageId.ToString());
enterpriseStorageFoldersStats.QuotaValue = stats.AllocatedEnterpriseStorageFolders;
enterpriseStorageFoldersStats.QuotaUsedValue = stats.CreatedEnterpriseStorageFolders;
if (stats.AllocatedEnterpriseStorageFolders != -1) enterpriseStorageFoldersStats.QuotaAvailable = tenantStats.AllocatedEnterpriseStorageFolders - tenantStats.CreatedEnterpriseStorageFolders;
lnkBESUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_folders",
lnkEnterpriseStorageFolders.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_folders",
"SpaceID=" + PanelSecurity.PackageId.ToString());
}