Messenger, Essensbestellungen, cDatenserver, ATEZ

This commit is contained in:
2023-09-25 16:13:01 +02:00
parent 021e459bdc
commit 2de1e68a43
4 changed files with 136 additions and 13 deletions

View File

@@ -1332,7 +1332,7 @@ Public Class cFormularManager
Public Shared Function getPDFViaSpirePDF_FromURL(URL As String, Optional targetPath As String = "") As String
Public Shared Function getPDFViaSpirePDF_FromURL(URL As String, Optional targetPath As String = "", Optional openFileAfterDownload As Boolean = False) As String
Try
If targetPath = "" Then targetPath = getTMPPath_PDF()
@@ -1479,6 +1479,9 @@ Public Class cFormularManager
Return ""
End Function
Public Shared Sub PrintViaSpirePDF(task As Task(Of List(Of String)))
Throw New NotImplementedException()
End Sub
End Class

View File

@@ -24,7 +24,6 @@ Partial Class frmMessenger
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
@@ -39,11 +38,11 @@ Partial Class frmMessenger
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMessenger))
Me.SplitContainer = New System.Windows.Forms.SplitContainer()
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer()
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
Me.Panel6 = New System.Windows.Forms.Panel()
Me.lblLKWChat_MsgCntInaktiv = New System.Windows.Forms.Label()
Me.cbxInaktiveChats = New System.Windows.Forms.CheckBox()
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
Me.Panel5 = New System.Windows.Forms.Panel()
Me.MyTextBox2 = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
@@ -64,7 +63,7 @@ Partial Class frmMessenger
Me.btnNeu = New System.Windows.Forms.Button()
Me.Button1 = New System.Windows.Forms.Button()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel(Me.components)
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel()
Me.UsrCntlMessenger_ChatElement1 = New VERAG_PROG_ALLGEMEIN.usrCntlMessenger_ChatElement()
Me.Panel3 = New System.Windows.Forms.Panel()
Me.btnTeilnehmer = New System.Windows.Forms.Button()
@@ -91,9 +90,9 @@ Partial Class frmMessenger
Me.btnSendAtt = New System.Windows.Forms.Button()
Me.btnSenden = New System.Windows.Forms.Button()
Me.rtbChatMessage = New System.Windows.Forms.RichTextBox()
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer(Me.components)
Me.Timer_REFRESH = New System.Windows.Forms.Timer(Me.components)
Me.cntxt = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer()
Me.Timer_REFRESH = New System.Windows.Forms.Timer()
Me.cntxt = New System.Windows.Forms.ContextMenuStrip()
Me.ChatDeaktivierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.toolChatReminder = New System.Windows.Forms.ToolStripMenuItem()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()

View File

@@ -1,6 +1,7 @@
Imports System.Data.SqlClient
Imports System.Net
Imports System.Reflection
Imports System.ServiceModel.Security
Imports System.Threading
Imports System.Web.Routing
Imports System.Windows.Forms
@@ -8,6 +9,107 @@ Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports Chilkat
Imports Newtonsoft.Json.Linq
Public Class cATEZ_NCTS_Sessions
Public Property session_Id As Integer
Public Property token As String
Public Property datetime As DateTime = Now()
Public Property refresh_token As String
Public Property token_validuntil As DateTime
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Public hasEntry As Boolean
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("session_Id", session_Id, , True, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token", token))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("datetime", datetime))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("refresh_token", refresh_token))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_validuntil", token_validuntil))
Return list
End Function
Sub New()
LOAD()
End Sub
Sub New(token As String, refreshtoken As String, timestamp As DateTime)
Me.token = token
Me.refresh_token = refreshtoken
token_validuntil = timestamp
SAVE()
End Sub
Public Function SAVE(Optional errHinweis = "") As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN " & getInsertCmd() &
" commit tran "
Dim IdTMP = session_Id
IdTMP = SQL.doSQLVarListID(IdTMP, sqlstr, "FMZOLL", , list, , errHinweis)
If session_Id <= 0 Then session_Id = IdTMP
Return session_Id > 0
End Function
Public Function getInsertCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim str As String = ""
Dim values As String = ""
For Each i In list
If Not i.isPrimaryParam Then
str &= "[" & i.Text & "],"
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
values = values.Substring(0, values.Length - 1) 'wg. ','
Return (" INSERT INTO tblATEZ_NCTS_Sessions (" & str & ") VALUES(" & values & ") ")
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ""
End Function
Public Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT TOP(1) * FROM tblATEZ_NCTS_Sessions where token_validuntil >= GetDate() order by datetime desc ", conn)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each li In getParameterList()
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
If dr.Item(li.Text) Is DBNull.Value Then
propInfo.SetValue(Me, Nothing)
Else
propInfo.SetValue(Me, dr.Item(li.Text))
End If
Next
hasEntry = True
End If
dr.Close()
End Using
End Using
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
End Class
Public Class cATEZ_NCTS_DATA
Public Property Id As Integer
@@ -41,6 +143,7 @@ Public Class cATEZ_NCTS_DATA
Public Property selectedDocuments As String
Public Property fehlerbeschreibung As String
Public Property json As String
Public Property sessionId As Integer
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
@@ -78,6 +181,7 @@ Public Class cATEZ_NCTS_DATA
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("dakosy_ref", dakosy_ref))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("selectedDocuments", selectedDocuments))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("fehlerbeschreibung", fehlerbeschreibung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sessionId", sessionId))
Return list
End Function
@@ -507,13 +611,25 @@ Public Class cATEZ_NCTS_IN
'PROD
Shared API_STRING As String = "https://transcom.singlewindow.io"
Shared token As String = ""
Shared refresh_token As String = ""
Public dataTable As New DataTable()
Shared jsonData As New Chilkat.JsonObject
Public Shared sessionID As Integer = -1
Shared Function SendRequestAuthentificationToken(ByVal myuri As String, ByVal contentType As String, ByVal method As String, ByRef Itoken As String) As String
Try
If Itoken <> "" Then Return "200"
Dim session = New cATEZ_NCTS_Sessions()
If Not IsDBNull(session.token) AndAlso session.token IsNot Nothing Then
Itoken = session.token
token = Itoken
sessionID = session.session_Id
Return "200"
End If
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
@@ -556,9 +672,13 @@ Public Class cATEZ_NCTS_IN
Dim jsonResp = New Chilkat.JsonObject()
jsonResp.LoadSb(sbResponseBody)
token = jsonResp.StringOf("access_token")
Itoken = token
Itoken = jsonResp.StringOf("access_token")
token = Itoken
refresh_token = jsonResp.StringOf("refresh_token")
Dim now As DateTime = DateTime.Now()
now = now.AddSeconds(jsonResp.IntOf("expires_in"))
session = New cATEZ_NCTS_Sessions(Itoken, refresh_token, now.ToString("yyyy-MM-dd HH:mm:ss"))
sessionID = session.session_Id
Return rest.ResponseStatusCode
Catch ex As WebException