diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/DatabaseServers/DatabaseServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/DatabaseServers/DatabaseServerController.cs index 57c468b8..26a3fac9 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/DatabaseServers/DatabaseServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/DatabaseServers/DatabaseServerController.cs @@ -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; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs index e49216d7..2f51f9b8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs @@ -273,19 +273,22 @@ namespace WebsitePanel.EnterpriseServer int exchangeServiceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.Exchange); - ServiceProvider exchange = GetServiceProvider(exchangeServiceId, org.ServiceId); - - ServiceProviderItemDiskSpace[] itemsDiskspace = exchange.GetServiceItemsDiskSpace(new SoapServiceProviderItem[] { soapOrg }); + if (exchangeServiceId != 0) + { + ServiceProvider exchange = GetServiceProvider(exchangeServiceId, org.ServiceId); - - if (itemsDiskspace != null && itemsDiskspace.Length > 0) - { - // set disk space - org.DiskSpace = (int)Math.Round(((float)itemsDiskspace[0].DiskSpace / 1024 / 1024)); + ServiceProviderItemDiskSpace[] itemsDiskspace = exchange.GetServiceItemsDiskSpace(new SoapServiceProviderItem[] { soapOrg }); - // save organization - UpdateOrganization(org); - } + + if (itemsDiskspace != null && itemsDiskspace.Length > 0) + { + // set disk space + org.DiskSpace = (int)Math.Round(((float)itemsDiskspace[0].DiskSpace / 1024 / 1024)); + + // save organization + UpdateOrganization(org); + } + } } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs index 973ea39f..a2f80906 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs @@ -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, diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Database/SqlDatabase.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Database/SqlDatabase.cs index 1d7ce043..c71ebb96 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Database/SqlDatabase.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Database/SqlDatabase.cs @@ -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; } + } + + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs index 62f54b5d..e48e2dca 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs @@ -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 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"); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs index ad331d58..65d4dabf 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010SP2.cs @@ -487,10 +487,13 @@ 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")) { @@ -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")) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SqlEditDatabase.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SqlEditDatabase.ascx.resx index b0d59ba5..cdb67610 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SqlEditDatabase.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SqlEditDatabase.ascx.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Cancel @@ -135,4 +135,6 @@ Users + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx index faa3bf95..b84d3e6e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx @@ -24,6 +24,14 @@ function confirmation() + + + + + + + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.cs index 4877e95a..b3831fbc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.cs @@ -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"); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.designer.cs index 58607255..90f68713 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.designer.cs @@ -1,10 +1,37 @@ +// 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. + //------------------------------------------------------------------------------ // // 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. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -40,6 +67,42 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.UsernameControl usernameControl; + /// + /// lblDBInternalServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDBInternalServer; + + /// + /// litDBInternalServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litDBInternalServer; + + /// + /// lblDBExternalServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDBExternalServer; + + /// + /// litDBExternalServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litDBExternalServer; + /// /// secUsers control. ///