private void buttonUpdateWithdraw_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridViewWithdraw.Rows.Count == 0)
                {
                    MessageBox.Show("Please add the data to the table.",
                                    "Withdraw .", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                else
                {
                    customer = DataBaseOperations.GetIdAccount(customerWithdraw.account.Iban);

                    DataBaseOperations.UpdateWithdraw(customerWithdraw.WithdrawAmount,
                                                      modeWithdraw, customer, customerWithdraw);

                    MessageBox.Show($"Withdraw with iban {customerWithdraw.account.Iban} was successful .",
                                    "Withdraw .", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);

                    textBoxIbanWithdraw.Clear();
                    textBoxNameCustomerWithdraw.Clear();
                    textBoxEGNCustomerWithdraw.Clear();
                    textBoxAccountBalanceWithdraw.Clear();
                    textBoxAmountWithdraw.Clear();
                    dataGridViewWithdraw.Rows.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        private void buttonUpdateDeposit_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridViewDeposit.Rows.Count == 0)
                {
                    MessageBox.Show("Please add the data to the table.",
                                    "Deposit .", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                else
                {
                    customer = DataBaseOperations.GetIdAccount(customerDeposit.account.Iban);

                    DataBaseOperations.UpdateDeposit(customerDeposit.DepositAmount,
                                                     customer, customerDeposit);

                    MessageBox.Show($"Deposit with iban {customerDeposit.account.Iban} was successful .",
                                    "Deposit ", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);

                    textBoxIbanDeposit.Clear();
                    textBoxNameCustomerDeposit.Clear();
                    textBoxEgnCustomerDeposit.Clear();
                    textBoxAccountBalanceDeposit.Clear();
                    textBoxDepositAmount.Clear();
                    dataGridViewDeposit.Rows.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }