示例#1
0
        private void đặtVéToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form2 f = new Form2();

            while (f.ShowDialog() == DialogResult.OK)
            {
                if (f.getTB1() == "" || f.getTB2() == "" || f.getTB3() == "" || f.getTB5() == "" || f.getTB6() == "" || (f.getCB2() == false && f.getCB1() == false))
                {
                    MessageBox.Show("Chưa điền đủ thông tin", "Title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    continue;
                }
                string a       = f.getTB5();
                int    id      = Convert.ToInt32(f.getTB6());
                string cmnd    = f.getTB1();
                string name    = f.getTB3();
                string surname = f.getTB2();
                string sex;
                if (f.getCB2() == true)
                {
                    sex = "male";
                }
                else
                {
                    sex = "female";
                }
                if (check_ticket_booked(obj, a, id) == true)
                {
                    MessageBox.Show("Vé đã được đặt", "Title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    continue;
                }
                if (check_CMND_booked(obj, a, cmnd) == true)
                {
                    MessageBox.Show("Khách hàng đã đặt vé trên chuyến bay này", "Title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    continue;
                }
                bookticket(obj, a, id, cmnd, name, surname, sex);
                MessageBox.Show("Đặt vé thành công", "Title", MessageBoxButtons.OK, MessageBoxIcon.Information);
                f.Close();
                break;
            }
        }