public MoneyGridRow Copy()
        {
            MoneyGridRow copy = new MoneyGridRow(this.Group, this.Category);

            copy.IsSum      = this.IsSum;
            copy.Values     = this.Values.Copy();
            copy.Percentage = this.Percentage;

            return(copy);
        }
Example #2
0
        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);
        }