public IList<IPieChartItem> GetTotals() { IList<IPieChartItem> retorno = new List<IPieChartItem>(); IDataQuery query = new DataQuery(); IList<IViewUserAges> collection = _repository.Find(query); int[] usersAgeBetween15_25 = collection.Where(m => m.Age.GetValueOrDefault() >= 15 && m.Age.GetValueOrDefault() <= 25).Select(m => m.Age.GetValueOrDefault()).ToArray<int>(); int[] usersAgeBetween26_40 = collection.Where(m => m.Age.GetValueOrDefault() >= 26 && m.Age.GetValueOrDefault() <= 40).Select(m => m.Age.GetValueOrDefault()).ToArray<int>(); int[] usersAgeBetween41_60 = collection.Where(m => m.Age.GetValueOrDefault() >= 41 && m.Age.GetValueOrDefault() <= 60).Select(m => m.Age.GetValueOrDefault()).ToArray<int>(); IPieChartItem total15_25 = new PieChartItem(); total15_25.Value = usersAgeBetween15_25.Length; total15_25.Legend = "15 - 25"; IPieChartItem total26_40 = new PieChartItem(); total26_40.Value = usersAgeBetween26_40.Length; total26_40.Legend = "26 - 40"; IPieChartItem total41_60 = new PieChartItem(); total41_60.Value = usersAgeBetween41_60.Length; total41_60.Legend = "41 - 60"; retorno.Add(total15_25); retorno.Add(total26_40); retorno.Add(total41_60); return retorno; }
public IList <IPieChartItem> GetTotals() { IList <IPieChartItem> retorno = new List <IPieChartItem>(); IDataQuery query = new DataQuery(); IList <IViewUserAges> collection = _repository.Find(query); int[] usersAgeBetween15_25 = collection.Where(m => m.Age.GetValueOrDefault() >= 15 && m.Age.GetValueOrDefault() <= 25).Select(m => m.Age.GetValueOrDefault()).ToArray <int>(); int[] usersAgeBetween26_40 = collection.Where(m => m.Age.GetValueOrDefault() >= 26 && m.Age.GetValueOrDefault() <= 40).Select(m => m.Age.GetValueOrDefault()).ToArray <int>(); int[] usersAgeBetween41_60 = collection.Where(m => m.Age.GetValueOrDefault() >= 41 && m.Age.GetValueOrDefault() <= 60).Select(m => m.Age.GetValueOrDefault()).ToArray <int>(); IPieChartItem total15_25 = new PieChartItem(); total15_25.Value = usersAgeBetween15_25.Length; total15_25.Legend = "15 - 25"; IPieChartItem total26_40 = new PieChartItem(); total26_40.Value = usersAgeBetween26_40.Length; total26_40.Legend = "26 - 40"; IPieChartItem total41_60 = new PieChartItem(); total41_60.Value = usersAgeBetween41_60.Length; total41_60.Legend = "41 - 60"; retorno.Add(total15_25); retorno.Add(total26_40); retorno.Add(total41_60); return(retorno); }
public IList <IPieChartItem> GetTotals() { IList <IPieChartItem> retorno = new List <IPieChartItem>(); IDataQuery query = new DataQuery(); IList <IViewActivityByHour> collection = _repository.Find(query); IList <IViewActivityByHour> dayList = collection.Where(m => m.Hour <= 17 && m.Hour >= 6).Select(m => m).ToList <IViewActivityByHour>(); IList <IViewActivityByHour> nightList = collection.Where(m => m.Hour >= 18 && m.Hour <= 23 || m.Hour >= 0 && m.Hour <= 5).Select(m => m).ToList <IViewActivityByHour>(); IPieChartItem totalNight = new PieChartItem(); totalNight.Value = nightList.Sum(m => m.TotalByHour).GetValueOrDefault(); totalNight.Legend = "Night"; IPieChartItem totalDay = new PieChartItem(); totalDay.Value = dayList.Sum(m => m.TotalByHour).GetValueOrDefault(); totalDay.Legend = "Day"; retorno.Add(totalNight); retorno.Add(totalDay); return(retorno); }
public IList<IPieChartItem> GetTotals() { IList<IPieChartItem> retorno = new List<IPieChartItem>(); IDataQuery query = new DataQuery(); IViewGenderTotal viewGenderTotal = _repository.Find(query).FirstOrDefault(); IPieChartItem totalFemale = new PieChartItem(); totalFemale.Value = ((decimal)(viewGenderTotal.Total * viewGenderTotal.TotalFemale) / 100); totalFemale.Legend = "Female"; IPieChartItem totalMale = new PieChartItem(); totalMale.Value = ((decimal)(viewGenderTotal.Total * viewGenderTotal.TotalMale) / 100); totalMale.Legend = "Male"; retorno.Add(totalMale); retorno.Add(totalFemale); return retorno; }
public IList <IPieChartItem> GetTotals() { IList <IPieChartItem> retorno = new List <IPieChartItem>(); IDataQuery query = new DataQuery(); IViewGenderTotal viewGenderTotal = _repository.Find(query).FirstOrDefault(); IPieChartItem totalFemale = new PieChartItem(); totalFemale.Value = ((decimal)(viewGenderTotal.Total * viewGenderTotal.TotalFemale) / 100); totalFemale.Legend = "Female"; IPieChartItem totalMale = new PieChartItem(); totalMale.Value = ((decimal)(viewGenderTotal.Total * viewGenderTotal.TotalMale) / 100); totalMale.Legend = "Male"; retorno.Add(totalMale); retorno.Add(totalFemale); return(retorno); }
public IList<IPieChartItem> GetTotals() { IList<IPieChartItem> retorno = new List<IPieChartItem>(); IDataQuery query = new DataQuery(); IList<IViewActivityByHour> collection = _repository.Find(query); IList<IViewActivityByHour> dayList = collection.Where(m => m.Hour <= 17 && m.Hour >= 6).Select(m => m).ToList<IViewActivityByHour>(); IList<IViewActivityByHour> nightList = collection.Where(m => m.Hour >= 18 && m.Hour <= 23 || m.Hour >= 0 && m.Hour <= 5).Select(m => m).ToList<IViewActivityByHour>(); IPieChartItem totalNight = new PieChartItem(); totalNight.Value = nightList.Sum(m => m.TotalByHour).GetValueOrDefault(); totalNight.Legend = "Night"; IPieChartItem totalDay = new PieChartItem(); totalDay.Value = dayList.Sum(m => m.TotalByHour).GetValueOrDefault(); totalDay.Legend = "Day"; retorno.Add(totalNight); retorno.Add(totalDay); return retorno; }