Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/128633613/15.2.4%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/E4107)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
<!-- default badges end -->
Expand Down
54 changes: 33 additions & 21 deletions VB/XtraSchedulerEFTest/EFAppointment.vb
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
Imports System
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema


Namespace XtraSchedulerEFTest
#Region "#efappointment"

'#Region "#efappointment"
Friend Class EFAppointment
<Key> _
Public Property UniqueID() As Integer
<Required> _
Public Property Type() As Integer
<Required> _
Public Property StartDate() As Date
<Required> _
Public Property EndDate() As Date
Public Property AllDay() As Boolean
Public Property Subject() As String
Public Property Location() As String
Public Property Description() As String
Public Property Status() As Integer
Public Property Label() As Integer
Public Property ResourceIDs() As String
Public Property ReminderInfo() As String
Public Property RecurrenceInfo() As String

<Key>
Public Property UniqueID As Integer

<Required>
Public Property Type As Integer

<Required>
Public Property StartDate As Date

<Required>
Public Property EndDate As Date

Public Property AllDay As Boolean

Public Property Subject As String

Public Property Location As String

Public Property Description As String

Public Property Status As Integer

Public Property Label As Integer

Public Property ResourceIDs As String

Public Property ReminderInfo As String

Public Property RecurrenceInfo As String
End Class
#End Region ' #efappointment
'#End Region ' #efappointment
End Namespace
50 changes: 32 additions & 18 deletions VB/XtraSchedulerEFTest/EFResource.vb
Original file line number Diff line number Diff line change
@@ -1,49 +1,63 @@
Imports System
Imports System
Imports System.ComponentModel.DataAnnotations
Imports System.Drawing

Namespace XtraSchedulerEFTest
#Region "#efresource"

'#Region "#efresource"
Friend Class EFResource
<Key> _
Public Property UniqueID() As Integer
Public Property ResourceID() As Integer
Public Property ResourceName() As String
Public Property Image() As Byte()
Public Property Color() As Integer

<Key>
Public Property UniqueID As Integer

Public Property ResourceID As Integer

Public Property ResourceName As String

Public Property Image As Byte()

Public Property Color As Integer
Get
Return ColorEx.ToArgb()
End Get

Set(ByVal value As Integer)
ColorEx = New MyColor(value)
End Set
End Property
Public Property ColorEx() As MyColor

Public Property ColorEx As MyColor
End Class

Friend Class MyColor
Public Property A() As Byte
Public Property R() As Byte
Public Property G() As Byte
Public Property B() As Byte

Public Property A As Byte

Public Property R As Byte

Public Property G As Byte

Public Property B As Byte

Public Sub New()
End Sub

Public Sub New(ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
Me.A = a
Me.R = r
Me.G = g
Me.B = b
End Sub

Public Sub New(ByVal color As Color)
A = color.A
R = color.R
G = color.G
B = color.B
End Sub

Public Sub New(ByVal argb As Integer)
Dim bytes() As Byte = BitConverter.GetBytes(argb)
Dim bytes As Byte() = BitConverter.GetBytes(argb)
A = bytes(0)
R = bytes(1)
G = bytes(2)
Expand All @@ -53,15 +67,15 @@ Namespace XtraSchedulerEFTest
Public Function ToColor() As Color
Return Color.FromArgb(A, R, G, B)
End Function

Public Shared Function FromColor(ByVal color As Color) As MyColor
Return New MyColor(color.A, color.R, color.G, color.B)
End Function

Public Function ToArgb() As Integer
Dim bytes() As Byte = { A, R, G, B }
Dim bytes As Byte() = New Byte() {A, R, G, B}
Return BitConverter.ToInt32(bytes, 0)
End Function

End Class
#End Region ' #efresource

'#End Region ' #efresource
End Namespace
56 changes: 31 additions & 25 deletions VB/XtraSchedulerEFTest/Form1.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 33 additions & 38 deletions VB/XtraSchedulerEFTest/Form1.vb
Original file line number Diff line number Diff line change
@@ -1,70 +1,65 @@
Imports System
Imports System
Imports System.Data.Entity
Imports System.Windows.Forms
Imports DevExpress.XtraScheduler

Namespace XtraSchedulerEFTest
Partial Public Class Form1

Public Partial Class Form1
Inherits Form

Private context As SchedulerContext

Public Sub New()
InitializeComponent()

schedulerStorage1.Appointments.CommitIdToDataSource = False
schedulerStorage1.Appointments.ResourceSharing = True
schedulerControl1.Storage.Resources.ColorSaving = ColorSavingType.ArgbColor

' #Region "#appmappings"
Me.schedulerStorage1.Appointments.Mappings.AllDay = "AllDay"
Me.schedulerStorage1.Appointments.Mappings.AppointmentId = "UniqueID"
Me.schedulerStorage1.Appointments.Mappings.Description = "Description"
Me.schedulerStorage1.Appointments.Mappings.End = "EndDate"
Me.schedulerStorage1.Appointments.Mappings.Label = "Label"
Me.schedulerStorage1.Appointments.Mappings.Location = "Location"
Me.schedulerStorage1.Appointments.Mappings.RecurrenceInfo = "RecurrenceInfo"
Me.schedulerStorage1.Appointments.Mappings.ReminderInfo = "ReminderInfo"
Me.schedulerStorage1.Appointments.Mappings.ResourceId = "ResourceIDs"
Me.schedulerStorage1.Appointments.Mappings.Start = "StartDate"
Me.schedulerStorage1.Appointments.Mappings.Status = "Status"
Me.schedulerStorage1.Appointments.Mappings.Subject = "Subject"
Me.schedulerStorage1.Appointments.Mappings.Type = "Type"
' #End Region ' #appmappings
' #Region "#resmappings"
Me.schedulerStorage1.Resources.Mappings.Caption = "ResourceName"
Me.schedulerStorage1.Resources.Mappings.Color = "Color"
Me.schedulerStorage1.Resources.Mappings.Id = "ResourceID"
Me.schedulerStorage1.Resources.Mappings.Image = "Image"
' #End Region ' #resmappings

'#Region "#appmappings"
schedulerStorage1.Appointments.Mappings.AllDay = "AllDay"
schedulerStorage1.Appointments.Mappings.AppointmentId = "UniqueID"
schedulerStorage1.Appointments.Mappings.Description = "Description"
schedulerStorage1.Appointments.Mappings.End = "EndDate"
schedulerStorage1.Appointments.Mappings.Label = "Label"
schedulerStorage1.Appointments.Mappings.Location = "Location"
schedulerStorage1.Appointments.Mappings.RecurrenceInfo = "RecurrenceInfo"
schedulerStorage1.Appointments.Mappings.ReminderInfo = "ReminderInfo"
schedulerStorage1.Appointments.Mappings.ResourceId = "ResourceIDs"
schedulerStorage1.Appointments.Mappings.Start = "StartDate"
schedulerStorage1.Appointments.Mappings.Status = "Status"
schedulerStorage1.Appointments.Mappings.Subject = "Subject"
schedulerStorage1.Appointments.Mappings.Type = "Type"
'#End Region ' #appmappings
'#Region "#resmappings"
schedulerStorage1.Resources.Mappings.Caption = "ResourceName"
schedulerStorage1.Resources.Mappings.Color = "Color"
schedulerStorage1.Resources.Mappings.Id = "ResourceID"
schedulerStorage1.Resources.Mappings.Image = "Image"
'#End Region ' #resmappings
AddHandler schedulerControl1.Storage.AppointmentsChanged, AddressOf Storage_AppointmentsModified
AddHandler schedulerControl1.Storage.AppointmentsInserted, AddressOf Storage_AppointmentsModified
AddHandler schedulerControl1.Storage.AppointmentsDeleted, AddressOf Storage_AppointmentsModified

schedulerControl1.GroupType = SchedulerGroupType.Resource
schedulerControl1.Start = Date.Now.Date
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
' #Region "#datainit"
Database.SetInitializer(New SchedulerContextSeedInilializer())
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
'#Region "#datainit"
Call Database.SetInitializer(New SchedulerContextSeedInilializer())
context = New SchedulerContext()

context.Database.Initialize(False)
context.EFAppointments.Load()
context.EFResources.Load()

eFAppointmentBindingSource.DataSource = context.EFAppointments.Local.ToBindingList()
eFResourceBindingSource.DataSource = context.EFResources.Local.ToBindingList()
' #End Region ' #datainit

eFAppointmentBindingSource.DataSource = context.EFAppointments.Local.ToBindingList(Of EFAppointment)()
eFResourceBindingSource.DataSource = context.EFResources.Local.ToBindingList(Of EFResource)()
'#End Region ' #datainit
End Sub

Private Sub Storage_AppointmentsModified(ByVal sender As Object, ByVal e As DevExpress.XtraScheduler.PersistentObjectsEventArgs)
Private Sub Storage_AppointmentsModified(ByVal sender As Object, ByVal e As PersistentObjectsEventArgs)
context.SaveChanges()
End Sub

Private Sub btnCreateAppointment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCreateAppointment.Click
Private Sub btnCreateAppointment_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim apt As Appointment = schedulerStorage1.CreateAppointment(AppointmentType.Normal)
apt.Start = Date.Now
apt.End = Date.Now.AddHours(4)
Expand Down
Loading