コード例 #1
0
        public Dictionary <string, string> PostInteraction()
        {
            HttpContent            requestContent         = Request.Content;
            string                 content                = requestContent.ReadAsStringAsync().Result;
            InteractionInformation interactionInformation = JsonConvert.DeserializeObject <InteractionInformation>(content);

            var homePageId = GlobalAttributesCache.Value("AvalancheHomePage").AsInteger();
            var pageCache  = PageCache.Read(homePageId);
            var siteId     = pageCache.SiteId;
            var person     = GetPerson();

            AppInteractionTransaction transaction = new AppInteractionTransaction()
            {
                ComponentName      = "Mobile App",
                SiteId             = siteId,
                PageId             = interactionInformation.PageId.AsIntegerOrNull(),
                PageTitle          = interactionInformation.PageTitle,
                DateViewed         = Rock.RockDateTime.Now,
                Operation          = interactionInformation.Operation,
                PersonAliasId      = person?.PrimaryAliasId,
                InteractionData    = interactionInformation.InteractionData,
                InteractionSummary = interactionInformation.InteractionSummary,
                IPAddress          = GetClientIp(Request),
                UserAgent          = Request.Headers.UserAgent.ToString()
            };

            RockQueue.TransactionQueue.Enqueue(transaction);
            return(new Dictionary <string, string> {
                { "Status", "Ok" }
            });
        }
コード例 #2
0
        private void SavePageViewInteraction(PageCache Page, Person CurrentPerson)
        {
            AppInteractionTransaction transaction = new AppInteractionTransaction()
            {
                PageId          = Page.Id,
                SiteId          = Page.SiteId,
                DateViewed      = Rock.RockDateTime.Now,
                PageTitle       = Page.PageTitle,
                Operation       = "View",
                PersonAliasId   = CurrentPerson?.PrimaryAliasId,
                InteractionData = Request.RequestUri.ToString(),
                IPAddress       = GetClientIp(Request),
                UserAgent       = Request.Headers.UserAgent.ToString()
            };

            RockQueue.TransactionQueue.Enqueue(transaction);
        }