private void returnTo_BOX_SelectedIndexChanged(object sender, EventArgs e) { if (returnTo_BOX.SelectedIndex == 0) { this.Hide(); MemberHome frm = new MemberHome(profile); frm.Show(); } if (returnTo_BOX.SelectedIndex == 1) { this.Hide(); MovieList frm = new MovieList(profile); frm.Show(); } if (returnTo_BOX.SelectedIndex == 2) { this.Hide(); AccountInfo frm = new AccountInfo(profile); frm.Show(); } }
private void RunConfirmOrderSqlStatement(AggActiveAccount prof, string movieSelect, double moviePrice) { prof.Balance = Convert.ToDouble(afterBal_TXT.Text); //SQL Statement for processing movie order string sqlProfileCreate = //updating active user account balance by subtracting the movie price (math is already done in copyObjectToForm method) "update Account " + "set Balance = '" + Convert.ToDouble(afterBal_TXT.Text) + "' " + "where AccountID = '" + prof.AccId + "' " + //creating a new transaction "declare @movieID int " + "set @movieID = (select movieID from Movie where Title = '" + movieSelect + "') " + "insert into Transactions(AccountID, MovieID, RewardID, RentDate, DueDate, Total) " + "values('"+ prof.AccId + "', @movieID, null, GETDATE(), '"+dueDateBox.Text+"', '"+moviePrice+"')"; //Establishes connection with SQL DB string dbStr = "Data Source = mis220.eil-server.cba.ua.edu; Initial Catalog = MovieRental; user id = uamis; password=RollTide"; SqlConnection dbCon = new SqlConnection(dbStr); try { //non-query SqlCommand cmdIns = new SqlCommand(sqlProfileCreate, dbCon); dbCon.Open(); cmdIns.ExecuteNonQuery(); cmdIns.Parameters.Clear(); cmdIns.Dispose(); cmdIns = null; } //catch(Exception ex)//need to write exceptions finally { dbCon.Close(); MessageBox.Show("Your order has been confirmed! Thank you for your business!"); this.Hide(); MovieList movieListForm = new MovieList(profile); movieListForm.Show(); } }
private void checkoutCancel_BTN_Click(object sender, EventArgs e) { this.Hide(); MovieList movieListForm = new MovieList(profile); movieListForm.Show(); }