private void button1_Click(object sender, EventArgs e) { int amount = int.Parse(tx_amt_tsf.Text); int benefociary = int.Parse(txt_bf_acc.Text); String password = txt_pass_tsf.Text; if (password == Session.password) { Account_DB acc = new Account_DB(); if (amount <= int.Parse(acc.getBalance(Session.user.id))) { acc.transfer(Session.user, benefociary, amount); } MessageBox.Show("Successfullly trasfered"); Transaction_DB tranc = new Transaction_DB(); tranc.date = DateTime.Now.ToString(); tranc.desc = "Amout tranferres to user id :" + txt_bf_acc.Text; tranc.credit = ""; tranc.debit = "-" + tx_amt_tsf.Text; tranc.balance = int.Parse(new Account_DB().getBalance(Session.user.id)); tranc.userid = Session.user.id; tranc.AddTransaction(tranc); tranc.desc = "Amount recieved from account no. " + Session.user.id; tranc.credit = "+" + tx_amt_tsf.Text; tranc.debit = ""; tranc.balance = int.Parse(new Account_DB().getBalance(txt_bf_acc.Text)); tranc.userid = txt_bf_acc.Text; tranc.AddTransaction(tranc); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { int amt = int.Parse(txt_wdamt.Text); string password = txt_wdpass.Text; Account_DB acc = new Account_DB(); if (password == Session.user.password) { if (int.Parse(acc.getBalance(Session.user.id)) >= amt) { acc.updatebalance(Session.user, amt, "withdraw"); MessageBox.Show("you successfully withdraw amount"); Transaction_DB tranc = new Transaction_DB(); tranc.date = DateTime.Now.ToString(); tranc.desc = "Amount withdraw"; tranc.credit = ""; tranc.debit = "-" + txt_wdamt.Text; tranc.balance = int.Parse(new Account_DB().getBalance(Session.user.id)); tranc.userid = Session.user.id; new Transaction_DB().AddTransaction(tranc); this.Close(); } else { MessageBox.Show("Insufficeint Balance"); } } else { MessageBox.Show("incorrect Password"); } }
private void AccountDetails_Load(object sender, EventArgs e) { txt_name.Text = Session.fname + " " + Session.lname; Account_DB acc = new Account_DB(); txt_balance.Text = acc.getBalance(Session.user.id); Console.WriteLine("id" + Session.user.id); datadrid_view.AutoGenerateColumns = true; Transaction_DB tranc = new Transaction_DB(); tranc.fillGridTop5(datadrid_view); startTimer(); }