Ejemplo n.º 1
0
 private void ButtonBalance_Click(object sender, EventArgs e)
 {
     List <string>[] Data1 = Ac1.GetInfo(card_number);
     if (lang == 1)
     {
         labelBalance.Text = "Баланс рахунку:\n" + string.Join(",", Data1[7].ToArray()) + " ГРН";
     }
     if (lang == 2)
     {
         labelBalance.Text = "Account balance:\n" + string.Join(",", Data1[7].ToArray()) + " UAH";
     }
     TabFrames1.SelectedTab = tabBalance;
 }
Ejemplo n.º 2
0
        private void ButtonNextT1_Click(object sender, EventArgs e)
        {
            if (textTAmount.Text == "" || !maskedTCardNumber.MaskCompleted)
            {
                if (lang == 1)
                {
                    MessageBox.Show("Введіть дані ще раз.", "Невірні дані", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (lang == 2)
                {
                    MessageBox.Show("Enter the data again.", "Incorrect data", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                Account Ac2 = new Account();

                List <string>[] Data2 = Ac2.GetInfo(maskedTCardNumber.Text);
                List <string>[] Data1 = Ac1.GetInfo(card_number);
                if (string.Join(",", Data2[0].ToArray()) == "")
                {
                    if (lang == 1)
                    {
                        MessageBox.Show("Користувача з таким рахунком не знайдено", "Невірні дані", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    if (lang == 2)
                    {
                        MessageBox.Show("No user with this account was found.", "Incorrect data", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    double From_old_balance, From_new_balance;
                    double To_old_balance, To_new_balance;
                    From_old_balance = Convert.ToDouble(string.Join(",", Data1[7].ToArray()));
                    To_old_balance   = Convert.ToDouble(string.Join(",", Data2[7].ToArray()));

                    if (From_old_balance < Convert.ToDouble(textTAmount.Text))
                    {
                        if (lang == 1)
                        {
                            MessageBox.Show("На рахунку недостатньо коштів. Введіть іншу суму",
                                            "Недостатьно коштів на рахунку", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else if (lang == 2)
                        {
                            MessageBox.Show("There is not enough money in the account. " +
                                            "Enter a different amount", "Not enought money", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        textTAmount.Text = "";
                    }
                    else
                    {
                        From_new_balance = From_old_balance - Convert.ToDouble(textTAmount.Text);
                        To_new_balance   = To_old_balance + Convert.ToDouble(textTAmount.Text);
                        Ac1.Withdraw(card_number, string.Format("{0:0.00}", From_new_balance), string.Format("{0:0.00}", From_old_balance));
                        Ac2.Withdraw(maskedTCardNumber.Text, string.Format("{0:0.00}", To_new_balance), string.Format("{0:0.00}", To_old_balance));
                        if (lang == 1)
                        {
                            MessageBox.Show("Операція пройшла успішна", "Результат", MessageBoxButtons.OK);
                        }
                        if (lang == 2)
                        {
                            MessageBox.Show("The operation was successful", "Result", MessageBoxButtons.OK);
                        }
                        textTAmount.Text       = "";
                        maskedTCardNumber.Text = "";
                        TabFrames1.SelectedTab = tabMainMenu;
                    }
                }
                Ac2.Dispose();
            }
        }