Commit changes from Robvde
This commit is contained in:
commit
18c68db5d7
1 changed files with 86 additions and 76 deletions
|
@ -419,36 +419,37 @@ namespace WebsitePanel.Portal
|
|||
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
|
||||
}
|
||||
|
||||
|
||||
private void RestampMailboxes(int mailboxPlanId)
|
||||
{
|
||||
txtStatus.Visible = true;
|
||||
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(PanelSecurity.SelectedUserId, true);
|
||||
|
||||
try
|
||||
{
|
||||
Providers.HostedSolution.Organization[] orgs = null;
|
||||
|
||||
if (PanelSecurity.SelectedUserId != 1)
|
||||
foreach (UserInfo ui in UsersInfo)
|
||||
{
|
||||
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
|
||||
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
|
||||
|
||||
if ((Packages != null) & (Packages.GetLength(0) > 0))
|
||||
{
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
foreach (PackageInfo Package in Packages)
|
||||
{
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
|
||||
}
|
||||
Providers.HostedSolution.Organization[] orgs = null;
|
||||
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
|
||||
|
||||
if ((orgs != null) & (orgs.GetLength(0) > 0))
|
||||
{
|
||||
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(0, mailboxPlanId);
|
||||
foreach (Organization org in orgs)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(org.GlobalAddressList))
|
||||
{
|
||||
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(org.Id, mailboxPlanId);
|
||||
|
||||
foreach (ExchangeAccount a in Accounts)
|
||||
{
|
||||
txtStatus.Text = "Completed";
|
||||
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(a.ItemId, a.AccountId, mailboxPlanId);
|
||||
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(org.Id, a.AccountId, mailboxPlanId);
|
||||
if (result < 0)
|
||||
{
|
||||
BindMailboxPlans();
|
||||
|
@ -458,49 +459,53 @@ namespace WebsitePanel.Portal
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_STAMPMAILBOXES");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage("EXCHANGE_STAMPMAILBOXES",ex);
|
||||
messageBox.ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP", ex);
|
||||
}
|
||||
|
||||
BindMailboxPlans();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void StampUnAssigned(int mailboxPlanId)
|
||||
{
|
||||
|
||||
txtStatus.Visible = true;
|
||||
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(PanelSecurity.SelectedUserId, true);
|
||||
|
||||
try
|
||||
{
|
||||
Providers.HostedSolution.Organization[] orgs = null;
|
||||
|
||||
if (PanelSecurity.SelectedUserId != 1)
|
||||
foreach (UserInfo ui in UsersInfo)
|
||||
{
|
||||
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
|
||||
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
|
||||
|
||||
if ((Packages != null) & (Packages.GetLength(0) > 0))
|
||||
{
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
foreach (PackageInfo Package in Packages)
|
||||
{
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
|
||||
}
|
||||
Providers.HostedSolution.Organization[] orgs = null;
|
||||
|
||||
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
|
||||
|
||||
if ((orgs != null) & (orgs.GetLength(0) > 0))
|
||||
{
|
||||
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(PanelRequest.ItemID, -1);
|
||||
foreach (Organization org in orgs)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(org.GlobalAddressList))
|
||||
{
|
||||
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(org.Id, -1);
|
||||
|
||||
foreach (ExchangeAccount a in Accounts)
|
||||
{
|
||||
txtStatus.Text = "Completed";
|
||||
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, a.AccountId, mailboxPlanId);
|
||||
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(org.Id, a.AccountId, mailboxPlanId);
|
||||
if (result < 0)
|
||||
{
|
||||
BindMailboxPlans();
|
||||
|
@ -510,8 +515,12 @@ namespace WebsitePanel.Portal
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_STAMPMAILBOXES");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -520,6 +529,7 @@ namespace WebsitePanel.Portal
|
|||
|
||||
BindMailboxPlans();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue