/// <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); } }
/// <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); } }
/// <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); } }
internal abstract bool UpdateRecord(BudgetRecord record, decimal amount, Category category, BudgetType budgetType, int onDay, int selectedMonth, int selectedYear);
internal abstract bool AddRecord(decimal amount, Category category, BudgetType budgetType, int onDay, int selectedMonth, int selectedYear, out BudgetRecord newRecord);
internal abstract bool DeleteRecord(BudgetRecord record);