Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Configuration.Dependency;
- using Contracts.Enumerations;
- using Contracts.Interfaces;
- using Contracts.Interfaces.Templating;
- using Contracts.Models;
- using Contracts.Models.SalesForce;
- using System;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using Contracts.Helpers;
- namespace ClientConsole
- {
- public class Program
- {
- #region Methods
- private static void Main(string[] args)
- {
- // Block on the async method to keep the console alive.
- MainAsync(args).Wait();
- }
- private static async Task MainAsync(string[] args)
- {
- IocContainer iocContainer = new IocContainer();
- Console.WriteLine("Type a message and press Enter to send.");
- while (true)
- {
- var message = new Message();
- message.UseTemplate = useTemplate;
- message.TemplateName = "NotificationServerTest";
- string contactId = "003g0000xxx1h3";
- string participantId = "a2qg0000xxx8m";
- message.TemplateDataDefinition = getTemplateDataDefinition(participantId, contactId);
- string messageString = SerialisationHelper.Serialise, message, true);
- ITemplateDataQuery deserialisedObject = SerialisationHelper.Deserialise(messageString, true);
- }
- }
- private static ITemplateDataQuery getTemplateDataDefinition(string particpantId, string contactId)
- {
- ITemplateDataQuery topLevelQuery = (ITemplateDataQuery)new TemplateDataQuery();
- topLevelQuery.RootModelObjectQueries.Add((ITemplateDataQueryElement)new TemplateDataQueryElement("Contact")
- {
- EntityName = "Contact",
- RecordId = contactId
- });
- topLevelQuery.RootModelObjectQueries.Add(new TemplateDataQueryElement("Participant__c")
- {
- EntityName = "Participant__c",
- RecordId = particpantId
- }.AddChild(new TemplateDataQueryElement("Class__c")
- {
- EntityName = "Class__c",
- ParentForeignKeyName = "Class__c"
- }.AddChildren(new List<TemplateDataQueryElement> {
- new TemplateDataQueryElement("Topic__c"){
- EntityName = "Topic__c",
- ParentForeignKeyName = "Topic__c"},
- new TemplateDataQueryElement("Training_Location__c"){
- EntityName = "Training_Location__c",
- ParentForeignKeyName = "Location__c"
- },
- }
- )));
- return topLevelQuery;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement