public CheckedListItem <T> Copy() { CheckedListItem <T> copy = new CheckedListItem <T>(); copy.Item = this.Item; copy.IsChecked = this.IsChecked; copy.IsHidden = this.IsHidden; return(copy); }
public bool Filter(MoneyGridRow row) { bool result = true; if (this.CategoryFilterActive) { CheckedListItem <Category> category = this.CategoryFilter.FirstOrDefault(x => (x.Item as Category).Equals(row.Category)); if (category == null || !category.IsChecked) { result = false; } } if (this.MonthFilterActive) { for (int i = 0; i < 12; i++) { if (i < this.StartMonth || i > this.EndMonth) { row.Values[i] = 0.0M; } } } if (this.GroupFilterActive) { CheckedListItem <Group> group = this.GroupFilter.FirstOrDefault(x => (x.Item as Group).Equals(row.Group)); if (group == null || !group.IsChecked) { result = false; } } if (this.IncomeFilterActive) { switch (this.IncomeFilter) { case IncomeFilterOption.Both: break; case IncomeFilterOption.Income: result = row.Group.IsIncome ? result : false; break; case IncomeFilterOption.Expenditures: result = row.Group.IsIncome ? false : result; break; default: result = false; break; } } return(result); }
public bool Filter(Transaction transaction, Group transactionGroup) { bool result = true; if (this.DateFilterActive && (transaction.Date < this.StartDate || transaction.Date > this.EndDate)) { result = false; } if (this.CategoryFilterActive) { CheckedListItem <Category> category = this.CategoryFilter.FirstOrDefault(x => (x.Item as Category).Equals(transaction.Category)); if (category == null || !category.IsChecked) { result = false; } } if (this.GroupFilterActive) { CheckedListItem <Group> group = this.GroupFilter.FirstOrDefault(x => (x.Item as Group).Equals(transactionGroup)); if (group == null || !group.IsChecked) { result = false; } } if (this.IncomeFilterActive) { switch (this.IncomeFilter) { case IncomeFilterOption.Both: break; case IncomeFilterOption.Income: result = transactionGroup.IsIncome ? result : false; break; case IncomeFilterOption.Expenditures: result = transactionGroup.IsIncome ? false : result; break; default: result = false; break; } } return(result); }