@@ -5,30 +5,21 @@ Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow.Constants
|
||||
|
||||
|
||||
Public Class frmNotification_Startup
|
||||
Private ReadOnly Property LogConfig As LogConfig
|
||||
Private ReadOnly Property Logger As Logger
|
||||
|
||||
Private ReadOnly _NotificationsTable As DataTable
|
||||
|
||||
|
||||
|
||||
Private ReadOnly _Environment As DigitalData.Modules.ZooFlow.Environment
|
||||
Private ReadOnly _GDPictureKey As String
|
||||
Private ReadOnly _FormCaption As String
|
||||
|
||||
Private ReadOnly FormHelper As FormHelper
|
||||
|
||||
Private CurrentNotificationId As Integer
|
||||
|
||||
Private NOTIFY_ID As Integer
|
||||
Private Property OperationMode As OperationMode
|
||||
Private Client As Client
|
||||
|
||||
Private Const COL_GUID As String = "GUID"
|
||||
Private Const COL_TITLE As String = "TITLE"
|
||||
|
||||
Private Const TYPE_MESSAGE = "MESSAGE"
|
||||
Private Const TYPE_FILE = "FILE"
|
||||
|
||||
Friend Class NotificationItem
|
||||
Public Id As Integer
|
||||
Public Title As String
|
||||
@@ -38,34 +29,26 @@ Public Class frmNotification_Startup
|
||||
Return Title
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Public Sub New(pNotificationsTable As DataTable, pLogConfig As LogConfig, pGDPictureKey As String, pCaption As String, pEnvironment As DigitalData.Modules.ZooFlow.Environment)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
_NotificationsTable = pNotificationsTable
|
||||
Public Sub New(DTNotifications As DataTable, pLogConfig As LogConfig, pGDPictureKey As String, pCaption As String, pEnvironment As DigitalData.Modules.ZooFlow.Environment)
|
||||
_NotificationsTable = DTNotifications
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
_GDPictureKey = pGDPictureKey
|
||||
_FormCaption = pCaption
|
||||
_Environment = pEnvironment
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
FormHelper = New FormHelper(pLogConfig, Me)
|
||||
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
Try
|
||||
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
||||
Dim cultureInfo As System.Globalization.CultureInfo
|
||||
cultureInfo = New System.Globalization.CultureInfo(_Environment.User.Language)
|
||||
If Not IsNothing(_Environment.User.DateFormat) Then
|
||||
cultureInfo.DateTimeFormat.ShortDatePattern = _Environment.User.DateFormat
|
||||
End If
|
||||
|
||||
cultureInfo.DateTimeFormat.ShortDatePattern = _Environment.User.DateFormat
|
||||
Thread.CurrentThread.CurrentCulture = cultureInfo
|
||||
Thread.CurrentThread.CurrentUICulture = cultureInfo
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
@@ -75,85 +58,63 @@ Public Class frmNotification_Startup
|
||||
DocumentViewer1.Init(LogConfig, _GDPictureKey)
|
||||
OperationMode = GetOperationMode()
|
||||
Client = _Environment.Service.Client
|
||||
|
||||
Text = _FormCaption
|
||||
lbStatus.Caption = ""
|
||||
|
||||
Me.Text = _FormCaption
|
||||
If _NotificationsTable.Rows.Count = 1 Then
|
||||
Me.ListBoxControl1.Visible = False
|
||||
Load_Profile(_NotificationsTable.Rows(0).Item(COL_GUID))
|
||||
Load_Profile(_NotificationsTable.Rows(0).Item("GUID"))
|
||||
Else
|
||||
|
||||
ListBoxControl1.DataSource = _NotificationsTable
|
||||
ListBoxControl1.ValueMember = COL_GUID
|
||||
ListBoxControl1.DisplayMember = COL_TITLE
|
||||
ListBoxControl1.ValueMember = "GUID"
|
||||
ListBoxControl1.DisplayMember = "TITLE"
|
||||
End If
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowErrorMessage(ex.Message, "Unexpected error loading form")
|
||||
Dim oMsgBox As New frmDialog(ex.Message, "Unexpected Error loading form:", frmDialog.DialogType.Error)
|
||||
oMsgBox.ShowDialog()
|
||||
End Try
|
||||
End Sub
|
||||
Sub Load_Profile(oIndex As Integer)
|
||||
Try
|
||||
DocumentViewer1.Visible = False
|
||||
RichEditControl1.Visible = False
|
||||
Dim oType As String, oMessage As String, oMarkasRead As Boolean
|
||||
Dim oType As String, oMSG_STRING As String, oMarkasRead As Boolean
|
||||
|
||||
If _NotificationsTable.Rows.Count = 1 Then
|
||||
Dim oRow As DataRow = _NotificationsTable.Rows(0)
|
||||
oType = oRow.Item("DISPLAY_TYPE")
|
||||
oMSG_STRING = oRow.Item("MSG_STRING")
|
||||
oMarkasRead = oRow.Item("VALIDATE_READ")
|
||||
NOTIFY_ID = oRow.Item("GUID")
|
||||
Else
|
||||
Dim oCount As Integer = 0
|
||||
For Each oRow As DataRow In _NotificationsTable.Rows
|
||||
If oIndex = oCount Then
|
||||
oType = oRow.Item("DISPLAY_TYPE")
|
||||
oMSG_STRING = oRow.Item("MSG_STRING")
|
||||
oMarkasRead = oRow.Item("VALIDATE_READ")
|
||||
NOTIFY_ID = oRow.Item("GUID")
|
||||
Exit For
|
||||
Else
|
||||
oCount += 1
|
||||
End If
|
||||
|
||||
Dim oRow = _NotificationsTable.AsEnumerable.
|
||||
Where(Function(row) row.Item(COL_GUID) = oIndex).
|
||||
FirstOrDefault()
|
||||
|
||||
If oRow Is Nothing Then
|
||||
FormHelper.ShowWarningMessage("Notification with Guid [{0}] could not be loaded!", "Unexpected error loading message")
|
||||
Exit Sub
|
||||
Next
|
||||
End If
|
||||
|
||||
oType = oRow.Item("DISPLAY_TYPE")
|
||||
oMessage = oRow.Item("MSG_STRING")
|
||||
oMarkasRead = oRow.Item("VALIDATE_READ")
|
||||
CurrentNotificationId = oRow.Item(COL_GUID)
|
||||
|
||||
'If _NotificationsTable.Rows.Count = 1 Then
|
||||
' Dim oRow As DataRow = _NotificationsTable.Rows(0)
|
||||
' oType = oRow.Item("DISPLAY_TYPE")
|
||||
' oMSG_STRING = oRow.Item("MSG_STRING")
|
||||
' oMarkasRead = oRow.Item("VALIDATE_READ")
|
||||
' CurrentNotificationId = oRow.Item(COL_GUID)
|
||||
'Else
|
||||
' Dim oCount As Integer = 0
|
||||
' For Each oRow As DataRow In _NotificationsTable.Rows
|
||||
' If oIndex = oCount Then
|
||||
' oType = oRow.Item("DISPLAY_TYPE")
|
||||
' oMSG_STRING = oRow.Item("MSG_STRING")
|
||||
' oMarkasRead = oRow.Item("VALIDATE_READ")
|
||||
' CurrentNotificationId = oRow.Item(COL_GUID)
|
||||
' Exit For
|
||||
' Else
|
||||
' oCount += 1
|
||||
' End If
|
||||
|
||||
' Next
|
||||
'End If
|
||||
|
||||
If oType = TYPE_MESSAGE Then
|
||||
RichEditControl1.Text = oMessage
|
||||
If oType = "MESSAGE" Then
|
||||
RichEditControl1.Text = oMSG_STRING
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = Windows.Forms.DockStyle.Fill
|
||||
BarStaticItemFileInfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
ElseIf oType = TYPE_FILE Then
|
||||
If IO.File.Exists(oMessage) Then
|
||||
DocumentViewer1.LoadFile(oMessage)
|
||||
Else
|
||||
If IO.File.Exists(oMSG_STRING) Then
|
||||
DocumentViewer1.LoadFile(oMSG_STRING)
|
||||
DocumentViewer1.Visible = True
|
||||
DocumentViewer1.Dock = Windows.Forms.DockStyle.Fill
|
||||
BarStaticItemFileInfo.Caption = oMessage
|
||||
Else
|
||||
Dim oMsgBox As New frmDialog("File not existing!", "Load Notification File", frmDialog.DialogType.Warning)
|
||||
oMsgBox.ShowDialog()
|
||||
BarStaticItemFileInfo.Caption += " - NOT EXISTING"
|
||||
End If
|
||||
BarStaticItemFileInfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||||
End If
|
||||
|
||||
If oMarkasRead = True Then
|
||||
btnMarkAsRead.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||||
Else
|
||||
@@ -161,23 +122,20 @@ Public Class frmNotification_Startup
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowErrorMessage(ex.Message, "Unexpected error loading message")
|
||||
Dim oMsgBox As New frmDialog(ex.Message, "Unexpected Error loading Message:", frmDialog.DialogType.Error)
|
||||
oMsgBox.ShowDialog()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub ListBoxControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBoxControl1.SelectedValueChanged
|
||||
If ListBoxControl1.SelectedItem Is Nothing Then
|
||||
Exit Sub
|
||||
If ListBoxControl1.SelectedIndex <> -1 Then
|
||||
Try
|
||||
Load_Profile(ListBoxControl1.SelectedIndex)
|
||||
Catch ex As Exception
|
||||
Dim oMsgBox As New frmDialog(ex.Message, "Unexpected Error switching Notifications:", frmDialog.DialogType.Error)
|
||||
oMsgBox.ShowDialog()
|
||||
End Try
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oRowView As DataRowView = ListBoxControl1.SelectedItem
|
||||
Dim oGuid = oRowView.Row.Item(COL_GUID)
|
||||
|
||||
Load_Profile(oGuid)
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowErrorMessage(ex.Message, "Unexpected error switching notifications")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCloseForm.ItemClick
|
||||
@@ -185,14 +143,15 @@ Public Class frmNotification_Startup
|
||||
End Sub
|
||||
|
||||
Private Sub btnMarkAsRead_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnMarkAsRead.ItemClick
|
||||
Dim oSuccess As Boolean = True
|
||||
Try
|
||||
|
||||
Dim oSuccess As Boolean = True
|
||||
Dim oSQL = $"INSERT INTO [dbo].[TBDD_NOTIFICATIONS_USER_HISTORY] ([NOTIFY_ID], [USR_ID]) VALUES ({CurrentNotificationId} ,{_Environment.User.UserId})"
|
||||
Dim oSQL = $"INSERT INTO [dbo].[TBDD_NOTIFICATIONS_USER_HISTORY] ([NOTIFY_ID], [USR_ID]) VALUES ({NOTIFY_ID} ,{_Environment.User.UserId})"
|
||||
If OperationMode = OperationMode.ZooFlow Or OperationMode = OperationMode.WithAppServer Then
|
||||
Dim oResponse = Client.ExecuteNonQueryFromECM(oSQL)
|
||||
oSuccess = oResponse.OK
|
||||
|
||||
If Not oResponse.OK Then
|
||||
oSuccess = False
|
||||
End If
|
||||
Else
|
||||
oSuccess = _Environment.Database.ExecuteNonQuery(oSQL)
|
||||
|
||||
@@ -208,9 +167,11 @@ Public Class frmNotification_Startup
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowErrorMessage(ex.Message, "Unexpected error writing history")
|
||||
|
||||
Dim oMsgBox As New frmDialog(ex.Message, "Unexpected Error HistoryInsert:", frmDialog.DialogType.Error)
|
||||
oMsgBox.ShowDialog()
|
||||
oSuccess = False
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
Private Function GetOperationMode() As OperationMode
|
||||
Dim oOperationMode As OperationMode
|
||||
@@ -223,4 +184,4 @@ Public Class frmNotification_Startup
|
||||
|
||||
Return oOperationMode
|
||||
End Function
|
||||
End Class
|
||||
End Class
|
||||
Reference in New Issue
Block a user