Imports System Imports System.ComponentModel Imports Microsoft.VisualBasic Imports DevExpress.Xpo Imports DevExpress.ExpressApp Imports DevExpress.Persistent.Base Imports DevExpress.Persistent.BaseImpl Imports DevExpress.Persistent.Validation Imports DevExpress.Persistent.Base.General Imports DevExpress.ExpressApp.Utils Imports DevExpress.ExpressApp.ConditionalAppearance _ _ _ _ Public Class BusinessDirectory Inherits BaseObject Implements ITreeNode, ITreeNodeImageProvider Private _BusinessDirectory_Parent As BusinessDirectory Private _ShortName As String Private _IsFolder As Boolean Private _FileData As FileData Private _FileCreated As Date Private _FileModified As Date Private _Completed As Boolean 'További tennivaló van -e? Private _TaskDescription As String Private _EMail_Sender As String Private _Email_Copy As String Private _IsDashBoard As Boolean Private _DashBoard_Server As String Private _DashBoard_Database As String Private _DashBoard_UserName As String Private _DashBoard_Password As String Private _SQLType As eSQLType Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() IsFolder = True IsDashBoard = False End Sub Protected Overrides Sub OnSaving() MyBase.OnSaving() If FileData IsNot Nothing Then IsFolder = False If String.IsNullOrEmpty(ShortName) Then ShortName = FileData.FileName Else IsFolder = True End If End Sub _ Property BusinessDirectory_Parent As BusinessDirectory Get Return _BusinessDirectory_Parent End Get Set(value As BusinessDirectory) SetPropertyValue("BusinessDirectory_Parent", _BusinessDirectory_Parent, value) End Set End Property _ Property ShortName As String Get Return _ShortName End Get Set(value As String) SetPropertyValue("ShortName", _ShortName, value) End Set End Property _ _ Property IsFolder As Boolean Get Return _IsFolder End Get Set(value As Boolean) SetPropertyValue("IsFolder", _IsFolder, value) If Not Session.IsObjectsSaving And Not Session.IsObjectsLoading Then If value And Session.IsNewObject(Me) Then Completed = True Else Completed = False End If End If End Set End Property Property FileData As FileData Get Return _FileData End Get Set(value As FileData) SetPropertyValue("FileData", _FileData, value) End Set End Property Property FileCreated As Date Get Return _FileCreated End Get Set(value As Date) SetPropertyValue("FileCreated", _FileCreated, value) End Set End Property Property FileModified As Date Get Return _FileModified End Get Set(value As Date) SetPropertyValue("FileModified", _FileModified, value) End Set End Property Property Completed As Boolean Get Return _Completed End Get Set(value As Boolean) SetPropertyValue("Completed", _Completed, value) End Set End Property _ Property TaskDescription As String Get Return _TaskDescription End Get Set(value As String) SetPropertyValue("TaskDescription", _TaskDescription, value) End Set End Property _ Property EMail_Sender As String Get Return _EMail_Sender End Get Set(value As String) SetPropertyValue("EMail_Sender", _EMail_Sender, value) End Set End Property _ Property Email_Copy As String Get Return _Email_Copy End Get Set(value As String) SetPropertyValue("Email_Copy", _Email_Copy, value) End Set End Property _ Property IsDashBoard As Boolean Get Return _IsDashBoard End Get Set(value As Boolean) SetPropertyValue("IsDashBoard", _IsDashBoard, value) End Set End Property _ Property DashBoard_Server As String Get Return _DashBoard_Server End Get Set(value As String) SetPropertyValue("DashBoard_Server", _DashBoard_Server, value) End Set End Property _ Property DashBoard_Database As String Get Return _DashBoard_Database End Get Set(value As String) SetPropertyValue("DashBoard_Database", _DashBoard_Database, value) End Set End Property _ Property DashBoard_UserName As String Get Return _DashBoard_UserName End Get Set(value As String) SetPropertyValue("DashBoard_UserName", _DashBoard_UserName, value) End Set End Property _ _ _ Property DashBoard_Password As String Get Return _DashBoard_Password End Get Set(value As String) SetPropertyValue("DashBoard_Password", _DashBoard_Password, value) End Set End Property _ Property SQLType As eSQLType Get Return _SQLType End Get Set(value As eSQLType) SetPropertyValue("SQLType", _SQLType, value) End Set End Property _ Public ReadOnly Property NestedBusinessDirectory() As XPCollection(Of BusinessDirectory) Get Return GetCollection(Of BusinessDirectory)("NestedBusinessDirectory") End Get End Property #Region "ITreeNode Members" Public ReadOnly Property Children() As IBindingList Implements ITreeNode.Children Get Return NestedBusinessDirectory End Get End Property Private ReadOnly Property Name() As String Implements ITreeNode.Name Get Return ShortName End Get End Property Public ReadOnly Property Parent() As ITreeNode Implements ITreeNode.Parent Get Return BusinessDirectory_Parent End Get End Property #End Region #Region "ITreeNodeImageProvider Members" Public Function GetImage(ByRef imageName As String) As System.Drawing.Image Implements DevExpress.Persistent.Base.General.ITreeNodeImageProvider.GetImage If IsFolder Then If NestedBusinessDirectory IsNot Nothing AndAlso NestedBusinessDirectory.Count > 0 Then imageName = "Folder_document" Else imageName = "Folder" End If Else If FileData Is Nothing Then imageName = "window_warning" Else Select Case System.IO.Path.GetExtension(FileData.FileName) Case ".msg" imageName = "mail2" Case ".pdf" imageName = "" Case ".rtf", ".docx", ".doc" imageName = "word_icon" Case ".xlsx", ".xls" imageName = "excel_icon" Case ".xml" imageName = "Navigation_Item_Dashboard" Case Else imageName = "BO_FileAttachment" End Select End If End If Return ImageLoader.Instance.GetImageInfo(imageName).Image End Function #End Region End Class