Beispiel #1
0
 public void CrunchIncomes(List<Income>firstList,List<IncomeByCategory>secondList)
 {
     foreach(var income in firstList)
     {
         if(income.InTypeId != 1)
         {
             var rex = new IncomeByCategory
             {
                 Category = GetIncomeLabel(income),
                 Amount = income.InAmount
             };
             if(secondList.Count > 0)
             {
                 foreach(var incomeByCategory in secondList)
                 {
                     if(incomeByCategory.Category == rex.Category)
                     {
                         incomeByCategory.Amount += rex.Amount;
                         goto OUT;
                     }
                 }
                 secondList.Add(rex);
             }
             else
             {
                 secondList.Add(rex);
             }
     OUT:
             ;
         }
     }
 }
Beispiel #2
0
 public ActionResult IncomeByCategory([Bind(Prefix = "")] IncomeByCategory report)
 {
     return(viewReport(report));
 }
Beispiel #3
0
        /// <summary>
        /// Just going to test this chart out!
        /// An also how to use them :)
        /// </summary>
        private void MockData()
        {
            var mock = new List<MonthlyIncomeVsExpence>();
            var incomeMock = new List<IncomeByCategory>();
            var expenseMock = new List<ExpenseByCategory>();
            var months = new [] {"Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
            var categories = new[] {"Salary", "Other", "Website Design","Report Form Generator","Updates","Upgrades"};
            var categories2 = new[] {"Education", "Fast Food", "Transport", "Entertainment"};
            var random = new Random();
            foreach (var month in months)
            {
                var x = new MonthlyIncomeVsExpence
                {
                    Month = month,
                    Income = random.Next(1500, 15000),
                    Expense = random.Next(27, 5500)
                };
                mock.Add(x);
            }

            foreach (var category in categories)
            {
                var x = new IncomeByCategory {Amount = random.Next(1500, 5020), Category = category};
                incomeMock.Add(x);
            }

            foreach (var s in categories2)
            {
                var x = new ExpenseByCategory
                {
                    Amount = random.Next(1522, 7890),
                    Category = s
                };
                expenseMock.Add(x);
            }

            foreach (var incomeByCategory in incomeMock)
            {
                var x = new PieDataPoint
                {
                    Label = incomeByCategory.Category,
                    Value = incomeByCategory.Amount,
                    //OffsetFromCenter=0.2
                };
                IncomePieSeries.DataPoints.Add(x);
            }

            foreach (var expenseByCategory in expenseMock)
            {
                var x = new PieDataPoint
                {
                    Label = expenseByCategory.Category,
                    Value = expenseByCategory.Amount,
                   // OffsetFromCenter = 0.2
                };
                ExpensePieSeries.DataPoints.Add(x);
            }
        }