Пример #1
0
 public CategoryTransactionsReportViewModel(IAccountStorage accountStorage, ICategoryStorage categoryStorage, ITransactionStorage transactionStorage)
 {
     _accountStorage     = accountStorage ?? throw new ArgumentNullException(nameof(accountStorage));
     _categoryStorage    = categoryStorage ?? throw new ArgumentNullException(nameof(categoryStorage));;
     _transactionStorage = transactionStorage ?? throw new ArgumentNullException(nameof(transactionStorage));
     _filteredSource     = new TransactionFilteredSource(DateTime.Now, DateTime.Now);
     Accounts            = new ObservableCollection <IAccount>(_accountStorage.GetAllAccounts());
     Categories          = new ObservableCollection <ICategory>(_categoryStorage.MakeFlatCategoryTree());
     StartDate           = DateTimeOffset.Now;
     EndDate             = StartDate;
 }
Пример #2
0
 public EditCategoryViewModel(ICategoryStorage categoryStorage, ICategory category, ICategory parent)
 {
     _categoryStorage = categoryStorage;
     Categories       = _categoryStorage.MakeFlatCategoryTree();
     if (category != null)
     {
         _category   = category;
         Name        = category.Name;
         Description = category.Description;
         if (category.Parent != null)
         {
             ParentCategory = Categories.FirstOrDefault(x => x.Id == category.Parent.Id);
         }
     }
     else
     {
         if (parent != null)
         {
             ParentCategory = Categories.FirstOrDefault(x => x.Id == parent.Id);
         }
     }
 }
Пример #3
0
 private void FillTheCache()
 {
     _cache = _storage.GetAllCategories();
     _flatCategoriesCache = _storage.MakeFlatCategoryTree();
     _isDirty             = false;
 }