667 lines
26 KiB
VB.net
667 lines
26 KiB
VB.net
Imports System.IO
|
|
Imports DevExpress.LookAndFeel
|
|
Imports DevExpress.Utils.Extensions
|
|
Imports DevExpress.XtraCharts
|
|
Imports DevExpress.XtraGrid
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
Imports DevExpress.XtraSplashScreen
|
|
Imports DigitalData.GUIs.Common
|
|
Imports DigitalData.Modules.Base
|
|
Imports DigitalData.Modules.Logging
|
|
Imports EnvelopeGenerator.Common
|
|
Imports EnvelopeGenerator.Common.My
|
|
Imports System.Diagnostics
|
|
Imports System.ComponentModel
|
|
Imports DevExpress.XtraPrinting
|
|
|
|
Public Class frmMain
|
|
Private ReadOnly LogConfig As LogConfig
|
|
Private ReadOnly Logger As Logger
|
|
Private TempFiles As TempFiles
|
|
Private GridBuilder As GridBuilder
|
|
Private RefreshHelper As RefreshHelper
|
|
|
|
Private State As State
|
|
Private Controller As EnvelopeListController
|
|
Private myFileData As Byte()
|
|
Private myResFileData As Byte()
|
|
|
|
Public Sub New(pState As State)
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
State = pState
|
|
LogConfig = pState.LogConfig
|
|
Logger = LogConfig.GetLogger()
|
|
End Sub
|
|
|
|
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Text = $"{State.DbConfig.ExternalProgramName} - {Resources.Envelope.Envelope_Overview}"
|
|
|
|
TempFiles = New TempFiles(LogConfig)
|
|
TempFiles.Create()
|
|
MyTempFiles = TempFiles
|
|
RefreshHelper = New RefreshHelper(ViewEnvelopes, "Id")
|
|
|
|
Controller = New EnvelopeListController(State)
|
|
|
|
Try
|
|
Me.LookAndFeel.UseDefaultLookAndFeel = False
|
|
LookAndFeel.SetSkinStyle(SkinStyle.Office2019White, SkinSvgPalette.DefaultSkin)
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
If MYUSER.IsAdmin Then
|
|
XtraTabControlMain.TabPages(2).PageVisible = True
|
|
Else
|
|
XtraTabControlMain.TabPages(2).PageVisible = False
|
|
End If
|
|
LoadEnvelopeData()
|
|
End Sub
|
|
|
|
Private Sub LoadEnvelopeData()
|
|
Try
|
|
RefreshHelper.SaveViewInfo()
|
|
If XtraTabControlMain.SelectedTabPageIndex = 0 Then
|
|
LoadEnvelopes()
|
|
ElseIf XtraTabControlMain.SelectedTabPageIndex = 1 Then
|
|
LoadCompletedEnvelopes()
|
|
End If
|
|
|
|
RefreshHelper.LoadViewInfo()
|
|
|
|
'LoadCharts()
|
|
txtRefreshLabel.Caption = String.Format(txtRefreshLabel.Tag, Now)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub LoadEnvelopes()
|
|
Try
|
|
GridBuilder = New GridBuilder(ViewEnvelopes)
|
|
GridBuilder.SetReadOnlyOptions(ViewEnvelopes)
|
|
|
|
GridBuilder.SetReadOnlyOptions(ViewHistory)
|
|
GridBuilder.SetDefaults(ViewHistory)
|
|
|
|
GridEnvelopes.DataSource = Controller.ListEnvelopes()
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub LoadCompletedEnvelopes()
|
|
Try
|
|
GridBuilder = New GridBuilder(ViewCompleted)
|
|
GridBuilder.SetReadOnlyOptions(ViewCompleted)
|
|
|
|
GridBuilder.SetReadOnlyOptions(ViewHistoryCompleted)
|
|
GridBuilder.SetDefaults(ViewHistoryCompleted)
|
|
|
|
GridCompleted.DataSource = Controller.ListCompleted()
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub LoadCharts()
|
|
Dim oChartControl As ChartControl = Controller.GetPieChart()
|
|
Me.SplitContainerControl1.Panel2.AddControl(oChartControl)
|
|
End Sub
|
|
|
|
Private Sub btnCreateEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateEnvelope.ItemClick
|
|
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
|
Try
|
|
Dim oForm As New frmEnvelopeEditor() With {.State = State}
|
|
oForm.ShowDialog()
|
|
LoadEnvelopeData()
|
|
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Finally
|
|
SplashScreenManager.CloseOverlayForm(oHandle)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnEditEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditEnvelope.ItemClick
|
|
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
|
|
If oSelectedRows.Count > 0 Then
|
|
LoadEnvelope(oSelectedRows.First)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub LoadEnvelope(pRowHandle As Integer)
|
|
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
|
Try
|
|
Dim oEnvelope As Envelope = DirectCast(ViewEnvelopes.GetRow(pRowHandle), Envelope)
|
|
|
|
If oEnvelope.IsAlreadySent Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oForm As New frmEnvelopeEditor() With {.State = State, .Envelope = oEnvelope}
|
|
oForm.ShowDialog()
|
|
LoadEnvelopeData()
|
|
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Finally
|
|
SplashScreenManager.CloseOverlayForm(oHandle)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub DeleteEnvelope(pRowHandle As Integer, pReason As String)
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(pRowHandle)
|
|
|
|
'If MsgBox(Resources.Envelope.Do_you_really_want_to_delete_this_envelope, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text) = MsgBoxResult.No Then
|
|
' Exit Sub
|
|
'End If
|
|
|
|
If Controller.DeleteEnvelope(oEnvelope, pReason) Then
|
|
LoadEnvelopeData()
|
|
Else
|
|
MsgBox(Resources.Envelope.The_envelope_could_not_be_deleted, MsgBoxStyle.Critical, Text)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ViewEnvelopes_DoubleClick(sender As Object, e As EventArgs) Handles ViewEnvelopes.DoubleClick
|
|
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
|
|
If oSelectedRows.Count > 0 Then
|
|
LoadEnvelope(oSelectedRows.First)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnDeleteEnvelope_ItemClick_1(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDeleteEnvelope.ItemClick
|
|
Try
|
|
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
|
|
If oSelectedRows.Count > 0 Then
|
|
Dim ofrmAbort As New frmRueckruf
|
|
frmRueckruf.ShowDialog()
|
|
If frmRueckruf.Continue_Reject = True Then
|
|
DeleteEnvelope(oSelectedRows.First, frmRueckruf.Reject_reason)
|
|
End If
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub frmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
|
|
' Cleanup Methods
|
|
TempFiles.CleanUp()
|
|
End Sub
|
|
|
|
Private Sub XtraTabControl1_SelectedPageChanged(sender As Object, e As DevExpress.XtraTab.TabPageChangedEventArgs) Handles XtraTabControlMain.SelectedPageChanged
|
|
RibbonPageGroupFunctions.Enabled = True
|
|
RibbonPageEnvelopeActions.Enabled = True
|
|
Select Case XtraTabControlMain.SelectedTabPageIndex
|
|
Case 1
|
|
btnEditEnvelope.Enabled = False
|
|
btnDeleteEnvelope.Enabled = False
|
|
btnContactReceiver.Enabled = False
|
|
btnShowDocument.Enabled = False
|
|
bbtnitmEB.Enabled = True
|
|
LoadEnvelopeData()
|
|
Case 0
|
|
btnEditEnvelope.Enabled = True
|
|
btnDeleteEnvelope.Enabled = True
|
|
btnContactReceiver.Enabled = True
|
|
btnShowDocument.Enabled = True
|
|
bbtnitmEB.Enabled = False
|
|
LoadEnvelopeData()
|
|
txtEnvelopeIdLabel.Caption = "No Envelope selected"
|
|
|
|
Case 2
|
|
RibbonPageGroupFunctions.Enabled = False
|
|
RibbonPageEnvelopeActions.Enabled = False
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
|
LoadEnvelopeData()
|
|
End Sub
|
|
|
|
Private Sub ViewEnvelopes_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles ViewEnvelopes.FocusedRowChanged
|
|
If ViewEnvelopes.FocusedRowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
|
|
|
|
txtEnvelopeIdLabel.Caption = String.Format(txtEnvelopeIdLabel.Tag, oEnvelope.Id)
|
|
|
|
If oEnvelope.IsAlreadySent Then
|
|
btnEditEnvelope.Enabled = False
|
|
Else
|
|
btnEditEnvelope.Enabled = True
|
|
End If
|
|
End Sub
|
|
Private Sub bbtnitmEB_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmEB.ItemClick
|
|
Try
|
|
If IsNothing(ViewEnvelopes.FocusedRowHandle) Then
|
|
bsitmInfo.Caption = "No row selected"
|
|
Exit Sub
|
|
End If
|
|
bsitmInfo.Caption = ""
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Dim oEnvelope As Envelope = ViewCompleted.GetRow(ViewCompleted.FocusedRowHandle)
|
|
GetResRepFileStreamByte(oEnvelope.Id)
|
|
Dim oTempFolder = TempFiles.TempPath
|
|
If Not Directory.Exists(oTempFolder) Then
|
|
Directory.CreateDirectory(oTempFolder)
|
|
End If
|
|
Dim oFilename = "ViewEnvResReport"
|
|
Dim oVersion As Integer = 0
|
|
Dim oTempFilename = String.Concat(oTempFolder, "\", $"{oFilename}_{oEnvelope.Id}.pdf")
|
|
Do While File.Exists(oTempFilename)
|
|
oVersion += 1
|
|
oTempFilename = String.Concat(oTempFolder, "\", $"{oFilename}_{oEnvelope.Id}_", oVersion.ToString, ".pdf")
|
|
Loop
|
|
downloadResFile(oTempFilename)
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Exclamation)
|
|
End Try
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
Private Sub ViewEnvelopes_CustomDrawCell(sender As Object, e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles ViewEnvelopes.CustomDrawCell
|
|
If e.RowHandle < 0 Or XtraTabControlMain.SelectedTabPageIndex = 1 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(e.RowHandle)
|
|
If oEnvelope.Status = Common.Constants.EnvelopeStatus.EnvelopePartlySigned Then
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.GREEN_300)
|
|
End If
|
|
|
|
If oEnvelope.Status = Common.Constants.EnvelopeStatus.EnvelopeQueued Or oEnvelope.Status = Common.Constants.EnvelopeStatus.EnvelopeSent Then
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.ORANGE_300)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ViewReceivers_CustomDrawCell(sender As Object, e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles ViewReceivers.CustomDrawCell
|
|
If e.RowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oView As GridView = DirectCast(sender, GridView)
|
|
Dim oReceiver As EnvelopeReceiver = oView.GetRow(e.RowHandle)
|
|
|
|
If (oReceiver Is Nothing) Then
|
|
Exit Sub
|
|
End If
|
|
|
|
If oReceiver.Status = Common.Constants.ReceiverStatus.Signed Then
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.GREEN_300)
|
|
Else
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.RED_300)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ViewCompleted_CustomDrawCell(sender As Object, e As Views.Base.RowCellCustomDrawEventArgs) Handles ViewCompleted.CustomDrawCell
|
|
If e.RowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oEnvelope As Envelope = ViewCompleted.GetRow(e.RowHandle)
|
|
If oEnvelope.Status = Common.Constants.EnvelopeStatus.EnvelopeCompletelySigned Then
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.GREEN_300)
|
|
End If
|
|
|
|
If oEnvelope.Status = Common.Constants.EnvelopeStatus.EnvelopeDeleted Then
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.RED_300)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ViewReceiversCompleted_CustomDrawCell(sender As Object, e As Views.Base.RowCellCustomDrawEventArgs) Handles ViewReceiversCompleted.CustomDrawCell
|
|
If e.RowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oView As GridView = DirectCast(sender, GridView)
|
|
Dim oReceiver As EnvelopeReceiver = oView.GetRow(e.RowHandle)
|
|
|
|
If (oReceiver Is Nothing) Then
|
|
Exit Sub
|
|
End If
|
|
|
|
If oReceiver.Status = Common.Constants.ReceiverStatus.Signed Then
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.GREEN_300)
|
|
Else
|
|
e.Appearance.BackColor = ColorTranslator.FromHtml(Common.Constants.RED_300)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RefreshTimer_Tick(sender As Object, e As EventArgs) Handles RefreshTimer.Tick
|
|
Try
|
|
|
|
If Application.OpenForms.OfType(Of frmEnvelopeEditor).Any = False Then
|
|
LoadEnvelopeData()
|
|
End If
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnContactReceiver_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnContactReceiver.ItemClick
|
|
If ViewEnvelopes.FocusedRowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
|
|
Dim oView As GridView = GridEnvelopes.FocusedView
|
|
If oView.Name = ViewReceivers.Name Then
|
|
Dim oReceiver As EnvelopeReceiver = oView.GetRow(oView.FocusedRowHandle)
|
|
Dim oEnvelopeTitle As String = Net.WebUtility.UrlEncode(oEnvelope.Title)
|
|
Process.Start($"mailto:{oReceiver.Email}?subject={oEnvelopeTitle}")
|
|
Else
|
|
MsgBox(Resources.Envelope.Please_select_a_recipient_from_the_Recipients_tab, MsgBoxStyle.Information, Text)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnShowDocument_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnShowDocument.ItemClick
|
|
Try
|
|
If ViewEnvelopes.FocusedRowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
|
|
Dim oDocument = oEnvelope.Documents.FirstOrDefault()
|
|
If oDocument Is Nothing Then
|
|
MsgBox(Resources.Envelope.The_envelope_does_not_contain_any_documents, MsgBoxStyle.Exclamation, Text)
|
|
Me.Cursor = Cursors.Default
|
|
Exit Sub
|
|
Else
|
|
If Not IsNothing(oDocument.Byte_Data) Then
|
|
Dim oTempFolder = TempFiles.TempPath
|
|
Dim oTempFilename = String.Concat(oTempFolder, "\", $"ViewEnvDoc_{oEnvelope.Id}.pdf")
|
|
If File.Exists(oTempFilename) Then
|
|
Try
|
|
File.OpenWrite(oTempFilename)
|
|
Catch ex As Exception
|
|
MsgBox("File might already be open?", MsgBoxStyle.Exclamation)
|
|
Me.Cursor = Cursors.Default
|
|
Exit Sub
|
|
End Try
|
|
|
|
|
|
File.Delete(oTempFilename)
|
|
End If
|
|
downloadFile(oTempFilename, oDocument.Byte_Data)
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(Resources.Envelope.Document_could_not_be_opened, MsgBoxStyle.Critical, Text)
|
|
Logger.Error(ex)
|
|
End Try
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
Private Sub GetResRepFileStreamByte(ByVal pEnvID As Long)
|
|
|
|
Dim strSql As String
|
|
'For Document
|
|
Try
|
|
'Get image data from gridview column.
|
|
strSql = "Select [DOC_RESULT] from [TBSIG_ENVELOPE] WHERE GUID = " & pEnvID
|
|
Dim obyteDB = DB_DD_ECM.GetScalarValue(strSql)
|
|
If Not IsDBNull(obyteDB) Then
|
|
'Get image data from DB
|
|
Dim fileData As Byte() = DirectCast(DB_DD_ECM.GetScalarValue(strSql), Byte())
|
|
If Not fileData Is Nothing Then
|
|
myResFileData = fileData
|
|
Else
|
|
bsitmInfo.Caption = "FileStream 1 is nothing - check data!"
|
|
myResFileData = Nothing
|
|
End If
|
|
Else
|
|
myResFileData = Nothing
|
|
bsitmInfo.Caption = "FileStream 2 is nothing - check data!"
|
|
End If
|
|
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in GetResRepFileStreamByte")
|
|
myResFileData = Nothing
|
|
End Try
|
|
|
|
End Sub
|
|
Private Sub downloadFile(ByVal sFileName As String, pByte As Byte())
|
|
|
|
'For Document
|
|
Try
|
|
If Not pByte Is Nothing Then
|
|
'Read image data into a file stream
|
|
Using fs As New FileStream(sFileName, FileMode.OpenOrCreate, FileAccess.Write)
|
|
fs.Write(pByte, 0, pByte.Length)
|
|
'Set image variable value using memory stream.
|
|
fs.Flush()
|
|
fs.Close()
|
|
End Using
|
|
'Open File
|
|
Process.Start(sFileName)
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in downloadFile")
|
|
End Try
|
|
End Sub
|
|
Private Sub downloadResFile(ByVal sFileName As String)
|
|
Try
|
|
If Not myResFileData Is Nothing Then
|
|
Logger.Debug("working myResFileData in downloadResFile")
|
|
'Read image data into a file stream
|
|
Using fs As New FileStream(sFileName, FileMode.OpenOrCreate, FileAccess.Write)
|
|
fs.Write(myResFileData, 0, myResFileData.Length)
|
|
'Set image variable value using memory stream.
|
|
fs.Flush()
|
|
fs.Close()
|
|
End Using
|
|
Logger.Debug($"Trying to open {sFileName}...")
|
|
'Open File
|
|
Process.Start(sFileName)
|
|
Else
|
|
MsgBox("Could not get DocData from Database!", MsgBoxStyle.Exclamation, "Error in downloadResFile")
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in downloadResFile")
|
|
End Try
|
|
End Sub
|
|
Private Sub ViewCompleted_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles ViewCompleted.FocusedRowChanged
|
|
If ViewCompleted.FocusedRowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oEnvelope As Envelope = ViewCompleted.GetRow(ViewCompleted.FocusedRowHandle)
|
|
If oEnvelope.Status = Common.Constants.EnvelopeStatus.EnvelopeArchived Then
|
|
bbtnitmEB.Enabled = True
|
|
Else
|
|
bbtnitmEB.Enabled = False
|
|
End If
|
|
txtEnvelopeIdLabel.Caption = String.Format(txtEnvelopeIdLabel.Tag, oEnvelope.Id)
|
|
End Sub
|
|
|
|
Private Sub btnOpenLogDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenLogDirectory.ItemClick
|
|
Try
|
|
Process.Start(LogConfig.LogDirectory)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub BarCheckItem1_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarCheckItem1.CheckedChanged
|
|
If BarCheckItem1.Checked = True Then
|
|
If CurrLogConfig.Debug = False Then
|
|
CurrLogConfig.Debug = True
|
|
bsitmInfo.Caption = "DEBUG-Log is active"
|
|
bsitmInfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
|
End If
|
|
Else
|
|
CurrLogConfig.Debug = False
|
|
bsitmInfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
|
|
If CurrLogConfig.Debug Then
|
|
BarCheckItem1.Checked = True
|
|
Else
|
|
BarCheckItem1.Checked = False
|
|
End If
|
|
bbtnitmEB.Enabled = False
|
|
RefreshTimer.Start()
|
|
End Sub
|
|
|
|
Private Sub bbtnitmInfoMail_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmInfoMail.ItemClick
|
|
If ViewEnvelopes.FocusedRowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
Try
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
|
|
Dim oView As GridView = GridEnvelopes.FocusedView
|
|
If oView.Name = ViewReceivers.Name Then
|
|
Dim oReceiver As EnvelopeReceiver = oView.GetRow(oView.FocusedRowHandle)
|
|
Dim oEnvelopeTitle As String = Net.WebUtility.UrlEncode(oEnvelope.Title)
|
|
Dim oCode = oReceiver.AccessCode
|
|
Dim oUID = oEnvelope.Uuid
|
|
|
|
' E-Mail-Details konfigurieren
|
|
Dim mailto As String = "support-flow@digitaldata.works"
|
|
Dim subject As String = "signFLOW - Envelope issue"
|
|
Dim body As String = $"<html><body>Dear Digital Data Team, <br> There is an error or misbehavin with following envelope and Receiver: <p> Envelope: <b>{oUID}</b> <br> Receiver: <b>{oReceiver.Email}</b>
|
|
<p>Issue/Description: Please describe the issue in Your own words...</p></body></html>"
|
|
|
|
' URL-encoding für Betreff und Inhalt der E-Mail
|
|
'Dim encodedSubject As String = Uri.EscapeDataString(subject)
|
|
'Dim encodedBody As String = Uri.EscapeDataString(body)
|
|
|
|
' mailto-Link erstellen
|
|
Dim mailtoLink As String = $"{mailto}?subject={subject}&body={body}"
|
|
Try
|
|
Process.Start(mailtoLink)
|
|
Catch ex1 As Exception
|
|
MsgBox(ex1.Message, MsgBoxStyle.Critical, Text)
|
|
End Try
|
|
' E-Mail-Client öffnen
|
|
|
|
|
|
Process.Start($"mailto:{oReceiver.Email}?subject={oEnvelopeTitle}")
|
|
Else
|
|
MsgBox(Resources.Envelope.Please_select_a_recipient_from_the_Recipients_tab, MsgBoxStyle.Information, Text)
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
|
Dim oView As GridView = GridEnvelopes.FocusedView
|
|
Dim selReceiver As EnvelopeReceiver
|
|
If oView.Name = ViewReceivers.Name Then
|
|
selReceiver = oView.GetRow(oView.FocusedRowHandle)
|
|
Else
|
|
MsgBox(Resources.Envelope.Please_select_a_recipient_from_the_Recipients_tab, MsgBoxStyle.Information, Text)
|
|
End If
|
|
If ViewEnvelopes.FocusedRowHandle < 0 Or IsNothing(selReceiver) Then
|
|
Exit Sub
|
|
End If
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
|
|
|
|
Dim oController = New EnvelopeEditorController(State, oEnvelope)
|
|
Dim Documents As New BindingList(Of EnvelopeDocument)
|
|
Dim Receivers As New BindingList(Of EnvelopeReceiver)
|
|
Receivers = New BindingList(Of EnvelopeReceiver)(oController.Envelope.Receivers)
|
|
For Each oReceiver As EnvelopeReceiver In Receivers
|
|
If oReceiver.Email = selReceiver.Email Then
|
|
If oController.ActionService.ResendReceiver(oEnvelope, oReceiver) = True Then
|
|
Dim oMsg = Resources.Envelope.Invitation_successfully_resend.Replace("@Mail", oReceiver.Email)
|
|
MsgBox(oMsg, MsgBoxStyle.Information, Text)
|
|
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub ViewEnvelopes_Click(sender As Object, e As EventArgs) Handles ViewEnvelopes.Click
|
|
If ViewEnvelopes.FocusedRowHandle < 0 Then
|
|
Exit Sub
|
|
End If
|
|
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
|
|
|
|
txtEnvelopeIdLabel.Caption = String.Format(txtEnvelopeIdLabel.Tag, oEnvelope.Id)
|
|
|
|
End Sub
|
|
|
|
Private Sub btnEnvelopes_thismonth_Click(sender As Object, e As EventArgs) Handles btnEnvelopes_thismonth.Click
|
|
If SQL_REP_ENV_USER_TM <> String.Empty Then
|
|
Result_Execute(SQL_REP_ENV_USER_TM)
|
|
Else
|
|
GridControlData.DataSource = Nothing
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnEnvelopes_lastmonth_Click(sender As Object, e As EventArgs) Handles btnEnvelopes_lastmonth.Click
|
|
If SQL_REP_ENV_USER_LM <> String.Empty Then
|
|
Result_Execute(SQL_REP_ENV_USER_LM)
|
|
Else
|
|
GridControlData.DataSource = Nothing
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnEnvelopes_thisYear_Click(sender As Object, e As EventArgs) Handles btnEnvelopes_thisYear.Click
|
|
If SQL_REP_ENV_USER_Y <> String.Empty Then
|
|
Result_Execute(SQL_REP_ENV_USER_Y)
|
|
Else
|
|
GridControlData.DataSource = Nothing
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnEnvelopes_All_Click(sender As Object, e As EventArgs) Handles btnEnvelopes_All.Click
|
|
If SQL_REP_ENV_USER_ALL <> String.Empty Then
|
|
Result_Execute(SQL_REP_ENV_USER_ALL)
|
|
Else
|
|
GridControlData.DataSource = Nothing
|
|
End If
|
|
End Sub
|
|
Private Sub Result_Execute(mySQL As String)
|
|
Try
|
|
Dim oDT As DataTable = DB_DD_ECM.GetDatatable(mySQL)
|
|
If Not IsNothing(oDT) Then
|
|
|
|
GridControlData.DataSource = oDT
|
|
Else
|
|
GridControlData.DataSource = Nothing
|
|
End If
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub LabelControl1_Click(sender As Object, e As EventArgs) Handles LabelControl1.Click
|
|
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
|
|
XtraSaveFileDialog1.FileName = "Overview.xlsx"
|
|
XtraSaveFileDialog1.DefaultExt = ".xlsx"
|
|
|
|
If XtraSaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
|
Dim oOptions As New XlsxExportOptions() With {
|
|
.ExportMode = XlsxExportMode.SingleFile
|
|
}
|
|
If XtraTabControlMain.SelectedTabPageIndex = 0 Then
|
|
GridEnvelopes.ExportToXlsx(XtraSaveFileDialog1.FileName, oOptions)
|
|
ElseIf XtraTabControlMain.SelectedTabPageIndex = 1 Then
|
|
GridCompleted.ExportToXlsx(XtraSaveFileDialog1.FileName, oOptions)
|
|
ElseIf XtraTabControlMain.SelectedTabPageIndex = 2 Then
|
|
GridControlData.ExportToXlsx(XtraSaveFileDialog1.FileName, oOptions)
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
End Class |