public String trasnfer(String fromacno, String toacno, Double amount, String type) { String am = "" + amount; String description = "Trnasfer from " + fromacno; BankDataSetTableAdapters.transactionsTableAdapter adp = new BankDataSetTableAdapters.transactionsTableAdapter(); adp.Insert(toacno, am, description, type, DateTime.Today); adp.Insert(fromacno, am, ("Transfered to : " + toacno), type, DateTime.Today); BankDataSetTableAdapters.AccountsTableAdapter adp2 = new BankDataSetTableAdapters.AccountsTableAdapter(); double bal2 = (double)adp2.getbalnce(fromacno); double bal = (double)adp2.getbalnce(toacno); if (bal2 >= amount) { adp2.updatebalance(((decimal)(bal + amount)), toacno); adp2.updatebalance((decimal)(bal2 - amount), fromacno); } else { return "Insufficient balance in the Account"; } return "Transaction completed Successfully"; }
public void deposit(String acno, Double amount, string description, String type) { BankDataSetTableAdapters.transactionsTableAdapter tadp = new BankDataSetTableAdapters.transactionsTableAdapter(); DateTime n1 = new DateTime(); String am = "" + amount; tadp.Insert(acno, am, description, type, DateTime.Today); BankDataSetTableAdapters.AccountsTableAdapter adp2 = new BankDataSetTableAdapters.AccountsTableAdapter(); double bal = (double)adp2.getbalnce(acno); double newbalance = (double)(bal + amount); adp2.updatebalance((decimal)newbalance, acno); //return "Hello World"; }