예제 #1
0
        private void PopulateData()
        {
            ExpenseData = new ObservableCollection <Expense>(_queryHandler.GetDataByCategory());

            //TotalValue = ExpenseData.Sum(var => var.Amount).ToString();
            ////await Task.Run(() =>
            //{
            //    var yearlyExpenses = ExpenseData.GroupBy(year => year.Time.Year).ToList();

            //    foreach (var yearlyExpense in yearlyExpenses)
            //    {
            //        YearlyExpenseData yearlyExpenseData = new YearlyExpenseData { Year = yearlyExpense.Key };

            //        var monthlyExpenseDetails = yearlyExpense.GroupBy(month => month.Time.ToString("MMM")).ToList();


            //        foreach (var monthlyExpense in monthlyExpenseDetails)
            //        {
            //            yearlyExpenseData.MonthlyData.Add(new MonthlyExpenseData() { Month = monthlyExpense.Key, Amount = monthlyExpense.Sum(var => var.Amount) });
            //        }

            //        yearlyExpenseData.TotalExpense = yearlyExpenseData.MonthlyData.Sum(var => var.Amount);

            //        YearWiseExpenses.Add(yearlyExpenseData);
            //    }
            //    //});
            //}
        }