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 Imports DevExpress.ExpressApp.ConditionalAppearance Imports DevExpress.ExpressApp.Utils _ _ _ _ _ _ _ eInProgress (8)", AppearanceItemType:="ViewItem", TargetItems:="QuestionInProgressState", Visibility:=Editors.ViewItemVisibility.Hide, Criteria:="QuestionStatus<>8", Context:="Any")> _ Public Class Question Inherits BaseObject Private _QuestionStatus As eQuestionStatus Private _QuestionClosed As eQuestionClosed Private _IssueType As eIssueType Private _DocumentNumber As String Private _Subject As String Private _Attachment As FileData Private _Description As String Private _User As User Private _UserResponsible As User 'Felelős személy Private _ObjectCreated As Date Private _UserCreated As User Private _Customers As Customers Private _AliasUser As User 'Aki létrehozta az User nevében Private _QuestionInProgressState As QuestionInProgressState Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() ObjectCreated = GetSQLTime(Session) DocumentNumber = "" End Sub Protected Overrides Sub OnSaving() Dim _Contacts As Contacts MyBase.OnSaving() If Session.IsNewObject(Me) Then ObjectCreated = Now UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser)) If User Is Nothing Then User = UserCreated End If If String.IsNullOrEmpty(DocumentNumber) And NumberGenerator IsNot Nothing Then DocumentNumber = NumberGenerator.GetNewNumber(NumberGenerator, Year(Now).ToString) End If If AliasUser IsNot Nothing Then _Contacts = Session.FindObject(Of Contacts)(CriteriaOperator.Parse("User.Oid=?", AliasUser.Oid)) If _Contacts IsNot Nothing Then Customers = _Contacts.Customers Else _Contacts = Session.FindObject(Of Contacts)(CriteriaOperator.Parse("User.Oid=?", User.Oid)) If _Contacts IsNot Nothing Then Customers = _Contacts.Customers End If End If End Sub _ Property QuestionStatus As eQuestionStatus Get Return _QuestionStatus End Get Set(value As eQuestionStatus) SetPropertyValue("QuestionStatus", _QuestionStatus, value) End Set End Property _ Property QuestionClosed As eQuestionClosed Get Return _QuestionClosed End Get Set(value As eQuestionClosed) SetPropertyValue("QuestionClosed", _QuestionClosed, value) End Set End Property _ Property IssueType As eIssueType Get Return _IssueType End Get Set(value As eIssueType) SetPropertyValue("IssueType", _IssueType, value) End Set End Property _ Property DocumentNumber As String Get Return _DocumentNumber End Get Set(value As String) SetPropertyValue("DocumentNumber", _DocumentNumber, value) End Set End Property _ _ Property Subject As String Get Return _Subject End Get Set(value As String) SetPropertyValue("Subject", _Subject, value) End Set End Property _ Property Attachment As FileData Get Return _Attachment End Get Set(value As FileData) SetPropertyValue("Attachment", _Attachment, value) End Set End Property _ _ _ Property Description As String Get Return _Description End Get Set(value As String) SetPropertyValue("Description", _Description, value) End Set End Property _ Property User As User Get Return _User End Get Set(value As User) SetPropertyValue("User", _User, value) End Set End Property Property UserResponsible As User Get Return _UserResponsible End Get Set(value As User) SetPropertyValue("UserResponsible", _UserResponsible, value) End Set End Property _ _ Property ObjectCreated As Date Get Return _ObjectCreated End Get Set(value As Date) SetPropertyValue("ObjectCreated", _ObjectCreated, value) End Set End Property _ _ Property UserCreated As User Get Return _UserCreated End Get Set(value As User) SetPropertyValue("UserCreated", _UserCreated, value) End Set End Property _ Property Customers As Customers Get Return _Customers End Get Set(value As Customers) SetPropertyValue("Customers", _Customers, value) End Set End Property Property AliasUser As User Get Return _AliasUser End Get Set(value As User) SetPropertyValue("AliasUser", _AliasUser, value) End Set End Property Property QuestionInProgressState As QuestionInProgressState Get Return _QuestionInProgressState End Get Set(value As QuestionInProgressState) SetPropertyValue("QuestionInProgressState", _QuestionInProgressState, value) End Set End Property '----------------ReadOnly------------ _ _ ReadOnly Property DisplayName As String Get Return DocumentNumber & ", " & Subject End Get End Property _ _ _ ReadOnly Property HTMLEvents As String Get Return CreateHTMLEvents(Me, Session) End Get End Property _ ReadOnly Property IMG As System.Drawing.Image Get If Me.QuestionStatus = eQuestionStatus.eActive Then Return ImageLoader.Instance.GetImageInfo("mail2").Image Else Return ImageLoader.Instance.GetImageInfo("mail").Image End If End Get End Property _ ReadOnly Property NumberGenerator As NumberGenerator Get Return TryCast(Session.FindObject(Of SupportNG)(CriteriaOperator.Parse("SupportType=0")), SupportNG).NumberGenerator End Get End Property _ ReadOnly Property WorkSheet_Header As XPCollection(Of WorkSheet_Header) Get Return New XPCollection(Of WorkSheet_Header)(Session, CriteriaOperator.Parse("Question.Oid=?", Me.Oid)) End Get End Property _ _ Private ReadOnly Property UserResponsibles As XPCollection(Of User) Get Dim _UserResponsibles_Collection As XPCollection(Of User) = New XPCollection(Of User)(Session, CriteriaOperator.Parse("1=1")) Dim _UserResponsibles_Back_Collection As New XPCollection(Of User)(Session, CriteriaOperator.Parse("1=2")) Dim _Need As Boolean = False For Each _ActUser As User In _UserResponsibles_Collection _Need = False If SecuritySystemHelper.IsUserInRole("Supporter", _ActUser) Then _Need = True Else Dim _Contacts As Contacts = Session.FindObject(Of Contacts)(CriteriaOperator.Parse("User.Oid=?", _ActUser.Oid)) If _Contacts IsNot Nothing Then Dim _Customers As Customers = _Contacts.Customers Dim _Subcontractor As Subcontractor = Session.FindObject(Of Subcontractor)(CriteriaOperator.Parse("Customers=?", _Customers)) If _Subcontractor IsNot Nothing Then _Need = True End If End If End If _UserResponsibles_Back_Collection.Add(_ActUser) Next Return _UserResponsibles_Back_Collection End Get End Property 'Private Function CreateHTMLEvents() As String ' Dim _Events_Collection As New XPCollection(Of Events)(Session, CriteriaOperator.Parse("Question.Oid=?", Me.Oid)) ' Dim _Events As Events ' Dim s As String = "" ' If _Events_Collection IsNot Nothing Then ' _Events_Collection.Sorting.Add(New SortProperty("ObjectCreated", DB.SortingDirection.Ascending)) ' For Each _Events In _Events_Collection ' If _Events.EventDirection = eEventDirection.eIn Then ' s += "" ' s += "" ' s += "