Пример #1
0
        // GET: /Graph/DownloadClient
        public ActionResult DownloadClient()
        {
            Guid userId;

            if (UserIdRepository.TryGetUserId(out userId))
            {
                ViewBag.UploadId = userId;
            }

            return(View());
        }
Пример #2
0
        private void SetUserCookie()
        {
            string userName = User.Identity.Name;

            using (var db = new UsersContext())
            {
                UserProfile user =
                    db.UserProfiles.Single(u => u.UserName.ToLower() == userName.ToLower());
                ViewBag.UploadId = user.UploadId;

                UserIdRepository.Set(userName, user.UploadId, Response);
            }
        }
Пример #3
0
        public Data GetByDay(long msSinceEpoch, int minutesOffset)
        {
            Guid userId;

            if (!UserIdRepository.TryGetUserId(out userId))
            {
                return(new Data());
            }

            DateTime utcStart = new DateTime(1970, 1, 1).AddTicks(msSinceEpoch * 10000);
            DateTime utcEnd   = utcStart.AddDays(1);

            var repo       = new UsageRepository();
            var dataRows   = repo.GetRows(userId, utcStart, utcEnd);
            var dailyUsage = dataRows.ToDaily(minutesOffset);
            var uiUsage    = dailyUsage.ToUI();

            return(uiUsage);
        }
Пример #4
0
        public IEnumerable <TableData> GetByDay(long msSinceEpoch, int minutesOffset)
        {
            Guid            userId;
            List <UsageRow> dataRows;

            if (!UserIdRepository.TryGetUserId(out userId))
            {
                dataRows = new List <UsageRow>();
            }
            else
            {
                DateTime utcStart = new DateTime(1970, 1, 1).AddTicks(msSinceEpoch * 10000);
                DateTime utcEnd   = utcStart.AddDays(1);

                var repo = new UsageRepository();
                dataRows = repo.GetRows(userId, utcStart, utcEnd);
            }

            return(dataRows.ToTableData());
        }