This is a migrated thread and some comments may be shown as answers.

Adding Custom Field

2 Answers 73 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 28 Nov 2015, 11:18 AM

Hi.

I am trying to add a custom field, but can't figure out how to make it work.

I have tried your examples, but the part where i read it in and out of the appointment is the problem. 

Here is my code so far:

Imports Telerik.WinControls.UI

Public Class CustomAppointmentFactory
    Implements IAppointmentFactory
#Region "IAppointmentFactory Members"
    Public Function CreateNewAppointment() As IEvent Implements IAppointmentFactory.CreateNewAppointment
        Return New AppointmentWithEmail()
    End Function
#End Region
End Class


Imports Telerik.WinControls.UI

Public Class AppointmentWithEmail
    Inherits Appointment
    Public Sub New()
        MyBase.New()
    End Sub

    Protected Overrides Function CreateOccurrenceInstance() As [Event]
        Return New AppointmentWithEmail()
    End Function
    Private _email As String = String.Empty
    Public Property Email() As String
        Get
            Return Me._email
        End Get
        Set(ByVal value As String)
            If Me._email <> value Then
                Me._email = value
                Me.OnPropertyChanged("Email")
            End If
        End Set
    End Property
End Class



Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports Telerik.WinControls.UI.Scheduler.Dialogs
Imports Telerik.WinControls.UI

