// Confirm Deposit Button protected void ConfirmDeposit(object sender, EventArgs e) { int balance = 0; int amount = Convert.ToInt32(txtDeposit.Text); string idx = (string)Application["Idx"]; // Calls DB methods to DB.Connect(); balance = DB.Action(idx, amount, '+'); DB.Disconnect(); // Calls DB methods to lblDepositSum.Text = "You deposired: " + amount + " your Blanace is: " + balance; }
// Confirm Withdraw Button protected void ConfirmWithdraw(object sender, EventArgs e) { int balance = 0; int amount = Convert.ToInt32(txtWithdraw.Text); string idx = (string)Application["Idx"]; // Calls DB methods to DB.Connect(); balance = DB.Action(idx, amount, '-'); DB.Disconnect(); // lblWithdrawSum.Text = "You withdrawed: " + amount + " your Blanace is: " + balance; }
// OK Button method for protected void Validation(object sender, EventArgs e) { List <string> lst = null; // Check info with database DB.Connect(); string idx = DB.IsUser(txtName.Text, txtPass.Text); if (idx != null) { // Gets list of table Customers about the user lst = DB.UserLookUp(idx); // Insert into Page Application the User info Application.Add("Idx", lst[0]); Application.Add("Name", lst[1]); Application.Add("Family", lst[2]); Application.Add("Address", lst[3]); Application.Add("CityNum", lst[4]); Application.Add("Phone", lst[5]); lst.Clear(); DB.Disconnect(); Response.Redirect("Welcome.aspx"); } // Check if admin else if (DB.IsAdmin(txtName.Text, txtPass.Text)) { DB.Disconnect(); Response.Redirect("administrator.aspx"); } // User not exsit else { DB.Disconnect(); Response.Redirect("Error.aspx"); } }
// Connect database on load protected void Page_Load(object sender, EventArgs e) { DB.Connect(); }