Exemplo n.º 1
0
        private void S_pay_btn_Click(object sender, EventArgs e)
        {
            //Validate the input
            int amount = 0;

            if (S_IBAN_textBox.Text == String.Empty)
            {
                MessageBox.Show("Empty IBAN Box ", "Empty Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                S_IBAN_textBox.Focus();
            }
            else if (S_AmountTextBox.Text == String.Empty)
            {
                MessageBox.Show("Empty Amount Box ", "Empty Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                S_AmountTextBox.Focus();
            }
            else
            {
                if (int.TryParse(S_AmountTextBox.Text, out amount))
                {
                    try
                    {
                        var msg = MessageBox.Show("Are you sure to transfer " + amount.ToString("c"), "Transfer Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (msg == DialogResult.Yes)
                        {
                            OnlineBankingSystemDBDataset.MoneyTransferRow Transfer;
                            Transfer          = onlineBankingSystemDBDataset1.MoneyTransfer.NewMoneyTransferRow();
                            Transfer.IBAN     = S_IBAN_textBox.Text;
                            Transfer.Amount   = amount;
                            Transfer.Comment  = S_CommentTextBox.Text;
                            Transfer.UserName = get_Name();
                            onlineBankingSystemDBDataset1.MoneyTransfer.Rows.Add(Transfer);
                            Amount_Balance -= amount;

                            MessageBox.Show("Money transfer successfully", "Transfer Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (Exception dataentry)
                    {
                        MessageBox.Show(dataentry.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect Amount", "Error Detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    S_AmountTextBox.Focus();
                    S_AmountTextBox.SelectAll();
                }
            }
        }
Exemplo n.º 2
0
        private void R_PayBtn_Click(object sender, EventArgs e)
        {
            int amount = 0;

            if (R_IBANTextBox.Text == String.Empty)
            {
                MessageBox.Show("Empty IBAN Box ", "Empty Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                R_IBANTextBox.Focus();
            }
            else if (R_AmountTextBox.Text == String.Empty)
            {
                MessageBox.Show("Empty Amount Box ", "Empty Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                R_AmountTextBox.Focus();
            }
            else
            {
                if (int.TryParse(R_AmountTextBox.Text, out amount))
                {
                    try
                    {
                        var msg = MessageBox.Show("Are you sure to request " + amount.ToString("c"), "Request Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (msg == DialogResult.Yes)
                        {
                            moneyRequestTableAdapter.Insert
                            (
                                R_IBANTextBox.Text,
                                amount,
                                R_CommentTextBox.Text,
                                get_Name()
                            );

                            MessageBox.Show("Money Requested successfully", "Request Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (Exception dataentry)
                    {
                        MessageBox.Show(dataentry.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect Amount", "Error Detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    S_AmountTextBox.Focus();
                    S_AmountTextBox.SelectAll();
                }
            }
        }