Imports System Imports System.Data Imports System.Web.UI Imports Infragistics.WebUI.WebSchedule Public Class USC_Kalender Inherits System.Web.UI.UserControl Private ds As DataSet = Nothing Dim sKalenderview As String Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load sKalenderview = Request.QueryString("View") If IsNothing(sKalenderview) Then sKalenderview = "" End If Me.WebMonthView1.Style.Add(HtmlTextWriterStyle.Overflow, "hidden") Me.wsInfo.AppointmentFormPath = "/samplesbrowser/samplescommon/aspnet/webschedule/forms/AppointmentAdd.aspx" Me.wsInfo.ReminderFormPath = "/samplesbrowser/samplescommon/aspnet/webschedule/forms/Reminder.aspx" Select Case sKalenderview.ToLower.Trim Case "Show1" LoadData_Show1() Case "messen" LoadData_messen() Case "Show2" LoadData_Show2() Case "Show3" LoadData_Show3() Case Else LoadData_Show1() End Select End Sub Protected Sub LoadData_Show1() ds = New DataSet("GenericDataProviderSample") Dim appointmentsTable As New DataTable("Appointments") appointmentsTable.Columns.Add("ID", GetType(Integer)) appointmentsTable.Columns.Add("StartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("Duration", GetType(Integer)) appointmentsTable.Columns.Add("Subject", GetType(String)) appointmentsTable.Columns.Add("AllDayEvent", GetType(Boolean)) appointmentsTable.Columns.Add("Location", GetType(String)) appointmentsTable.Columns.Add("Description", GetType(String)) appointmentsTable.Columns.Add("Status", GetType(Integer)) appointmentsTable.Columns.Add("EnableReminders", GetType(Boolean)) appointmentsTable.Columns.Add("ShowTimeAs", GetType(Integer)) appointmentsTable.Columns.Add("Importance", GetType(Integer)) appointmentsTable.Columns.Add("VarianceID", GetType(String)) appointmentsTable.Columns.Add("RecurrencePattern", GetType(String)) appointmentsTable.Columns.Add("RecurrenceID", GetType(Integer)) appointmentsTable.Columns.Add("OriginalStartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("ResourceKey", GetType(String)) Dim resourcesTable As New DataTable("Resources") resourcesTable.Columns.Add("ID", GetType(Integer)) resourcesTable.Columns.Add("ResourceName", GetType(String)) resourcesTable.Columns.Add("ResourceDescription", GetType(String)) resourcesTable.Columns.Add("EmailAddress", GetType(String)) resourcesTable.Rows.Add(New Object() {-999, "Unassigned", "Unassigned Resource", "unassigned@resources.com"}) resourcesTable.Rows.Add(New Object() {1, "Show1", "Show1", "info@test.com"}) ds.Tables.Add(appointmentsTable) ds.Tables.Add(resourcesTable) WebScheduleGenericProvider1.AppointmentBinding.DescriptionMember = "Description" WebScheduleGenericProvider1.AppointmentBinding.DataMember = "Appointments" WebScheduleGenericProvider1.ResourceBinding.DataMember = "Resources" WebScheduleGenericProvider1.ActivityDataSource = ds WebScheduleGenericProvider1.VarianceDataSource = ds WebScheduleGenericProvider1.ResourceDataSource = ds End Sub Protected Function CreateAppointment(id As Integer, startDateTime As DateTime, appointmentDuration As Integer, appName As String, location As String, appDescription As String, _ allDayEvent As Boolean, resourceKey As String) As Object() Return New Object() {id, startDateTime.ToUniversalTime(), appointmentDuration, appName, allDayEvent, location, _ appDescription, 1, False, 1, 1, Guid.NewGuid().ToString(), _ "", Nothing, Nothing, resourceKey} End Function Protected Sub WebScheduleInfo1_ActivityAdding(sender As Object, e As CancelableActivityEventArgs) e.Activity.DataKey = New Random().[Next]() End Sub Protected Sub wsInfo_VarianceAdding(sender As Object, e As CancelableActivityEventArgs) e.Activity.DataKey = New Random().[Next]() End Sub Protected Sub LoadData_messen() Try ds = New DataSet("GenericDataProviderSample") Dim appointmentsTable As New DataTable("Appointments") appointmentsTable.Columns.Add("ID", GetType(Integer)) appointmentsTable.Columns.Add("StartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("Duration", GetType(Integer)) appointmentsTable.Columns.Add("Subject", GetType(String)) appointmentsTable.Columns.Add("AllDayEvent", GetType(Boolean)) appointmentsTable.Columns.Add("Location", GetType(String)) appointmentsTable.Columns.Add("Description", GetType(String)) appointmentsTable.Columns.Add("Status", GetType(Integer)) appointmentsTable.Columns.Add("EnableReminders", GetType(Boolean)) appointmentsTable.Columns.Add("ShowTimeAs", GetType(Integer)) appointmentsTable.Columns.Add("Importance", GetType(Integer)) appointmentsTable.Columns.Add("VarianceID", GetType(String)) appointmentsTable.Columns.Add("RecurrencePattern", GetType(String)) appointmentsTable.Columns.Add("RecurrenceID", GetType(Integer)) appointmentsTable.Columns.Add("OriginalStartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("ResourceKey", GetType(String)) appointmentsTable.Rows.Add(CreateAppointment(1, "8.6.2015", (3600 * 24) * 4, "test", "Nürnberg", "test Messe", _ True, "1")) Dim resourcesTable As New DataTable("Resources") resourcesTable.Columns.Add("ID", GetType(Integer)) resourcesTable.Columns.Add("ResourceName", GetType(String)) resourcesTable.Columns.Add("ResourceDescription", GetType(String)) resourcesTable.Columns.Add("EmailAddress", GetType(String)) resourcesTable.Rows.Add(New Object() {-999, "Unassigned", "Unassigned Resource", "unassigned@resources.com"}) resourcesTable.Rows.Add(New Object() {1, "Messen", "Messen", "info@test.com"}) ds.Tables.Add(appointmentsTable) ds.Tables.Add(resourcesTable) WebScheduleGenericProvider1.Dispose() WebScheduleGenericProvider1.ActivityDataSource = ds WebScheduleGenericProvider1.VarianceDataSource = ds WebScheduleGenericProvider1.ResourceDataSource = ds WebScheduleGenericProvider1.DataBind() ' Response.Write("alles okay") Catch ex As Exception Response.Write("fehler--" & ex.Message) End Try End Sub Protected Sub LoadData_Show2() ds = New DataSet("GenericDataProviderSample") Dim appointmentsTable As New DataTable("Appointments") appointmentsTable.Columns.Add("ID", GetType(Integer)) appointmentsTable.Columns.Add("StartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("Duration", GetType(Integer)) appointmentsTable.Columns.Add("Subject", GetType(String)) appointmentsTable.Columns.Add("AllDayEvent", GetType(Boolean)) appointmentsTable.Columns.Add("Location", GetType(String)) appointmentsTable.Columns.Add("Description", GetType(String)) appointmentsTable.Columns.Add("Status", GetType(Integer)) appointmentsTable.Columns.Add("EnableReminders", GetType(Boolean)) appointmentsTable.Columns.Add("ShowTimeAs", GetType(Integer)) appointmentsTable.Columns.Add("Importance", GetType(Integer)) appointmentsTable.Columns.Add("VarianceID", GetType(String)) appointmentsTable.Columns.Add("RecurrencePattern", GetType(String)) appointmentsTable.Columns.Add("RecurrenceID", GetType(Integer)) appointmentsTable.Columns.Add("OriginalStartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("ResourceKey", GetType(String)) Dim resourcesTable As New DataTable("Resources") resourcesTable.Columns.Add("ID", GetType(Integer)) resourcesTable.Columns.Add("ResourceName", GetType(String)) resourcesTable.Columns.Add("ResourceDescription", GetType(String)) resourcesTable.Columns.Add("EmailAddress", GetType(String)) resourcesTable.Rows.Add(New Object() {-999, "Unassigned", "Unassigned Resource", "unassigned@resources.com"}) resourcesTable.Rows.Add(New Object() {1, "Show2", "Show2", "info@test.com"}) ' resourcesTable.Rows.Add(New Object() {2, "Ted Redfern", "Ted Redfern", "tRedfern@resources.com"}) ' resourcesTable.Rows.Add(New Object() {3, "Jamie Gadomski", "Jamie Gadomski", "jGadomski@resources.com"}) ds.Tables.Add(appointmentsTable) ds.Tables.Add(resourcesTable) WebScheduleGenericProvider1.ActivityDataSource = ds WebScheduleGenericProvider1.VarianceDataSource = ds WebScheduleGenericProvider1.ResourceDataSource = ds End Sub Protected Sub LoadData_Show3() ds = New DataSet("GenericDataProviderSample") Dim appointmentsTable As New DataTable("Appointments") appointmentsTable.Columns.Add("ID", GetType(Integer)) appointmentsTable.Columns.Add("StartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("Duration", GetType(Integer)) appointmentsTable.Columns.Add("Subject", GetType(String)) appointmentsTable.Columns.Add("AllDayEvent", GetType(Boolean)) appointmentsTable.Columns.Add("Location", GetType(String)) appointmentsTable.Columns.Add("Description", GetType(String)) appointmentsTable.Columns.Add("Status", GetType(Integer)) appointmentsTable.Columns.Add("EnableReminders", GetType(Boolean)) appointmentsTable.Columns.Add("ShowTimeAs", GetType(Integer)) appointmentsTable.Columns.Add("Importance", GetType(Integer)) appointmentsTable.Columns.Add("VarianceID", GetType(String)) appointmentsTable.Columns.Add("RecurrencePattern", GetType(String)) appointmentsTable.Columns.Add("RecurrenceID", GetType(Integer)) appointmentsTable.Columns.Add("OriginalStartDateTimeUtc", GetType(DateTime)) appointmentsTable.Columns.Add("ResourceKey", GetType(String)) Dim resourcesTable As New DataTable("Resources") resourcesTable.Columns.Add("ID", GetType(Integer)) resourcesTable.Columns.Add("ResourceName", GetType(String)) resourcesTable.Columns.Add("ResourceDescription", GetType(String)) resourcesTable.Columns.Add("EmailAddress", GetType(String)) resourcesTable.Rows.Add(New Object() {-999, "Unassigned", "Unassigned Resource", "unassigned@resources.com"}) resourcesTable.Rows.Add(New Object() {1, "Show3", "Show3", "info@test.com"}) ds.Tables.Add(appointmentsTable) ds.Tables.Add(resourcesTable) WebScheduleGenericProvider1.ActivityDataSource = ds WebScheduleGenericProvider1.VarianceDataSource = ds WebScheduleGenericProvider1.ResourceDataSource = ds End Sub End Class