Skip to content

Commit f8e4be6

Browse files
committed
add maintenance window
1 parent 93af2b5 commit f8e4be6

6 files changed

Lines changed: 47 additions & 19 deletions

File tree

ConfigMgr.QuickTools.Device/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.38.0")]
35-
[assembly: AssemblyFileVersion("1.0.38.0")]
34+
[assembly: AssemblyVersion("1.1.0.0")]
35+
[assembly: AssemblyFileVersion("1.1.0.0")]

ConfigMgr.QuickTools.Device/ResultMaintenanceWindowsControl.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ConfigMgr.QuickTools.Device/ResultMaintenanceWindowsControl.cs

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ private void BackgroundWorker_QueryProcessorObjectsReady(object sender, QueryPro
5353

5454
foreach (IResultObject resultObject in e.ResultObjects)
5555
{
56-
//string query = string.Format("SELECT * FROM SMS_CollectionSettings where CollectionID = '{0}'", resultObject["CollectionID"].StringValue);
57-
//IResultObject collectionSettings = Utility.GetFirstWMIInstance(ConnectionManager, query);
5856
IResultObject collectionSettings = ConnectionManager.GetInstance("SMS_CollectionSettings.CollectionID='" + resultObject["CollectionID"].StringValue + "'");
5957
collectionSettings.Get();
6058

@@ -114,16 +112,46 @@ private void BackgroundWorker_QueryProcessorObjectsReady(object sender, QueryPro
114112

115113
break;
116114
case 4:
115+
// monthly schedule with week selection, check when next windows occures
116+
currentTime = new DateTime(currentTime.Year, currentTime.Month, 1);
117+
// add months
118+
if (schedule["ForNumberOfMonths"].IntegerValue > 1)
119+
{
120+
currentTime = currentTime.AddMonths(schedule["ForNumberOfMonths"].IntegerValue);
121+
}
122+
// find the day in month
123+
while ((int)currentTime.DayOfWeek != (schedule["Day"].IntegerValue - 1))
124+
{
125+
currentTime = currentTime.AddDays(1);
126+
}
127+
// add weeks
128+
currentTime = currentTime.AddDays(days[(schedule["WeekOrder"].IntegerValue - 1)]);
129+
currentTime = currentTime.Date.Add(startTime.TimeOfDay);
130+
131+
date = currentTime.ToLongDateString();
117132

118-
if (schedule["WeekOrder"].IntegerValue >= 1)
133+
break;
134+
case 5:
135+
// monthly schedule, check when next windows occures
136+
int monthDay = schedule["MonthDay"].IntegerValue;
137+
// day of month
138+
if (monthDay >= 1)
139+
{
140+
currentTime = new DateTime(currentTime.Year, currentTime.Month, monthDay);
141+
}
142+
// last day of month
143+
else if (monthDay == 0)
119144
{
120-
DateTime firstDayOfMonth = new DateTime(currentTime.Year, currentTime.Month, 1);
145+
currentTime = new DateTime(currentTime.Year, currentTime.Month, DateTime.DaysInMonth(currentTime.Year, currentTime.Month));
146+
}
121147

122-
//while ((int)firstDayOfMonth.DayOfWeek != (schedule["Day"].IntegerValue - 1))
123-
//{
124-
// firstDayOfMonth = firstDayOfMonth.AddDays(1);
125-
// }
148+
if (schedule["ForNumberOfMonths"].IntegerValue > 1)
149+
{
150+
currentTime = currentTime.AddMonths(schedule["ForNumberOfMonths"].IntegerValue);
126151
}
152+
currentTime = currentTime.Date.Add(startTime.TimeOfDay);
153+
154+
date = currentTime.ToLongDateString();
127155

128156
break;
129157
}

ConfigMgr.QuickTools.DriverManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.14.0")]
35-
[assembly: AssemblyFileVersion("1.0.14.0")]
34+
[assembly: AssemblyVersion("1.1.0.0")]
35+
[assembly: AssemblyFileVersion("1.1.0.0")]

ConfigMgr.QuickTools.Warranty/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.14.0")]
35-
[assembly: AssemblyFileVersion("1.0.14.0")]
34+
[assembly: AssemblyVersion("1.1.0.0")]
35+
[assembly: AssemblyFileVersion("1.1.0.0")]

ConfigMgr.QuickTools/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.14.0")]
35-
[assembly: AssemblyFileVersion("1.0.14.0")]
34+
[assembly: AssemblyVersion("1.1.0.0")]
35+
[assembly: AssemblyFileVersion("1.1.0.0")]

0 commit comments

Comments
 (0)