Пример #1
0
        public ActionResult _HitCounter()
        {
            HitCounterEntity db = new HitCounterEntity();
            int TotalOnline     = 0;
            int TotalYesterday  = 0;
            int TotalMonth      = 0;
            int Total           = 0;

            try
            {
                var _hit = db.Visitors.ToList();
                TotalOnline    = (int)HttpContext.Application["Totaluser"];
                TotalYesterday = _hit.Where(x => x.visitTime <= DateTime.Now && x.visitTime >= DateTime.Now.Date).Count();
                TotalMonth     = _hit.Where(x => x.visitTime.Year == DateTime.Now.Year && x.visitTime.Month == DateTime.Now.Month).Count();
                Total          = _hit.Count();
            }
            catch
            {
            }
            ViewBag.TotalOnline    = TotalOnline.ToString("N0");
            ViewBag.TotalYesterday = TotalYesterday.ToString("N0");;
            ViewBag.TotalMonth     = TotalMonth.ToString("N0");
            ViewBag.Total          = Total.ToString("N0");
            return(PartialView());
        }
Пример #2
0
        public ActionResult HitCounterTotal()
        {
            HitCounterEntity db     = new HitCounterEntity();
            List <Visiter>   result = db.Visiters.ToList();
            long             _total = result.Count;

            _total += 31538606;
            string hit = "000000000";

            if (_total < 1000000000 && _total >= 100000000)
            {
                hit = _total.ToString();
            }

            if (_total < 100000000 && _total >= 10000000)
            {
                hit = "0" + _total.ToString();
            }

            if (_total < 10000000 && _total >= 1000000)
            {
                hit = "00" + _total.ToString();
            }

            if (_total < 1000000 && _total >= 100000)
            {
                hit = "000" + _total.ToString();
            }

            if (_total < 100000 && _total >= 10000)
            {
                hit = "0000" + _total.ToString();
            }

            if (_total < 10000 && _total >= 1000)
            {
                hit = "00000" + _total.ToString();
            }

            if (_total < 1000 && _total >= 100)
            {
                hit = "000000" + _total.ToString();
            }

            if (_total < 100 && _total >= 10)
            {
                hit = "0000000" + _total.ToString();
            }

            if (_total < 10 && _total >= 1)
            {
                hit = "00000000" + _total.ToString();
            }

            string outST = "";

            for (int i = 0; i < hit.Length; i++)
            {
                outST += "<span class=\"num\">" + hit[i] + "</span>";
            }
            ViewBag.TotalHitcounter = outST;
            languagecode            = HttpContext.Request.Cookies["languagecode"];
            if (languagecode != null && languagecode.Value == "en")
            {
                ViewBag.LanguageId = 2;
            }
            else
            {
                ViewBag.LanguageId = 1;
            }

            return(PartialView());
        }