This commit is contained in:
Jonathan Jenne
2020-06-23 12:04:38 +02:00
37 changed files with 1640 additions and 206 deletions

View File

@@ -12,6 +12,7 @@ Public Class ChatNewConv
Public IDBObjectId As Long
Public ConnStringIDB As String
Public Username As String
Public UserID As Long
Public User_Language As String
Public NewConversation As Long
@@ -19,12 +20,13 @@ Public Class ChatNewConv
InitializeComponent()
End Sub
Public Sub Init(LogConfig As LogConfig, ConnectionStringIDB As String, IDB_OBJ_ID As Long, Username As String, UserLanguage As String, DTUsers As DataTable, DTGroups As DataTable)
Public Sub Init(LogConfig As LogConfig, ConnectionStringIDB As String, IDB_OBJ_ID As Long, UserID As Long, Username As String, UserLanguage As String, DTUsers As DataTable, DTGroups As DataTable)
Me.LogConfig = LogConfig
Me.Logger = LogConfig.GetLogger()
Me.ConnStringIDB = ConnectionStringIDB
IDBObjectId = IDB_OBJ_ID
Me.Username = Username
Me.UserID = UserID
Me.User_Language = UserLanguage
Me._Database = New MSSQLServer(LogConfig, ConnectionStringIDB)
If Not IsNothing(DTUsers) Then
@@ -69,33 +71,38 @@ Public Class ChatNewConv
Dim oCONV_ID = _Database.GetScalarValue(oSQL)
If Not IsNothing(oCONV_ID) Then
NewConversation = oCONV_ID
Dim oSelectedUsers As Integer() = GridViewUsers.GetSelectedRows()
If oSelectedUsers.Count > 0 Then
For Each oRowHandle As Integer In oSelectedUsers
Dim oUserID
Try
oUserID = GridViewUsers.GetRowCellValue(oRowHandle, "UserID")
Catch ex As Exception
oSQL = $"EXEC PRIDB_ADD_USER_2_CONVERSATION {NewConversation},{UserID},'{Username}'"
If _Database.ExecuteNonQuery(oSQL) = True Then
Dim oSelectedUsers As Integer() = GridViewUsers.GetSelectedRows()
If oSelectedUsers.Count > 0 Then
For Each oRowHandle As Integer In oSelectedUsers
Dim oUserID
Try
oUserID = GridViewUsers.GetRowCellValue(oRowHandle, "USER_ID")
Catch ex1 As Exception
Logger.Warn("Error Selecting UserID/USER_ID: " & ex.Message)
oError = True
Exit Sub
oUserID = GridViewUsers.GetRowCellValue(oRowHandle, "UserID")
Catch ex As Exception
Try
oUserID = GridViewUsers.GetRowCellValue(oRowHandle, "USER_ID")
Catch ex1 As Exception
Logger.Warn("Error Selecting UserID/USER_ID: " & ex.Message)
oError = True
Exit Sub
End Try
End Try
End Try
oSQL = $"EXEC PRIDB_ADD_USER_2_CONVERSATION {oCONV_ID},{oUserID},'{Username}'"
If _Database.ExecuteNonQuery(oSQL) = False Then
oError = True
End If
Next
End If
If oError = False Then
RaiseEvent Conversation_Created()
oSQL = $"EXEC PRIDB_ADD_USER_2_CONVERSATION {NewConversation},{oUserID},'{Username}'"
If _Database.ExecuteNonQuery(oSQL) = False Then
oError = True
Exit For
End If
Next
End If
If oError = False Then
RaiseEvent Conversation_Created()
End If
End If
End If
Else
MsgBox("Error running create procedure. Check Your log!", MsgBoxStyle.Information)