コード例 #1
0
        private void comboBoxIBAN_SelectedIndexChanged(object sender, EventArgs e)
        {
            Page pg = DataManagement.getSold(comboBoxIBAN.SelectedItem.ToString());

            labelshowsold.Text = pg.Data;


            Page pg2 = DataManagement.getCurrency(comboBoxIBAN.SelectedItem.ToString());

            labelshowcurrency.Text = pg2.Data;

            comboBoxToTransferMyIBAN.Refresh();
            comboBoxSelectTransfer.SelectedIndex = -1;
        }
コード例 #2
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 MitBankDBEntities())
                        {
                            var result = DataManagement.getSold(comboBoxIBAN.SelectedItem.ToString());

                            getsold = double.Parse(result.Data);
                        }
                        if (getsold > (ValWithouComiss + comiss))
                        {
                            using (var context = new MitBankDBEntities())
                            {
                                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!");
            }
        }