Esempio n. 1
0
        private void buttonFirstDeposit_Click(object sender, EventArgs e)
        {
            if (!CheckDataInOpenFiscalYear()) return;
            try
            {
                _savingsBookProduct = _saving.Product;
                var openSavingsForm = new OpenSavingsForm(_saving.InitialAmount, _saving.EntryFees, _savingsBookProduct, false);
                DialogResult result = openSavingsForm.ShowDialog();

                if (result == DialogResult.OK)
                {
                    SavingServices.FirstDeposit(_saving, openSavingsForm.InitialAmount, TimeProvider.Now, openSavingsForm.EntryFees,
                        User.CurrentUser, Teller.CurrentTeller);
                    SavingServices.UpdateInitialData(_saving.Id, openSavingsForm.InitialAmount, openSavingsForm.EntryFees);
                    _saving = SavingServices.GetSaving(_saving.Id);

                    for (int i = 0; i < _client.Savings.Count(); i++)
                    {
                        if (_client.Savings[i].Id == _saving.Id)
                        {
                            _client.Savings[i] = _saving;
                        }
                    }

                    tBSavingCode.Text = _saving.Code;
                    DisplaySaving(_saving);
                    DisplaySavings(_client.Savings);
                    DisplaySavingEvent(_saving);
                    pnlSavingsButtons.Enabled = true;
                    buttonFirstDeposit.Visible = false;
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
Esempio n. 2
0
        private void buttonReopenSaving_Click(object sender, EventArgs e)
        {
            if (_saving is SavingBookContract)
            {
                try
                {
                    ServicesProvider.GetInstance().GetAccountingServices().FindExchangeRate(TimeProvider.Now, _saving.Product.Currency);

                    var openSavingsForm = new OpenSavingsForm(_saving.Product.InitialAmountMin, nudReopenFees.Value, _saving.Product, true);
                    DialogResult result = openSavingsForm.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        _saving.ReopenFees = openSavingsForm.EntryFees;
                        SavingServices.Reopen(openSavingsForm.InitialAmount, _saving, TimeProvider.Now, User.CurrentUser, _client);

                        _saving = SavingServices.GetSaving(_saving.Id);
                        DisplaySaving(_saving);
                        DisplaySavings(_client.Savings);
                        buttonReopenSaving.Visible = false;
                        buttonCloseSaving.Visible = true;
                    }
                }
                catch (Exception ex)
                {
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                    return;
                }
            }
            else
            {
                MessageBox.Show(@"Only SavingsBook accounts can be reopened!");
            }
        }