Merge branch 'master' of http://git.dd:3000/AppStd/EnvelopeGenerator
This commit is contained in:
commit
ff5536d3ea
@ -109,10 +109,10 @@ Public Class EnvelopeModel
|
|||||||
oCommand.Parameters.Add("SUBJECT", SqlDbType.NVarChar).Value = String.Empty
|
oCommand.Parameters.Add("SUBJECT", SqlDbType.NVarChar).Value = String.Empty
|
||||||
oCommand.Parameters.Add("MESSAGE", SqlDbType.NVarChar).Value = String.Empty
|
oCommand.Parameters.Add("MESSAGE", SqlDbType.NVarChar).Value = String.Empty
|
||||||
oCommand.Parameters.Add("UUID", SqlDbType.NVarChar).Value = pEnvelope.Uuid
|
oCommand.Parameters.Add("UUID", SqlDbType.NVarChar).Value = pEnvelope.Uuid
|
||||||
oCommand.Parameters.Add("STATUS", SqlDbType.NVarChar).Value = Constants.EnvelopeStatus.Created
|
oCommand.Parameters.Add("STATUS", SqlDbType.NVarChar).Value = Constants.EnvelopeStatus.Created.ToString()
|
||||||
oCommand.Parameters.Add("USER_ID", SqlDbType.Int).Value = pEnvelope.UserId
|
oCommand.Parameters.Add("USER_ID", SqlDbType.Int).Value = pEnvelope.UserId
|
||||||
oCommand.Parameters.Add("TITLE", SqlDbType.NVarChar).Value = pEnvelope.Title
|
oCommand.Parameters.Add("TITLE", SqlDbType.NVarChar).Value = pEnvelope.Title
|
||||||
oCommand.Parameters.Add("CONTRACT_TYPE", SqlDbType.NVarChar).Value = Constants.ContractType.Contract ' TODO - Contract Type
|
oCommand.Parameters.Add("CONTRACT_TYPE", SqlDbType.NVarChar).Value = pEnvelope.ContractType.ToString()
|
||||||
|
|
||||||
If Database.ExecuteNonQuery(oCommand) Then
|
If Database.ExecuteNonQuery(oCommand) Then
|
||||||
pEnvelope.Id = GetEnvelopeId(pEnvelope)
|
pEnvelope.Id = GetEnvelopeId(pEnvelope)
|
||||||
@ -135,6 +135,7 @@ Public Class EnvelopeModel
|
|||||||
oSql += " [MESSAGE] = @MESSAGE, "
|
oSql += " [MESSAGE] = @MESSAGE, "
|
||||||
oSql += " [STATUS] = @STATUS, "
|
oSql += " [STATUS] = @STATUS, "
|
||||||
oSql += " [TITLE] = @TITLE, "
|
oSql += " [TITLE] = @TITLE, "
|
||||||
|
oSql += " [CONTRACT_TYPE] = @CONTRACT_TYPE, "
|
||||||
oSql += " [CHANGED_WHEN] = GETDATE() "
|
oSql += " [CHANGED_WHEN] = GETDATE() "
|
||||||
oSql += " WHERE GUID = @ID AND USER_ID = @USER_ID"
|
oSql += " WHERE GUID = @ID AND USER_ID = @USER_ID"
|
||||||
Dim oCommand As New SqlCommand(oSql)
|
Dim oCommand As New SqlCommand(oSql)
|
||||||
@ -142,6 +143,7 @@ Public Class EnvelopeModel
|
|||||||
oCommand.Parameters.Add("MESSAGE", SqlDbType.NVarChar).Value = pEnvelope.Message
|
oCommand.Parameters.Add("MESSAGE", SqlDbType.NVarChar).Value = pEnvelope.Message
|
||||||
oCommand.Parameters.Add("STATUS", SqlDbType.NVarChar).Value = pEnvelope.Status
|
oCommand.Parameters.Add("STATUS", SqlDbType.NVarChar).Value = pEnvelope.Status
|
||||||
oCommand.Parameters.Add("TITLE", SqlDbType.NVarChar).Value = pEnvelope.Title
|
oCommand.Parameters.Add("TITLE", SqlDbType.NVarChar).Value = pEnvelope.Title
|
||||||
|
oCommand.Parameters.Add("CONTRACT_TYPE", SqlDbType.NVarChar).Value = pEnvelope.ContractType.ToString()
|
||||||
|
|
||||||
oCommand.Parameters.Add("ID", SqlDbType.Int).Value = pEnvelope.Id
|
oCommand.Parameters.Add("ID", SqlDbType.Int).Value = pEnvelope.Id
|
||||||
oCommand.Parameters.Add("USER_ID", SqlDbType.Int).Value = pEnvelope.UserId
|
oCommand.Parameters.Add("USER_ID", SqlDbType.Int).Value = pEnvelope.UserId
|
||||||
|
|||||||
@ -19,15 +19,15 @@ Public Class HistoryModel
|
|||||||
oSql += " (@ENVELOPE_ID "
|
oSql += " (@ENVELOPE_ID "
|
||||||
oSql += " ,@USER_REFERENCE "
|
oSql += " ,@USER_REFERENCE "
|
||||||
oSql += " ,@ACTION_TYPE "
|
oSql += " ,@ACTION_TYPE "
|
||||||
oSql += " ,@ACTION_DESCRIPTION) "
|
oSql += " ,@ACTION_DESCRIPTION "
|
||||||
oSql += " ,@ACTION_DATE) "
|
oSql += " ,@ACTION_DATE) "
|
||||||
|
|
||||||
Dim oCommand As New SqlCommand(oSql)
|
Dim oCommand As New SqlCommand(oSql)
|
||||||
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pHistory.EnvelopeId
|
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pHistory.EnvelopeId
|
||||||
oCommand.Parameters.Add("USER_REFERENCE", SqlDbType.NVarChar).Value = pHistory.UserReference
|
oCommand.Parameters.Add("USER_REFERENCE", SqlDbType.NVarChar).Value = pHistory.UserReference
|
||||||
oCommand.Parameters.Add("ACTION_TYPE", SqlDbType.NVarChar).Value = pHistory
|
oCommand.Parameters.Add("ACTION_TYPE", SqlDbType.NVarChar).Value = pHistory.ActionType.ToString()
|
||||||
oCommand.Parameters.Add("ACTION_DESCRIPTION", SqlDbType.NVarChar).Value = pHistory.ActionDescription
|
oCommand.Parameters.Add("ACTION_DESCRIPTION", SqlDbType.NVarChar).Value = pHistory.ActionDescription
|
||||||
oCommand.Parameters.Add("ACTION_DATE", SqlDbType.DateTime).Value = pHistory
|
oCommand.Parameters.Add("ACTION_DATE", SqlDbType.DateTime).Value = Now()
|
||||||
|
|
||||||
If Database.ExecuteNonQuery(oCommand) Then
|
If Database.ExecuteNonQuery(oCommand) Then
|
||||||
Return True
|
Return True
|
||||||
|
|||||||
@ -132,6 +132,9 @@
|
|||||||
<data name="Elements could not be saved" xml:space="preserve">
|
<data name="Elements could not be saved" xml:space="preserve">
|
||||||
<value>Elements could not be saved!</value>
|
<value>Elements could not be saved!</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Envelope already sent" xml:space="preserve">
|
||||||
|
<value>The envelope has already been sent!</value>
|
||||||
|
</data>
|
||||||
<data name="Envelope could not be sent" xml:space="preserve">
|
<data name="Envelope could not be sent" xml:space="preserve">
|
||||||
<value>Envelope could not be sent!</value>
|
<value>Envelope could not be sent!</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@ -132,6 +132,9 @@
|
|||||||
<data name="Elements could not be saved" xml:space="preserve">
|
<data name="Elements could not be saved" xml:space="preserve">
|
||||||
<value>Elemente konnten nicht gespeichert werden!</value>
|
<value>Elemente konnten nicht gespeichert werden!</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Envelope already sent" xml:space="preserve">
|
||||||
|
<value>Der Umschlag wurde bereits versendet!</value>
|
||||||
|
</data>
|
||||||
<data name="Envelope could not be sent" xml:space="preserve">
|
<data name="Envelope could not be sent" xml:space="preserve">
|
||||||
<value>Umschlag konnte nicht gesendet werden!</value>
|
<value>Umschlag konnte nicht gesendet werden!</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@ -109,6 +109,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Sucht eine lokalisierte Zeichenfolge, die Der Umschlag wurde bereits versendet! ähnelt.
|
||||||
|
'''</summary>
|
||||||
|
Public Shared ReadOnly Property Envelope_already_sent() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("Envelope already sent", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Sucht eine lokalisierte Zeichenfolge, die Umschlag konnte nicht gesendet werden! ähnelt.
|
''' Sucht eine lokalisierte Zeichenfolge, die Umschlag konnte nicht gesendet werden! ähnelt.
|
||||||
'''</summary>
|
'''</summary>
|
||||||
|
|||||||
@ -31,11 +31,9 @@ Public Class EnvelopeEditorController
|
|||||||
|
|
||||||
#Region "Public"
|
#Region "Public"
|
||||||
Public Function SendEnvelope() As Boolean
|
Public Function SendEnvelope() As Boolean
|
||||||
Dim oResult As Boolean = True
|
|
||||||
|
|
||||||
For Each receiverItem As EnvelopeReceiver In Envelope.Receivers
|
For Each receiverItem As EnvelopeReceiver In Envelope.Receivers
|
||||||
|
|
||||||
Dim oEmailData As EmailData = New EmailData With
|
Dim oEmailData As New EmailData With
|
||||||
{
|
{
|
||||||
.EmailAdress = receiverItem.Email,
|
.EmailAdress = receiverItem.Email,
|
||||||
.EmailSubject = Envelope.Subject,
|
.EmailSubject = Envelope.Subject,
|
||||||
@ -48,12 +46,12 @@ Public Class EnvelopeEditorController
|
|||||||
.SignatureLink = Helpers.GetEnvelopeURL(State.DbConfig.SignatureHost, Envelope.Uuid, receiverItem.Signature)
|
.SignatureLink = Helpers.GetEnvelopeURL(State.DbConfig.SignatureHost, Envelope.Uuid, receiverItem.Signature)
|
||||||
}
|
}
|
||||||
|
|
||||||
Dim oTemplate As EmailTemplate = New EmailTemplate(State)
|
Dim oTemplate As New EmailTemplate(State)
|
||||||
oTemplate.FillEmailBody(oEmailData)
|
oTemplate.FillEmailBody(oEmailData)
|
||||||
|
|
||||||
If EmailModel.Insert(oEmailData) = False Then
|
If EmailModel.Insert(oEmailData) = False Then
|
||||||
Logger.Error("EMail data could not be inserted.")
|
Logger.Error("EMail data could not be inserted.")
|
||||||
oResult = False
|
Dim oResult As Boolean = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
@ -97,12 +95,13 @@ Public Class EnvelopeEditorController
|
|||||||
|
|
||||||
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
|
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
|
||||||
.EnvelopeId = oEnvelope.Id,
|
.EnvelopeId = oEnvelope.Id,
|
||||||
.Status = HistoryStatus.Created,
|
.ActionType = EnvelopeHistoryActionType.Created,
|
||||||
.ActionTitle = "Envelope erstellt",
|
|
||||||
.ActionDescription = "Envelope wurde neu erstellt",
|
.ActionDescription = "Envelope wurde neu erstellt",
|
||||||
.UserEmailAddress = oEnvelope.User.Email
|
.UserReference = oEnvelope.User.Email
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HistoryModel.Insert(newHistoryEntry)
|
||||||
|
|
||||||
Return oEnvelope
|
Return oEnvelope
|
||||||
Else
|
Else
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@ -159,7 +158,7 @@ Public Class EnvelopeEditorController
|
|||||||
Public Function CreateDocument(pDocumentFilePath As String) As EnvelopeDocument
|
Public Function CreateDocument(pDocumentFilePath As String) As EnvelopeDocument
|
||||||
Try
|
Try
|
||||||
Dim oFileInfo = New FileInfo(pDocumentFilePath)
|
Dim oFileInfo = New FileInfo(pDocumentFilePath)
|
||||||
Dim oTempFiles As TempFiles = New TempFiles(State.LogConfig)
|
Dim oTempFiles As New TempFiles(State.LogConfig)
|
||||||
Dim oTempFilePath = Path.Combine(oTempFiles.TempPath, Guid.NewGuid().ToString + oFileInfo.Extension)
|
Dim oTempFilePath = Path.Combine(oTempFiles.TempPath, Guid.NewGuid().ToString + oFileInfo.Extension)
|
||||||
File.Copy(oFileInfo.FullName, oTempFilePath, True)
|
File.Copy(oFileInfo.FullName, oTempFilePath, True)
|
||||||
|
|
||||||
@ -273,6 +272,14 @@ Public Class EnvelopeEditorController
|
|||||||
oReceiver.Id = 0
|
oReceiver.Id = 0
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
For Each oCurrentReceiver In pCurrentReceivers
|
||||||
|
If oCurrentReceiver.Id = 0 Then
|
||||||
|
Dim oExistingReceiver As EnvelopeReceiver = oExistingReceivers.Where(Function(r) r.Email = oCurrentReceiver.Email).First()
|
||||||
|
oCurrentReceiver.Id = oExistingReceiver.Id
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
Dim oConnection = Database.GetConnection()
|
Dim oConnection = Database.GetConnection()
|
||||||
Dim oTransaction = oConnection.BeginTransaction()
|
Dim oTransaction = oConnection.BeginTransaction()
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
Imports System.ComponentModel
|
Imports System.ComponentModel
|
||||||
|
Imports DevExpress.XtraEditors
|
||||||
Imports DevExpress.XtraGrid
|
Imports DevExpress.XtraGrid
|
||||||
Imports DevExpress.XtraGrid.Views.Grid
|
Imports DevExpress.XtraGrid.Views.Grid
|
||||||
Imports DevExpress.XtraSplashScreen
|
Imports DevExpress.XtraSplashScreen
|
||||||
@ -98,9 +99,7 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
|
|
||||||
Private Sub btnSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick
|
Private Sub btnSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick
|
||||||
Try
|
Try
|
||||||
If SaveEnvelope() Then
|
SaveEnvelopeWithOutValidation()
|
||||||
|
|
||||||
End If
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
@ -114,7 +113,7 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
|
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
|
||||||
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
|
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
|
||||||
|
|
||||||
If SaveEnvelope() Then
|
If SaveEnvelopeWithOutValidation() Then
|
||||||
Dim oForm As New frmFieldEditor() With {
|
Dim oForm As New frmFieldEditor() With {
|
||||||
.Document = Controller.Envelope.Documents.
|
.Document = Controller.Envelope.Documents.
|
||||||
Where(Function(d) d.Filename = oDocument.Filename).
|
Where(Function(d) d.Filename = oDocument.Filename).
|
||||||
@ -133,9 +132,17 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function SaveEnvelope() As Boolean
|
Private Function SaveEnvelopeWithValidation() As Boolean
|
||||||
Dim oSubject = txtSubject.EditValue?.ToString
|
Return SaveEnvelope(True)
|
||||||
Dim oMessage = txtMessage.EditValue?.ToString
|
End Function
|
||||||
|
|
||||||
|
Private Function SaveEnvelopeWithOutValidation() As Boolean
|
||||||
|
Return SaveEnvelope(False)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function SaveEnvelope(pWithValidation As Boolean) As Boolean
|
||||||
|
Dim oSubject = GetEditValueFromTextControl(txtSubject)
|
||||||
|
Dim oMessage = GetEditValueFromTextControl(txtMessage)
|
||||||
|
|
||||||
' Ensure all receivers are saved
|
' Ensure all receivers are saved
|
||||||
ViewReceivers.CloseEditor()
|
ViewReceivers.CloseEditor()
|
||||||
@ -146,11 +153,13 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
oEnvelope.Receivers = Receivers.ToList
|
oEnvelope.Receivers = Receivers.ToList
|
||||||
oEnvelope.Documents = Documents.ToList
|
oEnvelope.Documents = Documents.ToList
|
||||||
|
|
||||||
|
If pWithValidation = True Then
|
||||||
Dim oErrors = oEnvelope.Validate()
|
Dim oErrors = oEnvelope.Validate()
|
||||||
If oErrors.Any Then
|
If oErrors.Any Then
|
||||||
ShowValidationErrors(Resources.Envelope.Errors_when_saving_the_envelope, oErrors)
|
ShowValidationErrors(Resources.Envelope.Errors_when_saving_the_envelope, oErrors)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If Controller.CreateEnvelopeReceivers(oEnvelope.Receivers) = False Then
|
If Controller.CreateEnvelopeReceivers(oEnvelope.Receivers) = False Then
|
||||||
MsgBox(Resources.Envelope.Error_when_saving_the_recipients, MsgBoxStyle.Critical, Text)
|
MsgBox(Resources.Envelope.Error_when_saving_the_recipients, MsgBoxStyle.Critical, Text)
|
||||||
@ -165,6 +174,14 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
End If
|
End If
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function GetEditValueFromTextControl(pControl As TextEdit) As String
|
||||||
|
If pControl.EditValue Is Nothing Then
|
||||||
|
Return String.Empty
|
||||||
|
Else
|
||||||
|
Return pControl.EditValue.ToString
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Sub ShowValidationErrors(pErrorTitle As String, pErrors As List(Of String))
|
Private Sub ShowValidationErrors(pErrorTitle As String, pErrors As List(Of String))
|
||||||
Dim oError = pErrorTitle & vbNewLine & vbNewLine & String.Join(vbNewLine, pErrors)
|
Dim oError = pErrorTitle & vbNewLine & vbNewLine & String.Join(vbNewLine, pErrors)
|
||||||
MsgBox(oError, MsgBoxStyle.Exclamation, Text)
|
MsgBox(oError, MsgBoxStyle.Exclamation, Text)
|
||||||
@ -199,7 +216,12 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSendEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSendEnvelope.ItemClick
|
Private Sub btnSendEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSendEnvelope.ItemClick
|
||||||
If SaveEnvelope() = False Then
|
If Controller.Envelope.Status = Constants.EnvelopeStatus.Sent Then
|
||||||
|
MsgBox(Resources.Envelope.Envelope_already_sent, MsgBoxStyle.Information, Text)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If SaveEnvelopeWithValidation() = False Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user