First create solution

This commit is contained in:
2017-03-08 11:21:27 +01:00
commit a2fb86bacf
5508 changed files with 1082238 additions and 0 deletions
@@ -0,0 +1,158 @@
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
<DefaultClassOptions()> _
<NavigationItem("Support")> _
<Appearance("Answer - Hide QuestionInProgressState, when QuestionStatus <> 8", AppearanceItemType.ViewItem, "QuestionStatus <> 8", TargetItems:="QuestionInProgressState", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class Answer
Inherits BaseObject
Private _Question As Question
Private _QuestionStatus As eQuestionStatus
Private _IssueType As eIssueType
Private _DocumentNumber As String
Private _Description As String
Private _ObjectCreated As Date
Private _UserCreated As User
Private _Attachment As FileData
Private _QuestionInProgressState As QuestionInProgressState
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
End Sub
Protected Overrides Sub OnSaving()
If Session.IsNewObject(Me) Then
ObjectCreated = Now
UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
If NumberGenerator IsNot Nothing Then
DocumentNumber = NumberGenerator.GetNewNumber(NumberGenerator, Year(Now).ToString)
End If
End If
End Sub
Property Question As Question
Get
Return _Question
End Get
Set(value As Question)
SetPropertyValue("Question", _Question, value)
End Set
End Property
<RuleValueComparison("", DefaultContexts.Save, ValueComparisonType.NotEquals, "eActive")> _
Property QuestionStatus As eQuestionStatus
Get
Return _QuestionStatus
End Get
Set(value As eQuestionStatus)
SetPropertyValue("QuestionStatus", _QuestionStatus, 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
<Size(-1)> _
<VisibleInListView(False)> _
<RuleRequiredField("Answer-Description", DefaultContexts.Save)> _
Property Description As String
Get
Return _Description
End Get
Set(value As String)
SetPropertyValue("Description", _Description, 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
<VisibleInListView(False)> _
Property Attachment As FileData
Get
Return _Attachment
End Get
Set(value As FileData)
SetPropertyValue("Attachment", _Attachment, 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----------------
<Browsable(False)> _
ReadOnly Property NumberGenerator As NumberGenerator
Get
Return TryCast(Session.FindObject(Of SupportNG)(CriteriaOperator.Parse("SupportType=1")), SupportNG).NumberGenerator
End Get
End Property
<VisibleInListView(False)> _
<Size(-1)> _
ReadOnly Property HTMLEvents As String
Get
If Question IsNot Nothing Then
Return Question.HTMLEvents
Else
Return ""
End If
End Get
End Property
<VisibleInListView(False), VisibleInLookupListView(False)> _
ReadOnly Property EventsAttachments As XPCollection(Of FileData)
Get
Dim _FileData_Collection As New XPCollection(Of FileData)(Session, CriteriaOperator.Parse("1=2"))
Dim _Events_Collection As New XPCollection(Of Events)(Session, CriteriaOperator.Parse("Question=?", Me.Question))
Dim _Events As [Events]
For Each _Events In _Events_Collection
If _Events.Attachment IsNot Nothing Then
_FileData_Collection.Add(_Events.Attachment)
End If
Next
Return _FileData_Collection
End Get
End Property
End Class
@@ -0,0 +1,48 @@
Partial Class AnswerVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aSaveAnswer = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
'
'aSaveAnswer
'
Me.aSaveAnswer.Caption = "Save Answer"
Me.aSaveAnswer.ConfirmationMessage = Nothing
Me.aSaveAnswer.Id = "aSaveAnswer"
Me.aSaveAnswer.ImageName = "disk_red"
Me.aSaveAnswer.Shortcut = Nothing
Me.aSaveAnswer.Tag = Nothing
Me.aSaveAnswer.TargetObjectsCriteria = Nothing
Me.aSaveAnswer.TargetViewId = "Answer_DetailView"
Me.aSaveAnswer.ToolTip = Nothing
Me.aSaveAnswer.TypeOfView = Nothing
End Sub
Friend WithEvents aSaveAnswer As DevExpress.ExpressApp.Actions.SimpleAction
End Class
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aSaveAnswer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,141 @@
Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp.SystemModule
Imports DevExpress.ExpressApp.CloneObject
Imports DevExpress.Data.Filtering
Imports System.Net.Mail
Imports DevExpress.Persistent.BaseImpl
Imports System.Reflection
Public Class AnswerVC
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
If View.Id = "Answer_DetailView" Then
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _Answer As Answer
Frame.GetController(Of NewObjectViewController).Active.SetItemValue("", False)
Frame.GetController(Of CloneObjectViewController).Active.SetItemValue("", False)
Frame.GetController(Of ModificationsController).SaveAction.Active.SetItemValue("", False)
Frame.GetController(Of ModificationsController).SaveAndCloseAction.Active.SetItemValue("", False)
Frame.GetController(Of ModificationsController).SaveAndNewAction.Active.SetItemValue("", False)
If SecuritySystem.CurrentUserName <> "ivan.szabo" Then Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", False)
_Answer = TryCast(View.SelectedObjects(0), Answer)
If _ocur.Session.IsNewObject(_Answer) Then
Frame.GetController(Of AnswerVC).aSaveAnswer.Active.SetItemValue("", True)
Else
Frame.GetController(Of AnswerVC).aSaveAnswer.Active.SetItemValue("", False)
End If
If View.Id = "Answer_ListView" Then
Frame.GetController(Of NewObjectViewController).Active.SetItemValue("", False)
If SecuritySystem.CurrentUserName <> "ivan.szabo" Then Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", False)
End If
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "Answer_DetailView" Then
Frame.GetController(Of NewObjectViewController).Active.SetItemValue("", True)
Frame.GetController(Of ModificationsController).SaveAction.Active.SetItemValue("", True)
Frame.GetController(Of ModificationsController).SaveAndCloseAction.Active.SetItemValue("", True)
Frame.GetController(Of ModificationsController).SaveAndNewAction.Active.SetItemValue("", True)
Frame.GetController(Of CloneObjectViewController).Active.SetItemValue("", True)
End If
End Sub
Private Sub aSaveAnswer_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aSaveAnswer.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _Answer As Answer = TryCast(View.SelectedObjects(0), Answer)
Dim _Events As Events
If _Answer IsNot Nothing Then
_Answer.Question.QuestionStatus = _Answer.QuestionStatus
_Answer.Question.IssueType = _Answer.IssueType
_Answer.Question.Save()
_Answer.Save()
_ocur.CommitChanges()
_Events = _onew.CreateObject(Of Events)()
_Events.Question = _onew.GetObject(_Answer.Question)
_Events.QuestionStatus = _Answer.QuestionStatus
_Events.Description = _Answer.Description
If _Answer.Attachment IsNot Nothing Then _Events.Attachment = _onew.GetObject(_Answer.Attachment)
_Events.Save()
_Events.EventDirection = eEventDirection.eOut
_onew.CommitChanges()
Try
Dim _WebParameters As WebParameters = _ocur.FindObject(Of WebParameters)(CriteriaOperator.Parse("1=1"))
If _WebParameters Is Nothing Then Throw New Exception("*Nincsnek e-mail paraméterek beállítva!")
If _WebParameters.SMTPHost Is Nothing Then Throw New Exception("*Nincs SMTP server beállítva!")
If _WebParameters.SMTPUserName = "" Then Throw New Exception("*Nincs felhasználói név beállítva!")
If _WebParameters.SMTPPort = 0 Then Throw New Exception("*Nincs SMTP port beállítva!")
Dim _MailMessage As New MailMessage
Dim _Attachment As Attachment
Dim _SmtpClient As SmtpClient = New SmtpClient(_WebParameters.SMTPHost)
_MailMessage.From = New MailAddress(_WebParameters.Email_SupportAdmin)
_MailMessage.To.Add(_Answer.Question.UserCreated.Email)
_MailMessage.Subject = _Answer.Question.DocumentNumber + " számú bejelentésre válasz"
_MailMessage.IsBodyHtml = True
Dim _EmailBody As String = _WebParameters.HTMLMailTemplate_QuestionStatusUpdate.HTMLBody
_EmailBody = String.Format(_EmailBody, _Answer.Question.UserCreated.FullName, _Answer.Question.DocumentNumber, DevExpress.ExpressApp.Utils.CaptionHelper.GetLocalizedText("Enums\Nuvolar.Module.eQuestionStatus", _Answer.Question.QuestionStatus.ToString) + _
vbNewLine, TryCast(SecuritySystem.CurrentUser, User).FullName)
_EmailBody = _EmailBody + vbNewLine + CreateHTMLEventsMail(_Answer.Question, _ocur.Session)
_MailMessage.Body = _EmailBody
_MailMessage.Attachments.Clear()
If Not String.IsNullOrEmpty(GLOBAL_ApplicationStartupPath_Mail) Then
_Attachment = New Attachment(GLOBAL_ApplicationStartupPath_Mail & "Images\iRedArrow.png")
_Attachment.ContentId = "c001"
_MailMessage.Attachments.Add(_Attachment)
_Attachment = New Attachment(GLOBAL_ApplicationStartupPath_Mail & "Images\iGreenArrow.png")
_Attachment.ContentId = "c002"
_MailMessage.Attachments.Add(_Attachment)
End If
_SmtpClient.Port = _WebParameters.SMTPPort
_SmtpClient.Credentials = New System.Net.NetworkCredential(_WebParameters.SMTPUserName, _WebParameters.SMTPPassword)
_SmtpClient.EnableSsl = _WebParameters.EnableSsl
_SmtpClient.Send(_MailMessage)
Catch ex As Exception
Dim sf As StackFrame = New StackFrame()
Dim _ErrorLog As ErrorLog = _ocur.CreateObject(Of ErrorLog)()
_ErrorLog.Description = ex.Message
_ErrorLog.SubName = TryCast(sf.GetMethod(), MethodBase).Name
_ocur.CommitChanges()
End Try
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "Question_DetailView_Info", True, _onew.GetObject(_Answer.Question))
View.Close()
End If
End Sub
End Class