diff --git a/ChatTest/Form1.vb b/ChatTest/Form1.vb index e75dbb85..6944a04f 100644 --- a/ChatTest/Form1.vb +++ b/ChatTest/Form1.vb @@ -7,8 +7,8 @@ Public Class Form1 Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath) Dim oConnectionString = "Server=sDD-VMP04-SQL17\DD_DEVELOP01;Database=IDB_TEST;User Id=sa;Password=dd;" Me._Database = New MSSQLServer(oLogConfig, oConnectionString) - ChatControl1.Init(oLogConfig, oConnectionString, "Email", "JenneJ") - ChatControl1.GetConversations(10070) + ChatControl1.Init(oLogConfig, oConnectionString, "Email", "JenneJ", "de-DE", Nothing) + ChatControl1.GetConversations(10070,True) Dim oSQL = "SELECT GUID as UserID,NAME,USERNAME,EMAIL from TBDD_USER" Dim oDTUSERS As DataTable = _Database.GetDatatable(oSQL) diff --git a/Controls.ChatAddUser/ChatAddUser.Designer.vb b/Controls.ChatAddUser/ChatAddUser.Designer.vb new file mode 100644 index 00000000..b0c9e390 --- /dev/null +++ b/Controls.ChatAddUser/ChatAddUser.Designer.vb @@ -0,0 +1,100 @@ + _ +Partial Class ChatAddUser + Inherits System.Windows.Forms.UserControl + + 'UserControl1 überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ChatAddUser)) + Me.Panel2 = New System.Windows.Forms.Panel() + Me.SimpleButton1 = New DevExpress.XtraEditors.SimpleButton() + Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker() + Me.GridControlUsers = New DevExpress.XtraGrid.GridControl() + Me.GridViewUsers = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.Panel2.SuspendLayout() + CType(Me.GridControlUsers, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridViewUsers, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'Panel2 + ' + Me.Panel2.Controls.Add(Me.SimpleButton1) + Me.Panel2.Dock = System.Windows.Forms.DockStyle.Bottom + Me.Panel2.Location = New System.Drawing.Point(0, 413) + Me.Panel2.Name = "Panel2" + Me.Panel2.Size = New System.Drawing.Size(463, 59) + Me.Panel2.TabIndex = 1 + ' + 'SimpleButton1 + ' + Me.SimpleButton1.Dock = System.Windows.Forms.DockStyle.Fill + Me.SimpleButton1.ImageOptions.SvgImage = CType(resources.GetObject("SimpleButton1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.SimpleButton1.Location = New System.Drawing.Point(0, 0) + Me.SimpleButton1.Name = "SimpleButton1" + Me.SimpleButton1.Size = New System.Drawing.Size(463, 59) + Me.SimpleButton1.TabIndex = 0 + Me.SimpleButton1.Text = "User hinzufügen" + ' + 'GridControlUsers + ' + Me.GridControlUsers.Dock = System.Windows.Forms.DockStyle.Fill + Me.GridControlUsers.Location = New System.Drawing.Point(0, 0) + Me.GridControlUsers.MainView = Me.GridViewUsers + Me.GridControlUsers.Name = "GridControlUsers" + Me.GridControlUsers.Size = New System.Drawing.Size(463, 413) + Me.GridControlUsers.TabIndex = 0 + Me.GridControlUsers.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewUsers}) + ' + 'GridViewUsers + ' + Me.GridViewUsers.Appearance.EvenRow.BackColor = System.Drawing.Color.PaleTurquoise + Me.GridViewUsers.Appearance.EvenRow.Options.UseBackColor = True + Me.GridViewUsers.GridControl = Me.GridControlUsers + Me.GridViewUsers.Name = "GridViewUsers" + Me.GridViewUsers.OptionsBehavior.Editable = False + Me.GridViewUsers.OptionsSelection.MultiSelect = True + Me.GridViewUsers.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect + Me.GridViewUsers.OptionsView.EnableAppearanceEvenRow = True + Me.GridViewUsers.OptionsView.ShowAutoFilterRow = True + Me.GridViewUsers.OptionsView.ShowGroupPanel = False + Me.GridViewUsers.OptionsView.ShowViewCaption = True + Me.GridViewUsers.ViewCaption = "Benutzer zu Konversation hinzufügen" + ' + 'ChatAddUser + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 14.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.GridControlUsers) + Me.Controls.Add(Me.Panel2) + Me.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "ChatAddUser" + Me.Size = New System.Drawing.Size(463, 472) + Me.Panel2.ResumeLayout(False) + CType(Me.GridControlUsers, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridViewUsers, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + Friend WithEvents Panel2 As Panel + Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker + Friend WithEvents GridControlUsers As DevExpress.XtraGrid.GridControl + Friend WithEvents GridViewUsers As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents SimpleButton1 As DevExpress.XtraEditors.SimpleButton +End Class diff --git a/Controls.ChatAddUser/ChatAddUser.resx b/Controls.ChatAddUser/ChatAddUser.resx new file mode 100644 index 00000000..1b8ff1ab --- /dev/null +++ b/Controls.ChatAddUser/ChatAddUser.resx @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z + LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl + dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAGICAAAC77u/ + PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi + IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv + MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh + Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg + MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5Z + ZWxsb3d7ZmlsbDojRkZCMTE1O30KCS5CbGFja3tmaWxsOiM3MjcyNzI7fQoJLkdyZWVue2ZpbGw6IzAz + OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9Cgkuc3Qwe29wYWNpdHk6MC43NTt9Cgkuc3Qxe29wYWNp + dHk6MC41O30KPC9zdHlsZT4NCiAgPGcgaWQ9IkFkZENpcmNsZWQiPg0KICAgIDxwYXRoIGQ9Ik0xNiw0 + QzkuNCw0LDQsOS40LDQsMTZzNS40LDEyLDEyLDEyczEyLTUuNCwxMi0xMlMyMi42LDQsMTYsNHogTTI0 + LDE4aC02djZoLTR2LTZIOHYtNGg2VjhoNHY2aDZWMTh6IiBjbGFzcz0iR3JlZW4iIC8+DQogIDwvZz4N + Cjwvc3ZnPgs= + + + + 17, 17 + + \ No newline at end of file diff --git a/Controls.ChatAddUser/ChatAddUser.vb b/Controls.ChatAddUser/ChatAddUser.vb new file mode 100644 index 00000000..bed4005b --- /dev/null +++ b/Controls.ChatAddUser/ChatAddUser.vb @@ -0,0 +1,80 @@ +Imports DevExpress.XtraGrid.Views.Tile +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Logging + +Public Class ChatAddUser + Public Delegate Sub UserAdded() + Public Event User_Added As UserAdded + Private _Database As MSSQLServer + Private LogConfig As LogConfig + Private Logger As Logger + + Public ConversationID As Long + Public ConnStringIDB As String + Public Username As String + Public User_Language As String + Public NewConversation As Long + + Public Sub New() + InitializeComponent() + End Sub + + Public Sub Init(LogConfig As LogConfig, ConnectionStringIDB As String, CONV_ID As Long, Username As String, UserLanguage As String, DTUsers As DataTable) + Me.LogConfig = LogConfig + Me.Logger = LogConfig.GetLogger() + Me.ConnStringIDB = ConnectionStringIDB + ConversationID = CONV_ID + + Me.Username = Username + Me.User_Language = UserLanguage + Me._Database = New MSSQLServer(LogConfig, ConnectionStringIDB) + If Not IsNothing(DTUsers) Then + If DTUsers.Rows.Count > 1 Then + GridControlUsers.DataSource = DTUsers + End If + + End If + End Sub + + Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click + AddUser() + End Sub + Public Function AddUser() + Try + Dim oSQL As String + Dim oError As Boolean = False + + 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 + Try + oUserID = GridViewUsers.GetRowCellValue(oRowHandle, "USER_ID") + Catch ex1 As Exception + Logger.Warn("Error Selecting UserID/USER_ID: " & ex.Message) + oError = True + Return False + End Try + + End Try + + oSQL = $"EXEC PRIDB_ADD_USER_2_CONVERSATION {ConversationID},{oUserID},'{Username}'" + If _Database.ExecuteNonQuery(oSQL) = False Then + oError = True + End If + Next + End If + If oError = False Then + RaiseEvent User_Added() + End If + + + Catch ex As Exception + Logger.Error(ex) + MsgBox($"Unexpected error in Add User2Conversation: {ex.Message}") + End Try + End Function +End Class diff --git a/Controls.ChatAddUser/ChatAddUser.vbproj b/Controls.ChatAddUser/ChatAddUser.vbproj new file mode 100644 index 00000000..62c2b5af --- /dev/null +++ b/Controls.ChatAddUser/ChatAddUser.vbproj @@ -0,0 +1,171 @@ + + + + + Debug + AnyCPU + {F0A807CC-BE14-4B5B-9200-27C16156BD8A} + Library + DigitalData.Controls.ChatAddUser + DigitalData.Controls.ChatAddUser + 512 + Windows + v4.6.1 + true + + + + true + full + true + true + bin\Debug\ + DigitalData.Controls.ChatAddUser.xml + _MYFORMS=True + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + pdbonly + false + true + true + bin\Release\ + DigitalData.Controls.ChatAddUser.xml + _MYFORMS=True + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + + + + + + + + + ..\Controls.LookupGrid\obj\Debug\DigitalData.Controls.LookupGrid.dll + + + + ..\packages\NLog.4.7.2\lib\net45\NLog.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + UserControl + + + ChatAddUser.vb + + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + ChatAddUser.vb + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + + + + {eaf0ea75-5fa7-485d-89c7-b2d843b03a96} + Database + + + {903b2d7d-3b80-4be9-8713-7447b704e1b0} + Logging + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Controls.ChatAddUser/ChatNewConv.sln b/Controls.ChatAddUser/ChatNewConv.sln new file mode 100644 index 00000000..7fbe294b --- /dev/null +++ b/Controls.ChatAddUser/ChatNewConv.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29728.190 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ChatNewConv", "ChatNewConv.vbproj", "{1F278760-4F6B-42E8-B82D-01D4C8618340}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1F278760-4F6B-42E8-B82D-01D4C8618340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F278760-4F6B-42E8-B82D-01D4C8618340}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F278760-4F6B-42E8-B82D-01D4C8618340}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F278760-4F6B-42E8-B82D-01D4C8618340}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7A1345F2-0B32-4B54-AD8C-2DA579BFF116} + EndGlobalSection +EndGlobal diff --git a/Controls.ChatAddUser/My Project/Application.Designer.vb b/Controls.ChatAddUser/My Project/Application.Designer.vb new file mode 100644 index 00000000..8ab460ba --- /dev/null +++ b/Controls.ChatAddUser/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/Controls.ChatAddUser/My Project/Application.myapp b/Controls.ChatAddUser/My Project/Application.myapp new file mode 100644 index 00000000..758895de --- /dev/null +++ b/Controls.ChatAddUser/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 1 + true + diff --git a/Controls.ChatAddUser/My Project/AssemblyInfo.vb b/Controls.ChatAddUser/My Project/AssemblyInfo.vb new file mode 100644 index 00000000..e3c1975f --- /dev/null +++ b/Controls.ChatAddUser/My Project/AssemblyInfo.vb @@ -0,0 +1,34 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' Allgemeine Informationen über eine Assembly werden über die folgenden +' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +' die einer Assembly zugeordnet sind. + +' Werte der Assemblyattribute überprüfen + + + + + + + + + + +'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird. + + +' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +' +' Hauptversion +' Nebenversion +' Buildnummer +' Revision +' +' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +' indem Sie "*" wie unten gezeigt eingeben: + + + diff --git a/Controls.ChatAddUser/My Project/Resources.Designer.vb b/Controls.ChatAddUser/My Project/Resources.Designer.vb new file mode 100644 index 00000000..aed253a3 --- /dev/null +++ b/Controls.ChatAddUser/My Project/Resources.Designer.vb @@ -0,0 +1,103 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + ''' + ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Controls.ChatAddUser.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + ''' + Friend ReadOnly Property Action_Workflow_Activate() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("Action_Workflow_Activate", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + ''' + Friend ReadOnly Property Action_Workflow_Deactivate() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("Action_Workflow_Deactivate", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + ''' + Friend ReadOnly Property crop_php() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("crop.php", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + ''' + Friend ReadOnly Property Send_16x16() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("Send_16x16", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + End Module +End Namespace diff --git a/Controls.ChatAddUser/My Project/Resources.resx b/Controls.ChatAddUser/My Project/Resources.resx new file mode 100644 index 00000000..c8bf3f12 --- /dev/null +++ b/Controls.ChatAddUser/My Project/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\crop.php.jpeg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Send_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Action_Workflow_Activate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Action_Workflow_Deactivate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Controls.ChatAddUser/My Project/Settings.Designer.vb b/Controls.ChatAddUser/My Project/Settings.Designer.vb new file mode 100644 index 00000000..9c3adb9a --- /dev/null +++ b/Controls.ChatAddUser/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "Automatische My.Settings-Speicherfunktion" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.DigitalData.Controls.ChatAddUser.My.MySettings + Get + Return Global.DigitalData.Controls.ChatAddUser.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/Controls.ChatAddUser/My Project/Settings.settings b/Controls.ChatAddUser/My Project/Settings.settings new file mode 100644 index 00000000..85b890b3 --- /dev/null +++ b/Controls.ChatAddUser/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Controls.ChatAddUser/My Project/licenses.licx b/Controls.ChatAddUser/My Project/licenses.licx new file mode 100644 index 00000000..75eb9ac1 --- /dev/null +++ b/Controls.ChatAddUser/My Project/licenses.licx @@ -0,0 +1,6 @@ +DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.GridLookUpEdit, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/Controls.ChatAddUser/Resources/Action_Workflow_Activate.png b/Controls.ChatAddUser/Resources/Action_Workflow_Activate.png new file mode 100644 index 00000000..5d967b1f Binary files /dev/null and b/Controls.ChatAddUser/Resources/Action_Workflow_Activate.png differ diff --git a/Controls.ChatAddUser/Resources/Action_Workflow_Deactivate.png b/Controls.ChatAddUser/Resources/Action_Workflow_Deactivate.png new file mode 100644 index 00000000..54a077fb Binary files /dev/null and b/Controls.ChatAddUser/Resources/Action_Workflow_Deactivate.png differ diff --git a/Controls.ChatAddUser/Resources/Send_16x16.png b/Controls.ChatAddUser/Resources/Send_16x16.png new file mode 100644 index 00000000..add634c2 Binary files /dev/null and b/Controls.ChatAddUser/Resources/Send_16x16.png differ diff --git a/Controls.ChatAddUser/Resources/crop.php.jpeg b/Controls.ChatAddUser/Resources/crop.php.jpeg new file mode 100644 index 00000000..68360c3b Binary files /dev/null and b/Controls.ChatAddUser/Resources/crop.php.jpeg differ diff --git a/Controls.ChatAddUser/packages.config b/Controls.ChatAddUser/packages.config new file mode 100644 index 00000000..1baeaab3 --- /dev/null +++ b/Controls.ChatAddUser/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Controls.ChatControl/ChatControl.Designer.vb b/Controls.ChatControl/ChatControl.Designer.vb index eb6ecb02..f76dc28e 100644 --- a/Controls.ChatControl/ChatControl.Designer.vb +++ b/Controls.ChatControl/ChatControl.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class ChatControl Inherits System.Windows.Forms.UserControl 'UserControl1 überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,7 +20,7 @@ Partial Class ChatControl 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - _ + Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim ItemTemplate1 As DevExpress.XtraGrid.Views.Tile.ItemTemplate = New DevExpress.XtraGrid.Views.Tile.ItemTemplate() @@ -29,39 +29,59 @@ Partial Class ChatControl Dim TileViewItemElement1 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TileViewItemElement2 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TileViewItemElement3 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() + Dim TileViewItemElement4 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TableRowDefinition1 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() Dim TableRowDefinition2 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TableRowDefinition3 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() Dim ItemTemplate2 As DevExpress.XtraGrid.Views.Tile.ItemTemplate = New DevExpress.XtraGrid.Views.Tile.ItemTemplate() Dim TableColumnDefinition3 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() Dim TableColumnDefinition4 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() - Dim TileViewItemElement4 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TileViewItemElement5 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TileViewItemElement6 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() - Dim TableRowDefinition3 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TileViewItemElement7 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TableRowDefinition4 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TableRowDefinition5 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim ItemTemplate3 As DevExpress.XtraGrid.Views.Tile.ItemTemplate = New DevExpress.XtraGrid.Views.Tile.ItemTemplate() Dim TableColumnDefinition5 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() Dim TableColumnDefinition6 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() - Dim TableRowDefinition5 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TileViewItemElement8 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() + Dim TileViewItemElement9 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() + Dim TileViewItemElement10 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() + Dim TileViewItemElement11 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TableRowDefinition6 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TableRowDefinition7 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TableRowDefinition8 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TableColumnDefinition7 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() + Dim TableColumnDefinition8 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() + Dim TableRowDefinition9 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() + Dim TableRowDefinition10 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ChatControl)) Me.columnUsername = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.columnMessage = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.columnDate = New DevExpress.XtraGrid.Columns.TileViewColumn() + Me.columnTO_USER = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.RepositoryItemHypertextLabel1 = New DevExpress.XtraEditors.Repository.RepositoryItemHypertextLabel() Me.RepositoryItemHyperLinkEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit() Me.GridChat = New DevExpress.XtraGrid.GridControl() Me.ChatView = New DevExpress.XtraGrid.Views.Tile.TileView() Me.btnSendMessage = New DevExpress.XtraEditors.SimpleButton() Me.ChatSource = New System.Windows.Forms.BindingSource(Me.components) - Me.Panel1 = New System.Windows.Forms.Panel() - Me.txtMessage = New System.Windows.Forms.TextBox() - Me.lblTitle = New System.Windows.Forms.Label() + Me.pnlMessage = New System.Windows.Forms.Panel() + Me.ListBoxUserMention = New System.Windows.Forms.ListBox() + Me.RichTextBox1 = New System.Windows.Forms.RichTextBox() + Me.MenuStrip1 = New System.Windows.Forms.MenuStrip() + Me.tsmitmTitle = New System.Windows.Forms.ToolStripMenuItem() + Me.tsmenitmHamburger = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripMenuItemConv_end = New System.Windows.Forms.ToolStripMenuItem() + Me.BenutzerHinzufügenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.TeilnehmerToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() CType(Me.RepositoryItemHypertextLabel1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RepositoryItemHyperLinkEdit1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridChat, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ChatView, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ChatSource, System.ComponentModel.ISupportInitialize).BeginInit() - Me.Panel1.SuspendLayout() + Me.pnlMessage.SuspendLayout() + Me.MenuStrip1.SuspendLayout() Me.SuspendLayout() ' 'columnUsername @@ -84,6 +104,8 @@ Partial Class ChatControl ' 'columnDate ' + Me.columnDate.DisplayFormat.FormatString = "g" + Me.columnDate.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime Me.columnDate.FieldName = "ADDED_WHEN" Me.columnDate.MinWidth = 23 Me.columnDate.Name = "columnDate" @@ -91,6 +113,15 @@ Partial Class ChatControl Me.columnDate.VisibleIndex = 2 Me.columnDate.Width = 87 ' + 'columnTO_USER + ' + Me.columnTO_USER.AppearanceCell.BackColor = System.Drawing.Color.GreenYellow + Me.columnTO_USER.AppearanceCell.Options.UseBackColor = True + Me.columnTO_USER.FieldName = "TO_USER" + Me.columnTO_USER.Name = "columnTO_USER" + Me.columnTO_USER.Visible = True + Me.columnTO_USER.VisibleIndex = 3 + ' 'RepositoryItemHypertextLabel1 ' Me.RepositoryItemHypertextLabel1.Name = "RepositoryItemHypertextLabel1" @@ -120,7 +151,7 @@ Partial Class ChatControl ' 'ChatView ' - Me.ChatView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.columnMessage, Me.columnUsername, Me.columnDate}) + Me.ChatView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.columnMessage, Me.columnUsername, Me.columnDate, Me.columnTO_USER}) Me.ChatView.ContextButtonOptions.HoverStateOpacity = 0.75! Me.ChatView.ContextButtonOptions.TopPanelColor = System.Drawing.Color.White Me.ChatView.DetailHeight = 431 @@ -131,7 +162,7 @@ Partial Class ChatControl Me.ChatView.OptionsTiles.IndentBetweenGroups = 0 Me.ChatView.OptionsTiles.IndentBetweenItems = 10 Me.ChatView.OptionsTiles.ItemPadding = New System.Windows.Forms.Padding(0) - Me.ChatView.OptionsTiles.ItemSize = New System.Drawing.Size(374, 64) + Me.ChatView.OptionsTiles.ItemSize = New System.Drawing.Size(374, 90) Me.ChatView.OptionsTiles.LayoutMode = DevExpress.XtraGrid.Views.Tile.TileViewLayoutMode.Kanban Me.ChatView.OptionsTiles.Orientation = System.Windows.Forms.Orientation.Vertical Me.ChatView.OptionsTiles.Padding = New System.Windows.Forms.Padding(5) @@ -144,13 +175,14 @@ Partial Class ChatControl TileViewItemElement1.Column = Me.columnUsername TileViewItemElement1.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter TileViewItemElement1.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement1.RowIndex = 1 TileViewItemElement1.Text = "columnUsername" TileViewItemElement1.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft TileViewItemElement1.TextLocation = New System.Drawing.Point(10, 0) TileViewItemElement2.Column = Me.columnMessage TileViewItemElement2.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter TileViewItemElement2.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside - TileViewItemElement2.RowIndex = 1 + TileViewItemElement2.RowIndex = 2 TileViewItemElement2.Text = "columnMessage" TileViewItemElement2.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft TileViewItemElement2.TextLocation = New System.Drawing.Point(10, 0) @@ -158,56 +190,109 @@ Partial Class ChatControl TileViewItemElement3.ColumnIndex = 1 TileViewItemElement3.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter TileViewItemElement3.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement3.RowIndex = 1 TileViewItemElement3.Text = "columnDate" TileViewItemElement3.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleRight TileViewItemElement3.TextLocation = New System.Drawing.Point(-10, 0) + TileViewItemElement4.Column = Me.columnTO_USER + TileViewItemElement4.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter + TileViewItemElement4.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement4.Text = "columnTO_USER" + TileViewItemElement4.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter ItemTemplate1.Elements.Add(TileViewItemElement1) ItemTemplate1.Elements.Add(TileViewItemElement2) ItemTemplate1.Elements.Add(TileViewItemElement3) + ItemTemplate1.Elements.Add(TileViewItemElement4) ItemTemplate1.Name = "ChatLeft" - TableRowDefinition1.Length.Value = 24.0R - TableRowDefinition2.Length.Value = 24.0R + TableRowDefinition1.Length.Value = 40.0R + TableRowDefinition2.Length.Value = 19.0R + TableRowDefinition3.Length.Value = 45.0R ItemTemplate1.Rows.Add(TableRowDefinition1) ItemTemplate1.Rows.Add(TableRowDefinition2) + ItemTemplate1.Rows.Add(TableRowDefinition3) TableColumnDefinition3.Length.Value = 100.0R TableColumnDefinition4.Length.Value = 250.0R ItemTemplate2.Columns.Add(TableColumnDefinition3) ItemTemplate2.Columns.Add(TableColumnDefinition4) - TileViewItemElement4.Column = Me.columnUsername - TileViewItemElement4.ColumnIndex = 1 - TileViewItemElement4.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter - TileViewItemElement4.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside - TileViewItemElement4.Text = "columnUsername" - TileViewItemElement4.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleRight - TileViewItemElement4.TextLocation = New System.Drawing.Point(-10, 0) - TileViewItemElement5.Column = Me.columnMessage + TileViewItemElement5.Column = Me.columnUsername TileViewItemElement5.ColumnIndex = 1 TileViewItemElement5.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter TileViewItemElement5.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside - TileViewItemElement5.RowIndex = 1 - TileViewItemElement5.Text = "columnMessage" + TileViewItemElement5.Text = "columnUsername" TileViewItemElement5.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleRight TileViewItemElement5.TextLocation = New System.Drawing.Point(-10, 0) - TileViewItemElement6.Column = Me.columnDate + TileViewItemElement6.Column = Me.columnMessage + TileViewItemElement6.ColumnIndex = 1 TileViewItemElement6.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter TileViewItemElement6.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside - TileViewItemElement6.Text = "columnDate" - TileViewItemElement6.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft - TileViewItemElement6.TextLocation = New System.Drawing.Point(10, 0) - ItemTemplate2.Elements.Add(TileViewItemElement4) + TileViewItemElement6.RowIndex = 1 + TileViewItemElement6.Text = "columnMessage" + TileViewItemElement6.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleRight + TileViewItemElement6.TextLocation = New System.Drawing.Point(-10, 0) + TileViewItemElement7.Column = Me.columnDate + TileViewItemElement7.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter + TileViewItemElement7.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement7.Text = "columnDate" + TileViewItemElement7.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft + TileViewItemElement7.TextLocation = New System.Drawing.Point(10, 0) ItemTemplate2.Elements.Add(TileViewItemElement5) ItemTemplate2.Elements.Add(TileViewItemElement6) + ItemTemplate2.Elements.Add(TileViewItemElement7) ItemTemplate2.Name = "ChatRight" - TableRowDefinition3.Length.Value = 24.0R - TableRowDefinition4.Length.Value = 24.0R - ItemTemplate2.Rows.Add(TableRowDefinition3) + TableRowDefinition4.Length.Value = 19.0R + TableRowDefinition5.Length.Value = 45.0R ItemTemplate2.Rows.Add(TableRowDefinition4) + ItemTemplate2.Rows.Add(TableRowDefinition5) + TableColumnDefinition5.Length.Value = 250.0R + TableColumnDefinition6.Length.Value = 100.0R + ItemTemplate3.Columns.Add(TableColumnDefinition5) + ItemTemplate3.Columns.Add(TableColumnDefinition6) + TileViewItemElement8.Column = Me.columnUsername + TileViewItemElement8.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter + TileViewItemElement8.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement8.RowIndex = 1 + TileViewItemElement8.Text = "columnUsername" + TileViewItemElement8.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft + TileViewItemElement8.TextLocation = New System.Drawing.Point(10, 0) + TileViewItemElement9.Column = Me.columnMessage + TileViewItemElement9.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter + TileViewItemElement9.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement9.RowIndex = 2 + TileViewItemElement9.Text = "columnMessage" + TileViewItemElement9.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft + TileViewItemElement9.TextLocation = New System.Drawing.Point(10, 0) + TileViewItemElement10.Column = Me.columnDate + TileViewItemElement10.ColumnIndex = 1 + TileViewItemElement10.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter + TileViewItemElement10.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement10.RowIndex = 1 + TileViewItemElement10.Text = "columnDate" + TileViewItemElement10.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleRight + TileViewItemElement10.TextLocation = New System.Drawing.Point(-10, 0) + TileViewItemElement11.Column = Me.columnTO_USER + TileViewItemElement11.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter + TileViewItemElement11.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside + TileViewItemElement11.Text = "columnTO_USER" + TileViewItemElement11.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft + TileViewItemElement11.TextLocation = New System.Drawing.Point(10, 0) + ItemTemplate3.Elements.Add(TileViewItemElement8) + ItemTemplate3.Elements.Add(TileViewItemElement9) + ItemTemplate3.Elements.Add(TileViewItemElement10) + ItemTemplate3.Elements.Add(TileViewItemElement11) + ItemTemplate3.Name = "ChatTo" + TableRowDefinition6.Length.Value = 17.0R + TableRowDefinition7.Length.Value = 19.0R + TableRowDefinition8.Length.Value = 54.0R + ItemTemplate3.Rows.Add(TableRowDefinition6) + ItemTemplate3.Rows.Add(TableRowDefinition7) + ItemTemplate3.Rows.Add(TableRowDefinition8) Me.ChatView.Templates.Add(ItemTemplate1) Me.ChatView.Templates.Add(ItemTemplate2) - Me.ChatView.TileColumns.Add(TableColumnDefinition5) - Me.ChatView.TileColumns.Add(TableColumnDefinition6) - Me.ChatView.TileRows.Add(TableRowDefinition5) - Me.ChatView.TileRows.Add(TableRowDefinition6) + Me.ChatView.Templates.Add(ItemTemplate3) + Me.ChatView.TileColumns.Add(TableColumnDefinition7) + Me.ChatView.TileColumns.Add(TableColumnDefinition8) + Me.ChatView.TileRows.Add(TableRowDefinition9) + Me.ChatView.TileRows.Add(TableRowDefinition10) ' 'btnSendMessage ' @@ -222,53 +307,95 @@ Partial Class ChatControl Me.btnSendMessage.TabIndex = 2 Me.btnSendMessage.ToolTip = "Add message" ' - 'Panel1 + 'pnlMessage ' - Me.Panel1.BackColor = System.Drawing.SystemColors.GradientActiveCaption - Me.Panel1.Controls.Add(Me.txtMessage) - Me.Panel1.Controls.Add(Me.btnSendMessage) - Me.Panel1.Dock = System.Windows.Forms.DockStyle.Bottom - Me.Panel1.Location = New System.Drawing.Point(0, 485) - Me.Panel1.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4) - Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(422, 102) - Me.Panel1.TabIndex = 3 + Me.pnlMessage.BackColor = System.Drawing.Color.DimGray + Me.pnlMessage.Controls.Add(Me.ListBoxUserMention) + Me.pnlMessage.Controls.Add(Me.RichTextBox1) + Me.pnlMessage.Controls.Add(Me.btnSendMessage) + Me.pnlMessage.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pnlMessage.Location = New System.Drawing.Point(0, 485) + Me.pnlMessage.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4) + Me.pnlMessage.Name = "pnlMessage" + Me.pnlMessage.Size = New System.Drawing.Size(422, 102) + Me.pnlMessage.TabIndex = 3 ' - 'txtMessage + 'ListBoxUserMention ' - Me.txtMessage.AcceptsReturn = True - Me.txtMessage.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.txtMessage.BackColor = System.Drawing.Color.GhostWhite - Me.txtMessage.BorderStyle = System.Windows.Forms.BorderStyle.None - Me.txtMessage.Font = New System.Drawing.Font("Calibri", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.txtMessage.ForeColor = System.Drawing.SystemColors.InfoText - Me.txtMessage.Location = New System.Drawing.Point(17, 15) - Me.txtMessage.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4) - Me.txtMessage.Multiline = True - Me.txtMessage.Name = "txtMessage" - Me.txtMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical - Me.txtMessage.Size = New System.Drawing.Size(349, 70) - Me.txtMessage.TabIndex = 3 + Me.ListBoxUserMention.BackColor = System.Drawing.SystemColors.Window + Me.ListBoxUserMention.BorderStyle = System.Windows.Forms.BorderStyle.None + Me.ListBoxUserMention.ForeColor = System.Drawing.Color.Blue + Me.ListBoxUserMention.FormattingEnabled = True + Me.ListBoxUserMention.ItemHeight = 16 + Me.ListBoxUserMention.Location = New System.Drawing.Point(191, 22) + Me.ListBoxUserMention.Name = "ListBoxUserMention" + Me.ListBoxUserMention.Size = New System.Drawing.Size(129, 80) + Me.ListBoxUserMention.TabIndex = 4 + Me.ListBoxUserMention.Visible = False ' - 'lblTitle + 'RichTextBox1 ' - Me.lblTitle.AutoSize = True - Me.lblTitle.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.lblTitle.Location = New System.Drawing.Point(3, 10) - Me.lblTitle.Name = "lblTitle" - Me.lblTitle.Size = New System.Drawing.Size(50, 16) - Me.lblTitle.TabIndex = 4 - Me.lblTitle.Text = "Label1" + Me.RichTextBox1.AutoWordSelection = True + Me.RichTextBox1.Location = New System.Drawing.Point(10, 6) + Me.RichTextBox1.Name = "RichTextBox1" + Me.RichTextBox1.ShowSelectionMargin = True + Me.RichTextBox1.Size = New System.Drawing.Size(353, 91) + Me.RichTextBox1.TabIndex = 3 + Me.RichTextBox1.Text = "" + ' + 'MenuStrip1 + ' + Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsmitmTitle, Me.tsmenitmHamburger, Me.TeilnehmerToolStripMenuItem}) + Me.MenuStrip1.Location = New System.Drawing.Point(0, 0) + Me.MenuStrip1.Name = "MenuStrip1" + Me.MenuStrip1.Size = New System.Drawing.Size(422, 25) + Me.MenuStrip1.TabIndex = 4 + Me.MenuStrip1.Text = "MenuStrip1" + ' + 'tsmitmTitle + ' + Me.tsmitmTitle.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.tsmitmTitle.Name = "tsmitmTitle" + Me.tsmitmTitle.Size = New System.Drawing.Size(48, 21) + Me.tsmitmTitle.Text = "sdsd" + ' + 'tsmenitmHamburger + ' + Me.tsmenitmHamburger.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right + Me.tsmenitmHamburger.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItemConv_end, Me.BenutzerHinzufügenToolStripMenuItem}) + Me.tsmenitmHamburger.Image = Global.DigitalData.Controls.ChatControl.My.Resources.Resources.kisspng_computer_icons_hamburger_button_menu_new_menu_5b34724c3cb0f7_1188475115301637882486 + Me.tsmenitmHamburger.Name = "tsmenitmHamburger" + Me.tsmenitmHamburger.Size = New System.Drawing.Size(28, 21) + ' + 'ToolStripMenuItemConv_end + ' + Me.ToolStripMenuItemConv_end.Image = Global.DigitalData.Controls.ChatControl.My.Resources.Resources.StatusAnnotations_Stop_16xLG + Me.ToolStripMenuItemConv_end.Name = "ToolStripMenuItemConv_end" + Me.ToolStripMenuItemConv_end.Size = New System.Drawing.Size(192, 22) + Me.ToolStripMenuItemConv_end.Text = "Konversation beenden" + ' + 'BenutzerHinzufügenToolStripMenuItem + ' + Me.BenutzerHinzufügenToolStripMenuItem.Image = Global.DigitalData.Controls.ChatControl.My.Resources.Resources.action_add_16xLG + Me.BenutzerHinzufügenToolStripMenuItem.Name = "BenutzerHinzufügenToolStripMenuItem" + Me.BenutzerHinzufügenToolStripMenuItem.Size = New System.Drawing.Size(192, 22) + Me.BenutzerHinzufügenToolStripMenuItem.Text = "Benutzer hinzufügen" + ' + 'TeilnehmerToolStripMenuItem + ' + Me.TeilnehmerToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right + Me.TeilnehmerToolStripMenuItem.ForeColor = System.Drawing.Color.DarkCyan + Me.TeilnehmerToolStripMenuItem.Name = "TeilnehmerToolStripMenuItem" + Me.TeilnehmerToolStripMenuItem.Size = New System.Drawing.Size(78, 21) + Me.TeilnehmerToolStripMenuItem.Text = "Teilnehmer" ' 'ChatControl ' Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 16.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.Controls.Add(Me.lblTitle) Me.Controls.Add(Me.GridChat) - Me.Controls.Add(Me.Panel1) + Me.Controls.Add(Me.pnlMessage) + Me.Controls.Add(Me.MenuStrip1) Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4) Me.Name = "ChatControl" @@ -278,8 +405,9 @@ Partial Class ChatControl CType(Me.GridChat, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.ChatView, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.ChatSource, System.ComponentModel.ISupportInitialize).EndInit() - Me.Panel1.ResumeLayout(False) - Me.Panel1.PerformLayout() + Me.pnlMessage.ResumeLayout(False) + Me.MenuStrip1.ResumeLayout(False) + Me.MenuStrip1.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -293,7 +421,14 @@ Partial Class ChatControl Friend WithEvents btnSendMessage As DevExpress.XtraEditors.SimpleButton Friend WithEvents RepositoryItemHyperLinkEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit Friend WithEvents RepositoryItemHypertextLabel1 As DevExpress.XtraEditors.Repository.RepositoryItemHypertextLabel - Friend WithEvents txtMessage As TextBox - Friend WithEvents Panel1 As Panel - Friend WithEvents lblTitle As Label + Friend WithEvents pnlMessage As Panel + Friend WithEvents MenuStrip1 As MenuStrip + Friend WithEvents tsmitmTitle As ToolStripMenuItem + Friend WithEvents tsmenitmHamburger As ToolStripMenuItem + Friend WithEvents ToolStripMenuItemConv_end As ToolStripMenuItem + Friend WithEvents BenutzerHinzufügenToolStripMenuItem As ToolStripMenuItem + Friend WithEvents TeilnehmerToolStripMenuItem As ToolStripMenuItem + Friend WithEvents RichTextBox1 As RichTextBox + Friend WithEvents columnTO_USER As DevExpress.XtraGrid.Columns.TileViewColumn + Friend WithEvents ListBoxUserMention As ListBox End Class diff --git a/Controls.ChatControl/ChatControl.resx b/Controls.ChatControl/ChatControl.resx index 7b631f33..05f8267d 100644 --- a/Controls.ChatControl/ChatControl.resx +++ b/Controls.ChatControl/ChatControl.resx @@ -158,4 +158,7 @@ 17, 17 + + 131, 17 + \ No newline at end of file diff --git a/Controls.ChatControl/ChatControl.vb b/Controls.ChatControl/ChatControl.vb index d140ef7b..2e64356b 100644 --- a/Controls.ChatControl/ChatControl.vb +++ b/Controls.ChatControl/ChatControl.vb @@ -7,118 +7,248 @@ Public Class ChatControl Private ReadOnly IdentificationColumn As String = "USER_FROM" Private ReadOnly MessageColumn As String = "MESSAGE_TEXT" Private ReadOnly DateColumn As String = "ADDED_WHEN" - + Public Delegate Sub ConversationEnded() + Public Event Conversation_Ended As ConversationEnded + Public Delegate Sub ConversationUsersAdded_Success() + Public Event Conversation_UsersAdded_Success As ConversationUsersAdded_Success Private Db As MSSQLServer Private LogConfig As LogConfig Private Logger As Logger - Private ReadOnly UsernameColorsDict As New Dictionary(Of String, Color) - Private ReadOnly UsernameColors As New List(Of Color) From { - Color.Purple, - Color.Red, - Color.LightBlue, - Color.DarkSeaGreen - } + Private AddMessage As Boolean + + Private oAddUSerForm As Form + + 'Private ReadOnly UsernameColorsDict As New Dictionary(Of String, Color) + 'Private ReadOnly UsernameColors As New List(Of Color) From { + ' Color.Purple, + ' Color.Red, + ' Color.LightBlue, + ' Color.DarkSeaGreen + '} + Private IsAssistKeyPressed As Boolean = False + + Private AssistListBox As ListBox = New ListBox() Public IDBObjectId As Long Public ConnStringIDB As String Public ConversationIdentification As String + Public UserID As Long Public Username As String - Public CurrentConversation As Long + Public User_Language As String + Public CurrentConversationID As Long + Public CurrentConversation_State As String + Public CurrentConversation_UserActive As Boolean + Public oDTConv_User As DataTable + + Public CurrentMentionedUser As String + Public CurrentMentionedUserID As Long + Public CurrentIdentifier + Public User_Datatable_Select As DataTable + Public DT_Rights As DataTable + + + Public QU_Conv_End As DataTable Public Sub New() InitializeComponent() End Sub - Public Sub Init(LogConfig As LogConfig, ConnectionStringIDB As String, ConversationIdentification As String, Username As String) - Me.LogConfig = LogConfig - Me.Logger = LogConfig.GetLogger() - Me.ConnStringIDB = ConnectionStringIDB - Me.ConversationIdentification = ConversationIdentification - Me.Username = Username + Public Function Init(LogConfig As LogConfig, ConnectionStringIDB As String, ConversationIdentification As String, UserID As Long, Username As String, USER_LANG As String, + Qust_Conv_End As DataTable, DTRIGHTS As DataTable) + Try + CurrentConversationID = 0 + Me.LogConfig = LogConfig + Me.Logger = LogConfig.GetLogger() + Me.ConnStringIDB = ConnectionStringIDB + Me.ConversationIdentification = ConversationIdentification + Me.UserID = UserID + Me.Username = Username + Me.User_Language = USER_LANG + QU_Conv_End = Qust_Conv_End + DT_Rights = DTRIGHTS + Me.Db = New MSSQLServer(LogConfig, ConnStringIDB) + Return True + Catch ex As Exception + Logger.Error(ex) + Return False + End Try + + End Function + Sub Check_Rights() + Dim oSQL As String + ToolStripMenuItemConv_end.Visible = False + tsmenitmHamburger.Visible = False + AddMessage = False + Dim oView As DataView = New DataView(DT_Rights) + oView.RowFilter = "CONF_TITLE = 'CONVERSATION_USER_ACTIVE'" + If oView.Count = 1 Then + CurrentConversation_UserActive = True + Else + CurrentConversation_UserActive = False + End If + + For Each oRow As DataRow In DT_Rights.Rows + If oRow.Item("CONF_TITLE").ToString.Contains("CONVERSATION_RIGHT") Then + Select Case oRow.Item("CONF_VALUE") + Case "Start|Stop" + ToolStripMenuItemConv_end.Visible = True + tsmenitmHamburger.Visible = True + AddMessage = True + Case "AddMessage" + AddMessage = True + Case "Admin" + ToolStripMenuItemConv_end.Visible = True + BenutzerHinzufügenToolStripMenuItem.Visible = True + tsmenitmHamburger.Visible = True + AddMessage = True + Case "Start" + BenutzerHinzufügenToolStripMenuItem.Visible = True + tsmenitmHamburger.Visible = True + Case "Stop" + ToolStripMenuItemConv_end.Visible = True + End Select + ElseIf oRow.Item("CONF_TITLE") = "CONVERSATION_ADD_USER_SELECT" Then + oSQL = oRow.Item("CONF_VALUE") + oSQL = oSQL.Replace("@CONVID", CurrentConversationID) + User_Datatable_Select = Db.GetDatatable(oSQL) + Logger.Debug($"User_Datatable_Select [{User_Datatable_Select}]") + End If + + + Next + If CurrentConversation_State = "Started" Then + pnlMessage.Visible = AddMessage + Else + pnlMessage.Visible = False + tsmenitmHamburger.Visible = False + End If - Me.Db = New MSSQLServer(LogConfig, ConnStringIDB) End Sub Public Function GetConversations(IDBObjectId As Long) - Dim oSQL As String = $"SELECT * FROM VWIDB_CONVERSATION WHERE IDB_OBJ_ID = {IDBObjectId} ORDER BY CONVERSATION_ID DESC" + CurrentConversationID = 0 + Dim oSQL As String = $"SELECT DISTINCT T.CONVERSATION_ID,T.TITLE,T.CONVERSATION_STATE,T.ADDED_WHEN FROM VWIDB_CONVERSATION T INNER JOIN VWIDB_CONVERSATION_USER T1 ON T.CONVERSATION_ID = T1.CONV_ID WHERE IDB_OBJ_ID = {IDBObjectId} + AND T1.USER_ID = {UserID} + ORDER BY CONVERSATION_ID DESC" Dim oDatatable As DataTable = Db.GetDatatable(oSQL) Dim oConversations As New List(Of String) If Not IsNothing(oDatatable) Then - If oDatatable.Rows.Count = 1 Then - Dim oItem = oDatatable.Rows(0).Item("CONVERSATION_ID").ToString + "|" + oDatatable.Rows(0).Item("TITLE").ToString - oConversations.Insert(0, oItem) - CurrentConversation = oDatatable.Rows(0).Item("CONVERSATION_ID") - LoadConversation(CurrentConversation) - Else - For Each oROW As DataRow In oDatatable.Rows - Dim oItem = oROW.Item("CONVERSATION_ID").ToString + "|" + oROW.Item("TITLE").ToString - oConversations.Insert(0, oItem) - If oROW.Item("CONVERSATION_STATE") = "Started" Then - CurrentConversation = oROW.Item("CONVERSATION_ID") - LoadConversation(CurrentConversation) + Dim i = 0 + For Each oROW As DataRow In oDatatable.Rows + Dim oItem = oROW.Item("CONVERSATION_ID").ToString + "|" + oROW.Item("TITLE").ToString + "|" + oROW.Item("CONVERSATION_STATE").ToString + "|" + oDatatable.Rows(0).Item("ADDED_WHEN").ToString + oConversations.Insert(i, oItem) + i += 1 + If oROW.Item("CONVERSATION_STATE") = "Started" Then + If CurrentConversationID = 0 Then + CurrentConversationID = oROW.Item("CONVERSATION_ID") + LoadConversation(CurrentConversationID) End If - Next - End If + End If + Next End If Return oConversations End Function - Private Sub tsCBConversations_SelectedIndexChanged(sender As Object, e As EventArgs) - 'If tsCBConversations.SelectedIndex <> -1 Then - ' Dim oValues As List(Of String) = tsCBConversations.Text.Split("|").ToList() - ' CurrentConversation = oValues(0) - ' LoadConversation(CurrentConversation) - - 'End If - End Sub Public Sub LoadConversation(ConversationId As Long) + ListBoxUserMention.Visible = False + RichTextBox1.Text = "" Dim oSQL As String = $"SELECT * FROM VWIDB_CONV_MESSAGES WHERE CONV_ID = {ConversationId} ORDER BY GUID" Dim oDatatable As DataTable = Db.GetDatatable(oSQL) - BuildUsernameColorDict(oDatatable) + ' BuildUsernameColorDict(oDatatable) oSQL = $"SELECT * FROM VWIDB_CONVERSATION WHERE CONVERSATION_ID = {ConversationId}" Dim oDatatable2 As DataTable = Db.GetDatatable(oSQL) GridChat.DataSource = ChatSource ChatSource.DataSource = oDatatable - lblTitle.Text = oDatatable2.Rows(0).Item("TITLE") + tsmitmTitle.Text = oDatatable2.Rows(0).Item("TITLE") + CurrentConversationID = ConversationId + CurrentConversation_State = oDatatable2.Rows(0).Item("CONVERSATION_STATE") + oSQL = $"SELECT * FROM VWIDB_CONVERSATION_USER WHERE CONV_ID = {ConversationId}" + oDTConv_User = Db.GetDatatable(oSQL) + If TeilnehmerToolStripMenuItem.HasDropDownItems Then + TeilnehmerToolStripMenuItem.DropDownItems.Clear() + End If + If ConversationIdentification.Contains("@") Then + CurrentIdentifier = "EMAIL" + Else + CurrentIdentifier = "USERNAME" + End If + AssistListBox.Items.Clear() + ListBoxUserMention.Items.Clear() + + Try + For Each oROW As DataRow In oDTConv_User.Rows + + Dim oConvUser + oConvUser = oROW.Item(CurrentIdentifier) + If IsDBNull(oConvUser) Then + oConvUser = String.Empty + End If + + If oConvUser.ToString = String.Empty Then + If CurrentIdentifier = "EMAIL" Then + oConvUser = $"No Email for User '{oROW.Item("USERNAME")}'" + Else + oConvUser = $"No Identification for UserID '{oROW.Item("USER_ID")}'" + End If + Else + ListBoxUserMention.Items.Add("@" & oConvUser.ToString.Substring(0, oConvUser.ToString.IndexOf("@"))) + AssistListBox.Items.Add("@" & oConvUser.ToString.Substring(0, oConvUser.ToString.IndexOf("@"))) + + End If + Dim oToolStripItem As ToolStripMenuItem = New ToolStripMenuItem(oConvUser.ToString) + TeilnehmerToolStripMenuItem.DropDownItems.Add(oToolStripItem) + Next + AddHandler AssistListBox.SelectedIndexChanged, AddressOf AssistListBox_Changed + Catch ex As Exception + MsgBox(ex.Message, MsgBoxStyle.Critical, "Error adding ConversationUsers") + End Try + + Check_Rights() End Sub Public Sub NewMessage(MessageText As String) Try - Dim oSQL As String = $"EXEC [PRIDB_NEW_CONVERSATION_MESSAGE] {CurrentConversation},'{MessageText}', '{ConversationIdentification}'" + Dim oSQL As String = $"EXEC [PRIDB_NEW_CONVERSATION_MESSAGE] {CurrentConversationID},'{MessageText}', '{ConversationIdentification}', {CurrentMentionedUserID},'{User_Language}'" + Logger.Debug($"NewMessageSQL: {oSQL}") Dim oResult = Db.GetScalarValue(oSQL) - LoadConversation(CurrentConversation) - txtMessage.Text = String.Empty + LoadConversation(CurrentConversationID) + RichTextBox1.Text = String.Empty ChatView.MoveLast() Catch ex As Exception Logger.Error(ex) End Try End Sub - Private Sub BuildUsernameColorDict(Datatable As DataTable) - Dim oIndex = 0 + 'Private Sub BuildUsernameColorDict(Datatable As DataTable) + ' Dim oIndex = 0 - UsernameColorsDict.Clear() + ' UsernameColorsDict.Clear() - Datatable.AsEnumerable(). - Select(Function(Row) Row.Item(IdentificationColumn)). - Distinct().ToList(). - ForEach(Sub(Name) - UsernameColorsDict.Add(Name, UsernameColors.Item(oIndex)) - oIndex += 1 - End Sub) - End Sub + ' Datatable.AsEnumerable(). + ' Select(Function(Row) Row.Item(IdentificationColumn)). + ' Distinct().ToList(). + ' ForEach(Sub(Name) + ' UsernameColorsDict.Add(Name, UsernameColors.Item(oIndex)) + ' oIndex += 1 + ' End Sub) + 'End Sub Private Sub ChatView_CustomItemTemplate(sender As Object, e As TileViewCustomItemTemplateEventArgs) Handles ChatView.CustomItemTemplate Dim oRow As DataRow = ChatView.GetDataRow(e.RowHandle) - Dim oUsername As String = oRow.Item(IdentificationColumn) - - If oUsername = ConversationIdentification Or oUsername = Username Then - e.Template = e.Templates.Item("ChatRight") + Dim oIdentification As String = oRow.Item(IdentificationColumn) + Dim oToUser = oRow.Item("TO_USER") + If Not IsDBNull(oToUser) Then + e.Template = e.Templates.Item("ChatTo") Else - e.Template = e.Templates.Item("ChatLeft") + If oIdentification = ConversationIdentification Or oIdentification = Username Then + e.Template = e.Templates.Item("ChatRight") + Else + e.Template = e.Templates.Item("ChatLeft") + End If End If + End Sub Private Sub ChatView_ItemCustomize(sender As Object, e As TileViewItemCustomizeEventArgs) Handles ChatView.ItemCustomize @@ -126,13 +256,17 @@ Public Class ChatControl Dim oUsername As String = oRow.Item(IdentificationColumn) Dim oMessage As String = oRow.Item(MessageColumn) - Dim oColor As Color = UsernameColorsDict.Item(oUsername) + ' Dim oColor As Color = UsernameColorsDict.Item(oUsername) If oUsername = ConversationIdentification Or oUsername = Username Then e.Item.AppearanceItem.Normal.BackColor = Color.PaleTurquoise + e.Item.Item(IdentificationColumn).Appearance.Normal.ForeColor = Color.Purple + Else + ' e.Item.AppearanceItem.Normal.BackColor = Color.whi + e.Item.Item(IdentificationColumn).Appearance.Normal.ForeColor = Color.Red End If - e.Item.AppearanceItem.Focused.BackColor = Color.Turquoise - e.Item.Item(IdentificationColumn).Appearance.Normal.ForeColor = oColor + 'e.Item.AppearanceItem.Focused.BackColor = Color.Turquoise + End Sub @@ -142,15 +276,13 @@ Public Class ChatControl End Sub Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles btnSendMessage.Click - If txtMessage.Text.Count > 0 Then - NewMessage(txtMessage.Text) + If RichTextBox1.Text.Count > 0 Then + NewMessage(RichTextBox1.Text) End If End Sub - Private Sub TextBox1_KeyUp(sender As Object, e As KeyEventArgs) Handles txtMessage.KeyUp - If e.Control And e.KeyCode = Keys.Enter And txtMessage.Text.Count > 0 Then - NewMessage(txtMessage.Text) - End If + Private Sub TextBox1_KeyUp(sender As Object, e As KeyEventArgs) + End Sub Private Sub ChatControl_Click(sender As Object, e As EventArgs) Handles MyBase.Click @@ -160,4 +292,156 @@ Public Class ChatControl Private Sub ChatControl_Leave(sender As Object, e As EventArgs) Handles Me.Leave End Sub + + Private Sub ToolStripMenuItemConv_end_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItemConv_end.Click + If CurrentConversationID <> 0 Then + Dim result As MsgBoxResult + result = MessageBox.Show(QU_Conv_End.Rows(0).Item("STRING1").ToString, QU_Conv_End.Rows(0).Item("STRING2").ToString, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) + If result = MsgBoxResult.Yes Then + Dim oSQL = $"EXEC PRIDB_END_CONVERSATION {CurrentConversationID}, '{Username}', '{User_Language}'" + If Db.ExecuteNonQuery(oSQL) = True Then + RaiseEvent Conversation_Ended() + Else + MsgBox("Unexpected error in PRIDB_END_CONVERSATION - Check Your log!", MsgBoxStyle.Exclamation) + End If + End If + End If + End Sub + + Private Sub BenutzerHinzufügenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BenutzerHinzufügenToolStripMenuItem.Click + Dim oForm = New Form() + Dim oaddUS As ChatAddUser.ChatAddUser = New ChatAddUser.ChatAddUser() + oaddUS.Init(LogConfig, ConnStringIDB, CurrentConversationID, Username, User_Language, User_Datatable_Select) + oForm.Controls.Add(oaddUS) + oaddUS.Dock = DockStyle.Fill + oForm.MaximizeBox = False + oForm.MinimizeBox = False + oForm.FormBorderStyle = FormBorderStyle.FixedDialog + oForm.StartPosition = FormStartPosition.CenterScreen + oForm.Text = "" + AddHandler oaddUS.User_Added, AddressOf onUsersAdded + oAddUSerForm = oForm + oForm.ShowDialog() + End Sub + + Sub onUsersAdded() + RaiseEvent Conversation_UsersAdded_Success() + oAddUSerForm.Close() + End Sub + + Private Function GetPoint(ByVal textBoxControl As RichTextBox) As Point + Dim graphics_1 As Graphics = Graphics.FromHwnd(textBoxControl.Handle) + Dim size As SizeF = graphics_1.MeasureString(textBoxControl.Text.Substring(0, textBoxControl.SelectionStart), textBoxControl.Font) + Dim coord As New Point(CInt(size.Width) + textBoxControl.Location.X, CInt(size.Height) + textBoxControl.Location.Y) + Return coord + End Function + + + + Private Sub RichTextBox1_KeyUp(sender As Object, e As KeyEventArgs) Handles RichTextBox1.KeyUp + If e.Control And e.KeyCode = Keys.Enter And RichTextBox1.Text.Count > 0 Then + NewMessage(RichTextBox1.Text) + ElseIf (Keys.Alt AndAlso Keys.Control) And e.KeyCode = keys.Q Then + + + With RichTextBox1 + ListBoxUserMention.Left = .GetPositionFromCharIndex( + .SelectionStart).X + .Left + 10 + ListBoxUserMention.Top = .GetPositionFromCharIndex( + .SelectionStart).Y + .Top + 20 + + ' Jetzt ListBox einblendenden, Focus auf diese setzen + ' und den ersten Eintrag selektieren + ListBoxUserMention.Visible = True + ListBoxUserMention.Focus() + ListBoxUserMention.SelectedIndex = 0 + End With + + + 'Dim opoint As Point = GetPoint(sender) + 'AssistListBox.PointToClient(opoint) + 'pnlMessage.Controls.Add(AssistListBox) + 'AssistListBox.Show() + 'AssistListBox.BringToFront() + + ' '@ was pressed + + End If + + End Sub + Sub AssistListBox_Changed() + Try + RichTextBox1.Text = RichTextBox1.Text + AssistListBox.SelectedItem + ": " + RichTextBox1.SelectionFont = New Font("Tahoma", 10, FontStyle.Bold And FontStyle.Underline) + RichTextBox1.Text = RichTextBox1.Text.Replace("@@", "@") + pnlMessage.Controls.Remove(AssistListBox) + 'RichTextBox1.SelectedText = AssistListBox.SelectedItem + + Catch ex As Exception + Logger.Error(ex) + End Try + + End Sub + Sub ADD_MentionedUser(pUser As String) + Dim oPos As Integer = RichTextBox1.TextLength + Dim oUsertext = pUser & ": " + With RichTextBox1 + .AppendText(Replace(.Text, "@", vbNullString) & oPos) + .Select(oPos, oUsertext.Length) + .SelectionColor = Color.Blue + .Select() + + End With + + End Sub + + Private Sub ListBoxUserMention_KeyUp(sender As Object, e As KeyEventArgs) Handles ListBoxUserMention.KeyUp + If e.KeyCode = Keys.Return Then + Dim oMentionedUser As String = ListBoxUserMention.SelectedItem + 'ADD_MentionedUser(strTag) + With RichTextBox1 + + CUrrentMentionedUser = oMentionedUser + ' Logger.Debug($"ListBoxUserMention_KeyUp.CurrentMentionedUser = {CurrentMentionedUser}") + For Each oROW As DataRow In oDTConv_User.Rows + + Dim oConvUser2beChecked + oConvUser2beChecked = oROW.Item(CurrentIdentifier) + If IsDBNull(oConvUser2beChecked) Then + oConvUser2beChecked = String.Empty + End If + + If oConvUser2beChecked.ToString = String.Empty Then + If CurrentIdentifier = "EMAIL" Then + oConvUser2beChecked = $"No Email for User '{oROW.Item("USERNAME")}'" + Else + oConvUser2beChecked = $"No Identification for UserID '{oROW.Item("USER_ID")}'" + End If + End If + CurrentMentionedUser = CurrentMentionedUser.Substring(1, CurrentMentionedUser.Length - 1) + 'Logger.Debug($"oConvUser2beChecked = {CurrentMentionedUser}") + If oConvUser2beChecked.ToString.Contains(CurrentMentionedUser) Then + CurrentMentionedUserID = oROW.Item("USER_ID") + Logger.Debug($"CurrentMentionedUserID Changed: {CurrentMentionedUserID}") + End If + + + Next + + ' Das "Steuerzeichen" # ersetzen durch einen NullString + .Text = Replace(.Text, "@", vbNullString) & oMentionedUser & ": " + + ' wo soll der Cursor nach dem Einfügen in der RTB stehen? + .SelectionStart = .TextLength + + ' Listbox wieder auf den ersten Eintrag setzen + ' und ausblenden + ListBoxUserMention.SelectedItem = 0 + ListBoxUserMention.Visible = False + + ' Focus wieder auf RTB setzen + .Focus() + End With + End If + End Sub End Class diff --git a/Controls.ChatControl/ChatControl.vbproj b/Controls.ChatControl/ChatControl.vbproj index 107ed7a2..b78dfaf9 100644 --- a/Controls.ChatControl/ChatControl.vbproj +++ b/Controls.ChatControl/ChatControl.vbproj @@ -146,6 +146,10 @@ + + {f0a807cc-be14-4b5b-9200-27c16156bd8a} + ChatAddUser + {eaf0ea75-5fa7-485d-89c7-b2d843b03a96} Database @@ -167,5 +171,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/Controls.ChatControl/My Project/Resources.Designer.vb b/Controls.ChatControl/My Project/Resources.Designer.vb index dfe565bf..ffd000d4 100644 --- a/Controls.ChatControl/My Project/Resources.Designer.vb +++ b/Controls.ChatControl/My Project/Resources.Designer.vb @@ -60,6 +60,16 @@ Namespace My.Resources End Set End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + ''' + Friend ReadOnly Property action_add_16xLG() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("action_add_16xLG", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. ''' @@ -90,6 +100,17 @@ Namespace My.Resources End Get End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + ''' + Friend ReadOnly Property kisspng_computer_icons_hamburger_button_menu_new_menu_5b34724c3cb0f7_1188475115301637882486() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("kisspng-computer-icons-hamburger-button-menu-new-menu-5b34724c3cb0f7.118847511530"& _ + "1637882486", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. ''' @@ -99,5 +120,15 @@ Namespace My.Resources Return CType(obj,System.Drawing.Bitmap) End Get End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + ''' + Friend ReadOnly Property StatusAnnotations_Stop_16xLG() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("StatusAnnotations_Stop_16xLG", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property End Module End Namespace diff --git a/Controls.ChatControl/My Project/Resources.resx b/Controls.ChatControl/My Project/Resources.resx index c8bf3f12..5bfe3c6f 100644 --- a/Controls.ChatControl/My Project/Resources.resx +++ b/Controls.ChatControl/My Project/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\Action_Workflow_Deactivate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\crop.php.jpeg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -127,7 +130,13 @@ ..\Resources\Action_Workflow_Activate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Action_Workflow_Deactivate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\kisspng-computer-icons-hamburger-button-menu-new-menu-5b34724c3cb0f7.1188475115301637882486.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\StatusAnnotations_Stop_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\action_add_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/Controls.ChatControl/My Project/licenses.licx b/Controls.ChatControl/My Project/licenses.licx index 53cc1d7d..f21e86b6 100644 --- a/Controls.ChatControl/My Project/licenses.licx +++ b/Controls.ChatControl/My Project/licenses.licx @@ -1,5 +1,6 @@ -DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/Controls.ChatControl/Resources/StatusAnnotations_Stop_16xLG.png b/Controls.ChatControl/Resources/StatusAnnotations_Stop_16xLG.png new file mode 100644 index 00000000..0e4a3ade Binary files /dev/null and b/Controls.ChatControl/Resources/StatusAnnotations_Stop_16xLG.png differ diff --git a/Controls.ChatControl/Resources/action_add_16xLG.png b/Controls.ChatControl/Resources/action_add_16xLG.png new file mode 100644 index 00000000..92db8ebd Binary files /dev/null and b/Controls.ChatControl/Resources/action_add_16xLG.png differ diff --git a/Controls.ChatControl/Resources/kisspng-computer-icons-hamburger-button-menu-new-menu-5b34724c3cb0f7.1188475115301637882486.png b/Controls.ChatControl/Resources/kisspng-computer-icons-hamburger-button-menu-new-menu-5b34724c3cb0f7.1188475115301637882486.png new file mode 100644 index 00000000..6d4015f2 Binary files /dev/null and b/Controls.ChatControl/Resources/kisspng-computer-icons-hamburger-button-menu-new-menu-5b34724c3cb0f7.1188475115301637882486.png differ diff --git a/Controls.ChatNewConv/ChatNewConv.vb b/Controls.ChatNewConv/ChatNewConv.vb index 2317e192..dc02f996 100644 --- a/Controls.ChatNewConv/ChatNewConv.vb +++ b/Controls.ChatNewConv/ChatNewConv.vb @@ -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) diff --git a/DDMonorepo.sln b/DDMonorepo.sln index 0ab6e450..60f7c947 100644 --- a/DDMonorepo.sln +++ b/DDMonorepo.sln @@ -124,9 +124,7 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ChatTest", "ChatTest\ChatTe EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ChatNewConv", "Controls.ChatNewConv\ChatNewConv.vbproj", "{86D27FFA-480F-481D-8D23-26DEAE92FE6C}" EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SQLEditor", "SQLEditor\SQLEditor.vbproj", "{E707BF50-6799-42B2-869F-E10641D51219}" -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SQLEditorTest", "SQLEditorTest\SQLEditorTest.vbproj", "{4B0AED11-31C4-431A-B488-72392B63E6E6}" +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ChatAddUser", "Controls.ChatAddUser\ChatAddUser.vbproj", "{F0A807CC-BE14-4B5B-9200-27C16156BD8A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -330,14 +328,10 @@ Global {86D27FFA-480F-481D-8D23-26DEAE92FE6C}.Debug|Any CPU.Build.0 = Debug|Any CPU {86D27FFA-480F-481D-8D23-26DEAE92FE6C}.Release|Any CPU.ActiveCfg = Release|Any CPU {86D27FFA-480F-481D-8D23-26DEAE92FE6C}.Release|Any CPU.Build.0 = Release|Any CPU - {E707BF50-6799-42B2-869F-E10641D51219}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E707BF50-6799-42B2-869F-E10641D51219}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E707BF50-6799-42B2-869F-E10641D51219}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E707BF50-6799-42B2-869F-E10641D51219}.Release|Any CPU.Build.0 = Release|Any CPU - {4B0AED11-31C4-431A-B488-72392B63E6E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B0AED11-31C4-431A-B488-72392B63E6E6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B0AED11-31C4-431A-B488-72392B63E6E6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B0AED11-31C4-431A-B488-72392B63E6E6}.Release|Any CPU.Build.0 = Release|Any CPU + {F0A807CC-BE14-4B5B-9200-27C16156BD8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0A807CC-BE14-4B5B-9200-27C16156BD8A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0A807CC-BE14-4B5B-9200-27C16156BD8A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0A807CC-BE14-4B5B-9200-27C16156BD8A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -392,8 +386,7 @@ Global {1F278760-4F6B-42E8-B82D-01D4C8618340} = {F98C0329-C004-417F-B2AB-7466E88D8220} {4A726345-FD6B-4E1C-9E5D-18C9043D7714} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A} {86D27FFA-480F-481D-8D23-26DEAE92FE6C} = {F98C0329-C004-417F-B2AB-7466E88D8220} - {E707BF50-6799-42B2-869F-E10641D51219} = {F98C0329-C004-417F-B2AB-7466E88D8220} - {4B0AED11-31C4-431A-B488-72392B63E6E6} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A} + {F0A807CC-BE14-4B5B-9200-27C16156BD8A} = {F98C0329-C004-417F-B2AB-7466E88D8220} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286} diff --git a/Modules.Messaging/Email.vb b/Modules.Messaging/Email.vb index 1d9dd7b5..b7d5252a 100644 --- a/Modules.Messaging/Email.vb +++ b/Modules.Messaging/Email.vb @@ -10,6 +10,8 @@ Imports System.IO Public Class Email Private ReadOnly _logger As Logging.Logger Private ReadOnly _logConfig As Logging.LogConfig + Public Err_Message As String + Public _msg_Send As Boolean Public Sub New(LogConfig As Logging.LogConfig) _logger = LogConfig.GetLogger() @@ -365,6 +367,8 @@ Public Class Email from_mailaddress As String, from_name As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String, AUTH_TYPE As String, SENDER_INSTANCE As String, Optional attment As String = "") Try + Err_Message = "" + _msg_Send = False ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 _logger.Debug($"in Email_Send_Independentsoft..") Dim empfaenger As String() @@ -440,6 +444,7 @@ Public Class Email client.Connect() Catch ex As Exception _logger.Warn("clsEmail.Client.Connect: " & ex.Message) + Err_Message = "clsEmail.Client.Connect: " & ex.Message _error = True ' Continue For End Try @@ -473,9 +478,11 @@ Public Class Email Try client.Send(oMessage) _logger.Info("Message to " & _mailempfaenger & " has been send.") + _msg_Send = True _error = False Catch ex As Exception _logger.Warn("clsEmail.Client.Send: " & ex.Message) + Err_Message = ex.Message _error = True client.Disconnect() Continue For @@ -483,7 +490,12 @@ Public Class Email client.Disconnect() Catch ex As Exception - _logger.Error(ex) + Err_Message = ex.Message + If _msg_Send = True Then + _logger.Info($"Error Closing Connection [{ex.Message}]") + Else + _logger.Error(ex) + End If _error = True End Try Next @@ -495,6 +507,7 @@ Public Class Email End If Catch ex As Exception _logger.Error(ex) + Err_Message = ex.Message Return False End Try End Function diff --git a/Modules.Messaging/My Project/AssemblyInfo.vb b/Modules.Messaging/My Project/AssemblyInfo.vb index b6fdfd76..f25ffd5a 100644 --- a/Modules.Messaging/My Project/AssemblyInfo.vb +++ b/Modules.Messaging/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Services.EmailService/DDEmailService.vbproj b/Services.EmailService/DDEmailService.vbproj index 998e122a..4e3ea547 100644 --- a/Services.EmailService/DDEmailService.vbproj +++ b/Services.EmailService/DDEmailService.vbproj @@ -82,6 +82,7 @@ + True Application.myapp diff --git a/Services.EmailService/EmailService.vb b/Services.EmailService/EmailService.vb index 43be36b6..cb97fa56 100644 --- a/Services.EmailService/EmailService.vb +++ b/Services.EmailService/EmailService.vb @@ -14,10 +14,8 @@ Public Class EmailService Private _MSSQL_Test As MSSQLServer Private _Email As Email Private _Encryption As EncryptionLegacy - Private _EmailQueue As BackgroundWorker Private _QueueTimer As Timer - Private _AnyDatabaseInitialized As Boolean = False Private Enum DatabaseType @@ -28,7 +26,6 @@ Public Class EmailService Protected Overrides Sub OnStart(ByVal args() As String) Try ' === Initialize Logger === - _LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, "Digital Data", "EmailService") _LogConfig.Debug = My.Settings.DEBUG _Logger = _LogConfig.GetLogger() @@ -203,7 +200,7 @@ Public Class EmailService End If Dim oEmailTo, oSubject, oBody As String - Dim oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, oAttachment, ofromName + Dim oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, oAttachment, ofromName, oErrorMsg Dim oAccountId, oGuid, oJobId As Integer For Each oEmailToRow As DataRow In oEmailQueue.Rows @@ -216,7 +213,7 @@ Public Class EmailService Case DatabaseType.MSSQL oAccountId = oEmailToRow.Item("SENDING_PROFILE") End Select - + oErrorMsg = "" For Each oAccountRow As DataRow In oEmailAccounts.Rows If oAccountRow.Item("GUID") = oAccountId Then oAccountMatch = True @@ -239,6 +236,12 @@ Public Class EmailService oMailUser = oAccountRow.Item("EMAIL_USER") oAuthType = oAccountRow.Item("AUTH_TYPE") oMailPW = oAccountRow.Item("EMAIL_PW") + Try + oErrorMsg = IIf(IsDBNull(oAccountRow.Item("ERROR_MSG")), "", oAccountRow.Item("ERROR_MSG")) + Catch ex As Exception + oErrorMsg = "" + End Try + End Select Dim oPasswordPlain = _Encryption.DecryptData(oMailPW) @@ -260,6 +263,9 @@ Public Class EmailService Return False End If + If oErrorMsg <> String.Empty Then + + End If Select Case Database Case DatabaseType.Firebird @@ -288,13 +294,16 @@ Public Class EmailService End Select If oAttachment <> String.Empty Then - If IO.File.Exists(oAttachment) = False Then - _Logger.Warn($"Email Attachment FB FileNotFound Exception!") - oComment = "Email Attachment FB FileNotFound Exception" - oAttachment = String.Empty - Else - _Logger.Debug("Email Attachment is: {0}", oAttachment) + If oAttachment.ToString.Contains("\") Then + If IO.File.Exists(oAttachment) = False Then + _Logger.Warn($"Email Attachment [{oAttachment}] not existing!") + oComment = $"Email Attachment [{oAttachment}] not existing!" + oAttachment = String.Empty + Else + _Logger.Debug("Email Attachment is: {0}", oAttachment) + End If End If + End If Dim oEmailSent As Boolean = False @@ -316,8 +325,39 @@ Public Class EmailService End If MSSQLInstance.ExecuteNonQuery(oSQL) End Select - _Logger.Info($"Email has been send to: {oEmailTo} - Subject: {oSubject}") + _Logger.Info($"EmailID [{oGuid.ToString}] has been send to: {oEmailTo}") Threading.Thread.Sleep(500) + Else + Select Case Database + 'Case DatabaseType.Firebird + ' oSQL = $"UPDATE TBEDM_EMAIL_QUEUE SET EMAIL_SENT = CURRENT_TIMESTAMP,COMMENT = '{oComment}' WHERE GUID = {oGuid}" + ' If oSQL.Contains(",COMMENT = ''") Then + ' oSQL.Replace(",COMMENT = ''", "") + ' End If + ' _Firebird.ExecuteNonQuery(oSQL) + Case DatabaseType.MSSQL + oSQL = $"UPDATE TBEMLP_EMAIL_OUT SET ERROR_TIMESTAMP = GETDATE(),ERROR_MSG = '{_Email.Err_Message}' WHERE GUID = {oGuid} " + MSSQLInstance.NewExecutenonQuery(oSQL) + If _Email._msg_Send = True Then + Select Case Database + Case DatabaseType.Firebird + oSQL = $"UPDATE TBEDM_EMAIL_QUEUE SET EMAIL_SENT = CURRENT_TIMESTAMP,COMMENT = '{oComment}' WHERE GUID = {oGuid}" + If oSQL.Contains(",COMMENT = ''") Then + oSQL.Replace(",COMMENT = ''", "") + End If + _Firebird.ExecuteNonQuery(oSQL) + Case DatabaseType.MSSQL + oSQL = $"UPDATE TBEMLP_EMAIL_OUT SET EMAIL_SENT = GETDATE(),COMMENT = '{oComment}' WHERE GUID = {oGuid} " + If oSQL.Contains(",COMMENT = ''") Then + oSQL.Replace(",COMMENT = ''", "") + End If + MSSQLInstance.NewExecutenonQuery(oSQL) + End Select + _Logger.Info($"EmailID [{oGuid.ToString}] has been send to: {oEmailTo} - althogh there was an error in connection close!") + + End If + + End Select End If Next diff --git a/Services.EmailService/ModuleRuntime.vb b/Services.EmailService/ModuleRuntime.vb new file mode 100644 index 00000000..75a70852 --- /dev/null +++ b/Services.EmailService/ModuleRuntime.vb @@ -0,0 +1,3 @@ +Module ModuleRuntime + Public Err_Message As String +End Module diff --git a/Services.EmailService/My Project/AssemblyInfo.vb b/Services.EmailService/My Project/AssemblyInfo.vb index 683cbc22..f49de587 100644 --- a/Services.EmailService/My Project/AssemblyInfo.vb +++ b/Services.EmailService/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + +