mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-17 09:35:37 -05:00
Remove unused code (#647)
This commit is contained in:
@@ -1,180 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for JobStepAdvancedLogging.
|
||||
/// </summary>
|
||||
internal sealed class JobStepAdvancedLogging
|
||||
{
|
||||
private CDataContainer dataContainer = null;
|
||||
|
||||
private JobStepData jobStepData;
|
||||
|
||||
|
||||
public JobStepAdvancedLogging()
|
||||
{
|
||||
}
|
||||
|
||||
public JobStepAdvancedLogging(CDataContainer dataContainer, JobStepData jobStepData)
|
||||
{
|
||||
this.dataContainer = dataContainer;
|
||||
this.jobStepData = jobStepData;
|
||||
}
|
||||
|
||||
|
||||
#region internal helpers
|
||||
/// <summary>
|
||||
/// Update the enabled/disabled status of controls
|
||||
/// </summary>
|
||||
private void UpdateControlStatus()
|
||||
{
|
||||
// this.appendToTable.Enabled = this.logToTable.Checked;
|
||||
// this.viewTableLog.Enabled = this.logToTable.Checked;
|
||||
// this.viewFileLog.Enabled = this.canViewFileLog
|
||||
// && this.outputFile.Text.Length > 0
|
||||
// && this.outputFile.Text[this.outputFile.Text.Length - 1] != '\\';
|
||||
// this.outputFile.Enabled = this.canSetFileLog;
|
||||
// this.browse.Enabled = this.canSetFileLog;
|
||||
// this.appendToFile.Enabled = this.canSetFileLog
|
||||
// && this.outputFile.Text.Length > 0
|
||||
// && this.outputFile.Text[this.outputFile.Text.Length - 1] != '\\';
|
||||
// if (!this.appendToFile.Enabled) this.appendToFile.Checked = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Check that a file exists on the server, and validates the path.
|
||||
/// It will throw if the file is either a directoty, or it's parent
|
||||
/// path is invalid.
|
||||
/// </summary>
|
||||
/// <param name="file">File name</param>
|
||||
/// <returns>true if the file already exists</returns>
|
||||
private bool CheckFileExistsAndIsValid(string file)
|
||||
{
|
||||
bool fileExists = false;
|
||||
// check to see that the file exists.
|
||||
// ServerConnection connection = this.dataContainer.ServerConnection;
|
||||
|
||||
// string query = String.Format(CultureInfo.InvariantCulture
|
||||
// , "EXECUTE master.dbo.xp_fileexist {0}"
|
||||
// , SqlSmoObject.MakeSqlString(file));
|
||||
|
||||
// DataSet data = connection.ExecuteWithResults(query);
|
||||
|
||||
// STrace.Assert(data.Tables.Count == 1, "Unexpected number of result sets returned from query");
|
||||
|
||||
// if (data.Tables.Count > 0)
|
||||
// {
|
||||
// DataTable table = data.Tables[0];
|
||||
|
||||
// STrace.Assert(table.Rows.Count == 1, "Unexpected number of rows returned");
|
||||
// STrace.Assert(table.Columns.Count == 3, "Unexpected number of columns returned");
|
||||
|
||||
// if (table.Rows.Count > 0 && table.Columns.Count > 2)
|
||||
// {
|
||||
// DataRow row = table.Rows[0];
|
||||
|
||||
// fileExists = ((byte)row[0] == 1);
|
||||
// bool fileIsDirectory = ((byte)row[1] == 1);
|
||||
|
||||
// if (fileIsDirectory)
|
||||
// {
|
||||
// throw new ApplicationException(SRError.FileIsDirectory);
|
||||
// }
|
||||
|
||||
// bool parentDiectoryExists = ((byte)row[2] == 1);
|
||||
// if (!parentDiectoryExists)
|
||||
// {
|
||||
// throw new ApplicationException(SRError.FileLocationInvalid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return fileExists;
|
||||
}
|
||||
/// <summary>
|
||||
/// read a log on the server to a local file. This method is only supported on
|
||||
/// pre 9.0 servers
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
private string ReadLogToFile(string fileName)
|
||||
{
|
||||
ServerConnection connection = this.dataContainer.ServerConnection;
|
||||
|
||||
string query = string.Format(CultureInfo.InvariantCulture
|
||||
, "EXECUTE master.dbo.xp_readerrorlog -1, {0}"
|
||||
, SqlSmoObject.MakeSqlString(fileName));
|
||||
|
||||
DataSet data = connection.ExecuteWithResults(query);
|
||||
|
||||
if (data.Tables.Count > 0)
|
||||
{
|
||||
DataTable table = data.Tables[0];
|
||||
|
||||
string tempFileName = string.Format(System.Globalization.CultureInfo.InvariantCulture,
|
||||
"{0}{1}", Path.GetTempPath(), "JobSR.StepOutput(Path.GetFileName(fileName))");
|
||||
|
||||
StreamWriter writer = new StreamWriter(tempFileName, false, Encoding.Unicode);
|
||||
|
||||
foreach(DataRow row in table.Rows)
|
||||
{
|
||||
writer.Write(row[0].ToString());
|
||||
if ((byte)row[1] == 0)
|
||||
{
|
||||
writer.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
writer.Close();
|
||||
|
||||
return tempFileName;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the step log to a file. This is only supported on a 9.0 Server
|
||||
/// </summary>
|
||||
/// <param name="step"></param>
|
||||
/// <returns></returns>
|
||||
private string ReadStepLogToFile(JobStep step)
|
||||
{
|
||||
DataTable table = step.EnumLogs();
|
||||
|
||||
String tempFileName = Path.GetTempFileName();
|
||||
|
||||
StreamWriter writer = new StreamWriter(tempFileName, false, Encoding.Unicode);
|
||||
|
||||
foreach(DataRow row in table.Rows)
|
||||
{
|
||||
writer.WriteLine(row["Log"].ToString());
|
||||
}
|
||||
|
||||
writer.Close();
|
||||
|
||||
return tempFileName;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,892 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
|
||||
namespace Microsoft.SqlServer.Management.SqlManagerUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for JobsReferencingScheduleControl.
|
||||
/// </summary>
|
||||
#if DEBUG || EXPOSE_MANAGED_INTERNALS
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
class JobsReferencingScheduleControl : ManagementActionBase
|
||||
{
|
||||
#region Constants
|
||||
private static double[] columnRatios = new double[] {
|
||||
0.10,
|
||||
0.35,
|
||||
0.10,
|
||||
0.35,
|
||||
0.90
|
||||
};
|
||||
|
||||
private const int colJobSelected = 0;
|
||||
private const int colJobName = 1;
|
||||
private const int colJobEnabled = 2;
|
||||
private const int colJobCategory = 3;
|
||||
private const int colJobDescription = 4;
|
||||
|
||||
/// <summary>
|
||||
/// column that stores inside the cell.Tag and SMO Job object
|
||||
/// </summary>
|
||||
private const int colTagSmoObject = colJobName;
|
||||
#endregion
|
||||
|
||||
#region UI Variables
|
||||
// private System.Windows.Forms.Panel panelEntireUserInterface;
|
||||
// private System.Windows.Forms.Label labelStaticSchedule;
|
||||
// private System.Windows.Forms.TextBox textBoxSchedule;
|
||||
// private System.Windows.Forms.Label labelStaticSelectJobs;
|
||||
// private System.Windows.Forms.Panel panelGridContainer;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
#endregion
|
||||
|
||||
#region Non-UI Variables
|
||||
private bool panelInitialized = false;
|
||||
private int m_scheduleId = -1; // used to unique identify the schedule (since duplicate schedule names are allowed)
|
||||
private string m_scheduleName = null;
|
||||
private bool m_readOnlyMode = false;
|
||||
private Urn jobUrn = null;
|
||||
#endregion
|
||||
|
||||
#region Public - ApplyChanges() , NoOfSelectedJobs
|
||||
private int m_noOfSelectedJobs = -1;
|
||||
public int NoOfSelectedJobs
|
||||
{
|
||||
get
|
||||
{
|
||||
//System.Diagnostics.Debug.Assert(m_grid != null);
|
||||
// System.Diagnostics.Debug.Assert(m_noOfSelectedJobs != -1, "ask for this property only after changes were applied");
|
||||
return m_noOfSelectedJobs;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// called by form container - tells control to apply user changes
|
||||
/// </summary>
|
||||
public void ApplyChanges()
|
||||
{
|
||||
SendDataToServer();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors/Dispose
|
||||
/// <summary>
|
||||
/// constructor used so Win Forms designer can work
|
||||
/// </summary>
|
||||
public JobsReferencingScheduleControl()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
// CreateGrid();
|
||||
// InitializeGridColumns();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// initialization - passing context (server and actual schedule to be displayed)
|
||||
///
|
||||
/// urn from context points to the actual schedule being managed
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
public JobsReferencingScheduleControl(CDataContainer context)
|
||||
{
|
||||
//System.Diagnostics.Debug.Assert(context != null);
|
||||
|
||||
m_scheduleName = context.ObjectName;
|
||||
m_readOnlyMode = false;
|
||||
|
||||
DataContainer = context;
|
||||
|
||||
// InitializeComponent();
|
||||
// CreateGrid();
|
||||
|
||||
// IPanelForm ip = this as IPanelForm;
|
||||
|
||||
// ip.OnInitialization();
|
||||
// ip.OnSelection(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialization - passing context (server and actual schedule to be displayed)
|
||||
///
|
||||
/// urn from context points to some generic context from which a parent dialog was launched (Manage Schedules/Schedule Properties/New Job/Job Properties)
|
||||
/// string urnSchedule points to actual schedule
|
||||
/// </summary>
|
||||
/// <param name="context">context as it came from object explorer</param>
|
||||
/// <param name="scheduleId">unique schedule id (since name cannot be used for identification - schedules can have duplicate names - e.g. the one used by Replication team)</param>
|
||||
/// <param name="scheduleName">friendly name of schedule (used for display purposes)</param>
|
||||
/// <param name="readOnlyMode">true if dialog is diplayed in read/only mode</param>
|
||||
public JobsReferencingScheduleControl(CDataContainer context, int scheduleId, string scheduleName, bool readOnlyMode)
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(context != null);
|
||||
System.Diagnostics.Debug.Assert(scheduleName != null);
|
||||
System.Diagnostics.Debug.Assert(scheduleName.Length > 0);
|
||||
|
||||
m_scheduleId = scheduleId;
|
||||
m_scheduleName = scheduleName;
|
||||
m_readOnlyMode = readOnlyMode;
|
||||
|
||||
//InitializeComponent();
|
||||
//CreateGrid();
|
||||
|
||||
DataContainer = context;
|
||||
|
||||
// IPanelForm ip = this as IPanelForm;
|
||||
|
||||
// ip.OnInitialization();
|
||||
// ip.OnSelection(null);
|
||||
|
||||
// this.HelpF1Keyword = AssemblyVersionInfo.VersionHelpKeywordPrefix + ".ag.jobsreferencingaschedule.f1";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// if (components != null)
|
||||
// {
|
||||
// components.Dispose();
|
||||
// }
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Implementation LoadData, InitProp
|
||||
/// <summary>
|
||||
/// reads context - ensures we have
|
||||
/// valid context
|
||||
/// valid server connection
|
||||
/// valid schedule name
|
||||
/// </summary>
|
||||
private void LoadData()
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(DataContainer != null);
|
||||
System.Diagnostics.Debug.Assert(DataContainer.Server != null);
|
||||
System.Diagnostics.Debug.Assert(m_scheduleName != null);
|
||||
System.Diagnostics.Debug.Assert(m_scheduleId != -1);
|
||||
|
||||
string urnString = String.Empty;
|
||||
|
||||
STParameters param = new STParameters();
|
||||
param.SetDocument(DataContainer.Document);
|
||||
|
||||
param.GetParam("joburn", ref urnString);
|
||||
|
||||
if (urnString != null)
|
||||
{
|
||||
this.jobUrn = new Urn(urnString);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create and initialize ui with real data
|
||||
/// </summary>
|
||||
private void InitProp()
|
||||
{
|
||||
// InitializeGridColumns();
|
||||
// ResetUIToInitialValues();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ResetUIToInitialValues, SendDataToServer
|
||||
/// <summary>
|
||||
/// initialize ui with data
|
||||
/// </summary>
|
||||
private void ResetUIToInitialValues()
|
||||
{
|
||||
// FillGridWithData();
|
||||
// UpdateDialogTitle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// applies changes
|
||||
/// </summary>
|
||||
private void SendDataToServer()
|
||||
{
|
||||
// System.Diagnostics.Debug.Assert(m_grid != null);
|
||||
// System.Diagnostics.Debug.Assert(DataContainer != null);
|
||||
// System.Diagnostics.Debug.Assert(DataContainer.Server != null);
|
||||
// System.Diagnostics.Debug.Assert(DataContainer.Server.JobServer != null);
|
||||
// System.Diagnostics.Debug.Assert(DataContainer.Server.JobServer.SharedSchedules != null);
|
||||
// System.Diagnostics.Debug.Assert(m_scheduleName != null);
|
||||
// System.Diagnostics.Debug.Assert(m_scheduleId != -1);
|
||||
|
||||
// if (m_readOnlyMode == true)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// JobSchedule schedule = DataContainer.Server.JobServer.SharedSchedules.ItemById(m_scheduleId);
|
||||
// System.Diagnostics.Debug.Assert(schedule != null);
|
||||
// if (schedule == null)
|
||||
// {
|
||||
// return; // schedule deleted meanwhile
|
||||
// }
|
||||
|
||||
// m_noOfSelectedJobs = 0;
|
||||
// for (int iRow = 0; iRow < m_grid.RowsNumber; ++iRow)
|
||||
// {
|
||||
// bool isSelected = IsEmbeededCheckboxChecked(m_grid, iRow, colJobSelected);
|
||||
// bool isEnabled = IsEmbeededCheckboxChecked(m_grid, iRow, colJobEnabled);
|
||||
|
||||
// if (isSelected)
|
||||
// {
|
||||
// m_noOfSelectedJobs++;
|
||||
// }
|
||||
|
||||
// Job job = GetJobTag(m_grid, iRow);
|
||||
// bool wasSelected = GetWasSelectedTag(m_grid, iRow);
|
||||
|
||||
// bool alterRequired = false;
|
||||
|
||||
// if (isEnabled != job.IsEnabled)
|
||||
// {
|
||||
// job.IsEnabled = isEnabled;
|
||||
// alterRequired = true;
|
||||
// }
|
||||
|
||||
// if (wasSelected && !isSelected)
|
||||
// {
|
||||
// // deselect
|
||||
// // Dont remove unused schedules automatically. Let user explicitly delete it from UI if needed
|
||||
// job.RemoveSharedSchedule(schedule.ID, true);
|
||||
// alterRequired = true;
|
||||
// }
|
||||
|
||||
// if (!wasSelected && isSelected)
|
||||
// {
|
||||
// // select
|
||||
// job.AddSharedSchedule(schedule.ID);
|
||||
// alterRequired = true;
|
||||
// }
|
||||
|
||||
// if (alterRequired == true)
|
||||
// {
|
||||
// job.Alter();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
// System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(JobsReferencingScheduleControl));
|
||||
// this.panelEntireUserInterface = new System.Windows.Forms.Panel();
|
||||
// this.labelStaticSchedule = new System.Windows.Forms.Label();
|
||||
// this.textBoxSchedule = new System.Windows.Forms.TextBox();
|
||||
// this.labelStaticSelectJobs = new System.Windows.Forms.Label();
|
||||
// this.panelGridContainer = new System.Windows.Forms.Panel();
|
||||
// this.panelEntireUserInterface.SuspendLayout();
|
||||
// this.SuspendLayout();
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
// //
|
||||
// // panelEntireUserInterface
|
||||
// //
|
||||
// this.panelEntireUserInterface.AccessibleDescription = resources.GetString("panelEntireUserInterface.AccessibleDescription");
|
||||
// this.panelEntireUserInterface.AccessibleName = resources.GetString("panelEntireUserInterface.AccessibleName");
|
||||
// this.panelEntireUserInterface.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("panelEntireUserInterface.Anchor")));
|
||||
// this.panelEntireUserInterface.AutoScroll = ((bool)(resources.GetObject("panelEntireUserInterface.AutoScroll")));
|
||||
// this.panelEntireUserInterface.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("panelEntireUserInterface.AutoScrollMargin")));
|
||||
// this.panelEntireUserInterface.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("panelEntireUserInterface.AutoScrollMinSize")));
|
||||
// this.panelEntireUserInterface.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panelEntireUserInterface.BackgroundImage")));
|
||||
// this.panelEntireUserInterface.Controls.Add(this.panelGridContainer);
|
||||
// this.panelEntireUserInterface.Controls.Add(this.labelStaticSelectJobs);
|
||||
// this.panelEntireUserInterface.Controls.Add(this.textBoxSchedule);
|
||||
// this.panelEntireUserInterface.Controls.Add(this.labelStaticSchedule);
|
||||
// this.panelEntireUserInterface.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("panelEntireUserInterface.Dock")));
|
||||
// this.panelEntireUserInterface.Enabled = ((bool)(resources.GetObject("panelEntireUserInterface.Enabled")));
|
||||
// this.panelEntireUserInterface.Font = ((System.Drawing.Font)(resources.GetObject("panelEntireUserInterface.Font")));
|
||||
// this.panelEntireUserInterface.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("panelEntireUserInterface.ImeMode")));
|
||||
// this.panelEntireUserInterface.Location = ((System.Drawing.Point)(resources.GetObject("panelEntireUserInterface.Location")));
|
||||
// this.panelEntireUserInterface.Name = "panelEntireUserInterface";
|
||||
// this.panelEntireUserInterface.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("panelEntireUserInterface.RightToLeft")));
|
||||
// this.panelEntireUserInterface.Size = ((System.Drawing.Size)(resources.GetObject("panelEntireUserInterface.Size")));
|
||||
// this.panelEntireUserInterface.TabIndex = ((int)(resources.GetObject("panelEntireUserInterface.TabIndex")));
|
||||
// this.panelEntireUserInterface.Text = resources.GetString("panelEntireUserInterface.Text");
|
||||
// this.panelEntireUserInterface.Visible = ((bool)(resources.GetObject("panelEntireUserInterface.Visible")));
|
||||
// //
|
||||
// // labelStaticSchedule
|
||||
// //
|
||||
// this.labelStaticSchedule.AccessibleDescription = resources.GetString("labelStaticSchedule.AccessibleDescription");
|
||||
// this.labelStaticSchedule.AccessibleName = resources.GetString("labelStaticSchedule.AccessibleName");
|
||||
// this.labelStaticSchedule.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("labelStaticSchedule.Anchor")));
|
||||
// this.labelStaticSchedule.AutoSize = ((bool)(resources.GetObject("labelStaticSchedule.AutoSize")));
|
||||
// this.labelStaticSchedule.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("labelStaticSchedule.Dock")));
|
||||
// this.labelStaticSchedule.Enabled = ((bool)(resources.GetObject("labelStaticSchedule.Enabled")));
|
||||
// this.labelStaticSchedule.Font = ((System.Drawing.Font)(resources.GetObject("labelStaticSchedule.Font")));
|
||||
// this.labelStaticSchedule.Image = ((System.Drawing.Image)(resources.GetObject("labelStaticSchedule.Image")));
|
||||
// this.labelStaticSchedule.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("labelStaticSchedule.ImageAlign")));
|
||||
// this.labelStaticSchedule.ImageIndex = ((int)(resources.GetObject("labelStaticSchedule.ImageIndex")));
|
||||
// this.labelStaticSchedule.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("labelStaticSchedule.ImeMode")));
|
||||
// this.labelStaticSchedule.Location = ((System.Drawing.Point)(resources.GetObject("labelStaticSchedule.Location")));
|
||||
// this.labelStaticSchedule.Name = "labelStaticSchedule";
|
||||
// this.labelStaticSchedule.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("labelStaticSchedule.RightToLeft")));
|
||||
// this.labelStaticSchedule.Size = ((System.Drawing.Size)(resources.GetObject("labelStaticSchedule.Size")));
|
||||
// this.labelStaticSchedule.TabIndex = ((int)(resources.GetObject("labelStaticSchedule.TabIndex")));
|
||||
// this.labelStaticSchedule.Text = resources.GetString("labelStaticSchedule.Text");
|
||||
// this.labelStaticSchedule.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("labelStaticSchedule.TextAlign")));
|
||||
// this.labelStaticSchedule.Visible = ((bool)(resources.GetObject("labelStaticSchedule.Visible")));
|
||||
// //
|
||||
// // textBoxSchedule
|
||||
// //
|
||||
// this.textBoxSchedule.AccessibleDescription = resources.GetString("textBoxSchedule.AccessibleDescription");
|
||||
// this.textBoxSchedule.AccessibleName = resources.GetString("textBoxSchedule.AccessibleName");
|
||||
// this.textBoxSchedule.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("textBoxSchedule.Anchor")));
|
||||
// this.textBoxSchedule.AutoSize = ((bool)(resources.GetObject("textBoxSchedule.AutoSize")));
|
||||
// this.textBoxSchedule.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("textBoxSchedule.BackgroundImage")));
|
||||
// this.textBoxSchedule.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("textBoxSchedule.Dock")));
|
||||
// this.textBoxSchedule.Enabled = ((bool)(resources.GetObject("textBoxSchedule.Enabled")));
|
||||
// this.textBoxSchedule.Font = ((System.Drawing.Font)(resources.GetObject("textBoxSchedule.Font")));
|
||||
// this.textBoxSchedule.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("textBoxSchedule.ImeMode")));
|
||||
// this.textBoxSchedule.Location = ((System.Drawing.Point)(resources.GetObject("textBoxSchedule.Location")));
|
||||
// this.textBoxSchedule.MaxLength = ((int)(resources.GetObject("textBoxSchedule.MaxLength")));
|
||||
// this.textBoxSchedule.Multiline = ((bool)(resources.GetObject("textBoxSchedule.Multiline")));
|
||||
// this.textBoxSchedule.Name = "textBoxSchedule";
|
||||
// this.textBoxSchedule.PasswordChar = ((char)(resources.GetObject("textBoxSchedule.PasswordChar")));
|
||||
// this.textBoxSchedule.ReadOnly = true;
|
||||
// this.textBoxSchedule.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("textBoxSchedule.RightToLeft")));
|
||||
// this.textBoxSchedule.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("textBoxSchedule.ScrollBars")));
|
||||
// this.textBoxSchedule.Size = ((System.Drawing.Size)(resources.GetObject("textBoxSchedule.Size")));
|
||||
// this.textBoxSchedule.TabIndex = ((int)(resources.GetObject("textBoxSchedule.TabIndex")));
|
||||
// this.textBoxSchedule.Text = resources.GetString("textBoxSchedule.Text");
|
||||
// this.textBoxSchedule.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("textBoxSchedule.TextAlign")));
|
||||
// this.textBoxSchedule.Visible = ((bool)(resources.GetObject("textBoxSchedule.Visible")));
|
||||
// this.textBoxSchedule.WordWrap = ((bool)(resources.GetObject("textBoxSchedule.WordWrap")));
|
||||
// //
|
||||
// // labelStaticSelectJobs
|
||||
// //
|
||||
// this.labelStaticSelectJobs.AccessibleDescription = resources.GetString("labelStaticSelectJobs.AccessibleDescription");
|
||||
// this.labelStaticSelectJobs.AccessibleName = resources.GetString("labelStaticSelectJobs.AccessibleName");
|
||||
// this.labelStaticSelectJobs.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("labelStaticSelectJobs.Anchor")));
|
||||
// this.labelStaticSelectJobs.AutoSize = ((bool)(resources.GetObject("labelStaticSelectJobs.AutoSize")));
|
||||
// this.labelStaticSelectJobs.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("labelStaticSelectJobs.Dock")));
|
||||
// this.labelStaticSelectJobs.Enabled = ((bool)(resources.GetObject("labelStaticSelectJobs.Enabled")));
|
||||
// this.labelStaticSelectJobs.Font = ((System.Drawing.Font)(resources.GetObject("labelStaticSelectJobs.Font")));
|
||||
// this.labelStaticSelectJobs.Image = ((System.Drawing.Image)(resources.GetObject("labelStaticSelectJobs.Image")));
|
||||
// this.labelStaticSelectJobs.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("labelStaticSelectJobs.ImageAlign")));
|
||||
// this.labelStaticSelectJobs.ImageIndex = ((int)(resources.GetObject("labelStaticSelectJobs.ImageIndex")));
|
||||
// this.labelStaticSelectJobs.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("labelStaticSelectJobs.ImeMode")));
|
||||
// this.labelStaticSelectJobs.Location = ((System.Drawing.Point)(resources.GetObject("labelStaticSelectJobs.Location")));
|
||||
// this.labelStaticSelectJobs.Name = "labelStaticSelectJobs";
|
||||
// this.labelStaticSelectJobs.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("labelStaticSelectJobs.RightToLeft")));
|
||||
// this.labelStaticSelectJobs.Size = ((System.Drawing.Size)(resources.GetObject("labelStaticSelectJobs.Size")));
|
||||
// this.labelStaticSelectJobs.TabIndex = ((int)(resources.GetObject("labelStaticSelectJobs.TabIndex")));
|
||||
// this.labelStaticSelectJobs.Text = resources.GetString("labelStaticSelectJobs.Text");
|
||||
// this.labelStaticSelectJobs.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("labelStaticSelectJobs.TextAlign")));
|
||||
// this.labelStaticSelectJobs.Visible = ((bool)(resources.GetObject("labelStaticSelectJobs.Visible")));
|
||||
// //
|
||||
// // panelGridContainer
|
||||
// //
|
||||
// this.panelGridContainer.AccessibleDescription = resources.GetString("panelGridContainer.AccessibleDescription");
|
||||
// this.panelGridContainer.AccessibleName = resources.GetString("panelGridContainer.AccessibleName");
|
||||
// this.panelGridContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("panelGridContainer.Anchor")));
|
||||
// this.panelGridContainer.AutoScroll = ((bool)(resources.GetObject("panelGridContainer.AutoScroll")));
|
||||
// this.panelGridContainer.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("panelGridContainer.AutoScrollMargin")));
|
||||
// this.panelGridContainer.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("panelGridContainer.AutoScrollMinSize")));
|
||||
// this.panelGridContainer.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panelGridContainer.BackgroundImage")));
|
||||
// this.panelGridContainer.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("panelGridContainer.Dock")));
|
||||
// this.panelGridContainer.Enabled = ((bool)(resources.GetObject("panelGridContainer.Enabled")));
|
||||
// this.panelGridContainer.Font = ((System.Drawing.Font)(resources.GetObject("panelGridContainer.Font")));
|
||||
// this.panelGridContainer.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("panelGridContainer.ImeMode")));
|
||||
// this.panelGridContainer.Location = ((System.Drawing.Point)(resources.GetObject("panelGridContainer.Location")));
|
||||
// this.panelGridContainer.Name = "panelGridContainer";
|
||||
// this.panelGridContainer.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("panelGridContainer.RightToLeft")));
|
||||
// this.panelGridContainer.Size = ((System.Drawing.Size)(resources.GetObject("panelGridContainer.Size")));
|
||||
// this.panelGridContainer.TabIndex = ((int)(resources.GetObject("panelGridContainer.TabIndex")));
|
||||
// this.panelGridContainer.Text = resources.GetString("panelGridContainer.Text");
|
||||
// this.panelGridContainer.Visible = ((bool)(resources.GetObject("panelGridContainer.Visible")));
|
||||
// //
|
||||
// // JobsReferencingScheduleControl
|
||||
// //
|
||||
// this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
|
||||
// this.AccessibleName = resources.GetString("$this.AccessibleName");
|
||||
// this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
|
||||
// this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
|
||||
// this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
|
||||
// this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
|
||||
// this.Controls.Add(this.panelEntireUserInterface);
|
||||
// this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
|
||||
// this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
|
||||
// this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
|
||||
// this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
|
||||
// this.Name = "JobsReferencingScheduleControl";
|
||||
// this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
|
||||
// this.Size = ((System.Drawing.Size)(resources.GetObject("$this.Size")));
|
||||
// this.panelEntireUserInterface.ResumeLayout(false);
|
||||
// this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IPanelForm interface
|
||||
|
||||
/// <summary>
|
||||
/// interface IPanelForm
|
||||
///
|
||||
/// implementation of Panel property
|
||||
/// </summary>
|
||||
// UserControl IPanelForm.Panel
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// interface IPanelForm
|
||||
// ///
|
||||
// /// implementation of OnSelection
|
||||
// /// </summary>
|
||||
// void IPanelForm.OnSelection(TreeNode node)
|
||||
// {
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// interface IPanelForm
|
||||
// ///
|
||||
// /// implementation of OnPanelLoseSelection
|
||||
// /// </summary>
|
||||
// /// <param name="node"></param>
|
||||
// void IPanelForm.OnPanelLoseSelection(TreeNode node)
|
||||
// {
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// interface IPanelForm
|
||||
// ///
|
||||
// /// implementation of OnReset
|
||||
// /// </summary>
|
||||
// /// <param name="node"></param>
|
||||
// public override void OnReset(object sender)
|
||||
// {
|
||||
// base.OnReset(sender);
|
||||
// if (this.panelInitialized)
|
||||
// {
|
||||
// ResetUIToInitialValues();
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// interface IPanelForm
|
||||
// ///
|
||||
// /// implementation of OnInitialization
|
||||
// /// </summary>
|
||||
// void IPanelForm.OnInitialization()
|
||||
// {
|
||||
// if (this.panelInitialized == true)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// this.panelInitialized = true;
|
||||
// try
|
||||
// {
|
||||
// this.HelpF1Keyword = AssemblyVersionInfo.VersionHelpKeywordPrefix + ".ag.jobsreferencingaschedule.f1";
|
||||
|
||||
// LoadData();
|
||||
// InitProp();
|
||||
|
||||
// IPanelForm panelform = this as IPanelForm;
|
||||
// panelform.Panel.Enabled = true;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// IPanelForm panelform = this as IPanelForm;
|
||||
// panelform.Panel.Enabled = false;
|
||||
|
||||
// throw;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// interface IPanelForm
|
||||
// ///
|
||||
// /// implementation of OnPanelRunNow
|
||||
// /// </summary>
|
||||
// /// <param name="node"></param>
|
||||
// public override void OnRunNow(object sender)
|
||||
// {
|
||||
// base.OnRunNow(sender);
|
||||
// if (this.panelInitialized)
|
||||
// {
|
||||
// SendDataToServer();
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region Grid Operations
|
||||
// private SqlManagerUIDlgGrid m_grid = null;
|
||||
|
||||
// /// <summary>
|
||||
// /// dinamically create a grid control
|
||||
// ///
|
||||
// /// normally this would have been done via winforms designer
|
||||
// /// but due to Whidbey migration we had to made it this way
|
||||
// /// </summary>
|
||||
// private void CreateGrid()
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_grid == null);
|
||||
|
||||
// m_grid = new SqlManagerUIDlgGrid();
|
||||
// m_grid.Dock = DockStyle.Fill;
|
||||
// m_grid.MouseButtonClicked += new Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventHandler(this.grid_MouseButtonClicked);
|
||||
|
||||
// try
|
||||
// {
|
||||
// this.SuspendLayout();
|
||||
// this.panelGridContainer.SuspendLayout();
|
||||
// this.panelGridContainer.Controls.Clear();
|
||||
// this.panelGridContainer.Controls.Add(m_grid);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// this.panelGridContainer.ResumeLayout();
|
||||
// this.ResumeLayout();
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// initialze grid columns
|
||||
// /// </summary>
|
||||
// private void InitializeGridColumns()
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_grid != null);
|
||||
// Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid grid = m_grid;
|
||||
|
||||
// while (grid.ColumnsNumber != 0)
|
||||
// {
|
||||
// grid.DeleteColumn(0);
|
||||
// }
|
||||
|
||||
// GridColumnInfo colInfo = null;
|
||||
// int i = 0;
|
||||
|
||||
// foreach (double fColumnRatio in columnRatios)
|
||||
// {
|
||||
// colInfo = new GridColumnInfo();
|
||||
// colInfo.ColumnWidth = (int)((double)grid.Width * fColumnRatio);
|
||||
// colInfo.WidthType = GridColumnWidthType.InPixels;
|
||||
// switch (i)
|
||||
// {
|
||||
// case colJobSelected:
|
||||
// colInfo.ColumnType = GridColumnType.Checkbox;
|
||||
// break;
|
||||
|
||||
// case colJobEnabled:
|
||||
// colInfo.ColumnType = GridColumnType.Checkbox;
|
||||
// break;
|
||||
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// grid.AddColumn(colInfo);
|
||||
// ++i;
|
||||
// }
|
||||
|
||||
// grid.SetHeaderInfo(colJobSelected, SR.GridHeader_JobSelected, null);
|
||||
// grid.SetHeaderInfo(colJobName, SR.GridHeader_JobName, null);
|
||||
// grid.SetHeaderInfo(colJobEnabled, SR.GridHeader_JobEnabled, null);
|
||||
// grid.SetHeaderInfo(colJobCategory, SR.GridHeader_JobCategory, null);
|
||||
// grid.SetHeaderInfo(colJobDescription, SR.GridHeader_JobDescription, null);
|
||||
|
||||
// grid.EnableSortingByColumn(colJobSelected);
|
||||
// grid.EnableSortingByColumn(colJobName);
|
||||
// grid.EnableSortingByColumn(colJobEnabled);
|
||||
// grid.EnableSortingByColumn(colJobCategory);
|
||||
// grid.EnableSortingByColumn(colJobDescription);
|
||||
|
||||
// grid.FirstScrollableColumn = colJobEnabled;
|
||||
// grid.SelectionType = GridSelectionType.SingleRow;
|
||||
// grid.UpdateGrid();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// fills grid with data
|
||||
// ///
|
||||
// /// iterates the available jobs and if they reference the schedule adds them to grid
|
||||
// /// </summary>
|
||||
// private void FillGridWithData()
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_grid != null);
|
||||
// System.Diagnostics.Debug.Assert(m_scheduleName != null);
|
||||
// System.Diagnostics.Debug.Assert(m_scheduleName.Length > 0);
|
||||
// System.Diagnostics.Debug.Assert(m_scheduleId != -1);
|
||||
|
||||
// System.Diagnostics.Debug.Assert(DataContainer != null);
|
||||
// System.Diagnostics.Debug.Assert(DataContainer.Server != null);
|
||||
// System.Diagnostics.Debug.Assert(DataContainer.Server.JobServer != null);
|
||||
// System.Diagnostics.Debug.Assert(DataContainer.Server.JobServer.Jobs != null);
|
||||
|
||||
// Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid grid = m_grid;
|
||||
|
||||
// grid.DeleteAllRows();
|
||||
|
||||
// Dictionary<Job, bool> jobs = new Dictionary<Job, bool>(DataContainer.Server.JobServer.Jobs.Count);
|
||||
|
||||
// JobSchedule schedule = DataContainer.Server.JobServer.SharedSchedules.ItemById(m_scheduleId);
|
||||
|
||||
// // if schedule object returned was null, it is possible that schedule specified in scheduledata
|
||||
// // is not yet created on server
|
||||
// if (null == schedule)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Guid[] jobGuids = schedule.EnumJobReferences(); // Note that this call is expensive
|
||||
// // since it uses a cursor
|
||||
|
||||
// foreach (Guid guid in jobGuids)
|
||||
// {
|
||||
// Job job = DataContainer.Server.JobServer.Jobs.ItemById(guid);
|
||||
// System.Diagnostics.Debug.Assert(job != null);
|
||||
// jobs.Add(job, true);
|
||||
// }
|
||||
|
||||
// if (!m_readOnlyMode)
|
||||
// {
|
||||
// // If we're not in readonly mode, we need to list all jobs.
|
||||
// // ensure we have latest info - what are the available jobs
|
||||
// DataContainer.Server.JobServer.Jobs.Refresh();
|
||||
// foreach (Job job in DataContainer.Server.JobServer.Jobs)
|
||||
// {
|
||||
// // If this job wasn't already in our dictionary, then we know it doesn't use
|
||||
// // this schedule. Add it as a new, unselected entry.
|
||||
// if (!jobs.ContainsKey(job))
|
||||
// {
|
||||
// jobs.Add(job, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// foreach (KeyValuePair<Job, bool> jobInfo in jobs)
|
||||
// {
|
||||
// AddGridRowForJob(jobInfo.Key, jobInfo.Value);
|
||||
// }
|
||||
|
||||
// m_grid.SortByColumn(colJobName, SortingColumnState.Ascending);
|
||||
|
||||
// if ((grid.SelectedRow < 0) && (grid.RowsNumber > 0))
|
||||
// {
|
||||
// grid.SelectedRow = 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// adds a new row to the grid
|
||||
// /// </summary>
|
||||
// private void AddGridRowForJob(Job job, bool selected)
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_grid != null);
|
||||
// System.Diagnostics.Debug.Assert(job != null);
|
||||
|
||||
// if (selected == false && m_readOnlyMode == true)
|
||||
// {
|
||||
// // in read-only mode we display only jobs that
|
||||
// // are referencing schedule dialog
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid grid = m_grid;
|
||||
|
||||
// GridCellCollection row = new GridCellCollection();
|
||||
// GridCell cell;
|
||||
|
||||
// if (job.Urn == this.jobUrn)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// cell = new GridCell
|
||||
// (
|
||||
// (m_readOnlyMode == true) ?
|
||||
// (selected ? GridCheckBoxState.Indeterminate : GridCheckBoxState.Disabled) :
|
||||
// (selected ? GridCheckBoxState.Checked : GridCheckBoxState.Unchecked)
|
||||
// );
|
||||
// cell.Tag = selected ? job : null; row.Add(cell); // selected (all by default) - TAGGED with initial selected value
|
||||
// cell = new GridCell(job.Name); cell.Tag = job; row.Add(cell); // name - TAGGED with Job object
|
||||
// cell = new GridCell
|
||||
// (
|
||||
// (m_readOnlyMode == true) ?
|
||||
// (job.IsEnabled ? GridCheckBoxState.Indeterminate : GridCheckBoxState.Disabled) :
|
||||
// (job.IsEnabled ? GridCheckBoxState.Checked : GridCheckBoxState.Unchecked)
|
||||
// );
|
||||
// row.Add(cell); // enabled
|
||||
|
||||
// LocalizableCategory catLocalized = new LocalizableCategory(job.CategoryID, job.Category);
|
||||
// cell = new GridCell(catLocalized.Name); row.Add(cell); // category
|
||||
// cell = new GridCell(job.Description); row.Add(cell); // description
|
||||
|
||||
// grid.AddRow(row);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// flips on/off checkboxes from grid
|
||||
// /// </summary>
|
||||
// /// <param name="rowsno"></param>
|
||||
// /// <param name="colno"></param>
|
||||
// void FlipCheckbox(SqlManagerUIDlgGrid grid, int rowno, int colno)
|
||||
// {
|
||||
// // get the storage for the cell
|
||||
// GridCell cell = grid.GetCellInfo(rowno, colno);
|
||||
// GridCheckBoxState state = (GridCheckBoxState)cell.CellData;
|
||||
|
||||
// // explicitly invert the cell state
|
||||
// switch (state)
|
||||
// {
|
||||
// case GridCheckBoxState.Checked:
|
||||
// cell.CellData = GridCheckBoxState.Unchecked;
|
||||
// break;
|
||||
|
||||
// case GridCheckBoxState.Unchecked:
|
||||
// cell.CellData = GridCheckBoxState.Checked;
|
||||
// break;
|
||||
|
||||
// case GridCheckBoxState.Indeterminate:
|
||||
// cell.CellData = GridCheckBoxState.Checked;
|
||||
// break;
|
||||
|
||||
// case GridCheckBoxState.None:
|
||||
// break;
|
||||
|
||||
// default:
|
||||
// System.Diagnostics.Debug.Assert(false, "unknown checkbox state");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// gets status of checkbox
|
||||
// /// </summary>
|
||||
// /// <param name="grid"></param>
|
||||
// /// <param name="rowno"></param>
|
||||
// /// <param name="colno"></param>
|
||||
// /// <returns></returns>
|
||||
// bool IsEmbeededCheckboxChecked(SqlManagerUIDlgGrid grid, int rowno, int colno)
|
||||
// {
|
||||
// // get the storage for the cell
|
||||
// GridCell cell = grid.GetCellInfo(rowno, colno);
|
||||
// GridCheckBoxState state = (GridCheckBoxState)cell.CellData;
|
||||
|
||||
// return (state == GridCheckBoxState.Checked);
|
||||
// }
|
||||
|
||||
// Job GetJobTag(Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid grid, int iRow)
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(grid != null);
|
||||
// System.Diagnostics.Debug.Assert(iRow >= 0);
|
||||
// System.Diagnostics.Debug.Assert(iRow < grid.RowsNumber);
|
||||
|
||||
// GridCell cell = grid.GetCellInfo(iRow, colTagSmoObject);
|
||||
|
||||
// System.Diagnostics.Debug.Assert(cell != null);
|
||||
// System.Diagnostics.Debug.Assert(cell.Tag != null);
|
||||
|
||||
// Job job = cell.Tag as Job;
|
||||
|
||||
// System.Diagnostics.Debug.Assert(job != null);
|
||||
// return job;
|
||||
// }
|
||||
|
||||
// bool GetWasSelectedTag(Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid grid, int iRow)
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(grid != null);
|
||||
// System.Diagnostics.Debug.Assert(iRow >= 0);
|
||||
// System.Diagnostics.Debug.Assert(iRow < grid.RowsNumber);
|
||||
|
||||
// GridCell cell = grid.GetCellInfo(iRow, colJobSelected);
|
||||
|
||||
// System.Diagnostics.Debug.Assert(cell != null);
|
||||
|
||||
// object o = cell.Tag;
|
||||
// return o != null;
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region Grid Events
|
||||
/// <summary>
|
||||
/// user clicked - we flip checkboxes
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="args"></param>
|
||||
// private void grid_MouseButtonClicked(object sender, Microsoft.SqlServer.Management.UI.Grid.MouseButtonClickedEventArgs args)
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_grid != null);
|
||||
// Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid grid = m_grid;
|
||||
|
||||
// if (args.Button != MouseButtons.Left)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (m_readOnlyMode == true)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// int rowno = Convert.ToInt32(args.RowIndex);
|
||||
// int colno = Convert.ToInt32(args.ColumnIndex);
|
||||
|
||||
// switch (colno)
|
||||
// {
|
||||
// case colJobSelected: // flip checkbox
|
||||
// FlipCheckbox(grid, rowno, colno);
|
||||
// break;
|
||||
|
||||
// case colJobEnabled: // flip checkbox
|
||||
// FlipCheckbox(grid, rowno, colno);
|
||||
// break;
|
||||
|
||||
// default: // else do default action: e.g. edit - open combo - etc ...
|
||||
// // grid.StartCellEdit(rowno,colno);
|
||||
// // grid.OnMouseButtonClicked(rowno, colno, args.CellRect, args.Button);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
// private void UpdateDialogTitle()
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_scheduleName != null);
|
||||
// System.Diagnostics.Debug.Assert(m_scheduleId != -1);
|
||||
|
||||
// this.Text = SR.DialogTitle_JobsReferencingSchedule(m_scheduleName);
|
||||
// this.textBoxSchedule.Text = m_scheduleName;
|
||||
// }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,186 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Form1.
|
||||
/// </summary>
|
||||
#if DEBUG || EXPOSE_MANAGED_INTERNALS
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
sealed class ScheduleScriptExecution : ManagementActionBase
|
||||
{
|
||||
private SqlConnectionInfo ci;
|
||||
private JobScheduleData scheduleData = null;
|
||||
|
||||
#region object construction
|
||||
/// <summary>
|
||||
/// constructs an empty schedule dialog.
|
||||
/// </summary>
|
||||
public ScheduleScriptExecution()
|
||||
{
|
||||
this.scheduleData = new JobScheduleData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new ScheduleDialog based upon an existing smo schedule. Will
|
||||
/// automatically save changes on ok.
|
||||
/// </summary>
|
||||
/// <param name="source">source schedule</param>
|
||||
public ScheduleScriptExecution(JobSchedule source)
|
||||
{
|
||||
this.scheduleData = new JobScheduleData(source);
|
||||
}
|
||||
/// <summary>
|
||||
/// Constructs a new ScheduleDialog based upon an existing smo Job. Will
|
||||
/// automatically save changes on ok.
|
||||
/// </summary>
|
||||
/// <param name="source">source schedule</param>
|
||||
public ScheduleScriptExecution(Job source)
|
||||
{
|
||||
this.scheduleData = new JobScheduleData(source);
|
||||
}
|
||||
/// <summary>
|
||||
/// Constructs a new ScheduleDialog based upon a JobScheduleData object.
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
public ScheduleScriptExecution(JobScheduleData source, SqlConnectionInfo ci)
|
||||
{
|
||||
this.scheduleData = source;
|
||||
this.ci = ci;
|
||||
}
|
||||
/// <summary>
|
||||
/// Constructs a new Schedule dialog based upon a SimpleJobSchedule structure
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
public ScheduleScriptExecution(SimpleJobSchedule source)
|
||||
{
|
||||
this.scheduleData = source.ToJobScheduleData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region public properties
|
||||
/// <summary>
|
||||
/// Underlying JobScheduleData object
|
||||
/// </summary>
|
||||
public JobScheduleData Schedule
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.scheduleData;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SimpleJobSchedule structure
|
||||
/// </summary>
|
||||
public SimpleJobSchedule SimpleSchedule
|
||||
{
|
||||
get
|
||||
{
|
||||
SimpleJobSchedule s = SimpleJobSchedule.FromJobScheduleData(this.scheduleData);
|
||||
s.Description = this.ToString();
|
||||
return s;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.scheduleData = value.ToJobScheduleData();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region ui event handlers
|
||||
|
||||
// private void OK_Click(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// Microsoft.SqlServer.Management.Smo.Server smoServer;
|
||||
|
||||
// scheduleData.Name = this.scheduleName.Text;
|
||||
|
||||
// if (this.scheduleType.SelectedIndex == idxAutoStartSchedule)
|
||||
// {
|
||||
// scheduleData.FrequencyTypes = FrequencyTypes.AutoStart;
|
||||
// }
|
||||
// else if (this.scheduleType.SelectedIndex == idxCpuIdleSchedule)
|
||||
// {
|
||||
// scheduleData.FrequencyTypes = FrequencyTypes.OnIdle;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.recurrancePattern.SaveData(this.scheduleData);
|
||||
// }
|
||||
|
||||
// ///For methods which pass a connection object, connect to smo and get information about the job server and the
|
||||
// ///job inventory to pass to the validate method
|
||||
// try
|
||||
// {
|
||||
// if (ci != null)
|
||||
// {
|
||||
// smoServer = new Microsoft.SqlServer.Management.Smo.Server(new ServerConnection(ci));
|
||||
// System.Version version = smoServer.Information.Version;
|
||||
// ///This is the creation of a new job. We won't need to pass schedule information to Validate
|
||||
// ///because this a new job.
|
||||
// ///But first make sure the job has not already been created
|
||||
// if (smoServer.JobServer.Jobs.Contains(this.jobName.Text.Trim()))
|
||||
// {
|
||||
// throw new ApplicationException(SRError.JobAlreadyExists(this.jobName.Text));
|
||||
// }
|
||||
// //If we have not failed. The job doesn't exist. Now check to make sure the schedule data
|
||||
// //is valid
|
||||
// ArrayList nullArrayList=null;
|
||||
// scheduleData.Validate(version, nullArrayList);
|
||||
// }
|
||||
// this.DialogResult = DialogResult.OK;
|
||||
// this.Close();
|
||||
// }
|
||||
// catch (ApplicationException error)
|
||||
// {
|
||||
// DisplayExceptionMessage(error);
|
||||
// this.DialogResult = DialogResult.None;
|
||||
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// smoServer = null;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// private void Cancel_Click(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// this.DialogResult = DialogResult.Cancel;
|
||||
// this.Close();
|
||||
// }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,166 +0,0 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SqlServerAgentPropSheet.
|
||||
/// </summary>
|
||||
internal sealed class SqlServerAgentPropSheet : ManagementActionBase
|
||||
{
|
||||
public SqlServerAgentPropSheet()
|
||||
{
|
||||
}
|
||||
|
||||
public SqlServerAgentPropSheet(CDataContainer dataContainer)
|
||||
{
|
||||
DataContainer = dataContainer;
|
||||
Initialize(dataContainer);
|
||||
}
|
||||
|
||||
public void Initialize(CDataContainer dataContainer)
|
||||
{
|
||||
// PanelTreeNode node;
|
||||
// PanelTreeNode auxNode;
|
||||
// CUtils util = new CUtils();
|
||||
// STParameters param;
|
||||
|
||||
// param = new STParameters();
|
||||
|
||||
// param.SetDocument(dataContainer.Document);
|
||||
|
||||
// UserControl AgentPropertiesGeneral = new SqlServerAgentPropertiesGeneral(dataContainer);
|
||||
// UserControl AgentPropertiesAdvanced = new SqlServerAgentPropertiesAdvanced(dataContainer);
|
||||
// UserControl AgentPropertiesJobSystem = new SqlServerAgentPropertiesJobSystem(dataContainer);
|
||||
// UserControl AgentPropertiesHistory = new SqlServerAgentPropertiesHistory(dataContainer);
|
||||
// UserControl AgentPropertiesConnection = new SqlServerAgentPropertiesConnection(dataContainer);
|
||||
// UserControl AgentPropertiesAlertSystem = new SqlServerAgentPropertiesAlertSystem(dataContainer);
|
||||
|
||||
// AddView(AgentPropertiesGeneral);
|
||||
// AddView(AgentPropertiesAdvanced);
|
||||
// AddView(AgentPropertiesAlertSystem);
|
||||
// AddView(AgentPropertiesJobSystem);
|
||||
// AddView(AgentPropertiesConnection);
|
||||
// AddView(AgentPropertiesHistory);
|
||||
|
||||
// this.Icon = util.LoadIcon("server.ico");
|
||||
|
||||
// node = new PanelTreeNode();
|
||||
// node.Text = SqlServerAgentSR.AgentPropertiesNode;
|
||||
// node.Type = eNodeType.Folder;
|
||||
// node.Tag = 1;
|
||||
|
||||
// auxNode = new PanelTreeNode();
|
||||
// auxNode.Text = SqlServerAgentSR.GeneralNode;
|
||||
// auxNode.Tag = 1;
|
||||
// auxNode.Type = eNodeType.Item;
|
||||
// node.Nodes.Add(auxNode);
|
||||
|
||||
// SelectNode(auxNode);
|
||||
|
||||
|
||||
// auxNode = new PanelTreeNode();
|
||||
// auxNode.Text = SqlServerAgentSR.AdvancedNode;
|
||||
// auxNode.Tag = 2;
|
||||
// auxNode.Type = eNodeType.Item;
|
||||
// node.Nodes.Add(auxNode);
|
||||
|
||||
// auxNode = new PanelTreeNode();
|
||||
// auxNode.Text = SqlServerAgentSR.AlertSystemNode;
|
||||
// auxNode.Tag = 3;
|
||||
// auxNode.Type = eNodeType.Item;
|
||||
// node.Nodes.Add(auxNode);
|
||||
|
||||
// auxNode = new PanelTreeNode();
|
||||
// auxNode.Text = SqlServerAgentSR.JobSystemNode;
|
||||
// auxNode.Tag = 4;
|
||||
// auxNode.Type = eNodeType.Item;
|
||||
// node.Nodes.Add(auxNode);
|
||||
|
||||
// auxNode = new PanelTreeNode();
|
||||
// auxNode.Text = SqlServerAgentSR.ConnectionNode;
|
||||
// auxNode.Tag = 5;
|
||||
// auxNode.Type = eNodeType.Item;
|
||||
// node.Nodes.Add(auxNode);
|
||||
|
||||
// auxNode = new PanelTreeNode();
|
||||
// auxNode.Text = SqlServerAgentSR.HistoryNode;
|
||||
// auxNode.Tag = 6;
|
||||
// auxNode.Type = eNodeType.Item;
|
||||
// node.Nodes.Add(auxNode);
|
||||
|
||||
|
||||
// AddNode(node);
|
||||
|
||||
// Text = SqlServerAgentSR.AgentPropertiesTitle(dataContainer.Server.Name);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Summary description for LogonUser.
|
||||
/// </summary>
|
||||
internal sealed class Impersonate
|
||||
{
|
||||
|
||||
[SuppressMessage("Microsoft.Globalization", "CA2101:SpecifyMarshalingForPInvokeStringArguments", MessageId="0", Justification="Temporary suppression: Revisit in SQL 11")]
|
||||
[SuppressMessage("Microsoft.Globalization", "CA2101:SpecifyMarshalingForPInvokeStringArguments", MessageId="1", Justification="Temporary suppression: Revisit in SQL 11")]
|
||||
[SuppressMessage("Microsoft.Globalization", "CA2101:SpecifyMarshalingForPInvokeStringArguments", MessageId="2", Justification="Temporary suppression: Revisit in SQL 11")]
|
||||
[DllImport("advapi32", SetLastError=true)]
|
||||
internal static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword,
|
||||
int dwLogonType, int dwLogonProvider, out IntPtr phToken);
|
||||
|
||||
[DllImport("Kernel32")]
|
||||
internal static extern int GetLastError();
|
||||
|
||||
[DllImport("advapi32")]
|
||||
internal static extern bool CloseHandle(IntPtr phToken);
|
||||
|
||||
internal static string LogonUserManaged(string userName, string password, ref IntPtr token)
|
||||
{
|
||||
string [] pair = userName.Split("\\".ToCharArray());
|
||||
int LogonMethod = 3; // logon using blah
|
||||
|
||||
if (pair.Length > 2)
|
||||
{
|
||||
return "SRError.InvalidUsername(userName)";
|
||||
}
|
||||
|
||||
bool retval = false;
|
||||
|
||||
if (pair.Length == 2)
|
||||
{
|
||||
retval = Impersonate.LogonUser(pair[1], pair[0], password, LogonMethod, 0, out token);
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = Impersonate.LogonUser(pair[0], ".", password, LogonMethod, 0, out token);
|
||||
}
|
||||
if (true == retval)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "SRError.LogonFailed(userName)";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,609 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Xml;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Resources;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SqlServerAgentPropertiesAdvanced.
|
||||
/// </summary>
|
||||
//public class SqlServerAgentPropertiesAdvanced : System.Windows.Forms.Form
|
||||
internal class SqlServerAgentPropertiesAdvanced : ManagementActionBase
|
||||
{
|
||||
#region UI controls members
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
// private System.ComponentModel.Container components = null;
|
||||
// private Microsoft.SqlServer.Management.Controls.Separator separatorEventForwarding;
|
||||
// private System.Windows.Forms.CheckBox checkForwardEVents;
|
||||
// private System.Windows.Forms.Label labelServerName;
|
||||
// private System.Windows.Forms.Label labelEvents;
|
||||
// private System.Windows.Forms.RadioButton radioEventsUnhandled;
|
||||
// private System.Windows.Forms.RadioButton radioEventsAll;
|
||||
// private System.Windows.Forms.Label labelEventSeverity;
|
||||
// private System.Windows.Forms.ComboBox comboEventSeverity;
|
||||
// private Microsoft.SqlServer.Management.Controls.Separator separatorIdleCPU;
|
||||
// private System.Windows.Forms.CheckBox checkCPUIdleCondition;
|
||||
// private System.Windows.Forms.Label labelCPUAverageUsage;
|
||||
// private System.Windows.Forms.NumericUpDown numCPUUsage;
|
||||
// private System.Windows.Forms.Label labelCPUPercent;
|
||||
// private System.Windows.Forms.Label labelCPUTImeBelow;
|
||||
// private System.Windows.Forms.Label labelCPUSeconds;
|
||||
// private System.Windows.Forms.NumericUpDown textCPUTimeBelow;
|
||||
// private System.Windows.Forms.TextBox textBoxForwardingServer;
|
||||
#endregion
|
||||
|
||||
#region Trace support
|
||||
public const string m_strComponentName = "SqlServerAgentPropAdvanced";
|
||||
private string ComponentName
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_strComponentName;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ctors
|
||||
public SqlServerAgentPropertiesAdvanced()
|
||||
{
|
||||
}
|
||||
|
||||
public SqlServerAgentPropertiesAdvanced(CDataContainer dataContainer)
|
||||
{
|
||||
DataContainer = dataContainer;
|
||||
//this.HelpF1Keyword = AssemblyVersionInfo.VersionHelpKeywordPrefix + @".ag.agent.advanced.f1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Utils
|
||||
|
||||
// private bool VerifyUI()
|
||||
// {
|
||||
// bool allOK = true;
|
||||
// allOK = CUtils.ValidateNumeric(this.numCPUUsage,SRError.InvalidNumericalValue(SRError.ControlCpuUsage,this.numCPUUsage.Minimum,this.numCPUUsage.Maximum),true);
|
||||
// if (false == allOK)
|
||||
// {
|
||||
// return allOK;
|
||||
// }
|
||||
// allOK = CUtils.ValidateNumeric(this.textCPUTimeBelow,SRError.InvalidNumericalValue(SRError.ControlRemainsBelowLevelFor,this.textCPUTimeBelow.Minimum,this.textCPUTimeBelow.Maximum),true);
|
||||
// if (false == allOK)
|
||||
// {
|
||||
// return allOK;
|
||||
// }
|
||||
// return allOK;
|
||||
// }
|
||||
|
||||
// private void SetControlsForForwarding(bool enabled)
|
||||
// {
|
||||
// this.textBoxForwardingServer.Enabled = enabled;
|
||||
// this.radioEventsAll.Enabled = enabled;
|
||||
// this.radioEventsUnhandled.Enabled = enabled;
|
||||
// this.comboEventSeverity.Enabled = enabled;
|
||||
// }
|
||||
|
||||
// private void SetControlsForIdleCondition(bool enabled)
|
||||
// {
|
||||
// this.numCPUUsage.Enabled = enabled;
|
||||
// this.textCPUTimeBelow.Enabled = enabled;
|
||||
// }
|
||||
|
||||
// private void PopulateEventSeverityCombo()
|
||||
// {
|
||||
// this.comboEventSeverity.Items.Clear();
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_001);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_002);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_003);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_004);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_005);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_006);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_007);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_008);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_009);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_010);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_011);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_012);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_013);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_014);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_015);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_016);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_017);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_018);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_019);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_020);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_021);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_022);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_023);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_024);
|
||||
// this.comboEventSeverity.Items.Add(SqlServerAgentSR.EventSeverity_025);
|
||||
// this.comboEventSeverity.SelectedIndex = 0;
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation
|
||||
// private void ApplyChanges()
|
||||
// {
|
||||
// this.ExecutionMode = ExecutionMode.Success;
|
||||
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
|
||||
// bool AlterValuesAgent = false;
|
||||
// bool AlterValuesAlert = false;
|
||||
|
||||
// string OrigialAlertForwardingServer = agent.AlertSystem.ForwardingServer;
|
||||
// string CurrentAlertForwardingServer = "";
|
||||
// bool CurrentForwardedAlways = this.radioEventsAll.Checked;
|
||||
|
||||
// if(this.checkForwardEVents.Checked == true)
|
||||
// {
|
||||
// CurrentAlertForwardingServer = this.textBoxForwardingServer.Text;
|
||||
// }
|
||||
|
||||
// try
|
||||
// {
|
||||
// if(CurrentAlertForwardingServer != OrigialAlertForwardingServer)
|
||||
// {
|
||||
// AlterValuesAlert = true;
|
||||
// agent.AlertSystem.ForwardingServer = CurrentAlertForwardingServer;
|
||||
// }
|
||||
|
||||
// if(CurrentAlertForwardingServer.Length > 0)
|
||||
// {
|
||||
|
||||
// if(agent.AlertSystem.IsForwardedAlways != CurrentForwardedAlways)
|
||||
// {
|
||||
// AlterValuesAlert = true;
|
||||
// agent.AlertSystem.IsForwardedAlways = CurrentForwardedAlways;
|
||||
// }
|
||||
|
||||
// int SelectedSevIndex = this.comboEventSeverity.SelectedIndex;
|
||||
|
||||
// if(agent.AlertSystem.ForwardingSeverity != SelectedSevIndex + 1)
|
||||
// {
|
||||
// AlterValuesAlert = true;
|
||||
// agent.AlertSystem.ForwardingSeverity = SelectedSevIndex +1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(agent.IsCpuPollingEnabled != this.checkCPUIdleCondition.Checked)
|
||||
// {
|
||||
// AlterValuesAgent = true;
|
||||
// agent.IsCpuPollingEnabled = this.checkCPUIdleCondition.Checked;
|
||||
// }
|
||||
// if(true == this.checkCPUIdleCondition.Checked)
|
||||
// {
|
||||
// if(this.numCPUUsage.Value != agent.IdleCpuPercentage)
|
||||
// {
|
||||
// AlterValuesAgent = true;
|
||||
// agent.IdleCpuPercentage = (int)this.numCPUUsage.Value;
|
||||
// }
|
||||
// if(this.textCPUTimeBelow.Value != agent.IdleCpuDuration)
|
||||
// {
|
||||
// AlterValuesAgent = true;
|
||||
// agent.IdleCpuDuration = (int)this.textCPUTimeBelow.Value;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// if(true == AlterValuesAlert)
|
||||
// {
|
||||
// agent.AlertSystem.Alter();
|
||||
// }
|
||||
// if(true == AlterValuesAgent)
|
||||
// {
|
||||
// agent.Alter();
|
||||
// }
|
||||
// }
|
||||
// catch(SmoException smoex)
|
||||
// {
|
||||
// DisplayExceptionMessage(smoex);
|
||||
// this.ExecutionMode = ExecutionMode.Failure;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// DisplayExceptionMessage(ex);
|
||||
// this.ExecutionMode = ExecutionMode.Failure;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// private void InitProperties()
|
||||
// {
|
||||
// PopulateEventSeverityCombo();
|
||||
|
||||
// DataContainer.Server.Refresh();
|
||||
// DataContainer.Server.JobServer.Refresh();
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
// string AlertForwardingServer = agent.AlertSystem.ForwardingServer;
|
||||
// bool managedInstance = DataContainer.Server.DatabaseEngineEdition == DatabaseEngineEdition.SqlManagedInstance;
|
||||
|
||||
// if(AlertForwardingServer.Length != 0 && !managedInstance)
|
||||
// {
|
||||
// this.checkForwardEVents.Checked = true;
|
||||
// SetControlsForForwarding(true);
|
||||
// this.textBoxForwardingServer.Text = AlertForwardingServer;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.checkForwardEVents.Checked = false;
|
||||
// SetControlsForForwarding(false);
|
||||
|
||||
// // Managed Instance does not allow forwarding events
|
||||
// // to a different server
|
||||
// //
|
||||
// this.checkForwardEVents.Enabled = !managedInstance;
|
||||
|
||||
// }
|
||||
// this.radioEventsAll.Checked = agent.AlertSystem.IsForwardedAlways;
|
||||
|
||||
// /// Assume that the items in the combo are int ordered from 1- 25
|
||||
// ///
|
||||
|
||||
// try
|
||||
// {
|
||||
// int RetrievedSeverityValue = agent.AlertSystem.ForwardingSeverity - 1;
|
||||
// if (RetrievedSeverityValue > this.comboEventSeverity.Items.Count - 1)
|
||||
// {
|
||||
// RetrievedSeverityValue = 0;
|
||||
// }
|
||||
|
||||
// this.comboEventSeverity.SelectedIndex = RetrievedSeverityValue;
|
||||
// }
|
||||
// catch (SmoException )
|
||||
// {
|
||||
// //DisplayExceptionMessage(se);
|
||||
// this.comboEventSeverity.Enabled = false;
|
||||
// this.comboEventSeverity.SelectedIndex = 0;
|
||||
// }
|
||||
|
||||
// bool enable = this.checkCPUIdleCondition.Checked = agent.IsCpuPollingEnabled;
|
||||
// SetControlsForIdleCondition(enable);
|
||||
// this.numCPUUsage.Tag = this.numCPUUsage.Value = agent.IdleCpuPercentage;
|
||||
// this.numCPUUsage.Text = this.numCPUUsage.Value.ToString(System.Globalization.CultureInfo.CurrentCulture);
|
||||
// this.numCPUUsage.Update();
|
||||
|
||||
// this.textCPUTimeBelow.Tag = this.textCPUTimeBelow.Value = agent.IdleCpuDuration;
|
||||
// this.textCPUTimeBelow.Text = this.textCPUTimeBelow.Value.ToString(System.Globalization.CultureInfo.CurrentCulture);
|
||||
// this.textCPUTimeBelow.Update();
|
||||
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPanenForm Implementation
|
||||
|
||||
// UserControl IPanelForm.Panel
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// IPanelForm.OnInitialization
|
||||
// ///
|
||||
// /// TODO - in order to reduce IPanelForm container load time
|
||||
// /// and to improve performance, IPanelForm-s should be able
|
||||
// /// to lazy-initialize themself when IPanelForm.OnInitialization
|
||||
// /// is called (a continer like TreePanelForm calls the
|
||||
// /// OnInitialization() method before first OnSelection())
|
||||
// /// </summary>
|
||||
// void IPanelForm.OnInitialization()
|
||||
// {
|
||||
// InitProperties();
|
||||
// }
|
||||
|
||||
|
||||
// public override void OnRunNow (object sender)
|
||||
// {
|
||||
// base.OnRunNow(sender);
|
||||
// ApplyChanges();
|
||||
// }
|
||||
|
||||
|
||||
// public override void OnReset(object sender)
|
||||
// {
|
||||
// base.OnReset(sender);
|
||||
|
||||
// this.DataContainer.Server.JobServer.Refresh();
|
||||
// this.DataContainer.Server.JobServer.AlertSystem.Refresh();
|
||||
// InitProperties();
|
||||
// }
|
||||
|
||||
|
||||
// void IPanelForm.OnSelection(TreeNode node)
|
||||
// {
|
||||
// }
|
||||
|
||||
|
||||
// void IPanelForm.OnPanelLoseSelection(TreeNode node)
|
||||
// {
|
||||
// }
|
||||
|
||||
|
||||
// bool ISupportValidation.Validate()
|
||||
// {
|
||||
// if (false == VerifyUI())
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// return base.Validate();
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
// protected override void Dispose( bool disposing )
|
||||
// {
|
||||
// if( disposing )
|
||||
// {
|
||||
// if(components != null)
|
||||
// {
|
||||
// components.Dispose();
|
||||
// }
|
||||
// }
|
||||
// base.Dispose( disposing );
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Windows Form Designer generated code
|
||||
// /// <summary>
|
||||
// /// Required method for Designer support - do not modify
|
||||
// /// the contents of this method with the code editor.
|
||||
// /// </summary>
|
||||
// private void InitializeComponent()
|
||||
// {
|
||||
// System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SqlServerAgentPropertiesAdvanced));
|
||||
// this.separatorEventForwarding = new Microsoft.SqlServer.Management.Controls.Separator();
|
||||
// this.checkForwardEVents = new System.Windows.Forms.CheckBox();
|
||||
// this.labelServerName = new System.Windows.Forms.Label();
|
||||
// this.labelEvents = new System.Windows.Forms.Label();
|
||||
// this.radioEventsUnhandled = new System.Windows.Forms.RadioButton();
|
||||
// this.radioEventsAll = new System.Windows.Forms.RadioButton();
|
||||
// this.labelEventSeverity = new System.Windows.Forms.Label();
|
||||
// this.comboEventSeverity = new System.Windows.Forms.ComboBox();
|
||||
// this.separatorIdleCPU = new Microsoft.SqlServer.Management.Controls.Separator();
|
||||
// this.checkCPUIdleCondition = new System.Windows.Forms.CheckBox();
|
||||
// this.labelCPUAverageUsage = new System.Windows.Forms.Label();
|
||||
// this.numCPUUsage = new System.Windows.Forms.NumericUpDown();
|
||||
// this.labelCPUPercent = new System.Windows.Forms.Label();
|
||||
// this.labelCPUTImeBelow = new System.Windows.Forms.Label();
|
||||
// this.labelCPUSeconds = new System.Windows.Forms.Label();
|
||||
// this.textCPUTimeBelow = new System.Windows.Forms.NumericUpDown();
|
||||
// this.textBoxForwardingServer = new System.Windows.Forms.TextBox();
|
||||
// ((System.ComponentModel.ISupportInitialize)(this.numCPUUsage)).BeginInit();
|
||||
// ((System.ComponentModel.ISupportInitialize)(this.textCPUTimeBelow)).BeginInit();
|
||||
// this.SuspendLayout();
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
// //
|
||||
// // separatorEventForwarding
|
||||
// //
|
||||
// resources.ApplyResources(this.separatorEventForwarding, "separatorEventForwarding");
|
||||
// this.separatorEventForwarding.Name = "separatorEventForwarding";
|
||||
// //
|
||||
// // checkForwardEVents
|
||||
// //
|
||||
// resources.ApplyResources(this.checkForwardEVents, "checkForwardEVents");
|
||||
// this.checkForwardEVents.Name = "checkForwardEVents";
|
||||
// this.checkForwardEVents.CheckedChanged += new System.EventHandler(this.checkForwardEVents_CheckedChanged);
|
||||
// //
|
||||
// // labelServerName
|
||||
// //
|
||||
// resources.ApplyResources(this.labelServerName, "labelServerName");
|
||||
// this.labelServerName.Name = "labelServerName";
|
||||
// //
|
||||
// // labelEvents
|
||||
// //
|
||||
// resources.ApplyResources(this.labelEvents, "labelEvents");
|
||||
// this.labelEvents.Name = "labelEvents";
|
||||
// //
|
||||
// // radioEventsUnhandled
|
||||
// //
|
||||
// resources.ApplyResources(this.radioEventsUnhandled, "radioEventsUnhandled");
|
||||
// this.radioEventsUnhandled.Checked = true;
|
||||
// this.radioEventsUnhandled.Name = "radioEventsUnhandled";
|
||||
// this.radioEventsUnhandled.TabStop = true;
|
||||
// //
|
||||
// // radioEventsAll
|
||||
// //
|
||||
// resources.ApplyResources(this.radioEventsAll, "radioEventsAll");
|
||||
// this.radioEventsAll.Name = "radioEventsAll";
|
||||
// //
|
||||
// // labelEventSeverity
|
||||
// //
|
||||
// resources.ApplyResources(this.labelEventSeverity, "labelEventSeverity");
|
||||
// this.labelEventSeverity.Name = "labelEventSeverity";
|
||||
// //
|
||||
// // comboEventSeverity
|
||||
// //
|
||||
// resources.ApplyResources(this.comboEventSeverity, "comboEventSeverity");
|
||||
// this.comboEventSeverity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
// this.comboEventSeverity.FormattingEnabled = true;
|
||||
// this.comboEventSeverity.Name = "comboEventSeverity";
|
||||
// //
|
||||
// // separatorIdleCPU
|
||||
// //
|
||||
// resources.ApplyResources(this.separatorIdleCPU, "separatorIdleCPU");
|
||||
// this.separatorIdleCPU.Name = "separatorIdleCPU";
|
||||
// //
|
||||
// // checkCPUIdleCondition
|
||||
// //
|
||||
// resources.ApplyResources(this.checkCPUIdleCondition, "checkCPUIdleCondition");
|
||||
// this.checkCPUIdleCondition.Name = "checkCPUIdleCondition";
|
||||
// this.checkCPUIdleCondition.CheckedChanged += new System.EventHandler(this.checkCPUIdleCondition_CheckedChanged);
|
||||
// //
|
||||
// // labelCPUAverageUsage
|
||||
// //
|
||||
// resources.ApplyResources(this.labelCPUAverageUsage, "labelCPUAverageUsage");
|
||||
// this.labelCPUAverageUsage.Name = "labelCPUAverageUsage";
|
||||
// //
|
||||
// // numCPUUsage
|
||||
// //
|
||||
// resources.ApplyResources(this.numCPUUsage, "numCPUUsage");
|
||||
// this.numCPUUsage.Minimum = new decimal(new int[] {
|
||||
// 10,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0});
|
||||
// this.numCPUUsage.Name = "numCPUUsage";
|
||||
// this.numCPUUsage.Value = new decimal(new int[] {
|
||||
// 10,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0});
|
||||
// this.numCPUUsage.Enter += new System.EventHandler(this.numCPUUsage_Enter);
|
||||
// this.numCPUUsage.ValueChanged += new System.EventHandler(this.numCPUUsage_ValueChanged);
|
||||
// this.numCPUUsage.Leave += new System.EventHandler(this.numCPUUsage_Leave);
|
||||
// //
|
||||
// // labelCPUPercent
|
||||
// //
|
||||
// resources.ApplyResources(this.labelCPUPercent, "labelCPUPercent");
|
||||
// this.labelCPUPercent.Name = "labelCPUPercent";
|
||||
// //
|
||||
// // labelCPUTImeBelow
|
||||
// //
|
||||
// resources.ApplyResources(this.labelCPUTImeBelow, "labelCPUTImeBelow");
|
||||
// this.labelCPUTImeBelow.Name = "labelCPUTImeBelow";
|
||||
// //
|
||||
// // labelCPUSeconds
|
||||
// //
|
||||
// resources.ApplyResources(this.labelCPUSeconds, "labelCPUSeconds");
|
||||
// this.labelCPUSeconds.Name = "labelCPUSeconds";
|
||||
// //
|
||||
// // textCPUTimeBelow
|
||||
// //
|
||||
// resources.ApplyResources(this.textCPUTimeBelow, "textCPUTimeBelow");
|
||||
// this.textCPUTimeBelow.Maximum = new decimal(new int[] {
|
||||
// 86400,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0});
|
||||
// this.textCPUTimeBelow.Minimum = new decimal(new int[] {
|
||||
// 20,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0});
|
||||
// this.textCPUTimeBelow.Name = "textCPUTimeBelow";
|
||||
// this.textCPUTimeBelow.Value = new decimal(new int[] {
|
||||
// 600,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0});
|
||||
// this.textCPUTimeBelow.Enter += new System.EventHandler(this.textCPUTimeBelow_Enter);
|
||||
// this.textCPUTimeBelow.ValueChanged += new System.EventHandler(this.textCPUTimeBelow_ValueChanged);
|
||||
// this.textCPUTimeBelow.Leave += new System.EventHandler(this.textCPUTimeBelow_Leave);
|
||||
// //
|
||||
// // textBoxForwardingServer
|
||||
// //
|
||||
// resources.ApplyResources(this.textBoxForwardingServer, "textBoxForwardingServer");
|
||||
// this.textBoxForwardingServer.Name = "textBoxForwardingServer";
|
||||
// //
|
||||
// // SqlServerAgentPropertiesAdvanced
|
||||
// //
|
||||
// this.Controls.Add(this.textBoxForwardingServer);
|
||||
// this.Controls.Add(this.textCPUTimeBelow);
|
||||
// this.Controls.Add(this.labelCPUSeconds);
|
||||
// this.Controls.Add(this.labelCPUTImeBelow);
|
||||
// this.Controls.Add(this.labelCPUPercent);
|
||||
// this.Controls.Add(this.numCPUUsage);
|
||||
// this.Controls.Add(this.labelCPUAverageUsage);
|
||||
// this.Controls.Add(this.checkCPUIdleCondition);
|
||||
// this.Controls.Add(this.separatorIdleCPU);
|
||||
// this.Controls.Add(this.comboEventSeverity);
|
||||
// this.Controls.Add(this.labelEventSeverity);
|
||||
// this.Controls.Add(this.radioEventsAll);
|
||||
// this.Controls.Add(this.radioEventsUnhandled);
|
||||
// this.Controls.Add(this.labelEvents);
|
||||
// this.Controls.Add(this.labelServerName);
|
||||
// this.Controls.Add(this.checkForwardEVents);
|
||||
// this.Controls.Add(this.separatorEventForwarding);
|
||||
// this.Name = "SqlServerAgentPropertiesAdvanced";
|
||||
// resources.ApplyResources(this, "$this");
|
||||
// ((System.ComponentModel.ISupportInitialize)(this.numCPUUsage)).EndInit();
|
||||
// ((System.ComponentModel.ISupportInitialize)(this.textCPUTimeBelow)).EndInit();
|
||||
// this.ResumeLayout(false);
|
||||
// this.PerformLayout();
|
||||
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region UI controls event handlers
|
||||
|
||||
// private void checkForwardEVents_CheckedChanged(object sender, System.EventArgs e)
|
||||
// {
|
||||
// bool IsChecked = this.checkForwardEVents.Checked;
|
||||
// SetControlsForForwarding(IsChecked);
|
||||
// }
|
||||
|
||||
// private void checkCPUIdleCondition_CheckedChanged(object sender, System.EventArgs e)
|
||||
// {
|
||||
// bool IsChecked = this.checkCPUIdleCondition.Checked;
|
||||
// SetControlsForIdleCondition(IsChecked);
|
||||
// }
|
||||
|
||||
// private void numCPUUsage_Leave(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// //bool bOK = CUtils.ValidateNumeric(this.numCPUUsage,SRError.InvalidNumericalValue(SRError.ControlCpuUsage,this.numCPUUsage.Minimum,this.numCPUUsage.Maximum),true);
|
||||
// }
|
||||
|
||||
// private void textCPUTimeBelow_Leave(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// //bool bOK = CUtils.ValidateNumeric(this.textCPUTimeBelow,SRError.InvalidNumericalValue(SRError.ControlRemainsBelowLevelFor,this.textCPUTimeBelow.Minimum,this.textCPUTimeBelow.Maximum),true);
|
||||
// }
|
||||
|
||||
// private void numCPUUsage_ValueChanged(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// STrace.Trace(m_strComponentName,numCPUUsage.Value.ToString(System.Globalization.CultureInfo.CurrentCulture));
|
||||
// }
|
||||
|
||||
// private void textCPUTimeBelow_ValueChanged(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// STrace.Trace(m_strComponentName,textCPUTimeBelow.Value.ToString(System.Globalization.CultureInfo.CurrentCulture));
|
||||
// }
|
||||
|
||||
// private void numCPUUsage_Enter(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// this.numCPUUsage.Tag = this.numCPUUsage.Value;
|
||||
// }
|
||||
|
||||
// private void textCPUTimeBelow_Enter(System.Object sender, System.EventArgs e)
|
||||
// {
|
||||
// this.textCPUTimeBelow.Tag = this.textCPUTimeBelow.Value;
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,470 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Resources;
|
||||
using System.Xml;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Smo.Mail;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SqlServerAgentPropertiesAlertSystem.
|
||||
/// </summary>
|
||||
internal class SqlServerAgentPropertiesAlertSystem : ManagementActionBase
|
||||
{
|
||||
public override void OnRunNow(object sender)
|
||||
{
|
||||
base.OnRunNow(sender);
|
||||
ApplyChanges();
|
||||
}
|
||||
|
||||
#region ctors
|
||||
public SqlServerAgentPropertiesAlertSystem(CDataContainer dataContainer)
|
||||
{
|
||||
DataContainer = dataContainer;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private void ApplyChanges()
|
||||
{
|
||||
//this.ExecutionMode = ExecutionMode.Success;
|
||||
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
// bool isSQL2005 = this.DataContainer.Server.Information.Version.Major >= SQL2005;
|
||||
|
||||
// bool AlterValues = false;
|
||||
// bool AlterAlertValues = false;
|
||||
// bool MustAlterProfile = false;
|
||||
|
||||
// try
|
||||
// {
|
||||
// // mail system
|
||||
// AgentMailType mailType;
|
||||
// if (isSQL2005)
|
||||
// {
|
||||
// mailType = agent.AgentMailType;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// mailType = AgentMailType.SqlAgentMail;
|
||||
// }
|
||||
// if (null != this.comboBoxMailSystem.SelectedItem)
|
||||
// {
|
||||
// if (this.comboBoxMailSystem.SelectedItem.ToString() == SqlServerAgentSR.SQLMail)
|
||||
// {
|
||||
// if (mailType != AgentMailType.SqlAgentMail)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// MustAlterProfile = true;
|
||||
// mailType = AgentMailType.SqlAgentMail;
|
||||
// agent.AgentMailType = AgentMailType.SqlAgentMail;
|
||||
// }
|
||||
// }
|
||||
// else if (this.comboBoxMailSystem.SelectedItem.ToString() == SqlServerAgentSR.SQLIMail)
|
||||
// {
|
||||
// if (mailType != AgentMailType.DatabaseMail)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// MustAlterProfile = true;
|
||||
// mailType = AgentMailType.DatabaseMail;
|
||||
// agent.AgentMailType = AgentMailType.DatabaseMail;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(false, "unknown selection for mail system");
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (this.checkEnableMailProfile.Checked == false)
|
||||
// {
|
||||
// // disable profiles
|
||||
// if (
|
||||
// (agent.SqlAgentMailProfile.Length != 0) ||
|
||||
// (true == isSQL2005 && agent.DatabaseMailProfile.Length != 0)
|
||||
// )
|
||||
// {
|
||||
// AlterValues = true;
|
||||
|
||||
// agent.SqlAgentMailProfile = String.Empty;
|
||||
// if (true == isSQL2005)
|
||||
// {
|
||||
// agent.DatabaseMailProfile = String.Empty;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // enable profiles
|
||||
// if
|
||||
// (
|
||||
// (agent.SqlAgentMailProfile.Length == 0) &&
|
||||
// (true == isSQL2005 && agent.DatabaseMailProfile.Length == 0)
|
||||
// )
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// MustAlterProfile = true;
|
||||
// }
|
||||
|
||||
// if
|
||||
// (
|
||||
// (mailType == AgentMailType.SqlAgentMail) &&
|
||||
// (
|
||||
// (agent.SqlAgentMailProfile != this.comboMailProfiles.Text) ||
|
||||
// (MustAlterProfile == true)
|
||||
// )
|
||||
// )
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.SqlAgentMailProfile = this.comboMailProfiles.Text;
|
||||
// }
|
||||
|
||||
// if
|
||||
// ((true == isSQL2005) &&
|
||||
// (mailType == AgentMailType.DatabaseMail) &&
|
||||
// (
|
||||
// (agent.DatabaseMailProfile != this.comboMailProfiles.Text) ||
|
||||
// (MustAlterProfile == true)
|
||||
// )
|
||||
// )
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.DatabaseMailProfile = this.comboMailProfiles.Text;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // save to sent folder
|
||||
|
||||
// if (this.checkSaveMailsToSentFolder.Checked != agent.SaveInSentFolder)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.SaveInSentFolder = this.checkSaveMailsToSentFolder.Checked;
|
||||
// }
|
||||
|
||||
// // rest of ui
|
||||
|
||||
// string LineTemplate = this.textToPrefix.Text;
|
||||
|
||||
// if (true == this.checkToAddress.Checked)
|
||||
// {
|
||||
// LineTemplate += AlertEnginePagerAddressToken + this.textToSuffix.Text;
|
||||
// }
|
||||
|
||||
// if (LineTemplate != agent.AlertSystem.PagerToTemplate)
|
||||
// {
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.PagerToTemplate = LineTemplate;
|
||||
// }
|
||||
|
||||
// LineTemplate = this.textCCPrfix.Text;
|
||||
// if (true == this.checkCCAddress.Checked)
|
||||
// {
|
||||
// LineTemplate += AlertEnginePagerAddressToken + this.textCCSuffix.Text;
|
||||
// }
|
||||
// if (LineTemplate != agent.AlertSystem.PagerCCTemplate)
|
||||
// {
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.PagerCCTemplate = LineTemplate;
|
||||
// }
|
||||
|
||||
// LineTemplate = this.textSubjectPrefix.Text + AlertEngineSubjectToken + this.textSubjectSuffix.Text;
|
||||
// if (LineTemplate != agent.AlertSystem.PagerSubjectTemplate &&
|
||||
// agent.AlertSystem.PagerSubjectTemplate.Length > 0)
|
||||
// {
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.PagerSubjectTemplate = LineTemplate;
|
||||
// }
|
||||
|
||||
// if (true == isSQL2005)
|
||||
// {
|
||||
// bool isTokenRplacementEnabled = this.checkBoxTokenReplacement.Checked;
|
||||
// if (isTokenRplacementEnabled != agent.ReplaceAlertTokensEnabled)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.ReplaceAlertTokensEnabled = isTokenRplacementEnabled;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (this.checkPagerIncludeBody.Checked != !agent.AlertSystem.PagerSendSubjectOnly)
|
||||
// {
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.PagerSendSubjectOnly = !this.checkPagerIncludeBody.Checked;
|
||||
// }
|
||||
|
||||
// string currentOperator = agent.AlertSystem.FailSafeOperator;
|
||||
// string selectedOperator = Convert.ToString(this.comboOperators.SelectedItem,
|
||||
// System.Globalization.CultureInfo.CurrentUICulture);
|
||||
|
||||
// if (this.checkEnableOperator.Checked &&
|
||||
// (currentOperator.Length == 0 || (currentOperator != selectedOperator)))
|
||||
// {
|
||||
// // update the operator to the new value
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.FailSafeOperator = selectedOperator;
|
||||
// }
|
||||
// else if (!this.checkEnableOperator.Checked && currentOperator.Length > 0)
|
||||
// {
|
||||
// // reset the operator
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.FailSafeOperator = string.Empty;
|
||||
// }
|
||||
|
||||
// int CurrentNotifyValue = 0;
|
||||
// if (this.checkNotifyEmail.Checked == true)
|
||||
// {
|
||||
// CurrentNotifyValue |= (int) NotifyMethods.NotifyEmail;
|
||||
// }
|
||||
|
||||
// if (this.checkNotifyPager.Checked == true)
|
||||
// {
|
||||
// CurrentNotifyValue |= (int) NotifyMethods.Pager;
|
||||
// }
|
||||
|
||||
// if (true == this.checkEnableOperator.Checked)
|
||||
// {
|
||||
// if (CurrentNotifyValue != (int) agent.AlertSystem.NotificationMethod)
|
||||
// {
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.NotificationMethod =
|
||||
// (Microsoft.SqlServer.Management.Smo.Agent.NotifyMethods) CurrentNotifyValue;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (agent.AlertSystem.NotificationMethod != NotifyMethods.None)
|
||||
// {
|
||||
// AlterAlertValues = true;
|
||||
// agent.AlertSystem.NotificationMethod = NotifyMethods.None;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (true == AlterAlertValues)
|
||||
// {
|
||||
// agent.AlertSystem.Alter();
|
||||
// }
|
||||
|
||||
// if (true == AlterValues)
|
||||
// {
|
||||
// agent.Alter();
|
||||
// }
|
||||
// }
|
||||
// catch (SmoException smoex)
|
||||
// {
|
||||
// DisplayExceptionMessage(smoex);
|
||||
// this.ExecutionMode = ExecutionMode.Failure;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// private void InitProperties()
|
||||
// {
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
|
||||
// bool isSql2005 = DataContainer.Server.Information.Version.Major >= SQL2005;
|
||||
// bool isSqlIMailEnabled = isSql2005 && this.DataContainer.Server.Databases["msdb"].IsMailHost == true;
|
||||
|
||||
// ExtendedStoredProcedure sendMail =
|
||||
// this.DataContainer.Server.Databases["master"].ExtendedStoredProcedures["xp_sendmail", "sys"];
|
||||
|
||||
// bool isSqlMailEnabled = (null != sendMail);
|
||||
|
||||
|
||||
// //bool isSqlMailEnabled = this.DataContainer.Server.Databases["master"].ExtendedStoredProcedures.Contains("sys.xp_sendmail");
|
||||
|
||||
// bool isMailEnabled = isSqlIMailEnabled || isSqlMailEnabled;
|
||||
|
||||
// this.checkEnableMailProfile.Enabled = isMailEnabled;
|
||||
|
||||
// this.checkEnableMailProfile.Checked = (isMailEnabled == true) &&
|
||||
// ((agent.SqlAgentMailProfile.Length != 0) ||
|
||||
// (isSql2005 && agent.DatabaseMailProfile.Length != 0));
|
||||
|
||||
// if (true == isSql2005)
|
||||
// {
|
||||
// bool isTokenReplacementEnabled = agent.ReplaceAlertTokensEnabled;
|
||||
// this.checkBoxTokenReplacement.Enabled = true;
|
||||
// this.checkBoxTokenReplacement.Checked = isTokenReplacementEnabled;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.checkBoxTokenReplacement.Enabled = false;
|
||||
// this.checkBoxTokenReplacement.Checked = false;
|
||||
// }
|
||||
|
||||
// string ToLineTemplate = agent.AlertSystem.PagerToTemplate;
|
||||
// int pos = ToLineTemplate.IndexOf(AlertEnginePagerAddressToken, StringComparison.Ordinal);
|
||||
// if (pos > 0)
|
||||
// {
|
||||
// this.textToPrefix.Text = ToLineTemplate.Substring(0, pos);
|
||||
// this.checkToAddress.Checked = true;
|
||||
// pos += AlertEnginePagerAddressToken.Length;
|
||||
// this.textToSuffix.Text = ToLineTemplate.Substring(pos, ToLineTemplate.Length - pos);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.textToPrefix.Text = ToLineTemplate;
|
||||
// this.checkToAddress.Checked = false;
|
||||
// this.textToSuffix.Enabled = false;
|
||||
// }
|
||||
|
||||
// string CcLineTemplate = agent.AlertSystem.PagerCCTemplate;
|
||||
// pos = CcLineTemplate.IndexOf(AlertEnginePagerAddressToken, StringComparison.Ordinal);
|
||||
// if (pos > 0)
|
||||
// {
|
||||
// this.textCCPrfix.Text = CcLineTemplate.Substring(0, pos);
|
||||
// this.checkCCAddress.Checked = true;
|
||||
// pos += AlertEnginePagerAddressToken.Length;
|
||||
// this.textCCSuffix.Text = CcLineTemplate.Substring(pos, CcLineTemplate.Length - pos);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.textCCPrfix.Text = CcLineTemplate;
|
||||
// this.checkCCAddress.Checked = false;
|
||||
// this.textCCSuffix.Enabled = false;
|
||||
// }
|
||||
|
||||
// string SubjectLineTemplate = agent.AlertSystem.PagerSubjectTemplate;
|
||||
// pos = SubjectLineTemplate.IndexOf(AlertEngineSubjectToken, StringComparison.Ordinal);
|
||||
|
||||
// if (pos > -1)
|
||||
// {
|
||||
// this.textSubjectPrefix.Text = SubjectLineTemplate.Substring(0, pos);
|
||||
// pos += AlertEngineSubjectToken.Length;
|
||||
// this.textSubjectSuffix.Text = SubjectLineTemplate.Substring(pos, SubjectLineTemplate.Length - pos);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /// We should throw ex here
|
||||
// }
|
||||
|
||||
|
||||
// try
|
||||
// {
|
||||
// this.checkPagerIncludeBody.Checked = !agent.AlertSystem.PagerSendSubjectOnly;
|
||||
// }
|
||||
// catch (SmoException)
|
||||
// {
|
||||
// this.checkPagerIncludeBody.Checked = false;
|
||||
// this.checkPagerIncludeBody.Enabled = false;
|
||||
// }
|
||||
|
||||
// PopulateOperatorsCombo();
|
||||
|
||||
|
||||
// try
|
||||
// {
|
||||
// bool enable = this.checkEnableOperator.Checked;
|
||||
// this.checkNotifyEmail.Enabled = enable;
|
||||
// this.checkNotifyPager.Enabled = enable;
|
||||
|
||||
// this.checkNotifyEmail.Checked = ((int) NotifyMethods.NotifyEmail &
|
||||
// (int) agent.AlertSystem.NotificationMethod) > 0;
|
||||
|
||||
// this.checkNotifyPager.Checked = ((int) NotifyMethods.Pager & (int) agent.AlertSystem.NotificationMethod) >
|
||||
// 0;
|
||||
// }
|
||||
// catch (SmoException)
|
||||
// {
|
||||
// this.checkNotifyEmail.Checked = false;
|
||||
// this.checkNotifyPager.Checked = false;
|
||||
// this.checkNotifyEmail.Enabled = false;
|
||||
// this.checkNotifyPager.Enabled = false;
|
||||
// }
|
||||
|
||||
// if (true == isMailEnabled)
|
||||
// {
|
||||
// AgentMailType mailType;
|
||||
// if (isSql2005 == true)
|
||||
// {
|
||||
// if (agent.AgentMailType == AgentMailType.SqlAgentMail && true == isSqlMailEnabled &&
|
||||
// 0 < agent.SqlAgentMailProfile.Length)
|
||||
// {
|
||||
// mailType = agent.AgentMailType;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// mailType = AgentMailType.DatabaseMail;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// mailType = AgentMailType.SqlAgentMail;
|
||||
// }
|
||||
|
||||
// PopulateMailSystemsCombo(mailType, DataContainer.Server.Information.Version);
|
||||
// //PopulateMailProfilesCombo(mailType);
|
||||
// EnableDisableProfilesUI(agent);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.comboBoxMailSystem.Enabled = false;
|
||||
// this.comboMailProfiles.Enabled = false;
|
||||
// this.buttonTest.Enabled = false;
|
||||
// this.checkSaveMailsToSentFolder.Enabled = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the sqlmail profiles
|
||||
/// </summary>
|
||||
/// <param name="server"></param>
|
||||
/// <param name="mailProfiles"></param>
|
||||
private void EnumerateSqlMailProfiles(Microsoft.SqlServer.Management.Smo.Server server,
|
||||
StringCollection mailProfiles)
|
||||
{
|
||||
DataSet ds =
|
||||
server.ConnectionContext.ExecuteWithResults("master.dbo.xp_sqlagent_notify N'M', null, null, null, N'E'");
|
||||
if (null != ds && ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||
{
|
||||
mailProfiles.Add(dr[0].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,159 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Xml;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Resources;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SqlServerAgentPropertiesConnection.
|
||||
/// </summary>
|
||||
internal class SqlServerAgentPropertiesConnection : ManagementActionBase
|
||||
{
|
||||
bool SqlPasswordChanged = false;
|
||||
|
||||
|
||||
#region Implementation
|
||||
|
||||
// private void ApplyChanges()
|
||||
// {
|
||||
// this.ExecutionMode = ExecutionMode.Success;
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
// string OriginalLogin = agent.HostLoginName;
|
||||
// string CurrentLogin = "";
|
||||
// bool AlterValues = false;
|
||||
// try
|
||||
// {
|
||||
// if (true == this.radioSQLAuth.Checked)
|
||||
// {
|
||||
// CurrentLogin = (this.comboLogin.SelectedItem).ToString();
|
||||
// }
|
||||
// if (String.Compare(CurrentLogin, OriginalLogin, StringComparison.OrdinalIgnoreCase) != 0 || true == SqlPasswordChanged)
|
||||
// {
|
||||
// if (CurrentLogin.Length > 0)
|
||||
// {
|
||||
// agent.SetHostLoginAccount(CurrentLogin, this.textPassword.Text);
|
||||
// VerifyLogin();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// agent.ClearHostLoginAccount();
|
||||
// }
|
||||
// }
|
||||
|
||||
// string SelectedAlias = this.comboAliases.Text;
|
||||
|
||||
// if (String.Compare(SelectedAlias, agent.LocalHostAlias, StringComparison.OrdinalIgnoreCase) != 0)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
|
||||
// agent.LocalHostAlias = SelectedAlias;
|
||||
|
||||
// }
|
||||
// if (true == AlterValues)
|
||||
// {
|
||||
// agent.Alter();
|
||||
// }
|
||||
// }
|
||||
// catch (SmoException smoex)
|
||||
// {
|
||||
// DisplayExceptionMessage(smoex);
|
||||
// this.ExecutionMode = ExecutionMode.Failure;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// private void InitProperties()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
|
||||
// if (this.DataContainer.Server.Information.Version.Major < 9)
|
||||
// {
|
||||
|
||||
// PopulateLoginCombo();
|
||||
|
||||
// bool IsWinAuth = (agent.HostLoginName.Length == 0);
|
||||
// this.radioWinAuth.Checked = IsWinAuth;
|
||||
// this.radioSQLAuth.Checked = !IsWinAuth;
|
||||
// if (false == IsWinAuth)
|
||||
// {
|
||||
// string SqlLogin = agent.HostLoginName;
|
||||
// if (!this.comboLogin.Items.Contains(SqlLogin))
|
||||
// {
|
||||
// this.comboLogin.Items.Add(SqlLogin);
|
||||
// }
|
||||
// this.comboLogin.SelectedItem = SqlLogin;
|
||||
// this.textPassword.Text = "**********";
|
||||
// SqlPasswordChanged = false;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.radioWinAuth.Checked = true;
|
||||
// this.radioWinAuth.Enabled = this.radioSQLAuth.Enabled = this.comboLogin.Enabled = false;
|
||||
// this.textPassword.Enabled = this.labelLogin.Enabled = this.labelPasswd.Enabled = false;
|
||||
// }
|
||||
|
||||
// string ServerAliasHost = agent.LocalHostAlias;
|
||||
// this.comboAliases.Text = ServerAliasHost;
|
||||
|
||||
// // Managed Instances do not allow changing
|
||||
// // "alias local host server"
|
||||
// //
|
||||
// this.comboAliases.Enabled = DataContainer.Server.DatabaseEngineEdition != DatabaseEngineEdition.SqlManagedInstance;
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ctors
|
||||
|
||||
public SqlServerAgentPropertiesConnection(CDataContainer dataContainer)
|
||||
{
|
||||
DataContainer = dataContainer;
|
||||
//this.HelpF1Keyword = AssemblyVersionInfo.VersionHelpKeywordPrefix + @".ag.agent.connection.f1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,254 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.ServiceProcess;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SqlServerAgentPropertiesGeneral.
|
||||
/// </summary>
|
||||
internal class SqlServerAgentPropertiesGeneral : ManagementActionBase
|
||||
{
|
||||
|
||||
#region Implementation members
|
||||
private int ServerVersion = 0;
|
||||
const int Version_90 = 9;
|
||||
#endregion
|
||||
|
||||
#region ctors
|
||||
|
||||
public SqlServerAgentPropertiesGeneral(CDataContainer dataContainer)
|
||||
{
|
||||
DataContainer = dataContainer;
|
||||
ServerVersion = DataContainer.Server.Information.Version.Major;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation
|
||||
|
||||
// private void ApplyChanges()
|
||||
// {
|
||||
// this.ExecutionMode = ExecutionMode.Success;
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
// bool AlterValues = false;
|
||||
// try
|
||||
// {
|
||||
// if (this.checkAutoAgent.Checked != agent.SqlAgentRestart)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.SqlAgentRestart = this.checkAutoAgent.Checked;
|
||||
// }
|
||||
|
||||
// if (this.checkAutoSql.Checked != agent.SqlServerRestart)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.SqlServerRestart = this.checkAutoSql.Checked;
|
||||
// }
|
||||
|
||||
// if (this.textFileName.Text != agent.ErrorLogFile)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.ErrorLogFile = this.textFileName.Text;
|
||||
// }
|
||||
|
||||
// if ((this.checkIncludeTrace.Checked == true && agent.AgentLogLevel != AgentLogLevels.All) || (this.checkIncludeTrace.Checked == false && agent.AgentLogLevel == AgentLogLevels.All))
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.AgentLogLevel = (this.checkIncludeTrace.Checked == true) ? AgentLogLevels.All : AgentLogLevels.Errors;
|
||||
// }
|
||||
// if (this.checkWriteOem.Checked != agent.WriteOemErrorLog)
|
||||
// {
|
||||
// AlterValues = true;
|
||||
// agent.WriteOemErrorLog = this.checkWriteOem.Checked;
|
||||
// }
|
||||
|
||||
// if (true == AlterValues)
|
||||
// {
|
||||
// agent.Alter();
|
||||
// }
|
||||
// }
|
||||
// catch (SMO.SmoException smoex)
|
||||
// {
|
||||
// DisplayExceptionMessage(smoex);
|
||||
// this.ExecutionMode = ExecutionMode.Failure;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
private void InitProperties()
|
||||
{
|
||||
|
||||
SMO.Server smoServer = DataContainer.Server;
|
||||
string SqlServerName = smoServer.Information.NetName;
|
||||
bool instanceSupported = smoServer.Information.Version >= new Version(8, 0);
|
||||
string InstanceName = instanceSupported ? smoServer.InstanceName : String.Empty;
|
||||
string machineName = CUtils.GetMachineName(SqlServerName);
|
||||
|
||||
bool IsDefaultInstance = true;
|
||||
|
||||
/// Determine if we work with the default instance
|
||||
if (0 != InstanceName.Length)
|
||||
{
|
||||
/// we work with a named instance
|
||||
IsDefaultInstance = false;
|
||||
}
|
||||
|
||||
string AgentServiceName = string.Empty;
|
||||
|
||||
if (false == IsDefaultInstance)
|
||||
{
|
||||
AgentServiceName = "SQLAgent$" + InstanceName;
|
||||
}
|
||||
else
|
||||
{
|
||||
AgentServiceName = "sqlserveragent";
|
||||
}
|
||||
|
||||
// try
|
||||
// {
|
||||
// using (ServiceController agentService = new ServiceController(AgentServiceName, machineName))
|
||||
// {
|
||||
// if (agentService.Status == ServiceControllerStatus.Stopped)
|
||||
// {
|
||||
// agentStopped = true;
|
||||
// }
|
||||
// this.textServiceState.Text = GetServiceState(agentService.Status);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// this.textServiceState.Text = string.Empty;
|
||||
// }
|
||||
|
||||
// this.textFileName.ReadOnly = true;
|
||||
// this.buttonBrowse.Enabled = agentStopped;
|
||||
// this.checkWriteOem.Enabled = agentStopped;
|
||||
|
||||
/// Get the job server (agent) object
|
||||
JobServer agent = smoServer.JobServer;
|
||||
|
||||
// try
|
||||
// {
|
||||
// this.checkAutoAgent.Checked = agent.SqlAgentRestart;
|
||||
// }
|
||||
// catch (SMO.SmoException)
|
||||
// {
|
||||
// this.checkAutoAgent.Enabled = false;
|
||||
// }
|
||||
|
||||
// try
|
||||
// {
|
||||
// this.checkAutoSql.Checked = agent.SqlServerRestart;
|
||||
// }
|
||||
// catch (SMO.SmoException)
|
||||
// {
|
||||
// this.checkAutoSql.Enabled = false;
|
||||
// }
|
||||
|
||||
// Managed Instances (CloudLifter) do not allow
|
||||
// changing setting related to service restarts.
|
||||
// Just disable the UI elements altogether.
|
||||
//
|
||||
// this.checkAutoAgent.Enabled = smoServer.DatabaseEngineEdition != DatabaseEngineEdition.SqlManagedInstance;
|
||||
// this.checkAutoSql.Enabled = smoServer.DatabaseEngineEdition != DatabaseEngineEdition.SqlManagedInstance;
|
||||
|
||||
// /// Error log file name
|
||||
// this.textFileName.Text = agent.ErrorLogFile;
|
||||
// this.toolTip1.SetToolTip(this.textFileName, agent.ErrorLogFile);
|
||||
|
||||
// /// Log level - All == Include trace messages
|
||||
// this.checkIncludeTrace.Checked = (agent.AgentLogLevel == AgentLogLevels.All);
|
||||
|
||||
// /// Write OEM file
|
||||
// this.checkWriteOem.Checked = agent.WriteOemErrorLog;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// private string GetServiceState(ServiceControllerStatus serviceState)
|
||||
// {
|
||||
// if (serviceState == ServiceControllerStatus.Running)
|
||||
// {
|
||||
// return SqlServerAgentSR.ServiceState_Running;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serviceState == ServiceControllerStatus.Stopped)
|
||||
// {
|
||||
// return SqlServerAgentSR.ServiceState_Stopped;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serviceState == ServiceControllerStatus.Paused)
|
||||
// {
|
||||
// return SqlServerAgentSR.ServiceState_Paused;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serviceState == ServiceControllerStatus.ContinuePending)
|
||||
// {
|
||||
// return SqlServerAgentSR.ServiceState_ContinuePending;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serviceState == ServiceControllerStatus.StartPending)
|
||||
// {
|
||||
// return SqlServerAgentSR.ServiceState_StartPending;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serviceState == ServiceControllerStatus.PausePending)
|
||||
// {
|
||||
// return SqlServerAgentSR.ServiceState_PausePending;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (serviceState == ServiceControllerStatus.StopPending)
|
||||
// {
|
||||
// return SqlServerAgentSR.ServiceState_StopPending;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return SqlServerAgentSR.Unknown;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,112 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Xml;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Resources;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SqlServerAgentPropertiesHistory.
|
||||
/// </summary>
|
||||
internal class SqlServerAgentPropertiesHistory : ManagementActionBase
|
||||
{
|
||||
|
||||
|
||||
#region ctors
|
||||
|
||||
public SqlServerAgentPropertiesHistory(CDataContainer dataContainer)
|
||||
{
|
||||
DataContainer = dataContainer;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation
|
||||
|
||||
// private void ApplyChanges()
|
||||
// {
|
||||
// this.ExecutionMode = ExecutionMode.Success;
|
||||
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
|
||||
// bool LimitHistory = this.checkLimitHistorySize.Checked;
|
||||
// bool DeleteHistory = this.checkRemoveHistory.Checked;
|
||||
// bool AlterValues = false;
|
||||
// int MaxLogRows = -1;
|
||||
// int MaxRowsJob = -1;
|
||||
|
||||
// try
|
||||
// {
|
||||
// if (true == LimitHistory)
|
||||
// {
|
||||
// MaxLogRows = (int) this.textMaxHistoryRows.Value;
|
||||
// MaxRowsJob = (int) this.textMaxHistoryRowsPerJob.Value;
|
||||
// }
|
||||
// if (MaxLogRows != agent.MaximumHistoryRows)
|
||||
// {
|
||||
// agent.MaximumHistoryRows = MaxLogRows;
|
||||
// AlterValues = true;
|
||||
// }
|
||||
// if (MaxRowsJob != agent.MaximumJobHistoryRows)
|
||||
// {
|
||||
// agent.MaximumJobHistoryRows = MaxRowsJob;
|
||||
// AlterValues = true;
|
||||
// }
|
||||
// if (true == DeleteHistory)
|
||||
// {
|
||||
// int timeunits = (int) this.numTimeUnits.Value;
|
||||
// JobHistoryFilter jobHistoryFilter = new JobHistoryFilter();
|
||||
// jobHistoryFilter.EndRunDate = CUtils.GetOldestDate(timeunits,
|
||||
// (TimeUnitType) (this.comboTimeUnits.SelectedIndex));
|
||||
// agent.PurgeJobHistory(jobHistoryFilter);
|
||||
// }
|
||||
|
||||
// if (true == AlterValues)
|
||||
// {
|
||||
// agent.Alter();
|
||||
// }
|
||||
// }
|
||||
// catch (SmoException smoex)
|
||||
// {
|
||||
// DisplayExceptionMessage(smoex);
|
||||
// this.ExecutionMode = ExecutionMode.Failure;
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,141 +0,0 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Resources;
|
||||
using System.Security;
|
||||
using System.Xml;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SqlServerAgentPropertiesJobSystem.
|
||||
/// </summary>
|
||||
internal class SqlServerAgentPropertiesJobSystem : ManagementActionBase
|
||||
{
|
||||
#region Implementation
|
||||
|
||||
private void ApplyChanges()
|
||||
{
|
||||
// this.ExecutionMode = ExecutionMode.Success;
|
||||
// bool AlterValues = false;
|
||||
// bool AlterProxyValues = false;
|
||||
|
||||
// JobServer agent = DataContainer.Server.JobServer;
|
||||
|
||||
// try
|
||||
// {
|
||||
// if (this.shutDownWaitTime != agent.AgentShutdownWaitTime)
|
||||
// {
|
||||
// agent.AgentShutdownWaitTime = this.shutDownWaitTime;
|
||||
// AlterValues = true;
|
||||
// }
|
||||
|
||||
// if (this.DataContainer.Server.Information.Version.Major < 9)
|
||||
// {
|
||||
// if (this.domainUser.Length != 0)
|
||||
// {
|
||||
// this.domainUser = this.domainUser + "\\" + this.userName;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.domainUser = this.userName;
|
||||
// }
|
||||
|
||||
// if (this.sysAdminOnly != agent.SysAdminOnly)
|
||||
// {
|
||||
// AlterProxyValues = true;
|
||||
// if (true == this.sysAdminOnly)
|
||||
// {
|
||||
// DataContainer.Server.ProxyAccount.IsEnabled = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// DataContainer.Server.ProxyAccount.IsEnabled = true;
|
||||
// DataContainer.Server.ProxyAccount.SetAccount(domainUser, this.securePasswd.ToString());
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (this.sysAdminOnly == false)
|
||||
// {
|
||||
// if (domainUser != DataContainer.Server.ProxyAccount.WindowsAccount)
|
||||
// {
|
||||
// AlterProxyValues = true;
|
||||
// DataContainer.Server.ProxyAccount.SetAccount(domainUser, this.securePasswd.ToString());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (passwdMask != this.securePasswd.ToString())
|
||||
// {
|
||||
// AlterProxyValues = true;
|
||||
// DataContainer.Server.ProxyAccount.SetPassword(this.securePasswd.ToString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (true == AlterProxyValues)
|
||||
// {
|
||||
// DataContainer.Server.ProxyAccount.Alter();
|
||||
// }
|
||||
// if(true == AlterValues)
|
||||
// {
|
||||
// agent.Alter();
|
||||
// }
|
||||
// }
|
||||
// catch(SmoException smoex)
|
||||
// {
|
||||
// DisplayExceptionMessage(smoex);
|
||||
// this.ExecutionMode = ExecutionMode.Failure;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ctors
|
||||
|
||||
public SqlServerAgentPropertiesJobSystem(CDataContainer dataContainer)
|
||||
{
|
||||
//InitializeComponent();
|
||||
DataContainer = dataContainer;
|
||||
//this.HelpF1Keyword = AssemblyVersionInfo.VersionHelpKeywordPrefix + @".ag.agent.job.f1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user