Commit Changes from Robvde

This commit is contained in:
Virtuworks 2012-08-07 11:43:17 -04:00
commit e270bdc1eb
6 changed files with 171 additions and 87 deletions

View file

@ -33,7 +33,7 @@
<tr>
<td class="FormLabel150"><asp:Localize ID="locOrganizationID" runat="server" meta:resourcekey="locOrganizationID" Text="Organization ID: *"></asp:Localize></td>
<td>
<asp:TextBox ID="txtOrganizationID" runat="server" CssClass="TextBox100"
<asp:TextBox ID="txtOrganizationID" runat="server" CssClass="HugeTextBox200"
MaxLength="128"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequiretxtOrganizationID" runat="server" meta:resourcekey="valRequiretxtOrganizationID" ControlToValidate="txtOrganizationID"
ErrorMessage="Enter Organization ID" ValidationGroup="CreateOrganization" Display="Dynamic" Text="*" SetFocusOnError="true"></asp:RequiredFieldValidator>

View file

@ -48,8 +48,16 @@ namespace WebsitePanel.Portal.ExchangeServer
gvOrgs.Columns[2].Visible = gvOrgs.Columns[3].Visible = gvOrgs.Columns[4].Visible = false;
btnCreate.Enabled = false;
}
else
if (gvOrgs.Rows.Count > 0) btnCreate.Enabled = false;
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATIONS))
{
btnCreate.Enabled = !(cntx.Quotas[Quotas.ORGANIZATIONS].QuotaAllocatedValue <= gvOrgs.Rows.Count);
}
//else
//if (gvOrgs.Rows.Count > 0) btnCreate.Enabled = false;
}
@ -103,6 +111,13 @@ namespace WebsitePanel.Portal.ExchangeServer
gvOrgs.DataBind();
orgsQuota.BindQuota();
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATIONS))
{
btnCreate.Enabled = !(cntx.Quotas[Quotas.ORGANIZATIONS].QuotaAllocatedValue <= gvOrgs.Rows.Count);
}
}
catch (Exception ex)
{

View file

@ -276,10 +276,10 @@ namespace WebsitePanel.Portal
break;
case "RestampItem":
RestampMailboxes(mailboxPlanId);
RestampMailboxes(mailboxPlanId, mailboxPlanId);
break;
case "StampUnassigned":
StampUnAssigned(mailboxPlanId);
RestampMailboxes(-1, mailboxPlanId);
break;
}
@ -420,7 +420,7 @@ namespace WebsitePanel.Portal
}
private void RestampMailboxes(int mailboxPlanId)
private void RestampMailboxes(int sourceMailboxPlanId, int destinationMailboxPlanId)
{
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(PanelSecurity.SelectedUserId, true);
@ -444,12 +444,12 @@ namespace WebsitePanel.Portal
{
if (!string.IsNullOrEmpty(org.GlobalAddressList))
{
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(org.Id, mailboxPlanId);
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(org.Id, sourceMailboxPlanId);
foreach (ExchangeAccount a in Accounts)
{
txtStatus.Text = "Completed";
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(org.Id, a.AccountId, mailboxPlanId);
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(org.Id, a.AccountId, destinationMailboxPlanId);
if (result < 0)
{
BindMailboxPlans();
@ -475,61 +475,6 @@ namespace WebsitePanel.Portal
}
private void StampUnAssigned(int mailboxPlanId)
{
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(PanelSecurity.SelectedUserId, true);
try
{
foreach (UserInfo ui in UsersInfo)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(ui.UserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
foreach (PackageInfo Package in Packages)
{
Providers.HostedSolution.Organization[] orgs = null;
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Package.PackageId, false);
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
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(org.Id, a.AccountId, mailboxPlanId);
if (result < 0)
{
BindMailboxPlans();
txtStatus.Text = "Error: " + a.AccountName;
messageBox.ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP");
return;
}
}
}
}
}
}
}
}
messageBox.ShowSuccessMessage("EXCHANGE_STAMPMAILBOXES");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP", ex);
}
BindMailboxPlans();
}
}
}