private void btnPay_Click(object sender, EventArgs e) { string name = tbName.Text; string bank = tbBank.Text; int cardNumber = Convert.ToInt32(tbCardNum.Text); string cardType = cbType.Text.ToString(); foreach (int seatNum in seat) { //Transfer data to Ticket database InsertTicket(seatNum, TotalPrice(idTrip), idUser, idTrip); //Add to list ticket tickets.Add(LoadTicket(GetIDTicket())); //Transfer data to Payment database InsertPayment(name, bank, cardNumber, cardType, GetIDTicket()); //Update available seat in trip database UpdateSeat(idTrip); } MessageBox.Show("Payment Successfull!!"); fTicketUser fTicketUser = new fTicketUser(seat.Count, idTrip, idUser, tickets); this.Hide(); fTicketUser.ShowDialog(); this.Show(); }
private void btnPay_Click(object sender, EventArgs e) { string name = tbName.Text; string bank = tbBank.Text; int cardNumber = Convert.ToInt32(tbCardNum.Text); string cardType = cbType.Text.ToString(); foreach (int seatNum in seat) { bool blank = false; int index = 0; foreach (TextBox tb in tbList) { if (IsBlank(tb, index++)) { blank = true; } } if (cbType.SelectedItem == null) { lbType.ForeColor = Color.Red; MessageBox.Show("Please fills missing information"); blank = true; } if (blank) { return; } //Transfer data to Ticket database InsertTicket(seatNum, TotalPrice(idTrip), idUser, idTrip); //Add to list ticket tickets.Add(LoadTicket(GetIDTicket())); //Transfer data to Payment database InsertPayment(name, bank, cardNumber, cardType, GetIDTicket()); //Update available seat in trip database UpdateSeat(idTrip); } MessageBox.Show("Payment Successfull!!"); fTicketUser fTicketUser = new fTicketUser(seat.Count, idTrip, idUser, tickets); this.Hide(); fTicketUser.ShowDialog(); this.Show(); }