コード例 #1
0
 public ReportDTO GetReportForTimePeriod(DateTime begin, DateTime end, UserDTO user)
 {
     logger.Info("Inside get report for time period");
     ReportDTO reportDTO = new ReportDTO();
     logger.Info("Begin time: " + begin.ToString());
     logger.Info("End time: " + end.ToString());
     IList<LogEntry> logEntries = unitOfWork.LogEntryRepository.Get(l => l.StartTime > begin && l.StartTime < end && l.UserId == user.UserId).ToList();
     logger.Info("Count in list: " + logEntries.Count());
     if (logEntries.Count() != 0)
     {
         logger.Info("Loading results");
         reportDTO.ActivityCount = logEntries.Count();
         reportDTO.Calories = (int)logEntries.Sum(l => l.Calories);
         reportDTO.Duration = logEntries.Sum(l => l.Duration);
         reportDTO.Distance = logEntries.Sum(l => l.Distance);
         logger.Info("Testing activity count: " + reportDTO.ActivityCount);
     }
     else
     {
         reportDTO.ActivityCount = 0;
         reportDTO.Calories = 0;
         reportDTO.Duration = 0;
         reportDTO.Distance = 0;
         logger.Info("no results");
     }
     return reportDTO;
 }
コード例 #2
0
        //
        // GET: /Reports/
        public ActionResult Index()
        {
            ReportDTO report = new ReportDTO();

            return View(report);
        }