Fixed: Exchange and Lync plans not listed properly with multiple

hosted organizations.

Plans now listed with hosted organizations they belong to
This commit is contained in:
robvde 2012-09-02 07:34:08 +04:00
parent 82e0b5e59c
commit 5717d66fb2
2 changed files with 26 additions and 16 deletions

View file

@ -2537,7 +2537,10 @@ namespace WebsitePanel.EnterpriseServer
UserInfo user = ObjectUtils.FillObjectFromDataReader<UserInfo>(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId));
ExchangeServerController.GetExchangeMailboxPlansByUser(user, ref mailboxPlans);
if (user.Role == UserRole.User)
ExchangeServerController.GetExchangeMailboxPlansByUser(itemId, user, ref mailboxPlans);
else
ExchangeServerController.GetExchangeMailboxPlansByUser(0, user, ref mailboxPlans);
return mailboxPlans;
}
@ -2551,7 +2554,7 @@ namespace WebsitePanel.EnterpriseServer
}
}
private static void GetExchangeMailboxPlansByUser(UserInfo user, ref List<ExchangeMailboxPlan>mailboxPlans)
private static void GetExchangeMailboxPlansByUser(int itemId, UserInfo user, ref List<ExchangeMailboxPlan>mailboxPlans)
{
if ((user != null))
{
@ -2571,9 +2574,14 @@ namespace WebsitePanel.EnterpriseServer
orgs = GetExchangeOrganizationsInternal(1, false);
}
if ((orgs != null) &(orgs.Count > 0))
int OrgId = -1;
if (itemId > 0) OrgId = itemId;
else if ((orgs != null) & (orgs.Count > 0)) OrgId = orgs[0].Id;
if (OrgId != -1)
{
List<ExchangeMailboxPlan> Plans = ObjectUtils.CreateListFromDataReader<ExchangeMailboxPlan>(DataProvider.GetExchangeMailboxPlans(orgs[0].Id));
List<ExchangeMailboxPlan> Plans = ObjectUtils.CreateListFromDataReader<ExchangeMailboxPlan>(DataProvider.GetExchangeMailboxPlans(OrgId));
foreach (ExchangeMailboxPlan p in Plans)
{
@ -2583,7 +2591,7 @@ namespace WebsitePanel.EnterpriseServer
UserInfo owner = UserController.GetUserInternally(user.OwnerId);
GetExchangeMailboxPlansByUser(owner, ref mailboxPlans);
GetExchangeMailboxPlansByUser(0, owner, ref mailboxPlans);
}
}