Example #1
0
        public void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data)
        {
            string FirstName = adaptedFields.GetEntryByName("FirstName").Value;
            string LastName  = adaptedFields.GetEntryByName("LastName").Value;
            string Message   = adaptedFields.GetEntryByName("Message").Value;
            string Date      = adaptedFields.GetEntryByName("Date").Value;
            string Email     = adaptedFields.GetEntryByName("Email").Value;

            Log.Info("New Form has been submited", this);
        }
Example #2
0
        public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data)
        {
            _log = Sitecore.Diagnostics.LoggerFactory.GetLogger("LogFileAppender");

            var name    = adaptedFields.GetEntryByName("Name");
            var email   = adaptedFields.GetEntryByName("Email");
            var comment = adaptedFields.GetEntryByName("Comment");

            _log.Info("Writing comment to database");
            HttpContext.Current.Session["Email"] = email;

            var goal = new PageEventData("My Custom Goal", Guid.Parse("{47FF654B-76B2-49EF-A6AA-C61AE6093768}"));

            Tracker.Current.CurrentPage.Register(goal);

            var contact = Tracker.Current?.Contact;

            if (contact != null)
            {
                var commentCounterTag = contact.Tags.Find("CommentCounter");
                if (commentCounterTag == null)
                {
                    contact.Tags.Set("CommentCounter", "1");
                }
                else
                {
                    int originalValue = 0;
                    int newValue      = 0;

                    var counter = commentCounterTag.Values.FirstOrDefault();
                    if (counter != null)
                    {
                        if (Int32.TryParse(counter.Value, out originalValue))
                        {
                            newValue = originalValue + 1;
                            contact.Tags.Remove("CommentCounter", originalValue.ToString());
                            contact.Tags.Set("CommentCounter", newValue.ToString());
                        }
                    }

                    if (originalValue < 10 && newValue >= 10)
                    {
                        contact.Extensions.SimpleValues["ContributionLevel"] = "Fanboy";
                    }
                }
            }
        }
Example #3
0
        public void Execute(ID formid, AdaptedResultList fields, params object[] data)
        {
            Log.Info("Sending to marketo", this);
            try
            {
                var firstName = fields.GetEntryByName("First name").Value;
                var email = fields.GetEntryByName("Email").Value;
                var postcode = fields.GetEntryByName("Postcode").Value;

                this.CreateUpdateLead(firstName, email, postcode);
                Log.Info("Sending to marketo succeeded", this);
            }
            catch (Exception ex)
            {
                Log.Error("Marketo Update failed", ex, this);
            }
        }
Example #4
0
        public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data)
        {
            _log = Sitecore.Diagnostics.LoggerFactory.GetLogger("LogFileAppender");

            var name      = adaptedFields.GetEntryByName("Full Name");
            var contactno = adaptedFields.GetEntryByName("Contact Number");
            var email     = adaptedFields.GetEntryByName("Email Address");

            var Age         = adaptedFields.GetEntryByName("Age");
            var Company     = adaptedFields.GetEntryByName("Company");
            var Designation = adaptedFields.GetEntryByName("Designation");

            _log.Info("Writing comment to database");
            HttpContext.Current.Session["Email"] = email;

            /// var goal = new PageEventData("My Custom Goal", Guid.Parse("{47FF654B-76B2-49EF-A6AA-C61AE6093768}"));
            // Tracker.Current.CurrentPage.Register(goal);
            LockAttemptResult <Contact> lockResult;
            ContactRepository           contactRepository = Sitecore.Configuration.Factory.CreateObject("tracking/contactRepository", true) as ContactRepository;
            ContactManager contactManager = Sitecore.Configuration.Factory.CreateObject("tracking/contactManager", true) as ContactManager;

            var contact = Tracker.Current?.Contact;

            if (contact == null)
            {
                lockResult = new LockAttemptResult <Contact>(LockAttemptStatus.NotFound, null, null);
                contact    = contactRepository.CreateContact(Sitecore.Data.ID.NewID);
                contact.Identifiers.AuthenticationLevel = Sitecore.Analytics.Model.AuthenticationLevel.None;
                contact.Identifiers.Identifier          = "*****@*****.**";
                contact.Identifiers.IdentificationLevel = ContactIdentificationLevel.Known;
                contact.System.Value      = 0;
                contact.System.VisitCount = 0;
                contact.ContactSaveMode   = ContactSaveMode.AlwaysSave;
                contactManager.FlushContactToXdb(contact);
                //  VisitorIdentification s = new VisitorIdentification();
            }
            else
            {
                lockResult = contactManager.TryLoadContact(contact.ContactId);


                contact = lockResult.Object;
            }
            if (contact != null)
            {
                var contactEmailAddresses = contact.GetFacet <IContactCommentsFacet>("Contact Details");

                if (!contactEmailAddresses.CustomerDetails.Contains("Contact Details"))
                {
                    contactEmailAddresses.CustomerDetails.Create("Contact Details");
                    contactEmailAddresses.CustomerDetails["Contact Details"].Age      = "18";
                    contactEmailAddresses.CustomerDetails["Contact Details"].Company  = "Companyemarr";
                    contactEmailAddresses.CustomerDetails["Contact Details"].FullName = "Designationdsddf";
                    contactEmailAddresses.CustomerDetails["Contact Details"].Email    = "Emailaddress";
                }
                var leaseOwner = new LeaseOwner(GetType() + Guid.NewGuid().ToString(), LeaseOwnerType.OutOfRequestWorker);

                contactManager.SaveAndReleaseContactToXdb(contact);
            }
        }