Пример #1
0
 /// <summary>
 /// Deletes budget record.
 /// </summary>
 /// <param name="record"></param>
 /// <returns></returns>
 public bool DeleteRecord(BudgetRecord record)
 {
     if (storage.DeleteRecord(record))
     {
         if (record.Month == currentMonth && record.Year == currentYear)
         {
             // Spending table has changed
             RaisePropertyChanged(nameof(CurrentMonthSpendings));
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #2
0
 /// <summary>
 /// Adds budget record.
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="category"></param>
 /// <param name="budgetType"></param>
 /// <param name="onDay"></param>
 /// <param name="selectedMonth"></param>
 /// <param name="selectedYear"></param>
 /// <param name="newRecord"></param>
 /// <returns></returns>
 public bool AddRecord(
     decimal amount, Category category, BudgetType budgetType,
     int onDay, int selectedMonth, int selectedYear,
     out BudgetRecord newRecord)
 {
     if (storage.AddRecord(
             amount, category, budgetType, onDay, selectedMonth, selectedYear, out newRecord))
     {
         if (newRecord.Month == currentMonth && newRecord.Year == currentYear)
         {
             // Spending table has changed
             RaisePropertyChanged(nameof(CurrentMonthSpendings));
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #3
0
        /// <summary>
        /// Updates properties of the budget record.
        /// </summary>
        /// <param name="record"></param>
        /// <param name="amount"></param>
        /// <param name="category"></param>
        /// <param name="budgetType"></param>
        /// <param name="onDay"></param>
        /// <param name="selectedMonth"></param>
        /// <param name="selectedYear"></param>
        /// <returns></returns>
        public bool UpdateRecord(BudgetRecord record,
                                 decimal amount, Category category, BudgetType budgetType,
                                 int onDay, int selectedMonth, int selectedYear)
        {
            bool updateFlag = (record.Month == currentMonth && record.Year == currentYear) ||
                              (selectedMonth == currentMonth && selectedYear == currentYear);

            if (storage.UpdateRecord(record, amount, category, budgetType, onDay, selectedMonth, selectedYear))
            {
                if (updateFlag)
                {
                    // Spending table has changed
                    RaisePropertyChanged(nameof(CurrentMonthSpendings));
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
 internal abstract bool UpdateRecord(BudgetRecord record, decimal amount, Category category, BudgetType budgetType, int onDay, int selectedMonth, int selectedYear);
Пример #5
0
 internal abstract bool AddRecord(decimal amount, Category category, BudgetType budgetType, int onDay, int selectedMonth, int selectedYear, out BudgetRecord newRecord);
Пример #6
0
 internal abstract bool DeleteRecord(BudgetRecord record);