This commit is contained in:
2021-06-24 23:05:48 +02:00
parent e625acc609
commit f2f992547d
134 changed files with 72921 additions and 2011 deletions

View File

@@ -70,11 +70,11 @@ Public Class cMessenger
End Sub
Sub New(chat_id As Integer, Optional topMax As String = "")
Sub New(chat_id As Integer, Optional topMax As String = "", Optional dateTmp As Object = Nothing)
Me.chat_id = chat_id
Me.chat_erstelltMaId = VERAG_PROG_ALLGEMEIN.cAllgemein.USRID
Me.chat_erstelltAm = Now
LOAD(topMax)
LOAD(topMax, dateTmp)
End Sub
Public Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
@@ -108,8 +108,8 @@ Public Class cMessenger
Return chat_id > 0
End Function
Public Sub LOAD(Optional topMax As String = "")
Try
Public Sub LOAD(Optional topMax As String = "", Optional dateTmp As Object = Nothing)
Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionADMIN()
Using cmd As New SqlCommand("Select * FROM tblMessenger_Chat WHERE chat_id=@chat_id ", conn)
cmd.Parameters.AddWithValue("@chat_id", chat_id)
@@ -126,7 +126,12 @@ Public Class cMessenger
Next
Me.LOAD_MEMBERS()
Me.LOAD_MESSAGES(topMax)
If dateTmp Is Nothing Then
Me.LOAD_MESSAGES(topMax)
Else
Me.LOAD_MESSAGES_DATE(dateTmp)
End If
End If
dr.Close()
End Using
@@ -198,6 +203,26 @@ Public Class cMessenger
End Try
End Sub
Public Sub LOAD_MESSAGES_DATE(dateTmp As Date)
Try
Me.CHAT_MESSAGES.Clear()
Using conn As SqlConnection = SQL.GetNewOpenConnectionADMIN()
Using cmd As New SqlCommand("SELECT * FROM [tblMessenger_ChatMessages] WHERE chatMg_chatId=@chat_id AND CAST(chatMg_datetime as date)>=@dateTmp order by chatMg_datetime asc", conn)
cmd.Parameters.AddWithValue("@chat_id", chat_id)
cmd.Parameters.AddWithValue("@dateTmp", dateTmp)
Dim dr = cmd.ExecuteReader()
While dr.Read
Dim MSG As New cMessenger_ChatMessages(dr.Item("chatMg_id")) 'Me.chat_id, dr.Item("chatMb_maId")) 'yxc
Me.CHAT_MESSAGES.Add(MSG)
End While
dr.Close()
End Using
End Using
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
End Sub
Public Function getUpdateCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()