in src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/ScheduleData.cs [1055:1145]
public bool UpdateSourceSchedule()
{
bool changesMade = false;
// cannot apply changes if we were created with a struct.
if (this.source == null && this.parentJob == null && this.parentJobServer == null)
{
return false;
}
if (!this.alreadyCreated)
{
// creating a new job. setup the name. Create the object.
this.originalName = this.currentName;
if (this.IsSharedSchedule)
{
this.source = new JobSchedule(this.parentJobServer, this.Name); // ID for this.source is created by agent, we don't have to specify it
}
else // job schedule
{
this.source = new JobSchedule(this.parentJob, this.Name); // ID for this.source is created by agent, we don't have to specify it
}
changesMade = true;
}
else if (this.originalName != this.currentName)
{
// must explicitly rename an object.
this.source.Rename(currentName);
this.originalName = this.currentName;
changesMade = true;
}
if (!this.alreadyCreated || this.enabled != source.IsEnabled)
{
source.IsEnabled = this.enabled;
changesMade = true;
}
if (!this.alreadyCreated || this.frequencyType != source.FrequencyTypes)
{
source.FrequencyTypes = this.frequencyType;
changesMade = true;
}
// use properties for the date and time properties as the agent accepts
// different max dates/times as the ndp. These manage this.
if (!this.alreadyCreated || this.startDate != source.ActiveStartDate)
{
source.ActiveStartDate = this.ActiveStartDate;
changesMade = true;
}
if (!this.alreadyCreated || this.startTime != source.ActiveStartTimeOfDay)
{
source.ActiveStartTimeOfDay = this.ActiveStartTime;
changesMade = true;
}
if (!this.alreadyCreated || this.endDate != source.ActiveEndDate)
{
source.ActiveEndDate = this.ActiveEndDate;
changesMade = true;
}
if (!this.alreadyCreated || this.endTime != source.ActiveEndTimeOfDay)
{
source.ActiveEndTimeOfDay = this.ActiveEndTime;
changesMade = true;
}
if (!this.alreadyCreated || this.frequencyInterval != source.FrequencyInterval)
{
source.FrequencyInterval = this.frequencyInterval;
changesMade = true;
}
if (!this.alreadyCreated || this.frequencyRecurranceFactor != source.FrequencyRecurrenceFactor)
{
source.FrequencyRecurrenceFactor = this.frequencyRecurranceFactor;
changesMade = true;
}
if (!this.alreadyCreated || this.frequencyRelativeInterval != source.FrequencyRelativeIntervals)
{
source.FrequencyRelativeIntervals = this.frequencyRelativeInterval;
changesMade = true;
}
if (!this.alreadyCreated || this.frequencySubDayInterval != source.FrequencySubDayInterval)
{
source.FrequencySubDayInterval = this.frequencySubDayInterval;
changesMade = true;
}
if (!this.alreadyCreated || this.frequencySubDayTypes != source.FrequencySubDayTypes)
{
source.FrequencySubDayTypes = this.frequencySubDayTypes;
changesMade = true;
}
return changesMade;
}