'宣言 Public Function GetHolidaysInRange( _ ByVal startDateTime As Date, _ ByVal endDateTime As Date _ ) As HolidaysSubsetCollection
public HolidaysSubsetCollection GetHolidaysInRange( DateTime startDateTime, DateTime endDateTime )
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.IO Imports System.Globalization Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click ' 返されたサブセット コレクションのカウントを取得し、 ' 現在の日に各アクティビティ タイプがあるかどうかを決定します Dim hasAppointments As Boolean = Me.ultraCalendarInfo1.GetAppointmentsInRange(DateTime.Today.Date.AddHours(9.0F), DateTime.Today.Date.AddHours(9.5F)).Count > 0 Dim hasHolidays As Boolean = Me.ultraCalendarInfo1.GetHolidaysInRange(DateTime.Today.Date, DateTime.Today.Date).Count > 0 Dim hasNotes As Boolean = Me.ultraCalendarInfo1.GetNotesInRange(DateTime.Today.Date, DateTime.Today.Date).Count > 0 ' 現在の日のアクティビティの状態を表示します Dim info As String = String.Empty If (Not hasAppointments And Not hasHolidays And Not hasNotes) Then info += "There are no Appointments, Holidays, or Notes for " + DateTime.Today.ToLongDateString() + "." + vbCrLf Else If (hasAppointments) Then info += "There are Appointments scheduled for " + DateTime.Today.ToLongDateString() + "." + vbCrLf If (hasHolidays) Then info += "There are Holidays that fall on " + DateTime.Today.ToLongDateString() + "." + vbCrLf If (hasNotes) Then info += "There are Notes for " + DateTime.Today.ToLongDateString() + "." + vbCrLf End If End If End If End If MessageBox.Show(info, "GetAppointmentsInRange/GetHolidaysInRange/GetNotesInRange", MessageBoxButtons.OK) End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.IO; using System.Globalization; private void button1_Click(object sender, System.EventArgs e) { // 返されたサブセット コレクションのカウントを取得し、 // 現在の日に各アクティビティ タイプがあるかどうかを決定します bool hasAppointments = this.ultraCalendarInfo1.GetAppointmentsInRange( DateTime.Today.Date.AddHours( 9.0F ), DateTime.Today.Date.AddHours( 9.5F ) ).Count > 0; bool hasHolidays = this.ultraCalendarInfo1.GetHolidaysInRange( DateTime.Today.Date, DateTime.Today.Date ).Count > 0; bool hasNotes = this.ultraCalendarInfo1.GetNotesInRange( DateTime.Today.Date, DateTime.Today.Date ).Count > 0; // 現在の日のアクティビティの状態を表示します string info = string.Empty; if ( ! hasAppointments && ! hasHolidays && ! hasNotes ) info += "There are no Appointments, Holidays, or Notes for " + DateTime.Today.ToLongDateString() + "." + "\n"; else { if ( hasAppointments ) info += "There are Appointments scheduled for " + DateTime.Today.ToLongDateString() + "." + "\n"; if ( hasHolidays ) info += "There are Holidays that fall on " + DateTime.Today.ToLongDateString() + "." + "\n"; if ( hasNotes ) info += "There are Notes for " + DateTime.Today.ToLongDateString() + "." + "\n"; } MessageBox.Show( info, "GetAppointmentsInRange/GetHolidaysInRange/GetNotesInRange", MessageBoxButtons.OK ); }