public virtual SavingValue WithdrawSavingValue(Saving saving, decimal value, DateTime date, string description) { SavingValue SavingValue = saving.Withdraw(value, date, description, this); SavingValues.Add(SavingValue); return(SavingValue); }
public void RemoveSavingValue(SavingValue savingValue) { using (var tx = Database.GetTransaction()) { Database.Delete(savingValue); tx.Complete(); CachedService.Clear(CachedServiceKeys.AllSavings); } LoadSavingsData(); }
public virtual SavingValue Withdraw(decimal value, DateTime date, string description, Budget withdrawToBudget) { SavingValue newSavingValue = new SavingValue { Saving = this, Date = date, Value = -value, Description = description, Budget = withdrawToBudget, Expense = new Expense(), }; newSavingValue.UpdateDescription(); Values.Add(newSavingValue); return(newSavingValue); }
public virtual SavingValue Deposit(Expense depositSource, decimal value, DateTime date, string description = null) { SavingValue newSavingValue = new SavingValue { Date = date, Value = value, Saving = this, Description = description, Expense = depositSource, }; if (depositSource != null) { newSavingValue.Budget = depositSource.Budget; newSavingValue.UpdateDescription(); } Values.Add(newSavingValue); return(newSavingValue); }
public virtual SavingValue Withdraw(decimal value, DateTime date, string description, Budget withdrawToBudget) { SavingValue newSavingValue = new SavingValue { Saving = this, Date = date, Value = -value, Description = description, Budget = withdrawToBudget, Expense = new Expense(), }; newSavingValue.UpdateDescription(); Values.Add(newSavingValue); return newSavingValue; }
public virtual void RemoveValue(SavingValue value) { Values.Remove(value); }
public virtual SavingValue Deposit(Expense depositSource, decimal value, DateTime date, string description = null) { SavingValue newSavingValue = new SavingValue { Date = date, Value = value, Saving = this, Description = description, Expense = depositSource, }; if (depositSource != null) { newSavingValue.Budget = depositSource.Budget; newSavingValue.UpdateDescription(); } Values.Add(newSavingValue); return newSavingValue; }
public void RemoveSavingValue(SavingValue savingValue) { Budget.CancelWithdrawSavingValue(savingValue); DeleteRevenue(savingValue); }
public virtual void CancelWithdrawSavingValue(SavingValue savingValue) { savingValue.Saving.Values.Remove(savingValue); SavingValues.Remove(savingValue); }