예제 #1
0
        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);
        }
예제 #2
0
 public void RemoveSavingValue(SavingValue savingValue)
 {
     using (var tx = Database.GetTransaction())
     {
         Database.Delete(savingValue);
         tx.Complete();
         CachedService.Clear(CachedServiceKeys.AllSavings);
     }
     LoadSavingsData();
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 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;
 }
예제 #6
0
 public virtual void RemoveValue(SavingValue value)
 {
     Values.Remove(value);
 }
예제 #7
0
        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;
        }
예제 #8
0
 public void RemoveSavingValue(SavingValue savingValue)
 {
     Budget.CancelWithdrawSavingValue(savingValue);
     DeleteRevenue(savingValue);
 }
예제 #9
0
 public virtual void CancelWithdrawSavingValue(SavingValue savingValue)
 {
     savingValue.Saving.Values.Remove(savingValue);
     SavingValues.Remove(savingValue);
 }
예제 #10
0
 public virtual void CancelWithdrawSavingValue(SavingValue savingValue)
 {
     savingValue.Saving.Values.Remove(savingValue);
     SavingValues.Remove(savingValue);
 }
예제 #11
0
 public virtual void RemoveValue(SavingValue value)
 {
     Values.Remove(value);
 }