Beispiel #1
0
        /// <summary>
        /// Export link trackers for monthly click through
        /// </summary>
        /// <returns></returns>
        public HSSFWorkbook Exports(LinkTrackerMonthlyClickThroughSearchModel searchModel)
        {
            var data         = SearchLinkTrackers(searchModel);
            var linkTrackers = Maps(data, searchModel);

            return(ExcelUtilities.CreateWorkBook(linkTrackers));
        }
Beispiel #2
0
        /// <summary>
        /// Search the link trackers for monthly click through
        /// </summary>
        /// <returns></returns>
        public JqGridSearchOut SearchLinkTrackers(JqSearchIn si, LinkTrackerMonthlyClickThroughSearchModel searchModel)
        {
            var data         = SearchLinkTrackers(searchModel);
            var linkTrackers = Maps(data, searchModel);

            return(si.Search(linkTrackers));
        }
Beispiel #3
0
 /// <summary>
 /// Search link trackers for monthly click through
 /// </summary>
 /// <param name="searchModel"></param>
 /// <returns></returns>
 private IQueryable <LinkTracker> SearchLinkTrackers(LinkTrackerMonthlyClickThroughSearchModel searchModel)
 {
     return(Fetch(l => string.IsNullOrEmpty(searchModel.Keyword)
                  ||
                  (!string.IsNullOrEmpty(l.Name) && l.Name.ToLower().Contains(searchModel.Keyword.ToLower()))
                  ||
                  (!string.IsNullOrEmpty(l.RedirectUrl) &&
                   l.RedirectUrl.ToLower().Contains(searchModel.Keyword.ToLower()))));
 }
        public ActionResult LinkTrackerMonthlyClickThroughExports(LinkTrackerMonthlyClickThroughSearchModel searchModel)
        {
            var workbook = _linkTrackerService.Exports(searchModel);

            var output = new MemoryStream();

            workbook.Write(output);

            return(File(output.ToArray(), "application/vnd.ms-excel", "LinkTrackersMonthlyClickThrough.xls"));
        }
Beispiel #5
0
        /// <summary>
        /// Map entities to models
        /// </summary>
        /// <param name="linkTrackers"></param>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        private IQueryable <LinkTrackerMonthlyClickThroughModel> Maps(IQueryable <LinkTracker> linkTrackers,
                                                                      LinkTrackerMonthlyClickThroughSearchModel searchModel)
        {
            if (searchModel.Year.HasValue)
            {
                return(linkTrackers.Select(l => new LinkTrackerMonthlyClickThroughModel
                {
                    Id = l.Id,
                    Name = l.Name,
                    January =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 1 && lc.Created.Year == searchModel.Year.Value),
                    February =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 2 && lc.Created.Year == searchModel.Year.Value),
                    March =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 3 && lc.Created.Year == searchModel.Year.Value),
                    April =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 4 && lc.Created.Year == searchModel.Year.Value),
                    May =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 5 && lc.Created.Year == searchModel.Year.Value),
                    June =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 6 && lc.Created.Year == searchModel.Year.Value),
                    July =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 7 && lc.Created.Year == searchModel.Year.Value),
                    August =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 8 && lc.Created.Year == searchModel.Year.Value),
                    September =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 9 && lc.Created.Year == searchModel.Year.Value),
                    October =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 10 && lc.Created.Year == searchModel.Year.Value),
                    November =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 11 && lc.Created.Year == searchModel.Year.Value),
                    December =
                        l.LinkTrackerClicks.Count(
                            lc => lc.Created.Month == 12 && lc.Created.Year == searchModel.Year.Value)
                }));
            }

            return(linkTrackers.Select(l => new LinkTrackerMonthlyClickThroughModel
            {
                Id = l.Id,
                Name = l.Name,
                January = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 1),
                February = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 2),
                March = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 3),
                April = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 4),
                May = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 5),
                June = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 6),
                July = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 7),
                August = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 8),
                September = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 9),
                October = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 10),
                November = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 11),
                December = l.LinkTrackerClicks.Count(lc => lc.Created.Month == 12)
            }));
        }
 public string _LinkTrackerMonthlyClickThroughAjaxBinding(JqSearchIn si, LinkTrackerMonthlyClickThroughSearchModel searchModel)
 {
     return(JsonConvert.SerializeObject(_linkTrackerService.SearchLinkTrackers(si, searchModel)));
 }
        public ActionResult MonthlyClickThrough()
        {
            var searchModel = new LinkTrackerMonthlyClickThroughSearchModel();

            return(View(searchModel));
        }