partial commit

This commit is contained in:
robvde 2012-12-22 05:01:28 +04:00
parent 57483fbf7f
commit d5f30bf493
7 changed files with 186 additions and 22 deletions

View file

@ -37,6 +37,7 @@ namespace WebsitePanel.Providers.HostedSolution
public string DisplayName{ get; set; }
public DateTime AccountCreated { get; set; }
public string PrimaryEmailAddress { get; set; }
public bool LitigationHoldEnabled { get; set; }
public bool POPEnabled { get; set; }
public bool IMAPEnabled { get; set; }
public bool OWAEnabled { get; set; }
@ -45,6 +46,9 @@ namespace WebsitePanel.Providers.HostedSolution
public int TotalItems { get; set; }
public long TotalSize { get; set; }
public long MaxSize { get; set; }
public long LitigationHoldTotalSize { get; set; }
public long LitigationHoldTotalItems { get; set; }
public long LitigationHoldMaxSize { get; set; }
public DateTime LastLogon { get; set; }
public DateTime LastLogoff { get; set; }
public bool Enabled { get; set; }

View file

@ -2795,7 +2795,7 @@ namespace WebsitePanel.Providers.HostedSolution
return type;
}
private ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id)
virtual internal ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id)
{
ExchangeLog.LogStart("GetMailboxStatisticsInternal");
ExchangeLog.DebugInfo("Account: {0}", id);

View file

@ -160,6 +160,89 @@ namespace WebsitePanel.Providers.HostedSolution
}
internal override ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id)
{
ExchangeLog.LogStart("GetMailboxStatisticsInternal");
ExchangeLog.DebugInfo("Account: {0}", id);
ExchangeMailboxStatistics info = new ExchangeMailboxStatistics();
Runspace runSpace = null;
try
{
runSpace = OpenRunspace();
Collection<PSObject> result = GetMailboxObject(runSpace, id);
PSObject mailbox = result[0];
string dn = GetResultObjectDN(result);
string path = AddADPrefix(dn);
DirectoryEntry entry = GetADObject(path);
info.Enabled = !(bool)entry.InvokeGet("AccountDisabled");
info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName");
SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress");
if (smtpAddress != null)
info.PrimaryEmailAddress = smtpAddress.ToString();
info.MaxSize = ConvertUnlimitedToBytes((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota"));
info.LitigationHoldMaxSize = ConvertUnlimitedToBytes((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota"));
DateTime? whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated");
info.AccountCreated = ConvertNullableToDateTime(whenCreated);
//Client Access
Command cmd = new Command("Get-CASMailbox");
cmd.Parameters.Add("Identity", id);
result = ExecuteShellCommand(runSpace, cmd);
mailbox = result[0];
info.ActiveSyncEnabled = (bool)GetPSObjectProperty(mailbox, "ActiveSyncEnabled");
info.OWAEnabled = (bool)GetPSObjectProperty(mailbox, "OWAEnabled");
info.MAPIEnabled = (bool)GetPSObjectProperty(mailbox, "MAPIEnabled");
info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
info.IMAPEnabled = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");
//Statistics
cmd = new Command("Get-MailboxStatistics");
cmd.Parameters.Add("Identity", id);
result = ExecuteShellCommand(runSpace, cmd);
if (result.Count > 0)
{
PSObject statistics = result[0];
Unlimited<ByteQuantifiedSize> totalItemSize = (Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(statistics, "TotalItemSize");
info.TotalSize = ConvertUnlimitedToBytes(totalItemSize);
uint? itemCount = (uint?)GetPSObjectProperty(statistics, "ItemCount");
info.TotalItems = ConvertNullableToInt32(itemCount);
totalItemSize = (Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(statistics, "FolderAndSubfolderSize");
info.LitigationHoldTotalSize = ConvertUnlimitedToBytes(totalItemSize);
itemCount = (uint?)GetPSObjectProperty(statistics, "ItemsInFolder");
info.LitigationHoldTotalItems = ConvertNullableToInt32(itemCount);
DateTime? lastLogoffTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogoffTime");
DateTime? lastLogonTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogonTime");
info.LastLogoff = ConvertNullableToDateTime(lastLogoffTime);
info.LastLogon = ConvertNullableToDateTime(lastLogonTime);
}
else
{
info.TotalSize = 0;
info.TotalItems = 0;
info.LastLogoff = DateTime.MinValue;
info.LastLogon = DateTime.MinValue;
}
}
finally
{
CloseRunspace(runSpace);
}
ExchangeLog.LogEnd("GetMailboxStatisticsInternal");
return info;
}
internal override void SetMailboxAdvancedSettingsInternal(string organizationId, string accountName, bool enablePOP, bool enableIMAP,
bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB,

View file

@ -159,4 +159,13 @@
<data name="valRequireDisplayName.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="chkEnableLitigationHold.Text" xml:space="preserve">
<value>Enable Litigation Hold</value>
</data>
<data name="locLitigationHoldSpace.Text" xml:space="preserve">
<value>Litigation Hold Space:</value>
</data>
<data name="secLitigationHoldSettings.Text" xml:space="preserve">
<value>Litigation Hold Settings</value>
</data>
</root>

View file

@ -32,9 +32,7 @@
<wsp:MailboxTabs id="tabs" runat="server" SelectedTab="mailbox_settings" />
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<wsp:CollapsiblePanel id="secGeneral" runat="server"
TargetControlID="General" meta:resourcekey="secGeneral" Text="General">
</wsp:CollapsiblePanel>
<wsp:CollapsiblePanel id="secGeneral" runat="server" TargetControlID="General" meta:resourcekey="secGeneral" Text="General"></wsp:CollapsiblePanel>
<asp:Panel ID="General" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
@ -71,14 +69,35 @@
</asp:UpdatePanel>
</asp:Panel>
<wsp:CollapsiblePanel id="secCalendarSettings" runat="server"
TargetControlID="CalendarSettings" meta:resourcekey="secCalendarSettings" Text="General">
</wsp:CollapsiblePanel>
<wsp:CollapsiblePanel id="secLitigationHoldSettings" runat="server" TargetControlID="LitigationHoldSettings" meta:resourcekey="secGeneral" Text="General"></wsp:CollapsiblePanel>
<asp:Panel ID="LitigationHoldSettings" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="LitigationHoldUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<table>
<tr>
<td></td>
<td>
<asp:CheckBox ID="chkEnableLitigationHold" runat="server" meta:resourcekey="chkEnableLitigationHold" Text="Enable Litigation Hold" />
<br />
<br />
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="locLitigationHoldSpace" runat="server" meta:resourcekey="locLitigationHoldSpace" Text="Litigation Hold Space:"></asp:Localize></td>
<td>
<wsp:QuotaViewer ID="litigationHoldSpace" runat="server" QuotaTypeId="2" DisplayGauge="true" /> MB
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<wsp:CollapsiblePanel id="secCalendarSettings" runat="server" TargetControlID="CalendarSettings" meta:resourcekey="secCalendarSettings" Text="General"></wsp:CollapsiblePanel>
<asp:Panel ID="CalendarSettings" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<table>
</table>
</ContentTemplate>
</asp:UpdatePanel>

View file

@ -50,8 +50,9 @@ namespace WebsitePanel.Portal.ExchangeServer
chkHideAddressBook.Visible = false;
chkDisable.Visible = false;
}
}
secLitigationHoldSettings.Visible = (Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, cntx));
}
}
}
@ -99,10 +100,13 @@ namespace WebsitePanel.Portal.ExchangeServer
mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024);
mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1: (int)Math.Round((double)(stats.MaxSize / 1024 / 1024));
if ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room))
secCalendarSettings.Visible = true;
else
secCalendarSettings.Visible = false;
secCalendarSettings.Visible = ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room));
chkEnableLitigationHold.Checked = mailbox.EnableLitigationHold;
litigationHoldSpace.QuotaUsedValue = Convert.ToInt32(stats.LitigationHoldTotalSize / 1024 / 1024);
litigationHoldSpace.QuotaValue = (stats.LitigationHoldMaxSize == -1) ? -1 : (int)Math.Round((double)(stats.LitigationHoldMaxSize / 1024 / 1024));
}

View file

@ -165,6 +165,60 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer mailboxSize;
/// <summary>
/// secLitigationHoldSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secLitigationHoldSettings;
/// <summary>
/// LitigationHoldSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel LitigationHoldSettings;
/// <summary>
/// LitigationHoldUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel LitigationHoldUpdatePanel;
/// <summary>
/// chkEnableLitigationHold control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkEnableLitigationHold;
/// <summary>
/// locLitigationHoldSpace control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locLitigationHoldSpace;
/// <summary>
/// litigationHoldSpace control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer litigationHoldSpace;
/// <summary>
/// secCalendarSettings control.
/// </summary>
@ -218,14 +272,5 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
/// <summary>
/// FormComments control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize FormComments;
}
}