Commit changes from Robvde

This commit is contained in:
Virtuworks 2012-08-10 07:50:53 -04:00
commit ddf7a699c0
10 changed files with 200 additions and 19 deletions

View file

@ -96,6 +96,12 @@ namespace WebsitePanel.EnterpriseServer
database.ServiceId = item.ServiceId;
database.GroupName = item.GroupName;
StringDictionary settings = ServerController.GetServiceSettings(item.ServiceId);
if (settings["InternalAddress"] != null) database.InternalServerName = settings["InternalAddress"];
if (settings["ExternalAddress"] != null) database.ExternalServerName = settings["ExternalAddress"];
return database;
}

View file

@ -273,6 +273,8 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.Exchange);
if (exchangeServiceId != 0)
{
ServiceProvider exchange = GetServiceProvider(exchangeServiceId, org.ServiceId);
ServiceProviderItemDiskSpace[] itemsDiskspace = exchange.GetServiceItemsDiskSpace(new SoapServiceProviderItem[] { soapOrg });
@ -285,6 +287,7 @@ namespace WebsitePanel.EnterpriseServer
// save organization
UpdateOrganization(org);
}
}
}
catch (Exception ex)

View file

@ -1172,7 +1172,10 @@ namespace WebsitePanel.EnterpriseServer
foreach (OrganizationUser user in Tmpaccounts.ToArray())
{
accounts.Add(GetUserGeneralSettings(itemId, user.AccountId));
OrganizationUser tmpUser = GetUserGeneralSettings(itemId, user.AccountId);
if (tmpUser != null)
accounts.Add(tmpUser);
}
result.PageUsers = accounts.ToArray();
@ -1536,15 +1539,23 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.StartTask("ORGANIZATION", "GET_USER_GENERAL");
TaskManager.ItemId = itemId;
OrganizationUser account = null;
Organization org = null;
try
{
// load organization
Organization org = GetOrganization(itemId);
org = GetOrganization(itemId);
if (org == null)
return null;
// load account
OrganizationUser account = GetAccount(itemId, accountId);
account = GetAccount(itemId, accountId);
}
catch (Exception){}
try
{
// get mailbox settings
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
@ -1566,12 +1577,14 @@ namespace WebsitePanel.EnterpriseServer
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
//throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
return (account);
}
public static int SetUserGeneralSettings(int itemId, int accountId, string displayName,

View file

@ -40,6 +40,8 @@ namespace WebsitePanel.Providers.Database
private int logSize;
private string[] users;
private string location;
private string internalServerName;
private string externalServerName;
public SqlDatabase()
{
@ -92,5 +94,19 @@ namespace WebsitePanel.Providers.Database
get { return this.location; }
set { this.location = value; }
}
public string InternalServerName
{
get { return this.internalServerName; }
set { this.internalServerName = value; }
}
public string ExternalServerName
{
get { return this.externalServerName; }
set { this.externalServerName = value; }
}
}
}

View file

