Beispiel #1
0
        //Gloabal/Basic interaction
        public void CreateAccount(AccountType accountType)
        {
            Account newAccount;

            //Handling new account events
            AccountCreated       = EventsOutput.ShowAccountMessage;
            AccountCashTransited = EventsOutput.ShowAccountMessage;
            AccountInfoDisplayed = EventsOutput.ShowAccountMessage;


            //Creating new account and adding it to the list of accounts
            if (_numberOfAccounts < 2 && accounts.Exists(x => x._accountType == accountType) == false)
            {
                switch (accountType)
                {
                case AccountType.Personal:

                    newAccount = new PersonalAccount(0);
                    accounts.Add(newAccount);
                    AccountCreated(newAccount, new AccountEventArgs("Создан персональный счет, текущий баланс: " + newAccount.CurrentBalance, newAccount.CurrentBalance));
                    break;

                case AccountType.Family:
                    newAccount = new FamilyAccount(0);
                    accounts.Add(newAccount);
                    AccountCreated(newAccount, new AccountEventArgs("Создан семейный счет, текущий баланс: " + newAccount.CurrentBalance, newAccount.CurrentBalance));
                    break;
                }
                _numberOfAccounts++;
            }
            else
            {
                AccountExists(this, new WalletEventArgs("У вас уже присутсвуют счета таких типов"));
            }
        }
Beispiel #2
0
        public void AddCoowner(string coOwnerName)
        {
            FamilyAccount account = accounts.Find(x => x._accountType == AccountType.Family) as FamilyAccount;

            if (account != null)
            {
                account.AddCoOwner(coOwnerName);
            }
            else
            {
                CoOwnerAdded(this, new WalletEventArgs("Не найдено семейного аккаунта."));
            }
        }
Beispiel #3
0
        public void ShowCoOwnersFlowInfo()
        {
            try
            {
                FamilyAccount account = accounts.Find(x => x._accountType == AccountType.Family) as FamilyAccount;
                foreach (CoOwner owner in account._coOwners)
                {
                    //Handling displaying events for expenses
                    AccountInfoDisplayed(owner, new AccountEventArgs("Расходы для текущего счета совладельца " + owner.Name + ": ", account.CurrentBalance));
                    foreach (CashFlow expense in owner._pesonCashFlowList)
                    {
                        if (expense is Expense)
                        {
                            AccountInfoDisplayed(expense, new AccountEventArgs("Расходы по статье " + expense.ItemName + " составляют: " + expense.BudgetChangeValue, expense.BudgetChangeValue));
                        }
                    }
                    AccountInfoDisplayed(owner, new AccountEventArgs("Суммарные месячные расходы: " + owner.GetMonthlyExpense(), owner.GetMonthlyExpense()));


                    //Handling displaying events for income
                    AccountInfoDisplayed(account, new AccountEventArgs("Доходы для текущего счета совладельца " + owner.Name + ": ", account.CurrentBalance));
                    foreach (CashFlow income in owner._pesonCashFlowList)
                    {
                        if (income is Income)
                        {
                            AccountInfoDisplayed(income, new AccountEventArgs("Доходы по статье " + income.ItemName + " составляют: " + income.BudgetChangeValue, income.BudgetChangeValue));
                        }
                    }
                    AccountInfoDisplayed(owner, new AccountEventArgs("Суммарные месячные доходы: " + owner.GetMonthlyIncome(), owner.GetMonthlyIncome()));
                }
            }
            catch (Exception)
            {
                AccountInfoDisplayed(this, new AccountEventArgs("В аккаунт не было добавлено совладельцев: "));
            }
        }
Beispiel #4
0
        public void AddCoownerIncome(string incomeName, decimal value, string coOwnerName)
        {
            FamilyAccount account = accounts.Find(x => x._accountType == AccountType.Family) as FamilyAccount;

            account.AddIncome(incomeName, value, coOwnerName);
        }
Beispiel #5
0
        public void AddCoownerExpense(string expenseName, decimal value, string coOwnerName)
        {
            FamilyAccount account = accounts.Find(x => x._accountType == AccountType.Family) as FamilyAccount;

            account.AddExpense(expenseName, value, coOwnerName);
        }