public void xemdulieu() { BUL_BanVe bUL_BanVe = new BUL_BanVe(); BUL_HangVe bUL_HangVe = new BUL_HangVe(); BUL_LichChuyenBay bUL_LichChuyenBay = new BUL_LichChuyenBay(); dGVbanVe.DataSource = bUL_BanVe.getVe(); dGVbanVe.Refresh(); dGVbanVe.Columns[0].HeaderText = "Mã vé chuyến bay"; dGVbanVe.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVbanVe.Columns[1].HeaderText = "Mã chuyến bay"; dGVbanVe.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVbanVe.Columns[2].HeaderText = "Mã hành khách"; dGVbanVe.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVbanVe.Columns[3].HeaderText = "Mã hạng vé"; dGVbanVe.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVbanVe.Columns[4].HeaderText = "Giá tiền"; dGVbanVe.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; cBmaCB.DataSource = bUL_LichChuyenBay.getLichChuyenBay(); cBmaCB.DisplayMember = "MaCB"; cBmaCB.ValueMember = "MaCB"; cBhangVe.DataSource = bUL_HangVe.getHV(); cBhangVe.DisplayMember = "TenHV"; cBhangVe.ValueMember = "MaHV"; }
public void xemdulieu() { BUL_HangVe bUL_HangVe = new BUL_HangVe(); dGVcapNhatHangVe.DataSource = bUL_HangVe.getHV(); dGVcapNhatHangVe.Refresh(); dGVcapNhatHangVe.Columns[0].HeaderText = "Mã hạng vé"; dGVcapNhatHangVe.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVcapNhatHangVe.Columns[1].HeaderText = "Tên hạng vé"; dGVcapNhatHangVe.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVcapNhatHangVe.Columns[2].HeaderText = "Ghi chú"; dGVcapNhatHangVe.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
private void btnXacNhan_Click(object sender, EventArgs e) { BUL_HangVe bUL_HangVe = new BUL_HangVe(); if (txtMaHangVe.Text != "" && txtTenHangVe.Text != "") { HangVe hv = new HangVe(txtMaHangVe.Text, txtTenHangVe.Text, txtGhiChu.Text); if (bUL_HangVe.themHangVe(hv)) { MessageBox.Show("Thêm thành công"); dGVthemHangVe.DataSource = bUL_HangVe.getHV(); // refresh datagridview } else { MessageBox.Show("Đã có lỗi xảy ra", "Lỗi"); } } else { MessageBox.Show("Xin hãy nhập đầy đủ"); } }