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

' 
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False)> _
Public Class EMailSendQueueRows
    Inherits BaseObject

    Private _EMailSendQueueHeader As EMailSendQueueHeader
    Private _EMailFrom As String '255
    Private _EMailTo As String '255
    Private _Subject As String '255
    Private _HTMLBody As String '-1
    Private _FileAttachments1 As FileData
    Private _FileAttachments2 As FileData
    Private _FileAttachments3 As FileData
    Private _ExceptionMessage As String ' -1

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    End Sub

    Protected Overrides Sub OnDeleting()
        MyBase.OnDeleting()
        Dim _AssetsHandling As AssetsHandling
        Dim _AssetsHandling_Collection As New XPCollection(Of AssetsHandling)(Session, CriteriaOperator.Parse("EMailSendQueueRows=?", Me))
        For Each _AssetsHandling In _AssetsHandling_Collection
            _AssetsHandling.EMailSendQueueRows = Nothing
            Dim _AssetsHandlingStatus As AssetsHandlingStatus = Session.FindObject(Of AssetsHandlingStatus)(CriteriaOperator.Parse("QueueIndex=0"))
            If _AssetsHandling.InvoiceHeader IsNot Nothing Then
                _AssetsHandling.InvoiceHeader.AssetsHandlingStatus = _AssetsHandlingStatus
            End If

        Next
    End Sub
    <Association("EMailSendQueueHeader-EMailSendQueueRows", GetType(EMailSendQueueHeader))> _
    Property EMailSendQueueHeader As EMailSendQueueHeader
        Get
            Return _EMailSendQueueHeader
        End Get
        Set(value As EMailSendQueueHeader)
            SetPropertyValue("EMailSendQueueHeader", _EMailSendQueueHeader, value)
        End Set
    End Property
    <Size(255)> _
    Property EMailFrom As String
        Get
            Return _EMailFrom
        End Get
        Set(value As String)
            SetPropertyValue("EMailFrom", _EMailFrom, value)
        End Set
    End Property
    <Size(255)> _
    Property EMailTo As String
        Get
            Return _EMailTo
        End Get
        Set(value As String)
            SetPropertyValue("EMailTo", _EMailTo, value)
        End Set
    End Property
    <Size(255)> _
    Property Subject As String
        Get
            Return _Subject
        End Get
        Set(value As String)
            SetPropertyValue("Subject", _Subject, value)
        End Set
    End Property
    <Size(-1)> _
    Property HTMLBody As String
        Get
            Return _HTMLBody
        End Get
        Set(value As String)
            SetPropertyValue("HTMLBody", _HTMLBody, value)
        End Set
    End Property
    Property FileAttachments1 As FileData
        Get
            Return _FileAttachments1
        End Get
        Set(value As FileData)
            SetPropertyValue("FileAttachments1", _FileAttachments1, value)
        End Set
    End Property
    Property FileAttachments2 As FileData
        Get
            Return _FileAttachments2
        End Get
        Set(value As FileData)
            SetPropertyValue("FileAttachments2", _FileAttachments2, value)
        End Set
    End Property
    Property FileAttachments3 As FileData
        Get
            Return _FileAttachments3
        End Get
        Set(value As FileData)
            SetPropertyValue("FileAttachments3", _FileAttachments3, value)
        End Set
    End Property
    Property ExceptionMessage As String
        Get
            Return _ExceptionMessage
        End Get
        Set(value As String)
            SetPropertyValue("ExceptionMessage", _ExceptionMessage, value)
        End Set
    End Property

    'ReadOnly
    <Association("EMailSendQueueRows-EMailSendQueueRows_FileAttachment", GetType(EMailSendQueueRows_FileAttachment)), VisibleInListView(False)> _
    ReadOnly Property EMailSendQueueRows_FileAttachment As XPCollection(Of EMailSendQueueRows_FileAttachment)
        Get
            Return GetCollection(Of EMailSendQueueRows_FileAttachment)("EMailSendQueueRows_FileAttachment")
        End Get
    End Property
End Class
