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("MESSAGE", SqlDbType.NVarChar).Value = String.Empty
|
||||
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("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
|
||||
pEnvelope.Id = GetEnvelopeId(pEnvelope)
|
||||
@ -135,6 +135,7 @@ Public Class EnvelopeModel
|
||||
oSql += " [MESSAGE] = @MESSAGE, "
|
||||
oSql += " [STATUS] = @STATUS, "
|
||||
oSql += " [TITLE] = @TITLE, "
|
||||
oSql += " [CONTRACT_TYPE] = @CONTRACT_TYPE, "
|
||||
oSql += " [CHANGED_WHEN] = GETDATE() "
|
||||
oSql += " WHERE GUID = @ID AND USER_ID = @USER_ID"
|
||||
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("STATUS", SqlDbType.NVarChar).Value = pEnvelope.Status
|
||||
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("USER_ID", SqlDbType.Int).Value = pEnvelope.UserId
|
||||
|
||||
@ -19,15 +19,15 @@ Public Class HistoryModel
|
||||
oSql += " (@ENVELOPE_ID "
|
||||
oSql += " ,@USER_REFERENCE "
|
||||
oSql += " ,@ACTION_TYPE "
|
||||
oSql += " ,@ACTION_DESCRIPTION) "
|
||||
oSql += " ,@ACTION_DESCRIPTION "
|
||||
oSql += " ,@ACTION_DATE) "
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pHistory.EnvelopeId
|
||||
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_DATE", SqlDbType.DateTime).Value = pHistory
|
||||
oCommand.Parameters.Add("ACTION_DATE", SqlDbType.DateTime).Value = Now()
|
||||
|
||||
If Database.ExecuteNonQuery(oCommand) Then
|
||||
Return True
|
||||
|
||||
@ -132,6 +132,9 @@
|
||||
<data name="Elements could not be saved" xml:space="preserve">
|
||||
<value>Elements could not be saved!</value>
|
||||
</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">
|
||||
<value>Envelope could not be sent!</value>
|
||||
</data>
|
||||
|
||||
@ -132,6 +132,9 @@
|
||||
<data name="Elements could not be saved" xml:space="preserve">
|
||||
<value>Elemente konnten nicht gespeichert werden!</value>
|
||||
</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">
|
||||
<value>Umschlag konnte nicht gesendet werden!</value>
|
||||
</data>
|
||||
|
||||
@ -109,6 +109,15 @@ Namespace My.Resources
|
||||
End Get
|
||||
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>
|
||||
''' Sucht eine lokalisierte Zeichenfolge, die Umschlag konnte nicht gesendet werden! ähnelt.
|
||||
'''</summary>
|
||||
|
||||
@ -31,11 +31,9 @@ Public Class EnvelopeEditorController
|
||||
|
||||
#Region "Public"
|
||||
Public Function SendEnvelope() As Boolean
|
||||
Dim oResult As Boolean = True
|
||||
|
||||
For Each receiverItem As EnvelopeReceiver In Envelope.Receivers
|
||||
|
||||
Dim oEmailData As EmailData = New EmailData With
|
||||
Dim oEmailData As New EmailData With
|
||||
{
|
||||
.EmailAdress = receiverItem.Email,
|
||||
.EmailSubject = Envelope.Subject,
|
||||
@ -48,12 +46,12 @@ Public Class EnvelopeEditorController
|
||||
.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)
|
||||
|
||||
If EmailModel.Insert(oEmailData) = False Then
|
||||
Logger.Error("EMail data could not be inserted.")
|
||||
oResult = False
|
||||
Dim oResult As Boolean = False
|
||||
End If
|
||||
|
||||
Next
|
||||
@ -97,12 +95,13 @@ Public Class EnvelopeEditorController
|
||||
|
||||
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
|
||||
.EnvelopeId = oEnvelope.Id,
|
||||
.Status = HistoryStatus.Created,
|
||||
.ActionTitle = "Envelope erstellt",
|
||||
.ActionType = EnvelopeHistoryActionType.Created,
|
||||
.ActionDescription = "Envelope wurde neu erstellt",
|
||||
.UserEmailAddress = oEnvelope.User.Email
|
||||
.UserReference = oEnvelope.User.Email
|
||||
}
|
||||
|
||||
HistoryModel.Insert(newHistoryEntry)
|
||||
|
||||
Return oEnvelope
|
||||
Else
|
||||
Return Nothing
|
||||
@ -159,7 +158,7 @@ Public Class EnvelopeEditorController
|
||||
Public Function CreateDocument(pDocumentFilePath As String) As EnvelopeDocument
|
||||
Try
|
||||
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)
|
||||
File.Copy(oFileInfo.FullName, oTempFilePath, True)
|
||||
|
||||
@ -273,6 +272,14 @@ Public Class EnvelopeEditorController
|
||||
oReceiver.Id = 0
|
||||
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 oTransaction = oConnection.BeginTransaction()
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
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
|
||||
Try
|
||||
If SaveEnvelope() Then
|
||||
|
||||
End If
|
||||
SaveEnvelopeWithOutValidation()
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
@ -114,7 +113,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
|
||||
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
|
||||
|
||||
If SaveEnvelope() Then
|
||||
If SaveEnvelopeWithOutValidation() Then
|
||||
Dim oForm As New frmFieldEditor() With {
|
||||
.Document = Controller.Envelope.Documents.
|
||||
Where(Function(d) d.Filename = oDocument.Filename).
|
||||
@ -133,9 +132,17 @@ Partial Public Class frmEnvelopeEditor
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function SaveEnvelope() As Boolean
|
||||
Dim oSubject = txtSubject.EditValue?.ToString
|
||||
Dim oMessage = txtMessage.EditValue?.ToString
|
||||
Private Function SaveEnvelopeWithValidation() As Boolean
|
||||
Return SaveEnvelope(True)
|
||||
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
|
||||
ViewReceivers.CloseEditor()
|
||||
@ -146,10 +153,12 @@ Partial Public Class frmEnvelopeEditor
|
||||
oEnvelope.Receivers = Receivers.ToList
|
||||
oEnvelope.Documents = Documents.ToList
|
||||
|
||||
Dim oErrors = oEnvelope.Validate()
|
||||
If oErrors.Any Then
|
||||
ShowValidationErrors(Resources.Envelope.Errors_when_saving_the_envelope, oErrors)
|
||||
Return False
|
||||
If pWithValidation = True Then
|
||||
Dim oErrors = oEnvelope.Validate()
|
||||
If oErrors.Any Then
|
||||
ShowValidationErrors(Resources.Envelope.Errors_when_saving_the_envelope, oErrors)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
If Controller.CreateEnvelopeReceivers(oEnvelope.Receivers) = False Then
|
||||
@ -165,6 +174,14 @@ Partial Public Class frmEnvelopeEditor
|
||||
End If
|
||||
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))
|
||||
Dim oError = pErrorTitle & vbNewLine & vbNewLine & String.Join(vbNewLine, pErrors)
|
||||
MsgBox(oError, MsgBoxStyle.Exclamation, Text)
|
||||
@ -199,7 +216,12 @@ Partial Public Class frmEnvelopeEditor
|
||||
End Sub
|
||||
|
||||
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
|
||||
End If
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user