Example #1
0
 public static Boolean Get(Category cat)
 {
     var db = new BudgetEntities();
     var query = from category in db.Categories
                 where category.Guid == cat.Guid
                 select category;
     return (query.Count() > 0);
 }
Example #2
0
        public static IEnumerable<Transaction> GetTransactions(Category selectedCategory = null, int year = default(int))
        {
            var db = new BudgetEntities();
            var query = from transaction in db.Transactions
                        select transaction;

            // if a year is specified just get transactions for that year
            if (year != default(int))
                query = query.Where(p => p.Date.Year == year);

            // if a category is specified, only get transactions for that category
            if (selectedCategory != null)
                query = query.Where(p => p.TransactionCategories.Any(q => q.Category == selectedCategory.Guid));

            // order by
            query = query.OrderBy(p => p.Date).ThenBy(q => q.Payee1.Name);

            return query;
        }
 public TransactionLogWindow(Category cat)
     : this()
 {
     _selectedCategory = cat;
 }