Show / Hide Table of Contents

Class TemplateVariables

This class holds template variables that can be used in template variable substitution.

Inheritance
Object
TagContainer
TemplateVariables
Inherited Members
TagContainer._bInitiated
TagContainer.AddData(Object[])
TagContainer.GetData()
TagContainer.ClearData()
TagContainer.SetValue(String, String)
TagContainer.RemoveCustomValue(String)
TagContainer.CurrentUiCulture
TagContainer.Data
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: SuperOffice.CRM.Globalization
Assembly: SoDataBase.dll
Syntax
public class TemplateVariables : TagContainer
Remarks

This class can be instantiated with current values in the form if id’s. Only values required are fetched from the database. Data objects holding information about values can be provided in order to reduce fetching data from the database.

Constructors

TemplateVariables(TemplateVariableIds)

Create a template variable substitution instance, and set entity ID's from parameters. Use the method to add other parameters, such as Entity objects that you may have (and don't want to re-read from the database).

Declaration
public TemplateVariables(TemplateVariableIds templateVariableIds)
Parameters
Type Name Description
TemplateVariableIds templateVariableIds

Object containing the relevant ids for substituting labels.

TemplateVariables(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Create a template variable substitution instance, and set entity ID's from parameters. Assume the sending associate is the current user. Use the method to add other parameters, such as Entity objects that you may have (and don't want to re-read from the database).

Declaration
public TemplateVariables(int contactId, int personId, int appointmentId, int documentId, int saleId, int selectionId, int projectId)
Parameters
Type Name Description
Int32 contactId

Primary id of the current contact.

Int32 personId

Primary id of the current person.

Int32 appointmentId

Primary id of the current appointment.

Int32 documentId

Primary id of the current document.

Int32 saleId

Primary id of the current sale.

Int32 selectionId

Primary id of the current selection.

Int32 projectId

Primary id of the current project

TemplateVariables(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Create a template variable substitution instance, and set entity ID's from parameters. Use the method to add other parameters, such as Entity objects that you may have (and don't want to re-read from the database).

Declaration
public TemplateVariables(int associateId, int contactId, int personId, int appointmentId, int documentId, int saleId, int selectionId, int projectId)
Parameters
Type Name Description
Int32 associateId

AssociateId for sender.

Int32 contactId

Primary id of the current contact.

Int32 personId

Primary id of the current person.

Int32 appointmentId

Primary id of the current appointment.

Int32 documentId

Primary id of the current document.

Int32 saleId

Primary id of the current sale.

Int32 selectionId

Primary id of the current selection.

Int32 projectId

Primary id of the current project

Fields

_currentContact

Declaration
protected ContactTags _currentContact
Field Value
Type Description
ContactTags

Properties

AssociateId

Declaration
public int AssociateId { get; }
Property Value
Type Description
Int32

ContactId

Declaration
public int ContactId { get; }
Property Value
Type Description
Int32

CurrentContact

Declaration
public ContactTags CurrentContact { get; set; }
Property Value
Type Description
ContactTags

CurrentPerson

Declaration
public CurrentPersonVariables CurrentPerson { get; set; }
Property Value
Type Description
CurrentPersonVariables

DoGetPersonTags

Declaration
protected virtual bool DoGetPersonTags { get; }
Property Value
Type Description
Boolean

Id

Declaration
public override int Id { get; }
Property Value
Type Description
Int32
Overrides
TagContainer.Id

PersonId

Declaration
public int PersonId { get; }
Property Value
Type Description
Int32

QuoteAlternativeId

Declaration
public int QuoteAlternativeId { get; }
Property Value
Type Description
Int32

QuoteId

Declaration
public int QuoteId { get; }
Property Value
Type Description
Int32

QuoteVersionId

Declaration
public int QuoteVersionId { get; }
Property Value
Type Description
Int32

Methods

GetValue(String)

Get a value for a tag.

Declaration
public override string GetValue(string tag)
Parameters
Type Name Description
String tag

Name of the tag.

Returns
Type Description
String

Value of the tag. An empty string is returned if there is no valid value.

Overrides
TagContainer.GetValue(String)

GetValue(String, Boolean)

Get a value for a tag, and optionally skip fadX templates

Declaration
public string GetValue(string tag, bool ignoreFad)
Parameters
Type Name Description
String tag

Name of the tag.

Boolean ignoreFad
Returns
Type Description
String

Value of the tag. An empty string is returned if there is no valid value.

Init()

Create the type-specific tag containers, and give them what we know

Declaration
protected override void Init()
Overrides
TagContainer.Init()
Remarks

base.Data is an object array that might contain things like Entity objects; if so then these will be discovered and used by the Info providers once the template variable objects need them.

An object such as DocumentTags will add the document id to whatever else is already in the array, and then that gets passed to the factory method for DocumentInfo. The method will iterate through the array, and if it sees a Entities.Document instance that matches the document id, then it will use that one as the basis for the DocumentInfo; otherwise the factory will create a new Entities.Document instance that reads data from the database.

It's a flexible system, but somewhat hard to trace if you have forgotten the original design.

IsTagInContext(String)

Is this a valid tag in the given context. If there are no current sale, there are no valid tags for sale.

Declaration
public override bool IsTagInContext(string tag)
Parameters
Type Name Description
String tag

Name of the tag.

Returns
Type Description
Boolean

True if the tag is valid in hte given context.

Overrides
TagContainer.IsTagInContext(String)

IsTagLegal(String)

Is this a legal tag?

Declaration
public override bool IsTagLegal(string tag)
Parameters
Type Name Description
String tag

Name of the tag.

Returns
Type Description
Boolean

True is returned if this is a legal tag.

Overrides
TagContainer.IsTagLegal(String)

SetContactPersonId(Int32, Int32)

Set new identities for contact and person

Declaration
public void SetContactPersonId(int contactId, int personId)
Parameters
Type Name Description
Int32 contactId

Identity of new contact

Int32 personId

Identity of new person

SetCurrentContact()

Declaration
protected virtual void SetCurrentContact()

SetInviteePersonId(Int32)

Declaration
public void SetInviteePersonId(int personId)
Parameters
Type Name Description
Int32 personId

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top