}//public void Server_Index_Changed(Object sender, EventArgs e) /// <summary>ServerSelected()</summary> public void ServerSelected() { bool system = false; bool user = false; string[] database = null; string exceptionMessage = null; string[] selectedServer = null; string sqlServerLoginUserName = null; string sqlServerPassword = null; try { UtilityWebControl.SelectedItem ( ListBoxServer, ref selectedServer ); if ( selectedServer == null || selectedServer.Length != 1 ) { return; } ViewState["SQLServerManagementObjectsSMOPage_ServerSelectedFirst"] = selectedServer[0]; sqlServerLoginUserName = SQLServerLoginUserName; sqlServerPassword = SQLServerPassword; system = CheckBoxSystem.Checked; user = CheckBoxUser.Checked; UtilitySQLServerManagementObjectsSMO.DatabaseList ( ref selectedServer[0], ref exceptionMessage, ref database, ref sqlServerLoginUserName, ref sqlServerPassword, ref system, ref user ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) if ( database == null || database.Length < 1 ) { return; }//if ( database == null || database.Length < 1 ) ListBoxDatabase.DataSource = database; ListBoxDatabase.DataBind(); }//try catch ( System.Exception exception ) { exceptionMessage = "System.Exception: " + exception.Message; }//catch ( System.Exception exception ) if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) }//public void ServerSelected(Object sender, EventArgs e)
}//public void ButtonReset_Click() /// <summary>WhoIsLookup</summary> public void WhoIsLookup() { string exceptionMessage = null; string[] registry = null; StringBuilder[][] sbWhoIs = null; StringBuilder sbJoin = null; UtilityWhoIsPort43Argument utilityWhoIsPort43Argument = null; try { UtilityWebControl.SelectedItem(ListBoxRegistry, ref registry); utilityWhoIsPort43Argument = new UtilityWhoIsPort43Argument ( RegistryDomainSuffixOnly, PortWhoIs, new string[] { DomainName }, registry ); UtilityWhoIsPort43.WhoisLookup ( ref utilityWhoIsPort43Argument, ref sbWhoIs, ref exceptionMessage ); if (exceptionMessage != null) { Feedback = exceptionMessage; return; } sbJoin = new StringBuilder(); for (int indexDimension1 = 0; indexDimension1 < sbWhoIs.Length; ++indexDimension1) { for (int indexDimension2 = 0; indexDimension2 < sbWhoIs[indexDimension1].Length; ++indexDimension2) { sbJoin.Append(sbWhoIs[indexDimension1][indexDimension2]); } //for ( int indexDimension2 = 0; indexDimension2 < sb[indexDimension1].Length; ++indexDimension2 ) } //for ( int indexDimension1 = 0; indexDimension1 < sb.Length; ++indexDimension1 ) } //try catch (Exception exception) { exceptionMessage = exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; } Feedback = sbJoin.ToString(); }//public void WhoIsLookup
}//Page_Load /// <summary>DropDownListTableName_PreRender</summary> public void DropDownListTableName_PreRender ( object sender, EventArgs e ) { if ( !Page.IsPostBack ) { if ( DropDownListTableName.Items.Count < 1 ) { DropDownListTableName.DataSourceID = null; DropDownListTableName.DataTextField = null; DropDownListTableName.DataValueField = null; DropDownListTableName.DataSource = TableNameURI; DropDownListTableName.DataBind(); }//if ( DropDownListTableName.Items.Count < 1 ) UtilityWebControl.SelectItem ( DropDownListTableName, TableNameURIDefault ); }//if ( !Page.IsPostBack ) }//public void DropDownListTableName_PreRender()
}//public void Database_Index_Changed(Object sender, EventArgs e) /// <summary>DatabaseSelected()</summary> public void DatabaseSelected() { bool system = false; bool user = false; string serverSelectedFirst = null; string exceptionMessage = null; string[] defaultName = null; string[] rule = null; string[] selectedDatabase = null; string sqlServerLoginUserName = null; string sqlServerPassword = null; string[] storedProcedure = null; string[] table = null; string[] trigger = null; string[] userDefinedDataType = null; string[] userDefinedFunction = null; string[] view = null; try { serverSelectedFirst = (string) ViewState["SQLServerManagementObjectsSMOPage_ServerSelectedFirst"]; if ( string.IsNullOrEmpty( serverSelectedFirst ) ) { return; } UtilityWebControl.SelectedItem ( ListBoxDatabase, ref selectedDatabase ); if ( selectedDatabase == null || selectedDatabase.Length != 1 ) { return; } sqlServerLoginUserName = SQLServerLoginUserName; sqlServerPassword = SQLServerPassword; system = CheckBoxSystem.Checked; user = CheckBoxUser.Checked; UtilitySQLServerManagementObjectsSMO.DatabaseResource ( ref serverSelectedFirst, ref selectedDatabase[0], ref exceptionMessage, ref sqlServerLoginUserName, ref sqlServerPassword, ref system, ref user, ref defaultName, ref rule, ref storedProcedure, ref table, ref trigger, ref userDefinedDataType, ref userDefinedFunction, ref view ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) ListBoxDefault.DataSource = defaultName; ListBoxDefault.DataBind(); ListBoxRule.DataSource = rule; ListBoxRule.DataBind(); ListBoxStoredProcedure.DataSource = storedProcedure; ListBoxStoredProcedure.DataBind(); ListBoxTable.DataSource = table; ListBoxTable.DataBind(); ListBoxTrigger.DataSource = trigger; ListBoxTrigger.DataBind(); ListBoxUserDefinedDataType.DataSource = userDefinedDataType; ListBoxUserDefinedDataType.DataBind(); ListBoxUserDefinedFunction.DataSource = userDefinedFunction; ListBoxUserDefinedFunction.DataBind(); ListBoxView.DataSource = view; ListBoxView.DataBind(); } catch ( System.Exception exception ) { exceptionMessage = "System.Exception: " + exception.Message; } if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; } }//public void DatabaseSelected()
}//public String public String Feedback /// <summary>ButtonSubmit_Click().</summary> public void ButtonSubmit_Click ( Object sender, EventArgs e ) { string[] defaultName = null; string[] database = null; String exceptionMessage = null; string[] rule = null; string[] server = null; string[] storedProcedure = null; string[] table = null; string[] trigger = null; string[] userDefinedDataType = null; string[] userDefinedFunction = null; string[] view = null; UtilitySQLServerManagementObjectsSMOArgument UtilitySQLServerManagementObjectsSMOArgument = null; /* if( sender == ButtonSubmit ) { Response.Write ( "ButtonSubmit" ); Feedback = "ButtonSubmit"; } */ try { UtilityWebControl.SelectedItem ( ListBoxServer, ref server ); UtilityWebControl.SelectedItem ( ListBoxDatabase, ref database ); UtilityWebControl.SelectedItem ( ListBoxDefault, ref defaultName ); UtilityWebControl.SelectedItem ( ListBoxRule, ref rule ); UtilityWebControl.SelectedItem ( ListBoxStoredProcedure, ref storedProcedure ); UtilityWebControl.SelectedItem ( ListBoxTable, ref table ); UtilityWebControl.SelectedItem ( ListBoxTrigger, ref trigger ); UtilityWebControl.SelectedItem ( ListBoxUserDefinedDataType, ref userDefinedDataType ); UtilityWebControl.SelectedItem ( ListBoxUserDefinedFunction, ref userDefinedFunction ); UtilityWebControl.SelectedItem ( ListBoxView, ref view ); UtilitySQLServerManagementObjectsSMOArgument = new UtilitySQLServerManagementObjectsSMOArgument ( CheckBoxBackup.Checked, database, defaultName, BackupDirectory, MaintenanceDirectory, ScriptDirectory, CheckBoxMaintenance.Checked, rule, CheckBoxScript.Checked, server, SQLServerLoginUserName, SQLServerPassword, storedProcedure, CheckBoxSystem.Checked, table, trigger, CheckBoxUser.Checked, userDefinedDataType, userDefinedFunction, view ); UtilitySQLServerManagementObjectsSMO.UtilitySMO ( ref UtilitySQLServerManagementObjectsSMOArgument, ref exceptionMessage ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) }//try catch ( System.Exception exception ) { exceptionMessage = exception.Message; } Feedback = exceptionMessage; }//public void ButtonSubmit_Click()
/// <summary>Page Load.</summary> public void Page_Load ( object sender, EventArgs e ) { String exceptionMessage = null; try { Server.ScriptTimeout = 60 * 60 * 12; //12 hours ServerMachineName = Server.MachineName; ServerMapPath = this.MapPath(""); /* FilenameConfigurationXml = Server.MapPath( FilenameConfigurationXml ); */ if ( ServerMapPath != null) { FilenameConfigurationXml = ServerMapPath + @"\" + FilenameConfigurationXml; }//if ( ServerMapPath != null) if ( !Page.IsPostBack ) { UtilitySQLServerManagementObjectsSMO.SQLServerList ( ref ServerName, ref exceptionMessage ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) UtilitySQLServerManagementObjectsSMO.ConfigurationXml ( FilenameConfigurationXml, ref exceptionMessage, ref DatabaseConnectionString, ref DatabaseName, ref DefaultName, ref DirectoryBackup, ref DirectoryMaintenance, ref DirectoryScript, ref RuleName, ref ServerName, ref SqlServerLoginUserName, ref SqlServerPassword, ref StoredProcedureName, ref TableName, ref TriggerName, ref UserDefinedDataTypeName, ref UserDefinedFunctionName, ref ViewName ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) ListBoxServer.DataSource = ServerName; ListBoxServer.DataBind(); if ( Array.BinarySearch ( ServerName, ServerMachineName, System.Collections.CaseInsensitiveComparer.DefaultInvariant ) >= 0 ) { UtilityWebControl.SelectItem ( ListBoxServer, ServerMachineName ); ServerSelected(); }//if ( Array.BinarySearch( ServerName, ServerMachineName, System.Collections.CaseInsensitiveComparer.DefaultInvariant ) >= 0 ) BackupDirectory = DirectoryBackup; MaintenanceDirectory = DirectoryMaintenance; ScriptDirectory = DirectoryScript; if ( !string.IsNullOrEmpty( SqlServerLoginUserName ) ) { SQLServerLoginUserName = SqlServerLoginUserName; } if ( !string.IsNullOrEmpty( SqlServerPassword ) ) { SQLServerPassword = SqlServerPassword; } }//if ( !Page.IsPostBack ) }//try catch ( System.Exception exception ) { exceptionMessage = "System.Exception: " + exception.Message; } if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) }//Page_Load