Set envelope default message by type using resources
Added "Please read and confirm this document" to resource files and updated resource class. Replaced Envelope constructor with WithDefaultMessage extension method to set default message based on EnvelopeTypeId. Updated controller and editor form to use this method. Cleaned up imports and comments.
This commit is contained in:
@@ -28,7 +28,7 @@ Public Class EnvelopeEditorController
|
||||
Public Sub New(pState As State, pEnvelope As Envelope)
|
||||
MyBase.New(pState)
|
||||
|
||||
Envelope = pEnvelope
|
||||
Envelope = pEnvelope.WithDefaultMessage()
|
||||
Envelope.Documents = DocumentModel.List(pEnvelope.Id).ToList()
|
||||
Envelope.Receivers = ReceiverModel.ListEnvelopeReceivers(pEnvelope.Id).ToList()
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports System.Runtime.CompilerServices
|
||||
Imports System.Resources
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.CommonServices
|
||||
Imports EnvelopeGenerator.CommonServices.My
|
||||
Imports EnvelopeGenerator.Domain.Entities
|
||||
Imports EnvelopeGenerator.Domain
|
||||
|
||||
Module ModuleSettings
|
||||
Public ENVELOPE_TEMP_DOCUMENT As String = ""
|
||||
@@ -27,4 +31,21 @@ Module ModuleSettings
|
||||
Public MyState As State
|
||||
Public CurrentEnvelopID As Integer = 0
|
||||
Public CurrentEnvelopetitle As String = ""
|
||||
|
||||
<Extension()>
|
||||
Public Function WithDefaultMessage(ByVal envelope As Envelope) As Envelope
|
||||
If envelope Is Nothing Then
|
||||
Throw New ArgumentNullException(NameOf(envelope))
|
||||
End If
|
||||
|
||||
Dim resourceManager As New ResourceManager("EnvelopeGenerator.Domain.Resources.Envelope", GetType(EnvelopeGenerator.Domain.Entities.Envelope).Assembly)
|
||||
|
||||
If envelope.EnvelopeTypeId = 1 Then
|
||||
envelope.Message = resourceManager.GetString("Please read and sign this document")
|
||||
ElseIf envelope.EnvelopeTypeId = 2 Then
|
||||
envelope.Message = resourceManager.GetString("Please read and confirm this document")
|
||||
End If
|
||||
|
||||
Return envelope
|
||||
End Function
|
||||
End Module
|
||||
|
||||
@@ -139,7 +139,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
End If
|
||||
End If
|
||||
|
||||
txtMessage.EditValue = Controller.Envelope.Message
|
||||
txtMessage.EditValue = Controller.Envelope.WithDefaultMessage().Message
|
||||
|
||||
GridDocuments.DataSource = Documents
|
||||
GridReceivers.DataSource = Receivers
|
||||
|
||||
Reference in New Issue
Block a user