Common: Rebuild frmNotification_Startup
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
Imports System.Drawing
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Controls.DocumentViewer
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
Imports DigitalData.Modules.ZooFlow.Constants
|
||||
Public Class frmNotification_Startup
|
||||
Private ReadOnly NotificationItems As New List(Of NotificationItem)
|
||||
Private oDTNotifications As DataTable
|
||||
|
||||
Public Class frmNotification_Startup2
|
||||
Private ReadOnly Property LogConfig As LogConfig
|
||||
Private ReadOnly Property Logger As Logger
|
||||
Private ReadOnly Environment As Environment
|
||||
Private GDPictureKey As String
|
||||
Private MyCaption As String
|
||||
|
||||
Private ReadOnly _NotificationsTable As DataTable
|
||||
|
||||
|
||||
|
||||
Private ReadOnly _Environment As DigitalData.Modules.ZooFlow.Environment
|
||||
Private ReadOnly _GDPictureKey As String
|
||||
Private ReadOnly _FormCaption As String
|
||||
|
||||
Private NOTIFY_ID As Integer
|
||||
Private Property OperationMode As OperationMode
|
||||
Private Client As Client
|
||||
@@ -24,21 +29,21 @@ Public Class frmNotification_Startup
|
||||
Return Title
|
||||
End Function
|
||||
End Class
|
||||
Public Sub New(DTNotifications As DataTable, pLogConfig As LogConfig, pGDPictureKey As String, pCaption As String, pEnvironment As Environment)
|
||||
oDTNotifications = DTNotifications
|
||||
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
|
||||
MyCaption = pCaption
|
||||
Environment = pEnvironment
|
||||
_GDPictureKey = pGDPictureKey
|
||||
_FormCaption = pCaption
|
||||
_Environment = pEnvironment
|
||||
|
||||
' 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)
|
||||
cultureInfo.DateTimeFormat.ShortDatePattern = Environment.User.DateFormat
|
||||
cultureInfo = New System.Globalization.CultureInfo(_Environment.User.Language)
|
||||
cultureInfo.DateTimeFormat.ShortDatePattern = _Environment.User.DateFormat
|
||||
Thread.CurrentThread.CurrentCulture = cultureInfo
|
||||
Thread.CurrentThread.CurrentUICulture = cultureInfo
|
||||
Catch ex As Exception
|
||||
@@ -50,29 +55,16 @@ Public Class frmNotification_Startup
|
||||
|
||||
Private Sub frmNotification_Startup_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
DocumentViewer1.Init(LogConfig, GDPictureKey)
|
||||
DocumentViewer1.Init(LogConfig, _GDPictureKey)
|
||||
OperationMode = GetOperationMode()
|
||||
Client = Environment.Service.Client
|
||||
Me.Text = MyCaption
|
||||
If oDTNotifications.Rows.Count = 1 Then
|
||||
Client = _Environment.Service.Client
|
||||
Me.Text = _FormCaption
|
||||
If _NotificationsTable.Rows.Count = 1 Then
|
||||
Me.ListBoxControl1.Visible = False
|
||||
Load_Profile(oDTNotifications.Rows(0).Item("GUID"))
|
||||
Load_Profile(_NotificationsTable.Rows(0).Item("GUID"))
|
||||
Else
|
||||
|
||||
|
||||
For Each oRow As DataRow In oDTNotifications.Rows
|
||||
NotificationItems.Add(New NotificationItem With {
|
||||
.Id = CInt(oRow.Item("GUID")),
|
||||
.Title = oRow.Item("TITLE").ToString
|
||||
})
|
||||
Next
|
||||
|
||||
' ListBoxControl1.Items.Clear()
|
||||
'ListBoxControl1.Items.AddRange(NotificationItems)
|
||||
|
||||
|
||||
|
||||
ListBoxControl1.DataSource = oDTNotifications
|
||||
ListBoxControl1.DataSource = _NotificationsTable
|
||||
ListBoxControl1.ValueMember = "GUID"
|
||||
ListBoxControl1.DisplayMember = "TITLE"
|
||||
End If
|
||||
@@ -87,19 +79,20 @@ Public Class frmNotification_Startup
|
||||
RichEditControl1.Visible = False
|
||||
Dim oType As String, oMSG_STRING As String, oMarkasRead As Boolean
|
||||
|
||||
If oDTNotifications.Rows.Count = 1 Then
|
||||
oType = oDTNotifications.Rows(0).Item("DISPLAY_TYPE")
|
||||
oMSG_STRING = oDTNotifications.Rows(0).Item("MSG_STRING")
|
||||
oMarkasRead = oDTNotifications.Rows(0).Item("VALIDATE_READ")
|
||||
NOTIFY_ID = oDTNotifications.Rows(0).Item("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")
|
||||
NOTIFY_ID = oRow.Item("GUID")
|
||||
Else
|
||||
Dim oCount As Integer = 0
|
||||
For Each orow As DataRow In oDTNotifications.Rows
|
||||
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")
|
||||
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
|
||||
@@ -123,9 +116,9 @@ Public Class frmNotification_Startup
|
||||
End If
|
||||
End If
|
||||
If oMarkasRead = True Then
|
||||
bbtnitmMarkRead.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||||
btnMarkAsRead.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||||
Else
|
||||
bbtnitmMarkRead.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
btnMarkAsRead.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
@@ -145,36 +138,31 @@ Public Class frmNotification_Startup
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCloseForm.ItemClick
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub bbtnitmMarkRead_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmMarkRead.ItemClick
|
||||
Private Sub btnMarkAsRead_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnMarkAsRead.ItemClick
|
||||
Dim oSuccess As Boolean = True
|
||||
Try
|
||||
|
||||
Dim oInsert = $"INSERT INTO [dbo].[TBDD_NOTIFICATIONS_USER_HISTORY]
|
||||
([NOTIFY_ID]
|
||||
,[USR_ID])
|
||||
VALUES
|
||||
({NOTIFY_ID}
|
||||
,{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(oInsert)
|
||||
Dim oResponse = Client.ExecuteNonQueryFromECM(oSQL)
|
||||
If Not oResponse.OK Then
|
||||
oSuccess = False
|
||||
End If
|
||||
Else
|
||||
oSuccess = Environment.Database.ExecuteNonQuery(oInsert)
|
||||
oSuccess = _Environment.Database.ExecuteNonQuery(oSQL)
|
||||
|
||||
End If
|
||||
If oSuccess = False Then
|
||||
BarStaticItem1.Caption = "Error while setting History!"
|
||||
BarStaticItem1.ItemAppearance.Normal.BackColor = Color.Red
|
||||
lbStatus.Caption = "Error while setting History!"
|
||||
lbStatus.ItemAppearance.Normal.BackColor = Color.Red
|
||||
Else
|
||||
BarStaticItem1.Caption = "History successfully saved!"
|
||||
BarStaticItem1.ItemAppearance.Normal.BackColor = Color.Green
|
||||
If oDTNotifications.Rows.Count = 1 Then
|
||||
lbStatus.Caption = "History successfully saved!"
|
||||
lbStatus.ItemAppearance.Normal.BackColor = Color.Green
|
||||
If _NotificationsTable.Rows.Count = 1 Then
|
||||
Me.Close()
|
||||
End If
|
||||
End If
|
||||
@@ -188,7 +176,7 @@ Public Class frmNotification_Startup
|
||||
Private Function GetOperationMode() As OperationMode
|
||||
Dim oOperationMode As OperationMode
|
||||
|
||||
If Environment.Service.Client?.IsOnline AndAlso Environment.Service.Address <> String.Empty Then
|
||||
If _Environment.Service.Client?.IsOnline AndAlso _Environment.Service.Address <> String.Empty Then
|
||||
oOperationMode = OperationMode.WithAppServer
|
||||
Else
|
||||
oOperationMode = OperationMode.NoAppServer
|
||||
|
||||
Reference in New Issue
Block a user