Пример #1
0
        public ActionResult GetInfo(string ip)
        {
            ip = ip.Trim();
            if (string.IsNullOrEmpty(ip) == false)
            {
                StatisticsInfoIPViewModel model = new StatisticsInfoIPViewModel
                {
                    CountCome     = statisticsRepository.GetAllStatistics().Count(x => x.IP == ip),
                    CountLike     = actionRepository.GetCountLikeByIP(ip),
                    CountDownload = actionRepository.GetCountDownloadsByIP(ip),
                    email         = emailRepository.GetEmailByIP(ip),
                    statistics    = statisticsRepository.GetStatisticsByIP(ip)
                };

                return(PartialView("_InfoPartial", model));
            }

            return(Json(false));
        }
Пример #2
0
        public StatisticsWorker(IStatisticsRepository statisticsRepository,
                                PersonViewModel person_Info,
                                string sessionID)// Uri referrer)
        {
            this.statisticsRepository = statisticsRepository;
            statistic = new Statistics();

            statistic.SessionID       = sessionID;
            statistic.dateTime        = DateTime.Now;
            statistic.Browser_name    = person_Info.browser_name;
            statistic.Browser_version = person_Info.browser_version;
            statistic.City            = person_Info.city;
            statistic.Country         = person_Info.country;
            statistic.Index           = person_Info.index;
            statistic.IP          = person_Info.ip;
            statistic.isMobile    = person_Info.is_mobile;
            statistic.Location    = person_Info.location;
            statistic.OS_name     = person_Info.os_name;
            statistic.OS_version  = person_Info.os_version;
            statistic.Screen_size = person_Info.screen_size;

            if (string.IsNullOrEmpty(person_Info.referrer) == false)
            {
                statistic.Referrer     = person_Info.referrer.Substring(0, 50); //.Host;
                statistic.FullReferrer = person_Info.referrer;
            }

            if (statisticsRepository.GetStatisticsByIP(person_Info.ip) != null)// db.Statistics.Where(x => x.IP == person_Info.ip).Any())
            {
                statistic.Status = "Return";
            }
            else
            {
                statistic.Status = "New";
            }
        }