@ -467,6 +467,9 @@ namespace WebsitePanel.Providers.HostedSolution
try
{
runSpace = OpenRunspace();
RemoveDevicesInternal(runSpace, id);
Command cmd = new Command("Disable-Mailbox");
cmd.Parameters.Add("Identity", id);
cmd.Parameters.Add("Confirm", false);
@ -1087,6 +1090,8 @@ namespace WebsitePanel.Providers.HostedSolution
try
{
id = ObjToString(GetPSObjectProperty(obj, "Identity"));
RemoveDevicesInternal(runSpace, id);
RemoveMailbox(runSpace, id);
}
catch (Exception ex)
@ -2063,6 +2068,8 @@ namespace WebsitePanel.Providers.HostedSolution
{
runSpace = OpenRunspace();
RemoveDevicesInternal(runSpace, accountName);
RemoveMailbox(runSpace, accountName);
}
finally
@ -6296,6 +6303,48 @@ namespace WebsitePanel.Providers.HostedSolution
ExchangeLog.LogEnd("CancelRemoteWipeRequestInternal");
}
internal void RemoveDevicesInternal(Runspace runSpace, string accountName)
{
ExchangeLog.LogStart("RemoveDevicesInternal");
ExchangeLog.DebugInfo("Account name: {0}", accountName);
try
{
runSpace = OpenRunspace();
Command cmd = new Command("Get-ActiveSyncDeviceStatistics");
cmd.Parameters.Add("Mailbox", accountName);
Collection<PSObject> result = null;
try
{
result = ExecuteShellCommand(runSpace, cmd);
}
catch (Exception)
{
}
if (result != null)
{
foreach (PSObject obj in result)
{
ExchangeMobileDevice device = GetMobileDeviceObject(obj);
cmd = new Command("Remove-ActiveSyncDevice");
cmd.Parameters.Add("Identity", device.DeviceID);
cmd.Parameters.Add("Confirm", false);
ExecuteShellCommand(runSpace, cmd);
}
}
}
finally
{
}
ExchangeLog.LogEnd("RemoveDevicesInternal");
}
private void RemoveDeviceInternal(string id)
{
ExchangeLog.LogStart("RemoveDeviceInternal");

View file

@ -487,11 +487,14 @@ namespace WebsitePanel.Providers.HostedSolution
string addressbookPolicy = ObjToString(GetPSObjectProperty(result[0], "AddressBookPolicy"));
RemoveDevicesInternal(runSpace, id);
cmd = new Command("Disable-Mailbox");
cmd.Parameters.Add("Identity", id);
cmd.Parameters.Add("Confirm", false);
ExecuteShellCommand(runSpace, cmd);
if (addressbookPolicy == (upn + " AP"))
{
try
@ -552,6 +555,8 @@ namespace WebsitePanel.Providers.HostedSolution
string upn = ObjToString(GetPSObjectProperty(result[0], "UserPrincipalName"));
string addressbookPolicy = ObjToString(GetPSObjectProperty(result[0], "AddressBookPolicy"));
RemoveDevicesInternal(runSpace, accountName);
RemoveMailbox(runSpace, accountName);
if (addressbookPolicy == (upn + " AP"))

View file

@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnCancel.Text" xml:space="preserve">
<value>Cancel</value>
@ -135,4 +135,6 @@
<data name="secUsers.Text" xml:space="preserve">
<value>Users</value>
</data>
<data name="lblDBInternalServer.Text" xml:space="preserve">
</data>
</root>

View file

@ -24,6 +24,14 @@ function confirmation()
<uc2:UsernameControl ID="usernameControl" runat="server" />
</td>
</tr>
<tr>
<td class="SubHead" style="width: 150px;"><asp:Label ID="lblDBInternalServer" runat="server" meta:resourcekey="lblDBInternalServer" Text="Internal Server:"></asp:Label></td>
<td class="Normal"><asp:Literal ID="litDBInternalServer" runat="server"></asp:Literal></td>
</tr>
<tr>
<td class="SubHead" style="width: 150px;"><asp:Label ID="lblDBExternalServer" runat="server" meta:resourcekey="lblDBExternalServer" Text="External Server:"></asp:Label></td>
<td class="Normal"><asp:Literal ID="litDBExternalServer" runat="server"></asp:Literal></td>
</tr>
</table>
<br />

View file

@ -125,6 +125,19 @@ namespace WebsitePanel.Portal
if (item != null)
{
if (!string.IsNullOrEmpty(item.ExternalServerName))
{
lblDBExternalServer.Visible =litDBExternalServer.Visible = true;
litDBExternalServer.Text = item.ExternalServerName;
}
if (!string.IsNullOrEmpty(item.InternalServerName))
{
lblDBInternalServer.Visible = litDBInternalServer.Visible = true;
litDBInternalServer.Text = item.InternalServerName;
}
// save package info
ViewState["PackageId"] = item.PackageId;
usernameControl.SetPackagePolicy(item.PackageId, policyName, "DatabaseNamePolicy");
@ -135,6 +148,9 @@ namespace WebsitePanel.Portal
}
else
{
lblDBExternalServer.Visible = lblDBInternalServer.Visible = false;
litDBExternalServer.Visible = litDBInternalServer.Visible = false;
// new item
ViewState["PackageId"] = PanelSecurity.PackageId;
usernameControl.SetPackagePolicy(PanelSecurity.PackageId, policyName, "DatabaseNamePolicy");

View file

@ -1,7 +1,34 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -40,6 +67,42 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::WebsitePanel.Portal.UsernameControl usernameControl;
/// <summary>
/// lblDBInternalServer 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.Label lblDBInternalServer;
/// <summary>
/// litDBInternalServer 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.Literal litDBInternalServer;
/// <summary>
/// lblDBExternalServer 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.Label lblDBExternalServer;
/// <summary>
/// litDBExternalServer 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.Literal litDBExternalServer;
/// <summary>
/// secUsers control.
/// </summary>