Imports UtilityLibrary
Imports System.IO
Imports C1.Win.C1TrueDBGrid
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.ComponentModel
Imports UtilityLibrary.Win32
Namespace EDOKA
Public Class MyMessage
Private meldungstexte As New DataView()
Public Function Get_Meldungstext(ByVal i As Integer) As String
Dim meldungen As New edokadb.clsMeldungstexte()
Dim res As Integer
meldungen.cpMainConnectionProvider = conn
If Me.meldungstexte.Count = 0 Then
Me.meldungstexte.Table = meldungen.SelectAll
End If
meldungstexte.Sort = "meldungstextnr"
res = meldungstexte.Find(i)
Try
Get_Meldungstext = Me.meldungstexte(res).Item(2)
Catch
Get_Meldungstext = ""
End Try
meldungen.Dispose()
End Function
Public Function show_standardmessage(ByVal i As Integer, ByVal typ As MsgBoxStyle) As Integer
MsgBox(Get_Meldungstext(i), typ)
End Function
Public Function Show_MessageYesNo(ByVal i As Integer) As MsgBoxResult
Show_MessageYesNo = MsgBox(Get_Meldungstext(i), MsgBoxStyle.YesNo + MsgBoxStyle.Question)
End Function
Public Function Show_MessageOKCancel(ByVal i As Integer) As MsgBoxResult
Show_MessageOKCancel = MsgBox(Get_Meldungstext(i), MsgBoxStyle.OkCancel + MsgBoxStyle.Information)
End Function
Public Function Show_MessageYesNoBL(ByVal i As Integer) As MsgBoxResult
Show_MessageYesNoBL = MsgBox(Get_Meldungstext(i), MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Banklagerndes Dokument")
End Function
Public Function show_MessageYesNo_ReplaceText(ByVal i As Integer, ByVal Text1 As String, ByVal Text2 As String) As MsgBoxResult
Dim s As String
s = Get_Meldungstext(i)
s = s.Replace("#1", Text1)
s = s.Replace("#2", Text2)
show_MessageYesNo_ReplaceText = MsgBox(s, MsgBoxStyle.YesNo + MsgBoxStyle.Question)
End Function
'''Ersetzt in einem String die #1 und #2 durch Text1 und Text 2
'''
'''
'''
'''Daniel Burren
'''Release 3.6
Public Function ReplaceTextinMSG(ByVal OrgText As String, ByVal Text1 As String, ByVal Text2 As String) As String
OrgText = OrgText.Replace("#1", Text1)
OrgText = OrgText.Replace("#2", Text2)
ReplaceTextinMSG = OrgText
End Function
Public Function Show_MessageYesNoCancel(ByVal i As Integer) As MsgBoxResult
Show_MessageYesNoCancel = MsgBox(Get_Meldungstext(i), MsgBoxStyle.YesNoCancel + MsgBoxStyle.Question)
End Function
Public Function Show_HinweisMessage(ByVal profilnr As Integer, ByVal messagenr As Integer, ByVal MeldungsNummer As Integer, ByVal style As Integer) As Boolean
If ShowMessage(profilnr, messagenr, 0, style) Then
Dim f As New frmHinweismeldung()
f.Label1.Text = MyMsg.Get_Meldungstext(MeldungsNummer)
f.CheckBox1.Checked = False
f.MsgBoxStyle = style
f.ShowDialog()
If f.DialogResult = DialogResult.OK Then Show_HinweisMessage = True Else Show_HinweisMessage = False
If f.CheckBox1.Checked Then
ShowMessage(profilnr, messagenr, 1, style)
End If
f.Dispose()
Else
Show_HinweisMessage = True
End If
End Function
Public Function Show_HinweisMessage(ByVal profilnr As Integer, ByVal messagenr As Integer, ByVal MeldungsNummer As Integer, ByVal style As Integer, ByVal formOnTop As Boolean) As Boolean
If ShowMessage(profilnr, messagenr, 0, style) Then
Dim f As New frmHinweismeldung()
f.Label1.Text = MyMsg.Get_Meldungstext(MeldungsNummer)
f.CheckBox1.Checked = False
f.MsgBoxStyle = style
If formOnTop = True Then f.TopMost = True
f.ShowDialog()
If f.DialogResult = DialogResult.OK Then Show_HinweisMessage = True Else Show_HinweisMessage = False
If f.CheckBox1.Checked Then
ShowMessage(profilnr, messagenr, 1, style)
End If
f.Dispose()
Else
Show_HinweisMessage = True
End If
End Function
Private Function ShowMessage(ByVal profilnr As Integer, ByVal messagenr As Integer, ByVal fnkt As Integer, ByVal style As Integer) As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Dim i As Integer
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.CommandText = "dbo.sp_show_hinweismeldung"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@profilnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, profilnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@hinweisnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, messagenr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, fnkt))
scmCmdToExecute.Parameters.Add(New SqlParameter("@showit", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
sdaAdapter.Fill(dtToReturn)
i = scmCmdToExecute.Parameters.Item("@showit").Value
If i <> 0 Then
ShowMessage = True
Else
ShowMessage = False
End If
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Public Function show_standardmessage_ReplaceText(ByVal i As Integer, ByVal typ As MsgBoxStyle, ByVal Text1 As String, ByVal Text2 As String) As Integer
Dim s As String
s = Get_Meldungstext(i)
s = s.Replace("#1", Text1)
s = s.Replace("#2", Text2)
MsgBox(s, typ)
End Function
Public Sub New()
End Sub
Public Function show_bcmessage(ByVal dokumentid As String)
Dim s As String
s = Get_Meldungstext(88)
s = parstext(s, dokumentid)
MsgBox(s, MsgBoxStyle.Information)
End Function
Public Function parstext(ByVal s As String, ByVal dokumentid As String) As String
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Dim i As Integer
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.CommandText = "dbo.sp_get_archivinfo"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
sdaAdapter.Fill(dtToReturn)
s = s.Replace("&Archiv&", dtToReturn.Rows(0).Item("Archiv"))
s = s.Replace("&ArchivKZ&", dtToReturn.Rows(0).Item("ArchivKZ"))
Return s
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
End Class
End Namespace