private void loginButton_Click(object sender, EventArgs e) { LoginForm log = new LoginForm(); log.ShowDialog(); if (GlobalConfig.GuestUser != -1) // Guest logged in { GuestForm form = new GuestForm(); form.ShowDialog(); } else if (GlobalConfig.OwnerUser != -1) // Owner logged in { BusOwnerForm form = new BusOwnerForm(); form.ShowDialog(); } }
private void buyTicket_Click(object sender, EventArgs e) { if (GlobalConfig.GuestUser != -1) { int counter = 0; foreach (Button but in TangDuoi.Controls) { if (but.BackColor == Color.Yellow) { GlobalConfig.AddTicket(bus, but.Text, but.Name); counter++; } } foreach (Button but in TangTren.Controls) { if (but.BackColor == Color.Yellow) { GlobalConfig.AddTicket(bus, but.Text, but.Name); counter++; } } if (counter > 0) { MessageBox.Show("Thành công!"); } else { MessageBox.Show("Bạn chưa chọn ghế"); } this.Close(); GuestForm form = new GuestForm(); form.ShowDialog(); } else { MessageBox.Show("Vui lòng đăng nhập!"); LoginForm form = new LoginForm(); form.ShowDialog(); } }