internal List <MonthlyIncome> GetMonthlyIncomes()
        {
            List <MonthlyIncome> itemsChart = new List <MonthlyIncome>();

            var groupedIncomings = (from i in Incomings
                                    where i.Category != null && i.Category.Name.Equals("Performance")
                                    group i by new { month = i.Date.Month, year = i.Date.Year } into d
                                    select new
            {
                dt = string.Format("{0}/{1}", d.Key.month, d.Key.year),
                count = d.Count()
            }).OrderByDescending(g => g.dt);

            foreach (var item in groupedIncomings)
            {
                var ic = itemsChart.Where(i => i.Date.Equals(DateTime.Parse("01/" + item.dt))).FirstOrDefault();
                if (ic == null)
                {
                    ic = new MonthlyIncome(item.dt);
                    itemsChart.Add(ic);
                }
                ic.SetIncoming(Incomings.Where(i => i.Date.Month.Equals(ic.Date.Month) &&
                                               i.Date.Year.Equals(ic.Date.Year) &&
                                               i.Category != null &&
                                               i.Category.Name.Equals("Performance")).Sum(i => i.Value));
            }

            return(itemsChart.OrderByDescending(i => i.Date).ToList());
        }
Example #2
0
        internal void AddIncoming(double value, DateTime date, Account account, ItemCategory category)
        {
            var incoming = new Incoming(date, account, value, category);

            Incomings.Add(incoming);
            incoming.Move(value);
            SaveAccounts();
            SaveIncomings();
        }
            internal void AssertValid()
            {
                Debug.Assert(Outgoing != null);        // We don't allow isolated vertices (but might later)
                Debug.Assert(Outgoing.Source == this); // Checks some of the halfedge hookup

                if (IsBoundary)
                {
                    // Condition ensuring Outgoing of a Boundary Vertex is the Boundary Halfedge
                    Debug.Assert(Outgoing.IsBoundary);
                    // Condition ensuring Manifold property for vertices
                    Debug.Assert(Incomings.Count(he => he.Edge.IsBoundary) <= 2);
                }
            }
        public List <ItemChartMonthly> GetItensChartMonthly()
        {
            List <ItemChartMonthly> itemCharts = new List <ItemChartMonthly>();

            var groupedIncomings = (from i in Incomings
                                    group i by new { month = i.Date.Month, year = i.Date.Year } into d
                                    select new {
                dt = string.Format("{0}/{1}", d.Key.month, d.Key.year),
                count = d.Count()
            }).OrderByDescending(g => g.dt);

            var groupedExpenses = (from e in Expenses
                                   group e by new { month = e.Date.Month, year = e.Date.Year } into d
                                   select new
            {
                dt = string.Format("{0}/{1}", d.Key.month, d.Key.year),
                count = d.Count()
            }).OrderByDescending(g => g.dt);

            foreach (var item in groupedIncomings)
            {
                var ic = itemCharts.Where(i => i.Date.Equals(DateTime.Parse("01/" + item.dt))).FirstOrDefault();
                if (ic == null)
                {
                    ic = new ItemChartMonthly(item.dt);
                    itemCharts.Add(ic);
                }
                ic.SetIncoming(Incomings.Where(i => i.Date.Month.Equals(ic.Date.Month) && i.Date.Year.Equals(ic.Date.Year)).Sum(i => i.Value));
            }

            foreach (var item in groupedExpenses)
            {
                var ic = itemCharts.Where(i => i.Date.Equals(DateTime.Parse("01/" + item.dt))).FirstOrDefault();

                if (ic == null)
                {
                    ic = new ItemChartMonthly(item.dt);
                    itemCharts.Add(ic);
                }
                ic.SetExpense(Expenses.Where(e => e.Date.Month.Equals(ic.Date.Month) && e.Date.Year.Equals(ic.Date.Year)).Sum(e => e.Value));
            }

            return(itemCharts.OrderByDescending(i => i.Date).ToList());
        }
Example #5
0
 internal void DeleteIncoming(Incoming incoming)
 {
     Incomings.Remove(incoming);
     SaveIncomings();
     SaveAccounts();
 }