System information

Table Of Contents
i.LON SmartServer 2.0 Programmer’s Reference
21-13
//create Exception item
holidays.Exception = new iLON_SmartServer.UFPTscheduler_CfgDateBasedException[1];
holidays.Exception[0] = new iLON_SmartServer.UFPTscheduler_CfgDateBasedException();
holidays.Exception[0].UCPTexceptionName = "Holidays";
holidays.Exception[0].UCPTindex = 0;
holidays.Exception[0].UCPTindexSpecified = true;
//store date-based (exception) schedule we created in a DateBased[]
myScheduler.DateBased = new iLON_SmartServer.UFPTscheduler_CfgDateBased[1];
myScheduler.DateBased[0] = new iLON_SmartServer.UFPTscheduler_CfgDateBased();
myScheduler.DateBased[0] = holidays;
//call Set function
iLON_SmartServer.Item_CfgColl itemCfgColl = new iLON_SmartServer.Item_CfgColl();
itemCfgColl.Item = new iLON_SmartServer.Item_Cfg[1];
itemCfgColl.Item[0] = myScheduler;
iLON_SmartServer.Item_Coll ItemColl_Set_Scheduler_Return = SmartServer.Set(itemCfgColl);
if (ItemColl_Set_Scheduler_Return.UCPTfaultCount > 0)
{
PrintGetError(ItemColl);
}
else
{
iLON_SmartServer.Item newScheduler = ItemColl_Set_Scheduler_Return.Item[0];
Console.WriteLine("New Scheduler = " + newScheduler.UCPTname);
}
}
// -------------- CREATING A CALENDAR --------------
//Create a new UFPTcalendar_Cfg item
myCalendar = new iLON_SmartServer.UFPTcalendar_Cfg();
myCalendar.UCPTname = "Net/LON/iLON App/myCalendar";
myCalendar.UCPTannotation = "#8000010128000000[4].UFPTcalendar";
//Configure the Calendar
iLON_SmartServer.UFPTscheduler_CfgEffectivePeriod effectivePeriod_calendar =
new iLON_SmartServer.UFPTscheduler_CfgEffectivePeriod();
effectivePeriod_calendar.StartDate = new DateTime(2009, 6, 8);
effectivePeriod_calendar.EndDate = new DateTime(2020, 12, 31);
effectivePeriod_calendar.StartDateSpecified =
true;
effectivePeriod_calendar.EndDateSpecified = true;
myCalendar.ScheduleEffectivePeriod = effectivePeriod_calendar;
//create an exception
myCalendar.Exception = new iLON_SmartServer.UFPTcalendar_CfgException[1];
myCalendar.Exception[0] = new iLON_SmartServer.UFPTcalendar_CfgException();
myCalendar.Exception[0].UCPTexceptionName = "Holidays";
myCalendar.Exception[0].UCPTaliasName = "Holidays";
myCalendar.Exception[0].UCPTindex = 0;
myCalendar.Exception[0].UCPTindexSpecified = true;
myCalendar.Exception[0].UCPTtemporary = 0;
myCalendar.Exception[0].UCPTtemporarySpecified = true;
myCalendar.Exception[0].UCPTmaxClient = 1;
myCalendar.Exception[0].UCPTmaxClientSpecified = true;
myCalendar.Exception[0].Client = new iLON_SmartServer.UFPTcalendar_CfgExceptionClient[1];
myCalendar.Exception[0].Client[0] = new iLON_SmartServer.UFPTcalendar_CfgExceptionClient();
myCalendar.Exception[0].Client[0].UCPTname = "Net/LON/iLON App/myScheduler";
myCalendar.Exception[0].Client[0].UCPTservicePath =
new ConsoleApplication_CSharp_Test_3._5.iLON_SmartServer.E_Path();
myCalendar.Exception[0].Client[0].UCPTservicePath.Value = "";