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