'宣言 Public Class OwnerRecurringDateSettings Inherits OwnerTimeSlotSettings
public class OwnerRecurringDateSettings : OwnerTimeSlotSettings
OwnerRecurringDateSettings クラスは、日付の定期的に繰り返されるパターンの稼働日、稼働時間、時間範囲の外観の指定が可能です。Appointment の繰り返しを管理する同様の定期的なエンジンを使用します。OwnerRecurringDateSettings クラスは、IsWorkDay プロパティ同様、OwnerTimeSlotSettings クラスや追加プロパティである Recurrence から、WorkingHours や TimeRangeAppearances コレクションを継承します。繰り返しプロパティは、DateRecurrence ( AppointmentRecurrenceクラス派生から) のタイプです。このプロパティは、定義が可能な日付パターン介して一般的なメカニズムを提供します。このプロパティの組み合わせによって、日付の繰り返しパターンのタイムスロット設定が管理できます。たとえば、「隔週の月曜、水曜、金曜」、「11 月の第 2 火曜日」、または「毎月、最初の平日」などを開発者が定義できます。
Imports System.Collections.Generic Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics ' Add a new Owner to the Owners collection Dim myOwner As Owner = Me.calendarInfo.Owners.Add("myCalendar") ' Create a DateRecurrence object for the first weekday of each month, ' beginning on the first day of the current year. Dim firstOfMonth As DateRecurrence = New DateRecurrence(New DateTime(DateTime.Today.Year, 1, 1)) ' Make the recurrence only span the current year. firstOfMonth.RangeEndDate = New DateTime(DateTime.Today.Year, 12, 31) ' Set the pattern properties for the recurrence. firstOfMonth.PatternFrequency = RecurrencePatternFrequency.Monthly firstOfMonth.PatternType = RecurrencePatternType.Calculated firstOfMonth.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.First firstOfMonth.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays ' Create an OwnerRecurringDateSettings object using the new recurrence. Dim firstOfMonthSettings As OwnerRecurringDateSettings = New OwnerRecurringDateSettings(firstOfMonth) ' Specify the working hours for the first weekday of each month ' as 8AM to 4:30PM. firstOfMonthSettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(8), TimeSpan.FromHours(16.5))) ' Now create a DateRecurrence object that will occur on every other Friday Dim everyOtherFriday As DateRecurrence = New DateRecurrence(New DateTime(DateTime.Today.Year, 1, 1)) ' Make the recurrence only span the current year. everyOtherFriday.RangeEndDate = New DateTime(DateTime.Today.Year, 12, 31) ' Set the pattern properties for the recurrence. everyOtherFriday.PatternFrequency = RecurrencePatternFrequency.Weekly everyOtherFriday.PatternInterval = 2 everyOtherFriday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday ' Create an OwnerRecurringDateSettings object using the new recurrence. Dim everyOtherFridaySettings As OwnerRecurringDateSettings = New OwnerRecurringDateSettings(everyOtherFriday) ' Specify the working hours for every other Friday as 9AM to 3PM. everyOtherFridaySettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(9), TimeSpan.FromHours(15))) ' Now create a DateRecurrence object that will occur every weekday Dim everyWeekday As DateRecurrence = New DateRecurrence(New DateTime(DateTime.Today.Year, 1, 1)) ' Make the recurrence only span the current year. everyWeekday.RangeEndDate = New DateTime(DateTime.Today.Year, 12, 31) ' Set the pattern properties for the recurrence. everyWeekday.PatternFrequency = RecurrencePatternFrequency.Daily everyWeekday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays ' Create an OwnerRecurringDateSettings object using the new recurrence. Dim everyWeekdaySettings As OwnerRecurringDateSettings = New OwnerRecurringDateSettings(everyWeekday) ' Specify the working hours for every weekday as 9AM to 5:30PM everyWeekdaySettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(9), TimeSpan.FromHours(17.5))) ' Now add each of the three OwnerRecurringDateSettings objects to the Owner's ' RecurringDateSettings collection. Note that the order in which they are added ' is important; as a rule, the one that generates the fewest occurences should ' be added first. This is because when the working hours are defined by the ' WorkingHours collection, any range of time that does not appear in the collection ' is considered to fall within the non-working hour range, i.e., the resolution ' process ends there. ' ' In this example, If we don't add the monthly and weekly recurrences before ' the daily one, the daily one will generate occurrences on the first weekday ' of every month and every other Friday, superceding the monthly and weekly recurrences. myOwner.RecurringDateSettings.Add(firstOfMonthSettings) myOwner.RecurringDateSettings.Add(everyOtherFridaySettings) myOwner.RecurringDateSettings.Add(everyWeekdaySettings)
using System.Collections.Generic; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; // Create a DateRecurrence object for the first weekday of each month, // beginning on the first day of the current year. DateRecurrence firstOfMonth = new DateRecurrence( new DateTime(DateTime.Today.Year, 1, 1) ); // Make the recurrence only span the current year. firstOfMonth.RangeEndDate = new DateTime(DateTime.Today.Year, 12, 31); // Set the pattern properties for the recurrence. firstOfMonth.PatternFrequency = RecurrencePatternFrequency.Monthly; firstOfMonth.PatternType = RecurrencePatternType.Calculated; firstOfMonth.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.First; firstOfMonth.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays; // Create an OwnerRecurringDateSettings object using the new recurrence. OwnerRecurringDateSettings firstOfMonthSettings = new OwnerRecurringDateSettings( firstOfMonth ); // Specify the working hours for the first weekday of each month // as 8AM to 4:30PM. firstOfMonthSettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(8), TimeSpan.FromHours(16.5) ) ); // Now create a DateRecurrence object that will occur on every other Friday DateRecurrence everyOtherFriday = new DateRecurrence( new DateTime(DateTime.Today.Year, 1, 1) ); // Make the recurrence only span the current year. everyOtherFriday.RangeEndDate = new DateTime(DateTime.Today.Year, 12, 31); // Set the pattern properties for the recurrence. everyOtherFriday.PatternFrequency = RecurrencePatternFrequency.Weekly; everyOtherFriday.PatternInterval = 2; everyOtherFriday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday; // Create an OwnerRecurringDateSettings object using the new recurrence. OwnerRecurringDateSettings everyOtherFridaySettings = new OwnerRecurringDateSettings( everyOtherFriday ); // Specify the working hours for every other Friday as 9AM to 3PM. everyOtherFridaySettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(9), TimeSpan.FromHours(15) ) ); // Now create a DateRecurrence object that will occur every weekday DateRecurrence everyWeekday = new DateRecurrence( new DateTime(DateTime.Today.Year, 1, 1) ); // Make the recurrence only span the current year. everyWeekday.RangeEndDate = new DateTime(DateTime.Today.Year, 12, 31); // Set the pattern properties for the recurrence. everyWeekday.PatternFrequency = RecurrencePatternFrequency.Daily; everyWeekday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays; // Create an OwnerRecurringDateSettings object using the new recurrence. OwnerRecurringDateSettings everyWeekdaySettings = new OwnerRecurringDateSettings( everyWeekday ); // Specify the working hours for every weekday as 9AM to 5:30PM everyWeekdaySettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(9), TimeSpan.FromHours(17.5) ) ); // Now add each of the three OwnerRecurringDateSettings objects to the Owner's // RecurringDateSettings collection. Note that the order in which they are added // is important; as a rule, the one that generates the fewest occurences should // be added first. This is because when the working hours are defined by the // WorkingHours collection, any range of time that does not appear in the collection // is considered to fall within the non-working hour range, i.e., the resolution // process ends there. // // In this example, If we don't add the monthly and weekly recurrences before // the daily one, the daily one will generate occurrences on the first weekday // of every month and every other Friday, superceding the monthly and weekly recurrences. myOwner.RecurringDateSettings.Add( firstOfMonthSettings ); myOwner.RecurringDateSettings.Add( everyOtherFridaySettings ); myOwner.RecurringDateSettings.Add( everyWeekdaySettings );