private void FormTourManager_Load(object sender, EventArgs e) { TourBL tourBL = new TourBL(); var a = tourBL.GetAllTours(); dataGridView1.DataSource = a; comboBox1.Text = "Active"; }
private void button1_Click(object sender, EventArgs e) { TourBL tourBL = new TourBL(); Tour tour = new Tour(); try { DateTime ngaydi = Convert.ToDateTime(dateTimePicker1.Value.ToString("MM/dd/yyyy")); int songay = Convert.ToInt32(textBox5.Text); int khuyenmai = Convert.ToInt32(textBox6.Text); int gia = Convert.ToInt32(textBox7.Text); if (textBox1.Text == null) { MessageBox.Show("Mã Tour Không Được Bỏ Trống"); } else if (ngaydi <= DateTime.Now) { MessageBox.Show("Ngày Bạn Chọn Không Hợp Lệ"); } else { if (tourBL.InsertTour(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, songay, ngaydi, khuyenmai, gia, comboBox1.Text) == true) { var a = tourBL.GetAllTours(); dataGridView1.DataSource = a; MessageBox.Show("Tour Đã Được Thêm!"); reload(); } else { MessageBox.Show("Thêm Thất Bại!"); } } } catch (System.Exception) { MessageBox.Show("Bạn Chưa Nhập Đầy Đủ"); } }