Ejemplo n.º 1
0
        private void btnViewBalance_Click(object sender, EventArgs e)
        {
            clsTransactions clsT    = new clsTransactions();
            double          balance = clsT.GetCurrentBalance();

            MessageBox.Show("Your current balance is: " + balance.ToString("c"));
        }
        private void FormViewAll_Load(object sender, EventArgs e)
        {
            dgvDisplayTransactions.ReadOnly = true;
            clsTransactions clsT         = new clsTransactions();
            var             transactions = clsT.GetTransactionsAsDataSet();

            dgvDisplayTransactions.DataSource = transactions.Tables[0];
            DataGridViewCellStyle style = new DataGridViewCellStyle();

            style.Format = "C";
            dgvDisplayTransactions.Columns[5].DefaultCellStyle = style;
            dgvDisplayTransactions.Columns[3].DefaultCellStyle = style;
        }
Ejemplo n.º 3
0
        private void btnAddTransaction_Click(object sender, EventArgs e)
        {
            clsTransactions insert = new clsTransactions();

            double amount;

            if (double.TryParse(txtAmount.Text, out amount))
            {
                string   type        = cbType.Text;
                string   description = txtDescription.Text;
                DateTime date        = dateTimePicker1.Value;
                insert.InsertTransaction(amount, type, description, date);
                MessageBox.Show("Insert Successful");
                cbType.Text = "";
                txtDescription.Clear();
                txtAmount.Clear();
            }
            else
            {
                MessageBox.Show("Enter valid deposit amount");
            }
        }