beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 392

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-40

Dim

newScheduler

As

iLON_SmartServer.Item = ItemColl_Set_Scheduler_Return.Item(0)

Console.WriteLine(

"New Scheduler = "

& newScheduler.UCPTname)

End

If

End

If

' -------------- CREATING A CALENDAR --------------

Create a new UFPTcalendar_Cfg item

Dim

myCalendar

As

New

iLON_SmartServer.UFPTcalendar_Cfg()

myCalendar.UCPTname =

"Net/LON/iLON App/myCalendar"

myCalendar.UCPTannotation =

"#8000010128000000[4].UFPTcalendar"

End

Try

'Configure the Calendar

Dim

effectivePeriod_calendar

As

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(0) {}

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(0) {}

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

iLON_SmartServer.E_Path()

myCalendar.Exception(0).Client(0).UCPTservicePath.Value =

""

'create exception dates

myCalendar.Exception(0).Schedule =

New

iLON_SmartServer.UFPTcalendar_CfgExceptionSchedule(3) {}

myCalendar.Exception(0).Schedule(0) =

New

iLON_SmartServer.UFPTcalendar_CfgExceptionSchedule()

myCalendar.Exception(0).Schedule(1) =

New

iLON_SmartServer.UFPTcalendar_CfgExceptionSchedule()

myCalendar.Exception(0).Schedule(2) =

New

iLON_SmartServer.UFPTcalendar_CfgExceptionSchedule()

myCalendar.Exception(0).Schedule(3) =

New

iLON_SmartServer.UFPTcalendar_CfgExceptionSchedule()


'create 4th of July exception

'==========================

myCalendar.Exception(0).Schedule(0).UCPTschedMonth =

New

iLON_SmartServer.E_LonString()

myCalendar.Exception(0).Schedule(0).UCPTschedMonth.LonFormat =

"UCPTschedMonth"

myCalendar.Exception(0).Schedule(0).UCPTschedMonth.Value =

"MN_JUL"

myCalendar.Exception(0).Schedule(0).UCPTschedDay =

New

iLON_SmartServer.E_LonString()

myCalendar.Exception(0).Schedule(0).UCPTschedDay.LonFormat =

"UCPTschedDay"

myCalendar.Exception(0).Schedule(0).UCPTschedDay.Value =

"DM_DAY_4"

'set start date

myCalendar.Exception(0).Schedule(0).StartDate =

New

iLON_SmartServer.UFPTcalendar_CfgESDate()

myCalendar.Exception(0).Schedule(0).StartDate.UCPTdate =

New

DateTime(2009, 6, 8)


'set end date

myCalendar.Exception(0).Schedule(0).EndDate =

New

iLON_SmartServer.UFPTcalendar_CfgESDate()

myCalendar.Exception(0).Schedule(0).EndDate.UCPTdate =

New

DateTime(2020, 12, 31)


'create Labor Day exception

'==========================