Exemple #1
0
        private void textBoxWriteIBAN_OnValueChanged(object sender, EventArgs e)
        {
            string getIBANfromTextBox = textBoxWriteIBAN.Text;
            Page   pg = new Page();

            using (var context = new MitBankDBEntities2())
            {
                var result = context.getAnyoneCurrency(getIBANfromTextBox).ToArray();
                if (result.Length != 0)
                {
                    pictureValid.Visible  = true;
                    pictureFailed.Visible = false;
                    var result2 = context.getAnyoneCurrency(getIBANfromTextBox.ToString()).ToArray();
                    foreach (var item in result2)
                    {
                        labelcurrencyToIban.Text = item.ToString();
                    }
                }
                else
                {
                    pictureFailed.Visible    = true;
                    pictureValid.Visible     = false;
                    labelcurrencyToIban.Text = "-";
                }
            }
        }
Exemple #2
0
        private void bunifuFlatButton3_Click(object sender, EventArgs e)
        {
            lastMenupanel.Visible     = false;
            panelMainTransfer.Visible = true;
            lastMenupanel.SendToBack();
            lastMenupanel = panelMainTransfer;


            using (var context = new MitBankDBEntities2())
            {
                List <Page> listIban = new List <Page>();
                listIban = DataManagement.getIbanList();
                foreach (var item in listIban)
                {
                    int index = -1;
                    index = comboBoxIBAN.FindString(item.Data.ToString());

                    if (index == -1)
                    {
                        comboBoxIBAN.Items.Add(item.Data.ToString());
                    }
                }
                if (listIban.Count() != 0)
                {
                    comboBoxIBAN.SelectedIndex           = 0;
                    comboBoxSelectTransfer.SelectedIndex = 0;
                }
            }
        }
Exemple #3
0
        public Form2()
        {
            InitializeComponent();
            panelMainDashboard.BackColor    = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainPaySomething.BackColor = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainSendMail.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainSettings.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainTransfer.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);

            panelMainDashboard.Visible    = true;
            panelMainPaySomething.Visible = false;
            panelMainSendMail.Visible     = false;
            panelMainTransfer.Visible     = false;
            panelMainSettings.Visible     = false;

            pictureFailed.Visible = false;
            pictureValid.Visible  = false;
            lastMenupanel         = panelMainDashboard;

            UIDashboardAccountFrame.generateDashboard(ibanList, panelMainDashboard, exchangeTbl);
            labelLastName.Text = DataManagement.getLastName();
            using (var context = new MitBankDBEntities2())
            {
                var result2 = context.getLastLogin(DataManagement.getIdUsername());
                foreach (var item in result2)
                {
                    labelLastLogin.Text = item.ToString();
                }
            }
        }
Exemple #4
0
 private void label11_Click(object sender, EventArgs e)
 {
     using (var context = new MitBankDBEntities2())
     {
         var result = context.insertLastLogin(DataManagement.getIdUsername(), DateTime.Now.ToString());
     }
     Application.Exit();
 }
Exemple #5
0
        private void comboBoxToTransferMyIBAN_SelectedIndexChanged(object sender, EventArgs e)
        {
            string currencyFromIBAN = "-";
            string currencyToIBAN   = "-";

            using (var context = new MitBankDBEntities2())
            {
                if (comboBoxToTransferMyIBAN.SelectedIndex != -1)
                {
                    var result = context.getAnyoneCurrency(comboBoxToTransferMyIBAN.Text).ToArray();
                    foreach (var item in result)
                    {
                        currencyToIBAN = item.ToString();
                    }
                    labelcurrencyToIban.Text = currencyToIBAN;
                }
            }
        }
Exemple #6
0
        private void logoutButton_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Are you sure?", "Info",
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                using (var context = new MitBankDBEntities2())
                {
                    var result2 = context.insertLastLogin(DataManagement.getIdUsername(), DateTime.Now.ToString());
                }
                this.Hide();
                Form1 frm = new Form1();
                this.Refresh();
                this.Invalidate();
                frm.Refresh();
                frm.Invalidate();
                frm.Show();
            }
        }
Exemple #7
0
        private void buttonSubmitTransfer_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo);

            try
            {
                if (dialogResult == DialogResult.Yes)
                {
                    double ValWithouComiss = 0;

                    ValWithouComiss = double.Parse(textoxValueToTransfer.Text);

                    double comiss = 0;

                    comiss = double.Parse(labelComisionValue.Text);

                    double valToTransfer = 1;
                    if (labelExchangeValue.Text != "-")
                    {
                        valToTransfer = double.Parse(labelExchangeValue.Text);
                    }

                    double getsold = 0;
                    if (labelComisionValue.Text != "-")
                    {
                        using (var context = new MitBankDBEntities2())
                        {
                            var result = DataManagement.getSold(comboBoxIBAN.SelectedItem.ToString());

                            getsold = double.Parse(result.Data);
                        }
                        if (getsold > (ValWithouComiss + comiss))
                        {
                            using (var context = new MitBankDBEntities2())
                            {
                                if (comboBoxSelectTransfer.SelectedItem.ToString() == "My another account")
                                {
                                    var result = context.transferMoney(comboBoxIBAN.SelectedItem.ToString(),
                                                                       comboBoxToTransferMyIBAN.SelectedItem.ToString(), ((ValWithouComiss + comiss)),
                                                                       valToTransfer);
                                    DataManagement.addOnHistory(comboBoxIBAN.SelectedItem.ToString(),
                                                                comboBoxToTransferMyIBAN.SelectedItem.ToString(), 4, (ValWithouComiss + comiss));
                                }
                                else if (comboBoxSelectTransfer.SelectedItem.ToString() == "Anyone else account")
                                {
                                    var result = context.transferMoney(comboBoxIBAN.SelectedItem.ToString(),
                                                                       textBoxWriteIBAN.Text, ((ValWithouComiss + comiss)),
                                                                       valToTransfer);

                                    DataManagement.addOnHistory(comboBoxIBAN.SelectedItem.ToString(),
                                                                textBoxWriteIBAN.Text, 4, (ValWithouComiss + comiss));
                                }
                                labelComisionValue.Text = "-";
                                labelExchangeValue.Text = "-";
                                MessageBox.Show("Done!");
                            }
                        }
                        else
                        {
                            MessageBox.Show("You dont have enought money!!!");
                        }
                    }
                }
            }catch (Exception)
            {
                MessageBox.Show("Put all informations or something wrong!");
            }
        }