From 3bee86e791c7d7899ceffcc3a93d3ae55a202c06 Mon Sep 17 00:00:00 2001 From: robvde Date: Thu, 9 Aug 2012 00:35:38 +0400 Subject: [PATCH] Fixed display sql server external and internal name --- .../DatabaseServerController.cs | 6 ++++ .../Database/SqlDatabase.cs | 16 +++++++++ .../SqlEditDatabase.ascx.resx | 12 +++---- .../WebsitePanel/SqlEditDatabase.ascx | 18 +++++----- .../WebsitePanel/SqlEditDatabase.ascx.cs | 34 +++++++++--------- .../SqlEditDatabase.ascx.designer.cs | 36 +++---------------- 6 files changed, 56 insertions(+), 66 deletions(-) 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.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.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SqlEditDatabase.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SqlEditDatabase.ascx.resx index 9e229f86..c16851a8 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 @@ -132,13 +132,13 @@ Database name: - + + Users + + Internal DB Server: External DB Server: - - 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 d8ee347e..1fd2c454 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx @@ -23,17 +23,15 @@ 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 f5ac7748..765f4815 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"); @@ -149,29 +165,11 @@ namespace WebsitePanel.Portal if (!IsPostBack) { // bind item to controls - string myintserveraddress = ""; - string myextserveraddress = ""; if (item != null) { - - string[] mysettings = ES.Services.Servers.GetServiceSettings(item.ServiceId); - foreach (string setting in mysettings) - { - string[] pair = setting.Split('='); - if(String.Equals(pair[0], "ExternalAddress", StringComparison.InvariantCultureIgnoreCase)) - myextserveraddress = pair[1]; - if (String.Equals(pair[0], "InternalAddress", StringComparison.InvariantCultureIgnoreCase)) - myintserveraddress = pair[1]; - - } - // bind item to controls usernameControl.Text = item.Name; usernameControl.EditMode = true; - usernameControl3.Text = myextserveraddress; - usernameControl3.EditMode = true; - usernameControl2.Text = myintserveraddress; - usernameControl2.EditMode = true; foreach (string user in item.Users) { ListItem li = dlUsers.Items.FindByValue(user); 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 228326b9..44e21680 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SqlEditDatabase.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -77,13 +49,13 @@ namespace WebsitePanel.Portal { protected global::System.Web.UI.WebControls.Label lblDBInternalServer; /// - /// usernameControl2 control. + /// litDBInternalServer control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.UsernameControl usernameControl2; + protected global::System.Web.UI.WebControls.Literal litDBInternalServer; /// /// lblDBExternalServer control. @@ -95,13 +67,13 @@ namespace WebsitePanel.Portal { protected global::System.Web.UI.WebControls.Label lblDBExternalServer; /// - /// usernameControl3 control. + /// litDBExternalServer control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.UsernameControl usernameControl3; + protected global::System.Web.UI.WebControls.Literal litDBExternalServer; /// /// secUsers control.