Exemplo n.º 1
0
        public override object GetData(ITabContext context)
        {
            try
            {
                var sitecoreData = _sitecoreRequest.GetData();

                if (!sitecoreData.HasData())
                {
                    return(null);
                }

                var analyicsOverviewSection = new AnalyicsOverviewSection(sitecoreData).Create();
                var analticsSummary         = new AnalticsSummary(sitecoreData).Create();

                if ((string.IsNullOrEmpty(analticsSummary)) || (analyicsOverviewSection == null))
                {
                    return(null);
                }

                var plugin = Plugin.Create("Visitor", analticsSummary);
                plugin.AddRow().Column("Overview").Column(analyicsOverviewSection).Selected();

                var profilesSection  = new ProfilesSection(sitecoreData).Create();
                var goalsSection     = new GoalsSection(sitecoreData).Create();
                var pageViewsSection = new PageViewsSection(sitecoreData).Create();

                if (profilesSection != null)
                {
                    plugin.Section("Profiles", profilesSection);
                }

                if (goalsSection != null)
                {
                    plugin.AddRow().Column("Goals").Column(goalsSection).Info();
                }

                if (pageViewsSection != null)
                {
                    plugin.AddRow().Column("Page Views").Column(pageViewsSection).Quiet();
                }

                return(plugin);
            }
            catch (Exception ex)
            {
                return(new { Exception = ex });
            }
        }
        public override object GetData(ITabContext context)
        {
            try
            {
                var sitecoreData = _sitecoreRequest.GetData();

                if (!sitecoreData.HasData()) return null;

                var analyicsOverviewSection = new AnalyicsOverviewSection(sitecoreData).Create();
                var analticsSummary = new AnalticsSummary(sitecoreData).Create();

                if ((string.IsNullOrEmpty(analticsSummary)) || (analyicsOverviewSection == null)) return null;

                var plugin = Plugin.Create("Visitor", analticsSummary);
                plugin.AddRow().Column("Overview").Column(analyicsOverviewSection).Selected();

                var profilesSection = new ProfilesSection(sitecoreData).Create();
                var goalsSection = new GoalsSection(sitecoreData).Create();
                var pageViewsSection = new PageViewsSection(sitecoreData).Create();

                if (profilesSection != null)
                    plugin.Section("Profiles", profilesSection);
                
                if (goalsSection != null)
                    plugin.AddRow().Column("Goals").Column(goalsSection).Info();

                if (pageViewsSection != null)
                    plugin.AddRow().Column("Page Views").Column(pageViewsSection).Quiet();

                return plugin;
            }
            catch (Exception ex)
            {
                return new { Exception = ex };
            }
        }