Exemple #1
0
        protected override Clue MakeClueImpl([NotNull] Session input, Guid accountId)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            var clue = _factory.Create(EntityType.Activity, input.Id.ToString(), accountId);

            var data = clue.Data.EntityData;

            if (!string.IsNullOrWhiteSpace(input.Id.ToString()))
            {
                data.Name = input.Id.ToString();
            }

            var vocab = new SessionVocabulary();

            data.Properties[vocab.CampaignId]     = input.CampaignId.PrintIfAvailable();
            data.Properties[vocab.Cdr]            = input.Cdr.PrintIfAvailable();
            data.Properties[vocab.EndTime]        = input.EndTime.PrintIfAvailable();
            data.Properties[vocab.Id]             = input.Id.PrintIfAvailable();
            data.Properties[vocab.LeadId]         = input.LeadId.PrintIfAvailable();
            data.Properties[vocab.SessionSeconds] = input.SessionSeconds.PrintIfAvailable();
            data.Properties[vocab.StartTime]      = input.StartTime.PrintIfAvailable();
            data.Properties[vocab.Status]         = input.Status.PrintIfAvailable();
            data.Properties[vocab.UserId]         = input.UserId.PrintIfAvailable();

            if (input.LeadId != default)
            {
                _factory.CreateOutgoingEntityReference(clue, EntityType.Sales.Lead, EntityEdgeType.PartOf, input, input.LeadId.ToString());
            }

            if (input.CampaignId != default)
            {
                _factory.CreateOutgoingEntityReference(clue, EntityType.Marketing.Campaign, EntityEdgeType.PartOf, input, input.CampaignId.ToString());
            }

            if (input.UserId != default)
            {
                _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.User, EntityEdgeType.PartOf, input, input.UserId.ToString());
            }

            if (!data.OutgoingEdges.Any())
            {
                _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf);
            }

            return(clue);
        }
Exemple #2
0
        protected override Clue MakeClueImpl([NotNull] Session input, Guid accountId)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            // TODO: Create clue specifying the type of entity it is and ID
            var id   = string.Format("GoToWebinarSession_{0}", input.SessionKey);
            var clue = _factory.Create(EntityType.Discussion, id, accountId);

            clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_003_Author_Name_MustBeSet);
            clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet);

            // TODO: Populate clue data
            var data = clue.Data.EntityData;

            data.Name = "Webinar session";

            var vocab = new SessionVocabulary();

            data.Properties[vocab.EndTime]             = input.EndTime.PrintIfAvailable();
            data.Properties[vocab.RegistrantsAttended] = input.RegistrantsAttended.PrintIfAvailable();
            data.Properties[vocab.SessionKey]          = input.SessionKey.PrintIfAvailable();
            data.Properties[vocab.StartTime]           = input.StartTime.PrintIfAvailable();
            data.Properties[vocab.WebinarID]           = input.WebinarID.PrintIfAvailable();
            data.Properties[vocab.WebinarKey]          = input.WebinarKey.PrintIfAvailable();

            var hasConnection = false;

            if (!string.IsNullOrEmpty(input.WebinarID))
            {
                var webinarId = string.Format("GoToWebinarWebinar_{0}", input.WebinarID);
                _factory.CreateOutgoingEntityReference(clue, EntityType.Discussion, "Instance of", webinarId, webinarId);
                hasConnection = true;
            }

            if (!hasConnection)
            {
                _factory.CreateEntityRootReference(clue, "parent");
            }

            return(clue);
        }