Imports System
Imports System.ComponentModel

Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering

Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Public Enum eEventDirection
    eIn = 0
    eOut = 1
End Enum
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
Public Class Events
    Inherits BaseObject
    Private _EventDirection As eEventDirection
    Private _Question As Question
    Private _QuestionStatus As eQuestionStatus
    Private _ObjectCreated As Date
    Private _UserCreated As User
    Private _Description As String
    Private _Attachment As FileData
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()
        If Session.IsNewObject(Me) Then
            ObjectCreated = Now
            UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
        End If
    End Sub
    Property EventDirection As eEventDirection
        Get
            Return _EventDirection
        End Get
        Set(value As eEventDirection)
            SetPropertyValue("EventDirection", _EventDirection, value)
        End Set
    End Property
    Property Question As Question
        Get
            Return _Question
        End Get
        Set(value As Question)
            SetPropertyValue("Question", _Question, value)
        End Set
    End Property
    Property QuestionStatus As eQuestionStatus
        Get
            Return _QuestionStatus
        End Get
        Set(value As eQuestionStatus)
            SetPropertyValue("QuestionStatus", _QuestionStatus, value)
        End Set
    End Property
    <NonCloneable> _
    Property ObjectCreated As Date
        Get
            Return _ObjectCreated
        End Get
        Set(value As Date)
            SetPropertyValue("ObjectCreated", _ObjectCreated, value)
        End Set
    End Property
    <NonCloneable> _
    Property UserCreated As User
        Get
            Return _UserCreated
        End Get
        Set(value As User)
            SetPropertyValue("UserCreated", _UserCreated, value)
        End Set
    End Property
    <Size(-1)> _
    Property Description As String
        Get
            Return _Description
        End Get
        Set(value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    <Browsable(False)> _
    Property Attachment As FileData
        Get
            Return _Attachment
        End Get
        Set(value As FileData)
            SetPropertyValue("Attachment", _Attachment, value)
        End Set
    End Property

End Class
