private void BuyTicketBtn_Click(object sender, EventArgs e) { var tickets = Convert.ToInt32(Math.Round(numTickets.Value, 0)); var concert = Convert.ToInt32(searchResultView.CurrentRow.Cells[0].Value); var useCoupons = useCouponBox.Checked; bool success = VendingMachine.BuyTickets(CurrentCustomer, tickets, concert, useCoupons); CurrentCustomer = CustomerEngine.SignIn(CurrentCustomer.Name, CurrentCustomer.Password)[0]; if (success) { MessageBox.Show("Tickets bought!"); } else { MessageBox.Show("Oh, something went wrong..."); } }
private void buyBtn_Click(object sender, EventArgs e) { var pesetasAmount = Convert.ToInt32(Math.Round(numOfPesetasUpDown.Value, 0)); var success = VendingMachine.BuyPesetas(CurrentCustomer, pesetasAmount); if (success) { MessageBox.Show("Pesetas refilled!"); //Here i must "sign in" (aka "refresh") the customer again to get the updated information from the Db. CurrentCustomer = CustomerEngine.SignIn(CurrentCustomer.Name, CurrentCustomer.Password)[0]; MyPage myPage = new MyPage(CurrentCustomer); myPage.Show(); this.Hide(); } else { MessageBox.Show("Hmm, something went wrong..."); MyPage myPage = new MyPage(CurrentCustomer); myPage.Show(); this.Hide(); } }
private void LogIn_Click(object sender, EventArgs e) { string name = Nametxt.Text; string password = Passwordtxt.Text; if (name.Length == 0 || password.Length == 0) { MessageBox.Show("Please enter name and password"); } else { List <Customer> customer = CustomerEngine.SignIn(name, password); if (customer.Count == 0) { MessageBox.Show("Could not find user"); } else { this.Hide(); MyPage frm2 = new MyPage(customer[0]); frm2.Show(); } } }