예제 #1
0
        /// <summary>
        /// Places the vote into Analytics.
        /// </summary>
        /// <param name="optionItem">The option item.</param>
        public static void PlaceVote(PollOptionItem optionItem)
        {
            //    //cancel pipeline handler (for CurrentPage)
            //Tracker.CurrentPage.Cancel();

            //    //Submit analytics tracking for poll item
            SubmitPollTracking(optionItem.Poll.InnerItem, optionItem.InnerItem);


            //    //event trigger on new poll option selected
            var peData = new PageEventData("Poll");

            string text = string.Format("Select {0} ({2}) in poll {1}", optionItem.Title, optionItem.Poll.Name, optionItem.Index);
            string data = string.Concat(new object[] { optionItem.Poll.Name, "|", optionItem.Title, "|", optionItem.Index });

            peData.Data    = data;
            peData.Text    = text;
            peData.DataKey = optionItem.Poll.Name;
            var row = Tracker.CurrentPage.Register(peData);

            row.DataCode = optionItem.Index;

            //    //submit immediatelly
            SubmitAnalyticsImmediatelly();
        }
 /// <summary>
 /// Gets the votes count.
 /// </summary>
 /// <param name="option">The option item.</param>
 /// <returns></returns>
 public virtual int GetVotesCount(PollOptionItem option)
 {
     IQueryable<DMSPollData.Analytics.PageEvent> pageEvents = GetVotesList(option.Poll);
     Assert.IsNotNull(pageEvents, "PageEvents");
     int voteCount = pageEvents.Where(pageEvent => pageEvent.DataCode == option.Index).Count();
     return voteCount + MergeVisitEvents(pageEvents, option);
     //return 0;
 }
        /// <summary>
        /// Gets the votes count.
        /// </summary>
        /// <param name="option">The option item.</param>
        /// <returns></returns>
        public virtual int GetVotesCount(PollOptionItem option)
        {
            IQueryable <DMSPollData.Analytics.PageEvent> pageEvents = GetVotesList(option.Poll);

            Assert.IsNotNull(pageEvents, "PageEvents");
            int voteCount = pageEvents.Where(pageEvent => pageEvent.DataCode == option.Index).Count();

            return(voteCount + MergeVisitEvents(pageEvents, option));
            //return 0;
        }
예제 #4
0
        /// <summary>
        /// Places the vote into Analytics.
        /// </summary>
        /// <param name="optionItem">The option item.</param>
        public static void PlaceVote(PollOptionItem optionItem)
        {
            //    //cancel pipeline handler (for CurrentPage)
              //Tracker.CurrentPage.Cancel();

              //    //Submit analytics tracking for poll item
              SubmitPollTracking(optionItem.Poll.InnerItem, optionItem.InnerItem);

              //    //event trigger on new poll option selected
              var peData = new PageEventData("Poll");

              string text = string.Format("Select {0} ({2}) in poll {1}", optionItem.Title, optionItem.Poll.Name, optionItem.Index);
              string data = string.Concat(new object[] { optionItem.Poll.Name, "|", optionItem.Title, "|", optionItem.Index });
              peData.Data = data;
              peData.Text = text;
              peData.DataKey = optionItem.Poll.Name;
              var row = Tracker.CurrentPage.Register(peData);
              row.DataCode = optionItem.Index;

              //    //submit immediatelly
              SubmitAnalyticsImmediatelly();
        }
        private static int MergeVisitEvents(IQueryable<DMSPollData.Analytics.PageEvent> pageevents, PollOptionItem option)
        {
            var currentvisitevents =
              Tracker.DataContext.PageEvents.Where(
                x => x.PageEventDefinitionId == PollConstants.PollPageEventDefinitionID.ToGuid() &&
                x.DataCode == option.Index);
            var count = 0;
            foreach (var currentvisitevent in currentvisitevents)
            {

                var c = pageevents.Where(x => x.PageEventId == currentvisitevent.PageEventId).Count();
                count += c;
            }
            return currentvisitevents.Count() - count;
        }
        private static int MergeVisitEvents(IQueryable <DMSPollData.Analytics.PageEvent> pageevents, PollOptionItem option)
        {
            var currentvisitevents =
                Tracker.DataContext.PageEvents.Where(
                    x => x.PageEventDefinitionId == PollConstants.PollPageEventDefinitionID.ToGuid() &&
                    x.DataCode == option.Index);
            var count = 0;

            foreach (var currentvisitevent in currentvisitevents)
            {
                var c = pageevents.Where(x => x.PageEventId == currentvisitevent.PageEventId).Count();
                count += c;
            }
            return(currentvisitevents.Count() - count);
        }