Public Class MultipleResourcesDialog
    Inherits EditAppointmentDialog
    Friend WithEvents butStartOpgave As Telerik.WinControls.UI.RadButton
    Friend WithEvents RadSeparator4 As Telerik.WinControls.UI.RadSeparator
    Friend WithEvents butPause As Telerik.WinControls.UI.RadButton
    Friend WithEvents butSlut As Telerik.WinControls.UI.RadButton
    Friend WithEvents RadSeparator5 As Telerik.WinControls.UI.RadSeparator
    Friend WithEvents butEmail As Telerik.WinControls.UI.RadButton
    Friend WithEvents butHaster As Telerik.WinControls.UI.RadButton
    Friend WithEvents RadSeparator6 As Telerik.WinControls.UI.RadSeparator
    Friend WithEvents butOrdre As Telerik.WinControls.UI.RadButton
    Friend WithEvents RadButton1 As Telerik.WinControls.UI.RadButton
    Friend WithEvents RadSeparator7 As Telerik.WinControls.UI.RadSeparator
    Friend WithEvents RadSeparator8 As Telerik.WinControls.UI.RadSeparator
    Friend WithEvents RadSeparator9 As Telerik.WinControls.UI.RadSeparator
    Friend WithEvents txtEmail As Telerik.WinControls.UI.RadTextBox
    Private listResources As Telerik.WinControls.UI.RadListControl

    'Dim appointmentElement As AppointmentElement = SchedulerUIHelper.GetSelectedAppointment(frmOpgaver2.uiRadSchedulerMain)
    'Dim appointment As Appointment = TryCast(AppointmentElement.Appointment, Appointment)


    Public Sub New()
        InitializeComponent()
    End Sub

    Protected Overrides Sub LoadSettingsFromEvent(ByVal sourceEvent As IEvent)

        MyBase.LoadSettingsFromEvent(sourceEvent)

        '--------
        Dim appointmentWithEmail As AppointmentWithEmail = TryCast(sourceEvent, AppointmentWithEmail)
        If appointmentWithEmail IsNot Nothing Then
            Me.txtEmail.Text = appointmentWithEmail.Email
        End If
        '-------------

        If sourceEvent.ResourceId IsNot Nothing Then

            For Each item As RadListDataItem In Me.listResources.Items
                If sourceEvent.ResourceIds.Contains(TryCast(item.Value, EventId)) Then
                    item.Selected = True
                Else
                    item.Selected = False
                End If
            Next

            If Me.SchedulerData.GroupType = GroupType.None AndAlso sourceEvent.ResourceIds.Count > 1 Then
                Me.listResources.SelectedIndex = 1
            End If
        End If
    End Sub

    Protected Overrides Sub LoadResources()
        MyBase.LoadResources()

        If Me.SchedulerData Is Nothing Then
            Return
        End If

        Dim resourceStorage As ISchedulerStorage(Of IResource) = Me.SchedulerData.GetResourceStorage()
        Me.listResources.Items.Clear()

        If Me.SchedulerData.GroupType = GroupType.None Then
            Dim item As New RadListDataItem("None")
            item.Value = -1
            Me.listResources.Items.Add(item)
        End If

        For Each resource As IResource In resourceStorage
            If resource.Visible Then
                Dim item As New RadListDataItem(resource.Name)
                item.Value = resource.Id
                Me.listResources.Items.Add(item)
            End If
        Next

        If Me.listResources.Items.Count > 0 Then
            Me.listResources.SelectedIndex = 0
        End If
    End Sub

    Protected Overrides Sub ApplySettingsToEvent(ByVal targetEvent As IEvent)
        MyBase.ApplySettingsToEvent(targetEvent)

        '---------
        Dim appointmentWithEmail As AppointmentWithEmail = TryCast(targetEvent, AppointmentWithEmail)
        If AppointmentWithEmail IsNot Nothing Then
            AppointmentWithEmail.Email = Me.txtEmail.Text
        End If
        MyBase.ApplySettingsToEvent(targetEvent)
        '------------------ 


        If Me.listResources.SelectedIndex >= 0 Then

            Dim selectedItem As RadListDataItem = listResources.Items(Me.listResources.SelectedIndex)

            If selectedItem.Text.Equals("None") Then
                If targetEvent.ResourceIds.Count > 0 Then
                    targetEvent.ResourceIds.Clear()
                End If
            Else
                targetEvent.ResourceIds.Clear()

                For Each item As RadListDataItem In listResources.SelectedItems
                    Dim resourceId As EventId = TryCast(item.Value, EventId)
                    If Not targetEvent.ResourceIds.Contains(resourceId) Then
                        targetEvent.ResourceIds.Add(resourceId)
                    End If
                Next
            End If
        End If
    End Sub

    Protected Overrides Function CreateNewEvent() As IEvent
        Return New AppointmentWithEmail()
    End Function

    Private Sub InitializeComponent()
        Me.listResources = New Telerik.WinControls.UI.RadListControl()
        Me.butStartOpgave = New Telerik.WinControls.UI.RadButton()
        Me.RadSeparator4 = New Telerik.WinControls.UI.RadSeparator()
        Me.butPause = New Telerik.WinControls.UI.RadButton()
        Me.butSlut = New Telerik.WinControls.UI.RadButton()
        Me.RadSeparator5 = New Telerik.WinControls.UI.RadSeparator()
        Me.butEmail = New Telerik.WinControls.UI.RadButton()
        Me.butHaster = New Telerik.WinControls.UI.RadButton()
        Me.RadSeparator6 = New Telerik.WinControls.UI.RadSeparator()
        Me.RadSeparator7 = New Telerik.WinControls.UI.RadSeparator()
        Me.butOrdre = New Telerik.WinControls.UI.RadButton()
        Me.RadButton1 = New Telerik.WinControls.UI.RadButton()
        Me.RadSeparator8 = New Telerik.WinControls.UI.RadSeparator()
        Me.RadSeparator9 = New Telerik.WinControls.UI.RadSeparator()
        Me.txtEmail = New Telerik.WinControls.UI.RadTextBox()
        CType(Me.labelSubject, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.labelLocation, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.labelBackground, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.txtSubject, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.txtLocation, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.cmbBackground, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.labelStartTime, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.labelEndTime, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.dateStart, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.timeStart, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.dateEnd, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.timeEnd, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.chkAllDay, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.labelResource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.cmbResource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.labelStatus, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.cmbShowTimeAs, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.textBoxDescription, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.buttonOK, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.buttonCancel, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.buttonDelete, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.buttonRecurrence, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.errorProvider, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.radSeparator1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.radSeparator2, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.radSeparator3, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.radDropDownListReminder, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.radLabelReminder, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.listResources, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.butStartOpgave, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.RadSeparator4, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.butPause, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.butSlut, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.RadSeparator5, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.butEmail, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.butHaster, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.RadSeparator6, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.RadSeparator6.SuspendLayout()
        CType(Me.RadSeparator7, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.butOrdre, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.RadButton1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.RadSeparator8, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.RadSeparator8.SuspendLayout()
        CType(Me.RadSeparator9, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.txtEmail, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'txtSubject
        '
        Me.txtSubject.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.txtSubject.ReadOnly = True
        '
        'txtLocation
        '
        Me.txtLocation.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        '
        'cmbBackground
        '
        '
        '
        '
        Me.cmbBackground.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren
        '
        'dateStart
        '
        Me.dateStart.Text = "17-05-2011"
        Me.dateStart.Value = New Date(2011, 5, 17, 11, 22, 29, 614)
        '
        'timeStart
        '
        Me.timeStart.Text = "11:22:29"
        Me.timeStart.Value = New Date(2011, 5, 17, 11, 22, 29, 614)
        '
        'dateEnd
        '
        Me.dateEnd.Text = "17-05-2011"
        Me.dateEnd.Value = New Date(2011, 5, 17, 11, 22, 29, 614)
        '
        'timeEnd
        '
        Me.timeEnd.Text = "11:22:29"
        Me.timeEnd.Value = New Date(2011, 5, 17, 11, 22, 29, 614)
        '
        'cmbResource
        '
        Me.cmbResource.Location = New System.Drawing.Point(853, 103)
        Me.cmbResource.Visible = False
        '
        'cmbShowTimeAs
        '
        Me.cmbShowTimeAs.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        '
        '
        '
        Me.cmbShowTimeAs.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren
        '
        'textBoxDescription
        '
        Me.textBoxDescription.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.textBoxDescription.Location = New System.Drawing.Point(7, 322)
        Me.textBoxDescription.Size = New System.Drawing.Size(525, 116)
        '
        'buttonOK
        '
        Me.buttonOK.Location = New System.Drawing.Point(6, 444)
        '
        'buttonCancel
        '
        Me.buttonCancel.Location = New System.Drawing.Point(87, 444)
        Me.buttonCancel.Text = "Fortryd"
        '
        'buttonDelete
        '
        Me.buttonDelete.Location = New System.Drawing.Point(168, 444)
        Me.buttonDelete.Text = "Slet"
        '
        'buttonRecurrence
        '
        Me.buttonRecurrence.Location = New System.Drawing.Point(249, 444)
        Me.buttonRecurrence.Text = "Gentagelse"
        '
        'radSeparator3
        '
        Me.radSeparator3.Location = New System.Drawing.Point(6, 306)
        '
        'radDropDownListReminder
        '
        Me.radDropDownListReminder.Location = New System.Drawing.Point(856, 103)
        Me.radDropDownListReminder.Text = "None"
        '
        'radLabelReminder
        '
        Me.radLabelReminder.Location = New System.Drawing.Point(773, 105)
        Me.radLabelReminder.Size = New System.Drawing.Size(54, 18)
        Me.radLabelReminder.Text = "Reminder"
        Me.radLabelReminder.Visible = False
        '
        'listResources
        '
        Me.listResources.Location = New System.Drawing.Point(79, 169)
        Me.listResources.Name = "listResources"
        Me.listResources.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple
        Me.listResources.Size = New System.Drawing.Size(180, 131)
        Me.listResources.TabIndex = 25
        Me.listResources.Text = "radListControl1"
        '
        'butStartOpgave
        '
        Me.butStartOpgave.Location = New System.Drawing.Point(559, 9)
        Me.butStartOpgave.Name = "butStartOpgave"
        Me.butStartOpgave.Size = New System.Drawing.Size(110, 24)
        Me.butStartOpgave.TabIndex = 26
        Me.butStartOpgave.Text = "Start opgave"
        '
        'RadSeparator4
        '
        Me.RadSeparator4.Location = New System.Drawing.Point(535, 9)
        Me.RadSeparator4.Name = "RadSeparator4"
        Me.RadSeparator4.Orientation = System.Windows.Forms.Orientation.Vertical
        Me.RadSeparator4.Size = New System.Drawing.Size(15, 429)
        Me.RadSeparator4.TabIndex = 27
        Me.RadSeparator4.Text = "RadSeparator4"
        '
        'butPause
        '
        Me.butPause.Location = New System.Drawing.Point(559, 39)
        Me.butPause.Name = "butPause"
        Me.butPause.Size = New System.Drawing.Size(110, 24)
        Me.butPause.TabIndex = 28
        Me.butPause.Text = "Pause opgave"
        '
        'butSlut
        '
        Me.butSlut.Location = New System.Drawing.Point(559, 69)
        Me.butSlut.Name = "butSlut"
        Me.butSlut.Size = New System.Drawing.Size(110, 24)
        Me.butSlut.TabIndex = 29
        Me.butSlut.Text = "Afslut opgave"
        '
        'RadSeparator5
        '
        Me.RadSeparator5.Location = New System.Drawing.Point(559, 127)
        Me.RadSeparator5.Name = "RadSeparator5"
        Me.RadSeparator5.Size = New System.Drawing.Size(105, 10)
        Me.RadSeparator5.TabIndex = 30
        Me.RadSeparator5.Text = "RadSeparator5"
        '
        'butEmail
        '
        Me.butEmail.Location = New System.Drawing.Point(559, 141)
        Me.butEmail.Name = "butEmail"
        Me.butEmail.Size = New System.Drawing.Size(110, 24)
        Me.butEmail.TabIndex = 31
        Me.butEmail.Text = "E-mail til kunde"
        '
        'butHaster
        '
        Me.butHaster.Location = New System.Drawing.Point(559, 101)
        Me.butHaster.Name = "butHaster"
        Me.butHaster.Size = New System.Drawing.Size(110, 24)
        Me.butHaster.TabIndex = 30
        Me.butHaster.Text = "Haster"
        '
        'RadSeparator6
        '
        Me.RadSeparator6.Controls.Add(Me.RadSeparator7)
        Me.RadSeparator6.Location = New System.Drawing.Point(559, 171)
        Me.RadSeparator6.Name = "RadSeparator6"
        Me.RadSeparator6.Size = New System.Drawing.Size(105, 10)
        Me.RadSeparator6.TabIndex = 32
        Me.RadSeparator6.Text = "RadSeparator6"
        '
        'RadSeparator7
        '
        Me.RadSeparator7.Location = New System.Drawing.Point(0, 46)
        Me.RadSeparator7.Name = "RadSeparator7"
        Me.RadSeparator7.Size = New System.Drawing.Size(105, 10)
        Me.RadSeparator7.TabIndex = 33
        Me.RadSeparator7.Text = "RadSeparator7"
        '
        'butOrdre
        '
        Me.butOrdre.Location = New System.Drawing.Point(559, 187)
        Me.butOrdre.Name = "butOrdre"
        Me.butOrdre.Size = New System.Drawing.Size(110, 24)
        Me.butOrdre.TabIndex = 33
        Me.butOrdre.Text = "Åbn ordre"
        '
        'RadButton1
        '
        Me.RadButton1.Location = New System.Drawing.Point(559, 230)
        Me.RadButton1.Name = "RadButton1"
        Me.RadButton1.Size = New System.Drawing.Size(110, 46)
        Me.RadButton1.TabIndex = 34
        Me.RadButton1.Text = "Opret opgave på eksisterende ordre"
        Me.RadButton1.TextWrap = True
        '
        'RadSeparator8
        '
        Me.RadSeparator8.Controls.Add(Me.RadSeparator9)
        Me.RadSeparator8.Location = New System.Drawing.Point(562, 214)
        Me.RadSeparator8.Name = "RadSeparator8"
        Me.RadSeparator8.Size = New System.Drawing.Size(105, 10)
        Me.RadSeparator8.TabIndex = 35
        Me.RadSeparator8.Text = "RadSeparator8"
        '
        'RadSeparator9
        '
        Me.RadSeparator9.Location = New System.Drawing.Point(0, 46)
        Me.RadSeparator9.Name = "RadSeparator9"
        Me.RadSeparator9.Size = New System.Drawing.Size(105, 10)
        Me.RadSeparator9.TabIndex = 33
        Me.RadSeparator9.Text = "RadSeparator9"
        '
        'txtEmail
        '
        Me.txtEmail.Location = New System.Drawing.Point(302, 230)
        Me.txtEmail.Name = "txtEmail"
        Me.txtEmail.Size = New System.Drawing.Size(230, 20)
        Me.txtEmail.TabIndex = 36
        '
        'MultipleResourcesDialog
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.ClientSize = New System.Drawing.Size(676, 472)
        Me.Controls.Add(Me.txtEmail)
        Me.Controls.Add(Me.RadSeparator8)
        Me.Controls.Add(Me.RadButton1)
        Me.Controls.Add(Me.butOrdre)
        Me.Controls.Add(Me.RadSeparator6)
        Me.Controls.Add(Me.butHaster)
        Me.Controls.Add(Me.butEmail)
        Me.Controls.Add(Me.RadSeparator5)
        Me.Controls.Add(Me.butSlut)
        Me.Controls.Add(Me.butPause)
        Me.Controls.Add(Me.RadSeparator4)
        Me.Controls.Add(Me.butStartOpgave)
        Me.Controls.Add(Me.listResources)
        Me.Name = "MultipleResourcesDialog"
        '
        '
        '
        Me.RootElement.ApplyShapeToControl = True
        Me.RootElement.MinSize = New System.Drawing.Size(539, 365)
        Me.Text = "Edit Appointment"
        Me.Controls.SetChildIndex(Me.radLabelReminder, 0)
        Me.Controls.SetChildIndex(Me.radDropDownListReminder, 0)
        Me.Controls.SetChildIndex(Me.listResources, 0)
        Me.Controls.SetChildIndex(Me.radSeparator3, 0)
        Me.Controls.SetChildIndex(Me.cmbResource, 0)
        Me.Controls.SetChildIndex(Me.labelSubject, 0)
        Me.Controls.SetChildIndex(Me.labelLocation, 0)
        Me.Controls.SetChildIndex(Me.labelBackground, 0)
        Me.Controls.SetChildIndex(Me.txtSubject, 0)
        Me.Controls.SetChildIndex(Me.txtLocation, 0)
        Me.Controls.SetChildIndex(Me.cmbBackground, 0)
        Me.Controls.SetChildIndex(Me.labelStartTime, 0)
        Me.Controls.SetChildIndex(Me.labelEndTime, 0)
        Me.Controls.SetChildIndex(Me.dateStart, 0)
        Me.Controls.SetChildIndex(Me.timeStart, 0)
        Me.Controls.SetChildIndex(Me.dateEnd, 0)
        Me.Controls.SetChildIndex(Me.timeEnd, 0)
        Me.Controls.SetChildIndex(Me.chkAllDay, 0)
        Me.Controls.SetChildIndex(Me.labelResource, 0)
        Me.Controls.SetChildIndex(Me.labelStatus, 0)
        Me.Controls.SetChildIndex(Me.cmbShowTimeAs, 0)
        Me.Controls.SetChildIndex(Me.textBoxDescription, 0)
        Me.Controls.SetChildIndex(Me.buttonOK, 0)
        Me.Controls.SetChildIndex(Me.buttonCancel, 0)
        Me.Controls.SetChildIndex(Me.buttonDelete, 0)
        Me.Controls.SetChildIndex(Me.buttonRecurrence, 0)
        Me.Controls.SetChildIndex(Me.radSeparator1, 0)
        Me.Controls.SetChildIndex(Me.radSeparator2, 0)
        Me.Controls.SetChildIndex(Me.butStartOpgave, 0)
        Me.Controls.SetChildIndex(Me.RadSeparator4, 0)
        Me.Controls.SetChildIndex(Me.butPause, 0)
        Me.Controls.SetChildIndex(Me.butSlut, 0)
        Me.Controls.SetChildIndex(Me.RadSeparator5, 0)
        Me.Controls.SetChildIndex(Me.butEmail, 0)
        Me.Controls.SetChildIndex(Me.butHaster, 0)
        Me.Controls.SetChildIndex(Me.RadSeparator6, 0)
        Me.Controls.SetChildIndex(Me.butOrdre, 0)
        Me.Controls.SetChildIndex(Me.RadButton1, 0)
        Me.Controls.SetChildIndex(Me.RadSeparator8, 0)
        Me.Controls.SetChildIndex(Me.txtEmail, 0)
        CType(Me.labelSubject, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.labelLocation, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.labelBackground, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.txtSubject, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.txtLocation, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.cmbBackground, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.labelStartTime, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.labelEndTime, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.dateStart, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.timeStart, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.dateEnd, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.timeEnd, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.chkAllDay, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.labelResource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.cmbResource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.labelStatus, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.cmbShowTimeAs, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.textBoxDescription, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.buttonOK, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.buttonCancel, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.buttonDelete, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.buttonRecurrence, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.errorProvider, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.radSeparator1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.radSeparator2, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.radSeparator3, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.radDropDownListReminder, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.radLabelReminder, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.listResources, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.butStartOpgave, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.RadSeparator4, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.butPause, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.butSlut, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.RadSeparator5, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.butEmail, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.butHaster, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.RadSeparator6, System.ComponentModel.ISupportInitialize).EndInit()
        Me.RadSeparator6.ResumeLayout(False)
        CType(Me.RadSeparator7, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.butOrdre, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.RadButton1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.RadSeparator8, System.ComponentModel.ISupportInitialize).EndInit()
        Me.RadSeparator8.ResumeLayout(False)
        CType(Me.RadSeparator9, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.txtEmail, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
  
End Class




   Private Sub uiRadSchedulerMain_AppointmentEditDialogShowing(sender As Object, e As AppointmentEditDialogShowingEventArgs) Handles uiRadSchedulerMain.AppointmentEditDialogShowing
        e.AppointmentEditDialog = New MultipleResourcesDialog
   End Sub


       Loading resources
       For Each dr As DataRow In MedarbejdereTableAdapter.GetData()

            With dr
                Dim resource As New Resource()
                resource.Id = New EventId(.Item("medarbejderId"))
                resource.Name = .Item("fornavn") & " - " & .Item("medarbejderId") ' medarbejder.Fornavn
                Me.uiRadSchedulerMain.Resources.Add(resource)
            End With
        Next




Loading appointments from database, after loading resources
       
uiRadSchedulerMain.Appointments.Clear()

        For Each dr As DataRow In AppointmentTableAdapter.GetData()

            With dr

                Dim schedulerAppointment As New Appointment()

                schedulerAppointment.Summary = .Item("Summary").ToString
                schedulerAppointment.Start = .Item("Start")
                schedulerAppointment.[End] = .Item("end")
                schedulerAppointment.Location = .Item("Location")
                schedulerAppointment.Description = .Item("Description")
                schedulerAppointment.AllDay = .Item("allDay")
                schedulerAppointment.StatusId = .Item("statusId")

                schedulerAppointment.ToolTipText = .Item("Description")
                schedulerAppointment.BackgroundId = .Item("ParentID")

                Me.AppointmentMedarbejdereLinkTableAdapter.FillByEnAftale(Me.FirmaDatabaseDataSet.AppointmentMedarbejdereLink, .Item("appointmentid"))

                For Each x As DataRow In AppointmentMedarbejdereLinkTableAdapter.GetDataBy1(.Item("appointmentid"))
                    With x
                        schedulerAppointment.ResourceIds.Add(New EventId(.Item("medarbejderid")))
                    End With
                Next

                uiRadSchedulerMain.Appointments.Add(schedulerAppointment)

            End With
        Next

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Dec 2015, 10:51 AM
Hello Peter,

Thank you for writing.

Following the provided description, I am not sure what is the exact problem that you are facing. That is why I have prepared a sample project where RadScheduler uses custom Appointments and store the information to the database. Note that it is important to specify the RadScheduler.AppointmentFactory and SchedulerBindingDataSource.EventProvider.AppointmentFactory properties when using custom events. The whole Scheduler >> DataBinding section in the online documentation is quite useful about the database setup.

Please refer to the attached sample project which contains a backup file of the database as well. In order to run the project successfully, restore the database and modify the connection string in the App.config.

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 07 Dec 2015, 12:52 PM

Thank you.

 Just what i needed to point me to the right direction.

 

Tags
Scheduler and Reminder
Asked by
Peter
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Peter
Top achievements
Rank 1
Share this question
or