Agent/improve steps (#710)

* added stepInfo for editing jobs/steps

* added schedules to history requests

* added alerts and schedules to history

* formatting

* code review comments

* removed smo import

* changed and optimized histories, steps, alerts and operators
This commit is contained in:
Aditya Bist
2018-10-16 13:24:32 -07:00
committed by GitHub
parent 8fe3d06068
commit 0efed221ee
7 changed files with 180 additions and 93 deletions

View File

@@ -379,15 +379,24 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
"HasSchedule",
"HasStep",
"HasServer",
"LastRunDate",
"NextRunDate",
"LastRunOutcome",
"JobID",
"Description"
"Description",
"LastRunDate",
"NextRunDate",
"OperatorToEmail",
"OperatorToNetSend",
"OperatorToPage",
"OwnerLoginName",
"PageLevel",
"StartStepID",
"NetSendLevel",
"EventLogLevel",
"EmailLevel",
"DeleteLevel"
};
DataTable dt = enumerator.Process(connection, request);
int numJobs = dt.Rows.Count;
if (numJobs == 0)
{
@@ -395,7 +404,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
}
Dictionary<Guid, JobProperties> foundJobs = new Dictionary<Guid, JobProperties>(numJobs);
for (int i = 0; i < numJobs; ++i)
{
JobProperties jobProperties = new JobProperties(dt.Rows[i]);

View File

@@ -16,7 +16,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
public class JobProperties
{
private string name;
private int currentExecutionStatus;
private int lastRunOutcome;
private string currentExecutionStep;
@@ -32,6 +31,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
private DateTime nextRun;
private Guid jobId;
private string description;
private string owner;
private string operatorToEmail;
private string operatorToPage;
private int startStepID;
private int emailLevel;
private int pageLevel;
private int eventLogLevel;
private int deleteLevel;
private JobProperties()
{
@@ -65,6 +72,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
this.lastRunOutcome = Convert.ToInt32(row["LastRunOutcome"], CultureInfo.InvariantCulture);
this.jobId = Guid.Parse(row["JobID"].ToString());
this.description = row["Description"].ToString();
this.owner = row["OwnerLoginName"].ToString();
this.operatorToEmail = row["OperatorToEmail"].ToString();
this.operatorToPage = row["OperatorToPage"].ToString();
this.startStepID = Convert.ToInt32(row["StartStepID"], CultureInfo.InvariantCulture);
this.emailLevel = Convert.ToInt32(row["EmailLevel"], CultureInfo.InvariantCulture);
this.pageLevel = Convert.ToInt32(row["PageLevel"], CultureInfo.InvariantCulture);
this.eventLogLevel = Convert.ToInt32(row["EventLogLevel"], CultureInfo.InvariantCulture);
this.deleteLevel = Convert.ToInt32(row["DeleteLevel"], CultureInfo.InvariantCulture);
// for a job to be runnable, it must:
// 1. have a target server