mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-02 17:24:50 -05:00
Agent Proxy and Credential request handlers (#637)
* Agent Proxy account WIP * Fixup Credential create\update\delete handlers * Use current user for test credential * Cleanup and delete code * Convert tabs to spaces
This commit is contained in:
@@ -6,19 +6,15 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
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.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
internal class AgentProxyAccount : ManagementActionBase
|
||||
internal class AgentProxyAccountActions : ManagementActionBase
|
||||
{
|
||||
#region Constants
|
||||
internal const string ProxyAccountPropertyName = "proxyaccount";
|
||||
@@ -47,35 +43,79 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
// Flag indicating that proxy account should be duplicated
|
||||
private bool duplicate;
|
||||
|
||||
public static string SysadminAccount
|
||||
{
|
||||
get { return "AgentProxyAccountSR.SysadminAccount"; }
|
||||
}
|
||||
private ConfigAction configAction;
|
||||
|
||||
private bool readOnly = false;
|
||||
|
||||
/// <summary>
|
||||
/// Main constructor. Creates all pages and adds them
|
||||
/// to the tree control.
|
||||
/// </summary>
|
||||
public AgentProxyAccount(CDataContainer dataContainer, AgentProxyInfo proxyInfo)
|
||||
public AgentProxyAccountActions(CDataContainer dataContainer, AgentProxyInfo proxyInfo, ConfigAction configAction)
|
||||
{
|
||||
this.DataContainer = dataContainer;
|
||||
this.proxyInfo = proxyInfo;
|
||||
this.configAction = configAction;
|
||||
|
||||
if (configAction != ConfigAction.Drop)
|
||||
{
|
||||
// Create data structures
|
||||
int length = Enum.GetValues(typeof(ProxyPrincipalType)).Length;
|
||||
this.principals = new ArrayList[length];
|
||||
for (int i = 0; i < length; ++i)
|
||||
{
|
||||
this.principals[i] = new ArrayList();
|
||||
}
|
||||
|
||||
if (configAction == ConfigAction.Update)
|
||||
{
|
||||
RefreshData();
|
||||
}
|
||||
}
|
||||
|
||||
// Find out if we are creating a new proxy account or
|
||||
// modifying an existing one.
|
||||
GetProxyAccountName(dataContainer, ref this.proxyAccountName, ref this.duplicate);
|
||||
}
|
||||
|
||||
public static string SysadminAccount
|
||||
{
|
||||
get { return SR.SysadminAccount; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Main execution method. Creates or Alters a proxyAccount name.
|
||||
/// </summary>
|
||||
/// <returns>Always returns false</returns>
|
||||
protected override bool DoPreProcessExecution(RunType runType, out ExecutionMode executionResult)
|
||||
{
|
||||
base.DoPreProcessExecution(runType, out executionResult);
|
||||
|
||||
if (this.configAction == ConfigAction.Create)
|
||||
{
|
||||
return Create();
|
||||
}
|
||||
else if (this.configAction == ConfigAction.Update)
|
||||
{
|
||||
return Update();
|
||||
}
|
||||
else if (this.configAction == ConfigAction.Drop)
|
||||
{
|
||||
return Drop();
|
||||
}
|
||||
|
||||
// Always return false to stop framework from calling OnRunNow
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// It creates a new ProxyAccount or gets an existing
|
||||
/// one from JobServer and updates all properties.
|
||||
/// </summary>
|
||||
private bool CreateOrUpdateProxyAccount(
|
||||
AgentProxyInfo proxyInfo,
|
||||
bool isUpdate)
|
||||
private bool CreateOrUpdateProxyAccount(AgentProxyInfo proxyInfo)
|
||||
{
|
||||
ProxyAccount proxyAccount = null;
|
||||
if (!isUpdate)
|
||||
if (this.configAction == ConfigAction.Create)
|
||||
{
|
||||
proxyAccount = new ProxyAccount(this.DataContainer.Server.JobServer,
|
||||
proxyInfo.AccountName,
|
||||
@@ -91,14 +131,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
// Try refresh and check again
|
||||
this.DataContainer.Server.JobServer.ProxyAccounts.Refresh();
|
||||
if (this.DataContainer.Server.JobServer.ProxyAccounts.Contains(this.proxyAccountName))
|
||||
{
|
||||
// fail since account exists and asked to create a new one
|
||||
if (!isUpdate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
proxyAccount = AgentProxyAccount.GetProxyAccount(this.proxyAccountName, this.DataContainer.Server.JobServer);
|
||||
{
|
||||
proxyAccount = AgentProxyAccountActions.GetProxyAccount(this.proxyAccountName, this.DataContainer.Server.JobServer);
|
||||
// Set the other properties
|
||||
proxyAccount.CredentialName = proxyInfo.CredentialName;
|
||||
proxyAccount.Description = proxyInfo.Description;
|
||||
@@ -113,7 +147,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
proxyAccount.Rename(proxyInfo.AccountName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,13 +212,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
public bool Create()
|
||||
{
|
||||
CreateOrUpdateProxyAccount(this.proxyInfo, false);
|
||||
CreateOrUpdateProxyAccount(this.proxyInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update()
|
||||
{
|
||||
CreateOrUpdateProxyAccount(this.proxyInfo, true);
|
||||
CreateOrUpdateProxyAccount(this.proxyInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -196,7 +230,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.DataContainer.Server.JobServer.ProxyAccounts.Refresh();
|
||||
if (this.DataContainer.Server.JobServer.ProxyAccounts.Contains(this.proxyAccountName))
|
||||
{
|
||||
ProxyAccount proxyAccount = AgentProxyAccount.GetProxyAccount(this.proxyAccountName, this.DataContainer.Server.JobServer);
|
||||
ProxyAccount proxyAccount = AgentProxyAccountActions.GetProxyAccount(this.proxyAccountName, this.DataContainer.Server.JobServer);
|
||||
proxyAccount.DropIfExists();
|
||||
}
|
||||
}
|
||||
@@ -205,8 +239,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called to update the proxy object with properties
|
||||
/// from this page.
|
||||
/// Called to update the proxy object
|
||||
/// </summary>
|
||||
public void UpdateProxyAccount(ProxyAccount proxyAccount)
|
||||
{
|
||||
@@ -217,9 +250,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
ArrayList principalsToAdd = new ArrayList();
|
||||
ArrayList principalsToRemove = new ArrayList();
|
||||
|
||||
|
||||
// Process Sql Logins
|
||||
if (ExtractPermissionsToAddAndRemove(this.proxyAccountName != null? proxyAccount.EnumLogins() : null, this.principals[(int) ProxyPrincipalType.SqlLogin], principalsToAdd, principalsToRemove))
|
||||
if (ExtractPermissionsToAddAndRemove(
|
||||
this.configAction == ConfigAction.Update ? proxyAccount.EnumLogins() : null,
|
||||
this.principals[(int) ProxyPrincipalType.SqlLogin],
|
||||
principalsToAdd,
|
||||
principalsToRemove))
|
||||
{
|
||||
foreach (string principal in principalsToRemove)
|
||||
{
|
||||
@@ -233,7 +270,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
|
||||
// Process Server Roles
|
||||
if (ExtractPermissionsToAddAndRemove(this.proxyAccountName != null? proxyAccount.EnumServerRoles() : null, this.principals[(int) ProxyPrincipalType.ServerRole], principalsToAdd, principalsToRemove))
|
||||
if (ExtractPermissionsToAddAndRemove(
|
||||
this.configAction == ConfigAction.Update ? proxyAccount.EnumServerRoles() : null,
|
||||
this.principals[(int) ProxyPrincipalType.ServerRole],
|
||||
principalsToAdd,
|
||||
principalsToRemove))
|
||||
{
|
||||
foreach (string principal in principalsToRemove)
|
||||
{
|
||||
@@ -247,7 +288,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
|
||||
// Process Msdb Roles
|
||||
if (ExtractPermissionsToAddAndRemove(this.proxyAccountName != null? proxyAccount.EnumMsdbRoles() : null, this.principals[(int) ProxyPrincipalType.MsdbRole], principalsToAdd, principalsToRemove))
|
||||
if (ExtractPermissionsToAddAndRemove(
|
||||
this.configAction == ConfigAction.Update ? proxyAccount.EnumMsdbRoles() : null,
|
||||
this.principals[(int) ProxyPrincipalType.MsdbRole],
|
||||
principalsToAdd,
|
||||
principalsToRemove))
|
||||
{
|
||||
foreach (string principal in principalsToRemove)
|
||||
{
|
||||
@@ -261,7 +306,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This method scans two list of principals - an existing one extracted from ProxyAccount object
|
||||
/// and a new one obtained from this panel and then it creates a two differential lists: one of
|
||||
@@ -328,28 +372,40 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
private void RefreshData()
|
||||
{
|
||||
// List all the jobsteps that use current
|
||||
// proxy account
|
||||
Request req = new Request();
|
||||
req.Urn = string.Format(System.Globalization.CultureInfo.InvariantCulture,
|
||||
"Server/JobServer/Job/Step[@ProxyName=\'{0}\']",
|
||||
Urn.EscapeString(this.proxyAccountName));
|
||||
req.ResultType = ResultType.IDataReader;
|
||||
req.Fields = new string[] {"Name", "SubSystem"};
|
||||
req.ParentPropertiesRequests = new PropertiesRequest[1];
|
||||
req.ParentPropertiesRequests[0] = new PropertiesRequest(new string[] {"Name"});
|
||||
|
||||
Enumerator en = new Enumerator();
|
||||
using (IDataReader reader = en.Process(this.DataContainer.ServerConnection, req).Data as IDataReader)
|
||||
// Reset all principal collections
|
||||
for (int i = 0; i < this.principals.Length; ++i)
|
||||
{
|
||||
while (reader.Read())
|
||||
this.principals[i].Clear();
|
||||
}
|
||||
|
||||
// Add new data from proxy account
|
||||
if (this.proxyAccountName != null)
|
||||
{
|
||||
ProxyAccount proxyAccount = GetProxyAccount(this.proxyAccountName, this.DataContainer.Server.JobServer);
|
||||
|
||||
// Get all the logins associated with this proxy
|
||||
DataTable dt = proxyAccount.EnumLogins();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
//JobStepSubSystems.
|
||||
// @TODO - write to output collection
|
||||
// new GridCell(reader.GetString(0)), // Job Name (parent property is first)
|
||||
// new GridCell(reader.GetString(1)), // JobStep Name
|
||||
// new GridCell(JobStepSubSystems.LookupFriendlyName((AgentSubSystem) reader.GetInt32(2))) // JobStep SubSystem
|
||||
this.principals[(int)ProxyPrincipalType.SqlLogin].Add(row["Name"]);
|
||||
}
|
||||
|
||||
// Get all the Server roles associated with this proxy
|
||||
dt = proxyAccount.EnumServerRoles();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
this.principals[(int)ProxyPrincipalType.ServerRole].Add(row["Name"]);
|
||||
}
|
||||
|
||||
// Get all the MSDB roles associated with this account
|
||||
dt = proxyAccount.EnumMsdbRoles();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
this.principals[(int)ProxyPrincipalType.MsdbRole].Add(row["Name"]);
|
||||
}
|
||||
|
||||
// only sa can modify
|
||||
this.readOnly = !this.DataContainer.Server.ConnectionContext.IsInFixedServerRole(FixedServerRoles.SysAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +439,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
// if still cannot get the proxy throw an exception
|
||||
if (proxyAccount == null)
|
||||
{
|
||||
throw new ApplicationException("SRError.ProxyAccountNotFound(proxyAccountName)");
|
||||
throw new ApplicationException(SR.ProxyAccountNotFound(proxyAccountName));
|
||||
}
|
||||
}
|
||||
return proxyAccount;
|
||||
@@ -398,7 +454,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
parameters.SetDocument(dataContainer.Document);
|
||||
|
||||
// Get proxy name
|
||||
parameters.GetParam(AgentProxyAccount.ProxyAccountPropertyName, ref proxyAccountName);
|
||||
parameters.GetParam(AgentProxyAccountActions.ProxyAccountPropertyName, ref proxyAccountName);
|
||||
if (proxyAccountName != null && proxyAccountName.Length == 0)
|
||||
{
|
||||
// Reset empty name back to null
|
||||
@@ -407,8 +463,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
// Get duplicate flag
|
||||
string mode = string.Empty;
|
||||
if (parameters.GetParam(AgentProxyAccount.ProxyAccountMode, ref mode) &&
|
||||
0 == string.Compare(mode, AgentProxyAccount.ProxyAccountDuplicateMode, StringComparison.Ordinal))
|
||||
if (parameters.GetParam(AgentProxyAccountActions.ProxyAccountMode, ref mode) &&
|
||||
0 == string.Compare(mode, AgentProxyAccountActions.ProxyAccountDuplicateMode, StringComparison.Ordinal))
|
||||
{
|
||||
duplicate = true;
|
||||
}
|
||||
@@ -434,7 +490,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
if (includeSysadmin)
|
||||
{
|
||||
proxyAccounts.Add(AgentProxyAccount.SysadminAccount);
|
||||
proxyAccounts.Add(AgentProxyAccountActions.SysadminAccount);
|
||||
}
|
||||
|
||||
// Get the list of proxy accounts
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IJobStepPropertiesControl.
|
||||
/// </summary>
|
||||
internal interface IJobStepPropertiesControl
|
||||
{
|
||||
void Load(JobStepData data);
|
||||
void Save(JobStepData data, bool isSwitching);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,19 +3,9 @@
|
||||
// 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.Data;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
@@ -12,7 +12,6 @@ using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
@@ -523,15 +522,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
set
|
||||
{
|
||||
CheckAndLoadMsaInformation();
|
||||
//If a change in the targetLocalServer was detected, then fire the OnCategoriesChanged
|
||||
//event so that the categories drop down list is properly populated.
|
||||
// If a change in the targetLocalServer was detected, then fire the OnCategoriesChanged
|
||||
// event so that the categories drop down list is properly populated.
|
||||
if (this.targetLocalServer != value)
|
||||
{
|
||||
this.targetLocalServer = value;
|
||||
this.displayableCategories = null;
|
||||
CheckAndLoadDisplayableCategories();
|
||||
OnCategoriesChanged();
|
||||
//TODO: add method to do this?
|
||||
this.owners = null;
|
||||
OnOwnersChanged();
|
||||
}
|
||||
@@ -581,7 +579,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
private void OnCategoriesChanged()
|
||||
{
|
||||
//Fire the categories changed event.
|
||||
// Fire the categories changed event.
|
||||
if (this.CategoriesChanged != null)
|
||||
{
|
||||
this.CategoriesChanged(this, EventArgs.Empty);
|
||||
@@ -589,7 +587,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
private void OnOwnersChanged()
|
||||
{
|
||||
//Fire the categories changed event.
|
||||
// Fire the categories changed event.
|
||||
if (this.OwnersChanged != null)
|
||||
{
|
||||
this.OwnersChanged(this, EventArgs.Empty);
|
||||
@@ -1129,7 +1127,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
if (!targetServerSelected)
|
||||
{
|
||||
///Not target servers selected. Throw error.
|
||||
throw new ApplicationException("SRError.TargetServerNotSelected");
|
||||
throw new ApplicationException(SR.TargetServerNotSelected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1386,7 +1384,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
if (smoJobCollection.Contains(jobName))
|
||||
{
|
||||
throw new ApplicationException("SRError.JobAlreadyExists(jobName)");
|
||||
throw new ApplicationException(SR.JobAlreadyExists(jobName));
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -8,10 +8,11 @@ using System.Text;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
@@ -7,10 +7,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
@@ -433,10 +429,10 @@ ORDER BY [InstanceID] ASC";
|
||||
{
|
||||
m_originalSourceName = sourceName;
|
||||
|
||||
m_pointInTime = Convert.ToDateTime(dr[JobUtilities.UrnRunDate], System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_serverName = Convert.ToString(dr[JobUtilities.UrnServer], System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_fieldJobName = Convert.ToString(dr[JobUtilities.UrnJobName], System.Globalization.CultureInfo.InvariantCulture);
|
||||
switch ((Microsoft.SqlServer.Management.Smo.Agent.CompletionResult)Convert.ToInt32(dr[JobUtilities.UrnRunStatus], System.Globalization.CultureInfo.InvariantCulture))
|
||||
m_pointInTime = Convert.ToDateTime(dr[AgentUtilities.UrnRunDate], System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_serverName = Convert.ToString(dr[AgentUtilities.UrnServer], System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_fieldJobName = Convert.ToString(dr[AgentUtilities.UrnJobName], System.Globalization.CultureInfo.InvariantCulture);
|
||||
switch ((Microsoft.SqlServer.Management.Smo.Agent.CompletionResult)Convert.ToInt32(dr[AgentUtilities.UrnRunStatus], System.Globalization.CultureInfo.InvariantCulture))
|
||||
{
|
||||
case CompletionResult.Cancelled:
|
||||
m_severity = SeverityClass.Cancelled;
|
||||
@@ -483,7 +479,7 @@ ORDER BY [InstanceID] ASC";
|
||||
|
||||
// if stepId is zero then dont show stepID and step name in log viewer
|
||||
// Valid step Ids starts from index 1
|
||||
int currentStepId = (int)dr[JobUtilities.UrnStepID];
|
||||
int currentStepId = (int)dr[AgentUtilities.UrnStepID];
|
||||
if (currentStepId == 0)
|
||||
{
|
||||
m_fieldStepID = String.Empty;
|
||||
@@ -493,18 +489,18 @@ ORDER BY [InstanceID] ASC";
|
||||
else
|
||||
{
|
||||
m_fieldStepID = Convert.ToString(currentStepId, System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldStepName = Convert.ToString(dr[JobUtilities.UrnStepName], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldStepName = Convert.ToString(dr[AgentUtilities.UrnStepName], System.Globalization.CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
m_fieldMessage = Convert.ToString(dr[JobUtilities.UrnMessage], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldSqlSeverity = Convert.ToString(dr[JobUtilities.UrnSqlSeverity], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldSqlMessageID = Convert.ToString(dr[JobUtilities.UrnSqlMessageID], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldOperatorEmailed = Convert.ToString(dr[JobUtilities.UrnOperatorEmailed], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldOperatorNetsent = Convert.ToString(dr[JobUtilities.UrnOperatorNetsent], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldOperatorPaged = Convert.ToString(dr[JobUtilities.UrnOperatorPaged], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldRetriesAttempted = Convert.ToString(dr[JobUtilities.UrnRetriesAttempted], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldMessage = Convert.ToString(dr[AgentUtilities.UrnMessage], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldSqlSeverity = Convert.ToString(dr[AgentUtilities.UrnSqlSeverity], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldSqlMessageID = Convert.ToString(dr[AgentUtilities.UrnSqlMessageID], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldOperatorEmailed = Convert.ToString(dr[AgentUtilities.UrnOperatorEmailed], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldOperatorNetsent = Convert.ToString(dr[AgentUtilities.UrnOperatorNetsent], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldOperatorPaged = Convert.ToString(dr[AgentUtilities.UrnOperatorPaged], System.Globalization.CultureInfo.CurrentCulture);
|
||||
m_fieldRetriesAttempted = Convert.ToString(dr[AgentUtilities.UrnRetriesAttempted], System.Globalization.CultureInfo.CurrentCulture);
|
||||
|
||||
Int64 hhmmss = Convert.ToInt64(dr[JobUtilities.UrnRunDuration], System.Globalization.CultureInfo.InvariantCulture); // HHMMSS
|
||||
Int64 hhmmss = Convert.ToInt64(dr[AgentUtilities.UrnRunDuration], System.Globalization.CultureInfo.InvariantCulture); // HHMMSS
|
||||
int hh = Convert.ToInt32(hhmmss / 10000, System.Globalization.CultureInfo.InvariantCulture);
|
||||
int mm = Convert.ToInt32((hhmmss / 100) % 100, System.Globalization.CultureInfo.InvariantCulture);
|
||||
int ss = Convert.ToInt32(hhmmss % 100, System.Globalization.CultureInfo.InvariantCulture);
|
||||
@@ -537,7 +533,7 @@ ORDER BY [InstanceID] ASC";
|
||||
{
|
||||
DataRow dr = dt.Rows[i];
|
||||
|
||||
object o = dr[JobUtilities.UrnStepID];
|
||||
object o = dr[AgentUtilities.UrnStepID];
|
||||
|
||||
try
|
||||
{
|
||||
@@ -575,8 +571,8 @@ ORDER BY [InstanceID] ASC";
|
||||
{
|
||||
m_originalSourceName = sourceName;
|
||||
|
||||
m_pointInTime = Convert.ToDateTime(dr[JobUtilities.UrnRunDate], System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_fieldJobName = Convert.ToString(dr[JobUtilities.UrnJobName], System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_pointInTime = Convert.ToDateTime(dr[AgentUtilities.UrnRunDate], System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_fieldJobName = Convert.ToString(dr[AgentUtilities.UrnJobName], System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
m_severity = SeverityClass.InProgress;
|
||||
|
||||
@@ -591,7 +587,7 @@ ORDER BY [InstanceID] ASC";
|
||||
m_fieldRetriesAttempted = null;
|
||||
m_serverName = null;
|
||||
|
||||
m_fieldDuration = Convert.ToString(Convert.ToDateTime(dr[JobUtilities.UrnServerTime]) - Convert.ToDateTime(dr[JobUtilities.UrnRunDate], System.Globalization.CultureInfo.InvariantCulture), System.Globalization.CultureInfo.InvariantCulture);
|
||||
m_fieldDuration = Convert.ToString(Convert.ToDateTime(dr[AgentUtilities.UrnServerTime]) - Convert.ToDateTime(dr[AgentUtilities.UrnRunDate], System.Globalization.CultureInfo.InvariantCulture), System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
|
||||
@@ -18,12 +18,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
/// <summary>
|
||||
/// Summary description for JobNotifications.
|
||||
/// </summary>
|
||||
internal class JobNotifications : ManagementActionBase
|
||||
internal class JobNotificationsActions : ManagementActionBase
|
||||
{
|
||||
private JobData data;
|
||||
private bool loading = false;
|
||||
|
||||
public JobNotifications(CDataContainer dataContainer, JobData data)
|
||||
public JobNotificationsActions(CDataContainer dataContainer, JobData data)
|
||||
{
|
||||
this.DataContainer = dataContainer;
|
||||
this.data = data;
|
||||
@@ -4,15 +4,8 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
|
||||
@@ -3,33 +3,23 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Microsoft.SqlServer.Management.SqlManagerUI;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for JobSchedules.
|
||||
/// </summary>
|
||||
internal class JobSchedules : ManagementActionBase
|
||||
internal class JobSchedulesActions : ManagementActionBase
|
||||
{
|
||||
private bool sharedSchedulesSupported = false;
|
||||
private JobData data;
|
||||
|
||||
public JobSchedules(CDataContainer dataContainer, JobData data)
|
||||
public JobSchedulesActions(CDataContainer dataContainer, JobData data)
|
||||
{
|
||||
this.DataContainer = dataContainer;
|
||||
this.data = data;
|
||||
@@ -3,21 +3,11 @@
|
||||
// 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.Data;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
@@ -176,3 +177,4 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -5,13 +5,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
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 SMO = Microsoft.SqlServer.Management.Smo;
|
||||
|
||||
@@ -202,6 +198,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.alreadyCreated;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ToBeDeleted
|
||||
{
|
||||
get
|
||||
@@ -213,6 +210,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.deleted = value;
|
||||
}
|
||||
}
|
||||
|
||||
public JobStepsData Parent
|
||||
{
|
||||
get
|
||||
@@ -220,6 +218,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.parent;
|
||||
}
|
||||
}
|
||||
|
||||
public string[] Databases
|
||||
{
|
||||
get
|
||||
@@ -227,6 +226,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.parent.Databases;
|
||||
}
|
||||
}
|
||||
|
||||
public bool StepIdChanged
|
||||
{
|
||||
get
|
||||
@@ -237,6 +237,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.id != this.originalId;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return parent.IsReadOnly; }
|
||||
@@ -269,6 +270,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.command = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int CommandExecutionSuccessCode
|
||||
{
|
||||
get
|
||||
@@ -282,6 +284,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.commandExecutionSuccessCode = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string DatabaseName
|
||||
{
|
||||
get
|
||||
@@ -295,6 +298,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.databaseName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string DatabaseUserName
|
||||
{
|
||||
get
|
||||
@@ -308,6 +312,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.databaseUserName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Server
|
||||
{
|
||||
get
|
||||
@@ -321,6 +326,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.server = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int ID
|
||||
{
|
||||
get
|
||||
@@ -332,6 +338,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.id = value;
|
||||
}
|
||||
}
|
||||
|
||||
public StepCompletionAction FailureAction
|
||||
{
|
||||
get
|
||||
@@ -344,6 +351,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.failureAction;
|
||||
}
|
||||
}
|
||||
|
||||
public JobStepData FailStep
|
||||
{
|
||||
get
|
||||
@@ -355,6 +363,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.failStep;
|
||||
}
|
||||
}
|
||||
|
||||
public StepCompletionAction SuccessAction
|
||||
{
|
||||
get
|
||||
@@ -367,6 +376,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.successAction;
|
||||
}
|
||||
}
|
||||
|
||||
public JobStepData SuccessStep
|
||||
{
|
||||
get
|
||||
@@ -378,6 +388,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.successStep;
|
||||
}
|
||||
}
|
||||
|
||||
public OSRunPriority Priority
|
||||
{
|
||||
get
|
||||
@@ -391,6 +402,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.priority = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string OutputFileName
|
||||
{
|
||||
get
|
||||
@@ -404,6 +416,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.outputFileName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AppendToLogFile
|
||||
{
|
||||
get
|
||||
@@ -417,6 +430,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.appendToLogFile = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AppendToStepHistory
|
||||
{
|
||||
get
|
||||
@@ -430,6 +444,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.appendToStepHist = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanLogToTable
|
||||
{
|
||||
get
|
||||
@@ -437,6 +452,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.Version.Major >= 9;
|
||||
}
|
||||
}
|
||||
|
||||
public bool WriteLogToTable
|
||||
{
|
||||
get
|
||||
@@ -450,6 +466,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.writeLogToTable = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AppendLogToTable
|
||||
{
|
||||
get
|
||||
@@ -463,6 +480,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.appendLogToTable = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int RetryAttempts
|
||||
{
|
||||
get
|
||||
@@ -476,6 +494,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.retryAttempts = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int RetryInterval
|
||||
{
|
||||
get
|
||||
@@ -527,7 +546,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
// Return sysadmin account name when proxy
|
||||
// name is not set, so we match the setter logic
|
||||
return AgentProxyAccount.SysadminAccount;
|
||||
return AgentProxyAccountActions.SysadminAccount;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -537,7 +556,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
set
|
||||
{
|
||||
CheckAndLoadExpandedInformation();
|
||||
if (value == AgentProxyAccount.SysadminAccount)
|
||||
if (value == AgentProxyAccountActions.SysadminAccount)
|
||||
{
|
||||
// Sysadmin is just a special name used
|
||||
// to reset proxy account
|
||||
@@ -558,18 +577,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
// new job step with context
|
||||
public JobStepData(JobStepsData parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
// existing job step
|
||||
public JobStepData(JobStep source, JobStepsData parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
LoadData(source);
|
||||
}
|
||||
|
||||
// copy constructor
|
||||
public JobStepData(JobStepData source)
|
||||
{
|
||||
@@ -647,6 +669,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
this.cachedSource = source;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load all data nessesary to edit a job
|
||||
/// </summary>
|
||||
@@ -694,6 +717,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
|
||||
this.cachedSource = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set defaults for a new empty job
|
||||
/// </summary>
|
||||
@@ -725,6 +749,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.proxyName = string.Empty;
|
||||
this.urn = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the completion actions for the step
|
||||
/// </summary>
|
||||
@@ -751,6 +776,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
return ApplyChanges(job, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save changes to the job step
|
||||
/// </summary>
|
||||
|
||||
@@ -1,78 +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.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlServer.Management.Diagnostics;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for JobStepProperties.
|
||||
/// </summary>
|
||||
internal class JobStepProperties : ManagementActionBase
|
||||
{
|
||||
private JobStepSubSystems subSystems;
|
||||
private JobStepSubSystem selectedSubSystem = null;
|
||||
private bool needToUpdate = false;
|
||||
private const int jobIdLowerBound= 1;
|
||||
private int currentStepID = jobIdLowerBound;
|
||||
private int stepsCount = jobIdLowerBound;
|
||||
private IJobStepPropertiesControl activeControl = null;
|
||||
private JobStepData data;
|
||||
// used to persist state between job step types
|
||||
private JobStepData runtimeData;
|
||||
|
||||
internal JobStepProperties(CDataContainer dataContainer, JobStepData context)
|
||||
{
|
||||
this.DataContainer = dataContainer;
|
||||
this.data = context;
|
||||
this.runtimeData = new JobStepData(this.data);
|
||||
currentStepID = this.data.ID;
|
||||
stepsCount = this.data.StepCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private JobStepSubSystems SubSystems
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.subSystems == null)
|
||||
{
|
||||
this.subSystems = new JobStepSubSystems(this.DataContainer, this.data);
|
||||
}
|
||||
return this.subSystems;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,108 +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.Collections;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
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 JobStepPropertySheet.
|
||||
/// </summary>
|
||||
internal class JobStepPropertySheet : ManagementActionBase
|
||||
{
|
||||
private JobStepData data = null;
|
||||
|
||||
public JobStepPropertySheet(CDataContainer dataContainer, JobStepData data)
|
||||
{
|
||||
this.DataContainer = dataContainer;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
JobStepProperties general = new JobStepProperties(this.DataContainer, this.data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public bool Create()
|
||||
{
|
||||
// Make sure the job step name is not blank.
|
||||
if (string.IsNullOrWhiteSpace(this.data.Name))
|
||||
{
|
||||
throw new Exception("SRError.JobStepNameCannotBeBlank");
|
||||
}
|
||||
|
||||
// Check to make sure that the user has not entered a job step name that already exists.
|
||||
for (int stepIndex = 0; stepIndex < this.data.Parent.Steps.Count; stepIndex++)
|
||||
{
|
||||
// don't compare if the id's are the same.
|
||||
if(data.ID != ((JobStepData)this.data.Parent.Steps[stepIndex]).ID && data.Name == ((JobStepData)this.data.Parent.Steps[stepIndex]).Name)
|
||||
{
|
||||
// Throw an error if the job step name already exists
|
||||
throw new Exception("JobSR.JobStepNameAlreadyExists(this.data.Name)");
|
||||
}
|
||||
}
|
||||
|
||||
this.data.ApplyChanges(this.GetCurrentJob());
|
||||
|
||||
// regular execution always takes place
|
||||
return true;
|
||||
}
|
||||
|
||||
private Job GetCurrentJob()
|
||||
{
|
||||
Job job = null;
|
||||
string urn = string.Empty;
|
||||
string jobIdString = null;
|
||||
STParameters parameters = new STParameters(this.DataContainer.Document);
|
||||
parameters.GetParam("urn", ref urn);
|
||||
parameters.GetParam("jobid", ref jobIdString);
|
||||
|
||||
// If JobID is passed in look up by jobID
|
||||
if (!string.IsNullOrEmpty(jobIdString))
|
||||
{
|
||||
job = this.DataContainer.Server.JobServer.Jobs.ItemById(Guid.Parse(jobIdString));
|
||||
}
|
||||
else
|
||||
{
|
||||
// or use urn path to query job
|
||||
job = this.DataContainer.Server.GetSmoObject(urn) as Job;
|
||||
}
|
||||
|
||||
return job;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We don't own the CDataContainer that we get from our creator. We need to
|
||||
/// return false here so that the base class won't dispose it in its Dispose method
|
||||
/// </summary>
|
||||
protected override bool OwnDataContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ using System.Linq;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
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
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
|
||||
@@ -7,15 +7,9 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
@@ -59,6 +53,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.parent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Server Version
|
||||
/// </summary>
|
||||
@@ -69,6 +64,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.parent.Version;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mode in which the dialog has been launched
|
||||
/// </summary>
|
||||
@@ -86,6 +82,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of steps in this job
|
||||
/// </summary>
|
||||
@@ -96,6 +93,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.jobSteps;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The default start step
|
||||
/// </summary>
|
||||
@@ -122,6 +120,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.startStep = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of all available databases on the server
|
||||
/// </summary>
|
||||
@@ -133,6 +132,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return this.databases;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not the order of the steps has changed
|
||||
/// </summary>
|
||||
@@ -152,6 +152,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
return orderChanged;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not the Job is read only
|
||||
/// </summary>
|
||||
@@ -188,6 +189,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
CommonInit(context, parent, script);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new jobsteps data object
|
||||
/// </summary>
|
||||
@@ -205,6 +207,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
CommonInit(context, parent, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Common initialization routines for constructrs
|
||||
/// </summary>
|
||||
@@ -246,6 +249,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.jobSteps.Add(step);
|
||||
RecalculateStepIds();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a jobstep into an existing location
|
||||
/// </summary>
|
||||
@@ -256,6 +260,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.jobSteps.Insert(index, step);
|
||||
RecalculateStepIds();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a jobstep
|
||||
/// </summary>
|
||||
@@ -275,6 +280,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
RecalculateStepIds();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a JobStepData object for a step id
|
||||
/// </summary>
|
||||
@@ -365,6 +371,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
return unreachableSteps;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if the Last steps success completion action will change.
|
||||
/// It will if we are editing a job, and the last steps Success Completion
|
||||
@@ -404,6 +411,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
}
|
||||
OnStepOrderChanged(EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delayed loading of database information
|
||||
/// </summary>
|
||||
@@ -420,6 +428,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.databases[i] = this.context.Server.Databases[i].Name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// fire the StepOrderChanged event
|
||||
/// </summary>
|
||||
@@ -430,6 +439,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
this.StepOrderChanged(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SMO job object we are manipulating
|
||||
/// </summary>
|
||||
@@ -463,6 +473,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
jsd.Name = "1";
|
||||
this.jobSteps.Add(jsd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load job steps from the server
|
||||
/// </summary>
|
||||
@@ -617,10 +628,3 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,118 +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.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||
using SMO = Microsoft.SqlServer.Management.Smo;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent
|
||||
{
|
||||
public class JobUtilities
|
||||
{
|
||||
public const string UrnJobName = "JobName";
|
||||
public const string UrnJobId = "JobId";
|
||||
public const string UrnRunStatus = "RunStatus";
|
||||
public const string UrnInstanceID = "InstanceId";
|
||||
public const string UrnSqlMessageID = "SqlMessageId";
|
||||
public const string UrnMessage = "Message";
|
||||
public const string UrnStepID = "StepId";
|
||||
public const string UrnStepName = "StepName";
|
||||
public const string UrnSqlSeverity = "SqlSeverity";
|
||||
public const string UrnRunDate = "RunDate";
|
||||
public const string UrnRunDuration = "RunDuration";
|
||||
public const string UrnOperatorEmailed = "OperatorEmailed";
|
||||
public const string UrnOperatorNetsent = "OperatorNetsent";
|
||||
public const string UrnOperatorPaged = "OperatorPaged";
|
||||
public const string UrnRetriesAttempted = "RetriesAttempted";
|
||||
public const string UrnServer = "Server";
|
||||
internal const string UrnServerTime = "CurrentDate";
|
||||
|
||||
public static AgentJobInfo ConvertToAgentJobInfo(JobProperties job)
|
||||
{
|
||||
return new AgentJobInfo
|
||||
{
|
||||
Name = job.Name,
|
||||
CurrentExecutionStatus = job.CurrentExecutionStatus,
|
||||
LastRunOutcome = job.LastRunOutcome,
|
||||
CurrentExecutionStep = job.CurrentExecutionStep,
|
||||
Enabled = job.Enabled,
|
||||
HasTarget = job.HasTarget,
|
||||
HasSchedule = job.HasSchedule,
|
||||
HasStep = job.HasStep,
|
||||
Runnable = job.Runnable,
|
||||
Category = job.Category,
|
||||
CategoryId = job.CategoryID,
|
||||
CategoryType = job.CategoryType,
|
||||
LastRun = job.LastRun != null ? job.LastRun.ToString() : string.Empty,
|
||||
NextRun = job.NextRun != null ? job.NextRun.ToString() : string.Empty,
|
||||
JobId = job.JobID != null ? job.JobID.ToString() : null
|
||||
};
|
||||
}
|
||||
|
||||
public static AgentJobStep ConvertToAgentJobStep(ILogEntry logEntry, DataRow jobRow)
|
||||
{
|
||||
var entry = logEntry as LogSourceJobHistory.LogEntryJobHistory;
|
||||
string stepId = entry.StepID;
|
||||
string stepName = entry.StepName;
|
||||
string message = entry.Message;
|
||||
DateTime runDate = logEntry.PointInTime;
|
||||
int runStatus = Convert.ToInt32(jobRow[UrnRunStatus], System.Globalization.CultureInfo.InvariantCulture);
|
||||
AgentJobStep step = new AgentJobStep();
|
||||
step.StepId = stepId;
|
||||
step.StepName = stepName;
|
||||
step.Message = message;
|
||||
step.RunDate = runDate;
|
||||
step.RunStatus = runStatus;
|
||||
return step;
|
||||
}
|
||||
|
||||
public static List<AgentJobHistoryInfo> ConvertToAgentJobHistoryInfo(List<ILogEntry> logEntries, DataRow jobRow)
|
||||
{
|
||||
List<AgentJobHistoryInfo> jobs = new List<AgentJobHistoryInfo>();
|
||||
// get all the values for a job history
|
||||
foreach (ILogEntry entry in logEntries)
|
||||
{
|
||||
// Make a new AgentJobHistoryInfo object
|
||||
var jobHistoryInfo = new AgentJobHistoryInfo();
|
||||
jobHistoryInfo.InstanceId = Convert.ToInt32(jobRow[UrnInstanceID], System.Globalization.CultureInfo.InvariantCulture);
|
||||
jobHistoryInfo.RunStatus = Convert.ToInt32(jobRow[UrnRunStatus], System.Globalization.CultureInfo.InvariantCulture);
|
||||
jobHistoryInfo.JobId = (Guid) jobRow[UrnJobId];
|
||||
var logEntry = entry as LogSourceJobHistory.LogEntryJobHistory;
|
||||
jobHistoryInfo.SqlMessageId = logEntry.SqlMessageID;
|
||||
jobHistoryInfo.Message = logEntry.Message;
|
||||
jobHistoryInfo.StepId = logEntry.StepID;
|
||||
jobHistoryInfo.StepName = logEntry.StepName;
|
||||
jobHistoryInfo.SqlSeverity = logEntry.SqlSeverity;
|
||||
jobHistoryInfo.JobName = logEntry.JobName;
|
||||
jobHistoryInfo.RunDate = entry.PointInTime;
|
||||
jobHistoryInfo.RunDuration = logEntry.Duration;
|
||||
jobHistoryInfo.OperatorEmailed = logEntry.OperatorEmailed;
|
||||
jobHistoryInfo.OperatorNetsent = logEntry.OperatorNetsent;
|
||||
jobHistoryInfo.OperatorPaged = logEntry.OperatorPaged;
|
||||
jobHistoryInfo.RetriesAttempted = logEntry.RetriesAttempted;
|
||||
jobHistoryInfo.Server = logEntry.Server;
|
||||
|
||||
// Add steps to the job if any
|
||||
var jobSteps = new List<AgentJobStep>();
|
||||
if (entry.CanLoadSubEntries)
|
||||
{
|
||||
foreach (ILogEntry step in entry.SubEntries)
|
||||
{
|
||||
jobSteps.Add(JobUtilities.ConvertToAgentJobStep(step, jobRow));
|
||||
}
|
||||
}
|
||||
jobHistoryInfo.Steps = jobSteps.ToArray();
|
||||
jobs.Add(jobHistoryInfo);
|
||||
}
|
||||
return jobs;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#if false
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
@@ -888,3 +889,4 @@ namespace Microsoft.SqlServer.Management.SqlManagerUI
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,443 +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.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||
|
||||
namespace Microsoft.SqlServer.Management.SqlManagerUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for JobsRefrencingScheduleForm.
|
||||
/// </summary>
|
||||
public class JobsReferencingScheduleForm
|
||||
{
|
||||
#region UI Variables
|
||||
|
||||
// private System.Windows.Forms.Panel panelContainer;
|
||||
// private Microsoft.SqlServer.Management.Controls.Separator separatorContainerFromButtons;
|
||||
// private System.Windows.Forms.Button buttonHelp;
|
||||
// private System.Windows.Forms.Button buttonOK;
|
||||
// private System.Windows.Forms.Button buttonCancel;
|
||||
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other Variables
|
||||
|
||||
private JobsReferencingScheduleControl m_innerControl = null;
|
||||
private IServiceProvider m_serviceProvider = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public
|
||||
|
||||
public int NoOfSelectedJobs
|
||||
{
|
||||
get
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(m_innerControl != null);
|
||||
// System.Diagnostics.Debug.Assert(this.DialogResult == DialogResult.OK,
|
||||
// "property meaningfull only if dialog dismised with OK");
|
||||
return m_innerControl.NoOfSelectedJobs;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors/Dispose
|
||||
|
||||
/// <summary>
|
||||
/// constructor used so WinForms designer can work
|
||||
/// </summary>
|
||||
public JobsReferencingScheduleForm()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// actual constuctor invoked from 'ManageSchedules' dialog
|
||||
/// </summary>
|
||||
/// <param name="context">context describing connection used, etc - similar with context in dbCommanders</param>
|
||||
/// <param name="scheduleId">shared schedule id (used to unique identify the shared schedule since duplicate names are possible)</param>
|
||||
/// <param name="scheduleName">shared schedule for which we should display the jobs (used for display purposes)</param>
|
||||
/// <param name="readOnlyMode">true if we dont allow user to modify data</param>
|
||||
/// <param name="svcProvider">provider used to show help, msg boxes, etc</param>
|
||||
public JobsReferencingScheduleForm(CDataContainer context, int scheduleId, string scheduleName,
|
||||
bool readOnlyMode, IServiceProvider svcProvider)
|
||||
{
|
||||
m_serviceProvider = svcProvider;
|
||||
|
||||
// InitializeComponent();
|
||||
// InitializeInnerUserControl(context, scheduleId, scheduleName, readOnlyMode);
|
||||
// InitializeButtonEvents();
|
||||
}
|
||||
|
||||
/// <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.Resources.ResourceManager resources =
|
||||
// new System.Resources.ResourceManager(typeof (JobsReferencingScheduleForm));
|
||||
// this.panelContainer = new System.Windows.Forms.Panel();
|
||||
// this.separatorContainerFromButtons = new Microsoft.SqlServer.Management.Controls.Separator();
|
||||
// this.buttonHelp = new System.Windows.Forms.Button();
|
||||
// this.buttonOK = new System.Windows.Forms.Button();
|
||||
// this.buttonCancel = new System.Windows.Forms.Button();
|
||||
// this.SuspendLayout();
|
||||
// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
// //
|
||||
// // panelContainer
|
||||
// //
|
||||
// this.panelContainer.AccessibleDescription = resources.GetString("panelContainer.AccessibleDescription");
|
||||
// this.panelContainer.AccessibleName = resources.GetString("panelContainer.AccessibleName");
|
||||
// this.panelContainer.Anchor =
|
||||
// ((System.Windows.Forms.AnchorStyles) (resources.GetObject("panelContainer.Anchor")));
|
||||
// this.panelContainer.AutoScroll = ((bool) (resources.GetObject("panelContainer.AutoScroll")));
|
||||
// this.panelContainer.AutoScrollMargin =
|
||||
// ((System.Drawing.Size) (resources.GetObject("panelContainer.AutoScrollMargin")));
|
||||
// this.panelContainer.AutoScrollMinSize =
|
||||
// ((System.Drawing.Size) (resources.GetObject("panelContainer.AutoScrollMinSize")));
|
||||
// this.panelContainer.BackgroundImage =
|
||||
// ((System.Drawing.Image) (resources.GetObject("panelContainer.BackgroundImage")));
|
||||
// this.panelContainer.Dock = ((System.Windows.Forms.DockStyle) (resources.GetObject("panelContainer.Dock")));
|
||||
// this.panelContainer.Enabled = ((bool) (resources.GetObject("panelContainer.Enabled")));
|
||||
// this.panelContainer.Font = ((System.Drawing.Font) (resources.GetObject("panelContainer.Font")));
|
||||
// this.panelContainer.ImeMode =
|
||||
// ((System.Windows.Forms.ImeMode) (resources.GetObject("panelContainer.ImeMode")));
|
||||
// this.panelContainer.Location = ((System.Drawing.Point) (resources.GetObject("panelContainer.Location")));
|
||||
// this.panelContainer.Name = "panelContainer";
|
||||
// this.panelContainer.RightToLeft =
|
||||
// ((System.Windows.Forms.RightToLeft) (resources.GetObject("panelContainer.RightToLeft")));
|
||||
// this.panelContainer.Size = ((System.Drawing.Size) (resources.GetObject("panelContainer.Size")));
|
||||
// this.panelContainer.TabIndex = ((int) (resources.GetObject("panelContainer.TabIndex")));
|
||||
// this.panelContainer.Text = resources.GetString("panelContainer.Text");
|
||||
// this.panelContainer.Visible = ((bool) (resources.GetObject("panelContainer.Visible")));
|
||||
// //
|
||||
// // separatorContainerFromButtons
|
||||
// //
|
||||
// this.separatorContainerFromButtons.AccessibleDescription =
|
||||
// resources.GetString("separatorContainerFromButtons.AccessibleDescription");
|
||||
// this.separatorContainerFromButtons.AccessibleName =
|
||||
// resources.GetString("separatorContainerFromButtons.AccessibleName");
|
||||
// this.separatorContainerFromButtons.Anchor =
|
||||
// ((System.Windows.Forms.AnchorStyles) (resources.GetObject("separatorContainerFromButtons.Anchor")));
|
||||
// this.separatorContainerFromButtons.AutoSize =
|
||||
// ((bool) (resources.GetObject("separatorContainerFromButtons.AutoSize")));
|
||||
// this.separatorContainerFromButtons.Dock =
|
||||
// ((System.Windows.Forms.DockStyle) (resources.GetObject("separatorContainerFromButtons.Dock")));
|
||||
// this.separatorContainerFromButtons.Enabled =
|
||||
// ((bool) (resources.GetObject("separatorContainerFromButtons.Enabled")));
|
||||
// this.separatorContainerFromButtons.Font =
|
||||
// ((System.Drawing.Font) (resources.GetObject("separatorContainerFromButtons.Font")));
|
||||
// this.separatorContainerFromButtons.ImeMode =
|
||||
// ((System.Windows.Forms.ImeMode) (resources.GetObject("separatorContainerFromButtons.ImeMode")));
|
||||
// this.separatorContainerFromButtons.Location =
|
||||
// ((System.Drawing.Point) (resources.GetObject("separatorContainerFromButtons.Location")));
|
||||
// this.separatorContainerFromButtons.Name = "separatorContainerFromButtons";
|
||||
// this.separatorContainerFromButtons.RightToLeft =
|
||||
// ((System.Windows.Forms.RightToLeft) (resources.GetObject("separatorContainerFromButtons.RightToLeft")));
|
||||
// this.separatorContainerFromButtons.Size =
|
||||
// ((System.Drawing.Size) (resources.GetObject("separatorContainerFromButtons.Size")));
|
||||
// this.separatorContainerFromButtons.TabIndex =
|
||||
// ((int) (resources.GetObject("separatorContainerFromButtons.TabIndex")));
|
||||
// this.separatorContainerFromButtons.Text = resources.GetString("separatorContainerFromButtons.Text");
|
||||
// this.separatorContainerFromButtons.TextAlign =
|
||||
// ((System.Drawing.ContentAlignment) (resources.GetObject("separatorContainerFromButtons.TextAlign")));
|
||||
// this.separatorContainerFromButtons.Visible =
|
||||
// ((bool) (resources.GetObject("separatorContainerFromButtons.Visible")));
|
||||
// //
|
||||
// // buttonHelp
|
||||
// //
|
||||
// this.buttonHelp.AccessibleDescription = resources.GetString("buttonHelp.AccessibleDescription");
|
||||
// this.buttonHelp.AccessibleName = resources.GetString("buttonHelp.AccessibleName");
|
||||
// this.buttonHelp.Anchor = ((System.Windows.Forms.AnchorStyles) (resources.GetObject("buttonHelp.Anchor")));
|
||||
// this.buttonHelp.BackgroundImage =
|
||||
// ((System.Drawing.Image) (resources.GetObject("buttonHelp.BackgroundImage")));
|
||||
// this.buttonHelp.Dock = ((System.Windows.Forms.DockStyle) (resources.GetObject("buttonHelp.Dock")));
|
||||
// this.buttonHelp.Enabled = ((bool) (resources.GetObject("buttonHelp.Enabled")));
|
||||
// this.buttonHelp.FlatStyle = ((System.Windows.Forms.FlatStyle) (resources.GetObject("buttonHelp.FlatStyle")));
|
||||
// this.buttonHelp.Font = ((System.Drawing.Font) (resources.GetObject("buttonHelp.Font")));
|
||||
// this.buttonHelp.Image = ((System.Drawing.Image) (resources.GetObject("buttonHelp.Image")));
|
||||
// this.buttonHelp.ImageAlign =
|
||||
// ((System.Drawing.ContentAlignment) (resources.GetObject("buttonHelp.ImageAlign")));
|
||||
// this.buttonHelp.ImageIndex = ((int) (resources.GetObject("buttonHelp.ImageIndex")));
|
||||
// this.buttonHelp.ImeMode = ((System.Windows.Forms.ImeMode) (resources.GetObject("buttonHelp.ImeMode")));
|
||||
// this.buttonHelp.Location = ((System.Drawing.Point) (resources.GetObject("buttonHelp.Location")));
|
||||
// this.buttonHelp.Name = "buttonHelp";
|
||||
// this.buttonHelp.RightToLeft =
|
||||
// ((System.Windows.Forms.RightToLeft) (resources.GetObject("buttonHelp.RightToLeft")));
|
||||
// this.buttonHelp.Size = ((System.Drawing.Size) (resources.GetObject("buttonHelp.Size")));
|
||||
// this.buttonHelp.TabIndex = ((int) (resources.GetObject("buttonHelp.TabIndex")));
|
||||
// this.buttonHelp.Text = resources.GetString("buttonHelp.Text");
|
||||
// this.buttonHelp.TextAlign =
|
||||
// ((System.Drawing.ContentAlignment) (resources.GetObject("buttonHelp.TextAlign")));
|
||||
// this.buttonHelp.Visible = ((bool) (resources.GetObject("buttonHelp.Visible")));
|
||||
// //
|
||||
// // buttonOK
|
||||
// //
|
||||
// this.buttonOK.AccessibleDescription = resources.GetString("buttonOK.AccessibleDescription");
|
||||
// this.buttonOK.AccessibleName = resources.GetString("buttonOK.AccessibleName");
|
||||
// this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles) (resources.GetObject("buttonOK.Anchor")));
|
||||
// this.buttonOK.BackgroundImage = ((System.Drawing.Image) (resources.GetObject("buttonOK.BackgroundImage")));
|
||||
// this.buttonOK.Dock = ((System.Windows.Forms.DockStyle) (resources.GetObject("buttonOK.Dock")));
|
||||
// this.buttonOK.Enabled = ((bool) (resources.GetObject("buttonOK.Enabled")));
|
||||
// this.buttonOK.FlatStyle = ((System.Windows.Forms.FlatStyle) (resources.GetObject("buttonOK.FlatStyle")));
|
||||
// this.buttonOK.Font = ((System.Drawing.Font) (resources.GetObject("buttonOK.Font")));
|
||||
// this.buttonOK.Image = ((System.Drawing.Image) (resources.GetObject("buttonOK.Image")));
|
||||
// this.buttonOK.ImageAlign = ((System.Drawing.ContentAlignment) (resources.GetObject("buttonOK.ImageAlign")));
|
||||
// this.buttonOK.ImageIndex = ((int) (resources.GetObject("buttonOK.ImageIndex")));
|
||||
// this.buttonOK.ImeMode = ((System.Windows.Forms.ImeMode) (resources.GetObject("buttonOK.ImeMode")));
|
||||
// this.buttonOK.Location = ((System.Drawing.Point) (resources.GetObject("buttonOK.Location")));
|
||||
// this.buttonOK.Name = "buttonOK";
|
||||
// this.buttonOK.RightToLeft =
|
||||
// ((System.Windows.Forms.RightToLeft) (resources.GetObject("buttonOK.RightToLeft")));
|
||||
// this.buttonOK.Size = ((System.Drawing.Size) (resources.GetObject("buttonOK.Size")));
|
||||
// this.buttonOK.TabIndex = ((int) (resources.GetObject("buttonOK.TabIndex")));
|
||||
// this.buttonOK.Text = resources.GetString("buttonOK.Text");
|
||||
// this.buttonOK.TextAlign = ((System.Drawing.ContentAlignment) (resources.GetObject("buttonOK.TextAlign")));
|
||||
// this.buttonOK.Visible = ((bool) (resources.GetObject("buttonOK.Visible")));
|
||||
// //
|
||||
// // buttonCancel
|
||||
// //
|
||||
// this.buttonCancel.AccessibleDescription = resources.GetString("buttonCancel.AccessibleDescription");
|
||||
// this.buttonCancel.AccessibleName = resources.GetString("buttonCancel.AccessibleName");
|
||||
// this.buttonCancel.Anchor =
|
||||
// ((System.Windows.Forms.AnchorStyles) (resources.GetObject("buttonCancel.Anchor")));
|
||||
// this.buttonCancel.BackgroundImage =
|
||||
// ((System.Drawing.Image) (resources.GetObject("buttonCancel.BackgroundImage")));
|
||||
// this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
// this.buttonCancel.Dock = ((System.Windows.Forms.DockStyle) (resources.GetObject("buttonCancel.Dock")));
|
||||
// this.buttonCancel.Enabled = ((bool) (resources.GetObject("buttonCancel.Enabled")));
|
||||
// this.buttonCancel.FlatStyle =
|
||||
// ((System.Windows.Forms.FlatStyle) (resources.GetObject("buttonCancel.FlatStyle")));
|
||||
// this.buttonCancel.Font = ((System.Drawing.Font) (resources.GetObject("buttonCancel.Font")));
|
||||
// this.buttonCancel.Image = ((System.Drawing.Image) (resources.GetObject("buttonCancel.Image")));
|
||||
// this.buttonCancel.ImageAlign =
|
||||
// ((System.Drawing.ContentAlignment) (resources.GetObject("buttonCancel.ImageAlign")));
|
||||
// this.buttonCancel.ImageIndex = ((int) (resources.GetObject("buttonCancel.ImageIndex")));
|
||||
// this.buttonCancel.ImeMode = ((System.Windows.Forms.ImeMode) (resources.GetObject("buttonCancel.ImeMode")));
|
||||
// this.buttonCancel.Location = ((System.Drawing.Point) (resources.GetObject("buttonCancel.Location")));
|
||||
// this.buttonCancel.Name = "buttonCancel";
|
||||
// this.buttonCancel.RightToLeft =
|
||||
// ((System.Windows.Forms.RightToLeft) (resources.GetObject("buttonCancel.RightToLeft")));
|
||||
// this.buttonCancel.Size = ((System.Drawing.Size) (resources.GetObject("buttonCancel.Size")));
|
||||
// this.buttonCancel.TabIndex = ((int) (resources.GetObject("buttonCancel.TabIndex")));
|
||||
// this.buttonCancel.Text = resources.GetString("buttonCancel.Text");
|
||||
// this.buttonCancel.TextAlign =
|
||||
// ((System.Drawing.ContentAlignment) (resources.GetObject("buttonCancel.TextAlign")));
|
||||
// this.buttonCancel.Visible = ((bool) (resources.GetObject("buttonCancel.Visible")));
|
||||
// //
|
||||
// // JobsReferencingScheduleForm
|
||||
// //
|
||||
// this.AcceptButton = this.buttonOK;
|
||||
// this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
|
||||
// this.AccessibleName = resources.GetString("$this.AccessibleName");
|
||||
// this.AutoScaleBaseSize = ((System.Drawing.Size) (resources.GetObject("$this.AutoScaleBaseSize")));
|
||||
// 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.CancelButton = this.buttonCancel;
|
||||
// this.ClientSize = ((System.Drawing.Size) (resources.GetObject("$this.ClientSize")));
|
||||
// this.Controls.Add(this.buttonCancel);
|
||||
// this.Controls.Add(this.buttonOK);
|
||||
// this.Controls.Add(this.buttonHelp);
|
||||
// this.Controls.Add(this.separatorContainerFromButtons);
|
||||
// this.Controls.Add(this.panelContainer);
|
||||
// this.Enabled = ((bool) (resources.GetObject("$this.Enabled")));
|
||||
// this.Font = ((System.Drawing.Font) (resources.GetObject("$this.Font")));
|
||||
// this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
|
||||
// this.ImeMode = ((System.Windows.Forms.ImeMode) (resources.GetObject("$this.ImeMode")));
|
||||
// this.Location = ((System.Drawing.Point) (resources.GetObject("$this.Location")));
|
||||
// this.MaximumSize = ((System.Drawing.Size) (resources.GetObject("$this.MaximumSize")));
|
||||
// this.MinimumSize = ((System.Drawing.Size) (resources.GetObject("$this.MinimumSize")));
|
||||
// this.Name = "JobsReferencingScheduleForm";
|
||||
// this.RightToLeft = ((System.Windows.Forms.RightToLeft) (resources.GetObject("$this.RightToLeft")));
|
||||
// this.StartPosition = ((System.Windows.Forms.FormStartPosition) (resources.GetObject("$this.StartPosition")));
|
||||
// this.Text = resources.GetString("$this.Text");
|
||||
// this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Initialize Inner UserControl
|
||||
|
||||
/// <summary>
|
||||
/// used for estitic purposes only
|
||||
/// </summary>
|
||||
private void InitializeInnerUserControl()
|
||||
{
|
||||
// try
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_innerControl == null, "inner control was already initialized");
|
||||
|
||||
// this.SuspendLayout();
|
||||
// this.panelContainer.SuspendLayout();
|
||||
|
||||
// System.Diagnostics.Debug.Assert(this.Parent != null);
|
||||
// if (this.Parent != null)
|
||||
// {
|
||||
// this.BackColor = Parent.BackColor;
|
||||
// this.Font = Parent.Font;
|
||||
// }
|
||||
|
||||
// m_innerControl = new JobsReferencingScheduleControl();
|
||||
// m_innerControl.Dock = DockStyle.Fill;
|
||||
|
||||
// this.panelContainer.Controls.Clear();
|
||||
// this.panelContainer.Controls.Add(m_innerControl);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// this.panelContainer.ResumeLayout();
|
||||
// this.ResumeLayout();
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// actual initialization
|
||||
/// </summary>
|
||||
private void InitializeInnerUserControl(CDataContainer context, int scheduleId, string scheduleName,
|
||||
bool readOnlyMode)
|
||||
{
|
||||
// try
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_innerControl == null, "inner control was already initialized");
|
||||
// this.SuspendLayout();
|
||||
// this.panelContainer.SuspendLayout();
|
||||
|
||||
// m_innerControl = new JobsReferencingScheduleControl(context, scheduleId, scheduleName, readOnlyMode);
|
||||
// m_innerControl.Dock = DockStyle.Fill;
|
||||
|
||||
// this.panelContainer.Controls.Clear();
|
||||
// this.panelContainer.Controls.Add(m_innerControl);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// this.panelContainer.ResumeLayout();
|
||||
// this.ResumeLayout();
|
||||
// }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides - OnHelpRequested
|
||||
|
||||
/// <summary>
|
||||
/// hook with standard help processing
|
||||
/// </summary>
|
||||
/// <param name="hevent"></param>
|
||||
// protected override void OnHelpRequested(HelpEventArgs hevent)
|
||||
// {
|
||||
// ShowHelp();
|
||||
|
||||
// hevent.Handled = true;
|
||||
// base.OnHelpRequested(hevent);
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Implementation - ShowHelp
|
||||
|
||||
// private void ShowHelp()
|
||||
// {
|
||||
// //F1 request might come in even when Help button is hidden
|
||||
// if (m_serviceProvider == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// string key = AssemblyVersionInfo.VersionHelpKeywordPrefix + ".ag.job.jobsreferencingaschedule.f1";
|
||||
// // pick schedule bol link
|
||||
// ILaunchFormHost2 host2 = m_serviceProvider.GetService(typeof (ILaunchFormHost2)) as ILaunchFormHost2;
|
||||
// System.Diagnostics.Debug.Assert(host2 != null,
|
||||
// "Service Provider could not provide us the ILaunchFormHost2 service required for displaying books online");
|
||||
|
||||
// if (host2 == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// host2.ShowHelp(key);
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Buttons Initialize / Events
|
||||
|
||||
/// <summary>
|
||||
/// normaly this shouold be handled by WinForms designer
|
||||
/// but currently Rascal and Everett designers are unusuable so hooking them manually
|
||||
/// </summary>
|
||||
// private void InitializeButtonEvents()
|
||||
// {
|
||||
// this.buttonOK.Click += new EventHandler(this.OnButtonOKClick);
|
||||
// this.buttonCancel.Click += new EventHandler(this.OnButtonCancelClick);
|
||||
// this.buttonHelp.Click += new EventHandler(this.OnButtonHelpClick);
|
||||
|
||||
// if (m_serviceProvider == null)
|
||||
// {
|
||||
// this.buttonHelp.Visible = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void OnButtonOKClick(object source, EventArgs args)
|
||||
// {
|
||||
// System.Diagnostics.Debug.Assert(m_innerControl != null);
|
||||
|
||||
// m_innerControl.ApplyChanges();
|
||||
|
||||
// this.DialogResult = m_innerControl.NoOfSelectedJobs != -1
|
||||
// ? DialogResult.OK
|
||||
// : DialogResult.None;
|
||||
// this.Close();
|
||||
// }
|
||||
|
||||
// private void OnButtonCancelClick(object source, EventArgs args)
|
||||
// {
|
||||
// this.DialogResult = DialogResult.Cancel;
|
||||
// this.Close();
|
||||
// }
|
||||
|
||||
// private void OnButtonHelpClick(object source, EventArgs args)
|
||||
// {
|
||||
// ShowHelp();
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user