コード例 #1
0
        private void buttonGetDetailsTransfer_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBoxFromIBanTransfer.Text == "")
                {
                    MessageBox.Show("Please enter IBAN on customer !",
                                    "Transfer .", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                else
                {
                    modelCustomerTransfer = DataBaseOperations.getCustomer(textBoxFromIBanTransfer.Text);

                    textBoxNameCusotmerTransfer.Text = modelCustomerTransfer.NameCustomer;
                    textBoxEGNCustomerTransfer.Text  = modelCustomerTransfer.EgnCustomer;

                    modelAccountCustomerTransfer       = DataBaseOperations.getBalance(textBoxFromIBanTransfer.Text);
                    textBoxAccountBalanceTransfer.Text = modelAccountCustomerTransfer.Balance.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        private void buttonGetDetailsWithdraw_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBoxIbanWithdraw.Text == "")
                {
                    MessageBox.Show("Please enter IBAN on customer !",
                                    "Withdraw .", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                else
                {
                    modelCustomerWithdraw = DataBaseOperations.getCustomer(textBoxIbanWithdraw.Text);

                    textBoxNameCustomerWithdraw.Text = modelCustomerWithdraw.NameCustomer;
                    textBoxEGNCustomerWithdraw.Text  = modelCustomerWithdraw.EgnCustomer;

                    ModelAccountCustomer = DataBaseOperations.getBalance(textBoxIbanWithdraw.Text);
                    textBoxAccountBalanceWithdraw.Text = ModelAccountCustomer.Balance.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        /// <summary>
        /// Select balance' customer
        /// </summary>
        /// <param name="iban"></param>
        /// <returns>Customer' balance in real time</returns>
        public static Model.ModelAccountCustomer getBalance(string iban)
        {
            Model.ModelAccountCustomer accountCustomer = new Model.ModelAccountCustomer();

            MySqlConnection con = new MySqlConnection(connectionString);

            MySqlCommand com = new MySqlCommand("get_balance", con);

            com.CommandType = CommandType.StoredProcedure;

            com.Parameters.AddWithValue("@ibanCustomer", iban);
            com.Parameters.Add(new MySqlParameter("?balance", MySqlDbType.VarChar));
            com.Parameters["?balance"].Direction = ParameterDirection.Output;

            com.Connection.Open();

            com.ExecuteNonQuery();

            accountCustomer.Balance = Convert.ToDecimal(com.Parameters["?balance"].Value.ToString().Replace(".", ","));

            com.Connection.Close();

            return(accountCustomer);
        }