private void Pay_btn_Click(object sender, EventArgs e)
        {
            double amount = 0;

            if (Markets_combbox.SelectedIndex == -1)
            {
                MessageBox.Show("Please select the market to complete the transaction", "Market Admin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Markets_combbox.Focus();
            }
            else if (Invoice_textBox.Text == string.Empty)
            {
                MessageBox.Show("Enter the invoice number", "Invoice Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Invoice_textBox.Focus();
            }
            else if (Amount_textBox.Text == string.Empty)
            {
                MessageBox.Show("Enter the amount", "Amount", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Amount_textBox.Focus();
            }
            else
            {
                if (double.TryParse(Amount_textBox.Text, out amount))
                {
                    var Msg = MessageBox.Show("Are you sure  to send " + amount.ToString("c") + " ?", "Funds Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (Msg == DialogResult.Yes)
                    {
                        try
                        {
                            OnlineBankingSystemDBDataset.PaysRow pay;
                            pay            = onlineBankingSystemDBDataset1.Pays.NewPaysRow();
                            pay.Shop_Name_ = Markets_combbox.SelectedItem.ToString();
                            pay.Invoice_No = Invoice_textBox.Text;
                            pay.Comment    = Comment_textBoxx.Text;
                            pay.User_Name  = Get_Name();
                            onlineBankingSystemDBDataset1.Pays.Rows.Add(pay);
                            MessageBox.Show("Funds send successfully", "Funds manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Account_Balance -= amount;
                        }
                        catch (Exception ErrorEntry)
                        {
                            MessageBox.Show(ErrorEntry.Message, "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Error Number Format ", "Number Format", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Amount_textBox.Focus();
                    Amount_textBox.SelectAll();
                }
            }
        }
Beispiel #2
0
 //TODO: Add transfer on other account logic.
 private void Transfer_buttonClick(object sender, EventArgs e)
 {
     if (cards.Any(c => c == CardNumber_textBox.Text))
     {
         if (Card.Balance > int.Parse(Amount_textBox.Text) && int.Parse(Amount_textBox.Text) <= Card.DailyLimit)
         {
             Card.Balance -= int.Parse(Amount_textBox.Text);
             BalanceChangeable_label.Text = Card.Balance.ToString();
         }
         else
         {
             MessageBox.Show("Not enough money on balance or ammount exceeded daily limit. Enter different ammount!");
             Amount_textBox.Clear();
         }
     }
 }