Exemplo n.º 1
0
 protected void cmdFilterAll_Execute()
 {
     _filterTo = DateTime.Now;
     OnPropertyChanged("FilterTo");
     _filterFrom = FilterTo.AddDays(-365);
     OnPropertyChanged("FilterFrom");
     Refresh();
 }
Exemplo n.º 2
0
 private void cmdFilterAll_Execute()
 {
     _filterTo = DateTime.Now;
     OnPropertyChanged("FilterTo");
     _filterFrom = FilterTo.AddDays(-365);
     OnPropertyChanged("FilterFrom");
     _filterMonth = null;
     OnPropertyChanged("FilterMonth");
     _filterYear = DateTime.Now.Year;
     OnPropertyChanged("FilterYear");
     Refresh();
 }
Exemplo n.º 3
0
        private async Task <IActionResult> GetValues(DateTime?filterFrom, DateTime?filterTo)
        {
            FilterFrom = filterFrom ?? new DateTime();
            FilterTo   = filterTo ?? DateTime.Today;
            var endOfDay = FilterTo.AddDays(1).AddSeconds(-1);

            TotalSms = await _context.Sms.CountAsync(s => s.Date >= FilterFrom && s.Date <= endOfDay);

            TotalCallDuration = TimeSpan.FromSeconds
                                (
                await _context.Calls
                .Where(f => f.Date >= FilterFrom && f.Date <= endOfDay)
                .SumAsync(c => c.Duration)
                                );

            TopCallMsisdns = await _context.Calls
                             .Where(c => c.Date >= FilterFrom && c.Date <= endOfDay)
                             .GroupBy(c => c.Msisdn)
                             .Select(g => new CallDurationVM {
                Msisdn = g.Key, CallDuration = TimeSpan.FromSeconds(g.Sum(c => c.Duration))
            })
                             .OrderByDescending(c => c.CallDuration)
                             .Take(5)
                             .ToListAsync();

            TopSmsMsisdns = await _context.Sms
                            .Where(s => s.Date >= FilterFrom && s.Date <= endOfDay)
                            .GroupBy(s => s.Msisdn)
                            .Select(g => new SmsCountVM {
                Msisdn = g.Key, SmsCount = g.Count()
            })
                            .OrderByDescending(c => c.SmsCount)
                            .Take(5)
                            .ToListAsync();

            return(Page());
        }