public void addbinding() { BUL_SanBay bUL_SanBay = new BUL_SanBay(); txtMaCB.DataBindings.Clear(); txtMaCB.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "MaCB"); cBsanBayDen.DataBindings.Clear(); cBsanBayDen.DataSource = bUL_SanBay.getSanBay(); cBsanBayDen.DisplayMember = "TenSB"; cBsanBayDen.ValueMember = "MaSB"; cBsanBayDen.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "TenSB1"); cBsanBayDi.DataBindings.Clear(); cBsanBayDi.DataSource = bUL_SanBay.getSanBay(); cBsanBayDi.DisplayMember = "TenSB"; cBsanBayDi.ValueMember = "MaSB"; cBsanBayDi.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "TenSB"); txtGiaVe.DataBindings.Clear(); txtGiaVe.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "GiaTien"); txtSLGheHang1.DataBindings.Clear(); txtSLGheHang1.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "SoLuongGheHang1"); txtSLGheHang2.DataBindings.Clear(); txtSLGheHang2.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "SoLuongGheHang2"); txtThoiGianBay.DataBindings.Clear(); txtThoiGianBay.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "ThoiGianBay"); dTPngayGio.DataBindings.Clear(); dTPngayGio.DataBindings.Add("Text", dGVLichChuyenBay.DataSource, "NgayGio", true, DataSourceUpdateMode.OnValidation, "", "dd/MM/yyyy HH:mm"); }
public void xemdulieu() { BUL_SanBay bUL_SanBay = new BUL_SanBay(); BUL_LichChuyenBay bUL_LichChuyenBay = new BUL_LichChuyenBay(); dGVthemLichCB.DataSource = bUL_LichChuyenBay.getLichChuyenBay(); dGVthemLichCB.Refresh(); dGVthemLichCB.Columns[0].HeaderText = "Mã chuyến bay"; dGVthemLichCB.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemLichCB.Columns[1].HeaderText = "Sân bay đi"; dGVthemLichCB.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemLichCB.Columns[2].HeaderText = "Sân bay đến"; dGVthemLichCB.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemLichCB.Columns[3].HeaderText = "Giá tiền"; dGVthemLichCB.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemLichCB.Columns[4].HeaderText = "Ngày giờ"; dGVthemLichCB.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemLichCB.Columns[4].DefaultCellStyle.Format = "MM/dd/yyyy HH:mm:ss"; dGVthemLichCB.Columns[5].HeaderText = "Thời gian bay"; dGVthemLichCB.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemLichCB.Columns[6].HeaderText = "Số lượng ghế hạng 1"; dGVthemLichCB.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemLichCB.Columns[7].HeaderText = "Số lượng ghế hạng 2"; dGVthemLichCB.Columns[7].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; cBsanBayDi.DataSource = bUL_SanBay.getSanBay(); cBsanBayDi.DisplayMember = "TenSB"; cBsanBayDi.ValueMember = "MaSB"; cBsanBayDen.DataSource = bUL_SanBay.getSanBay(); cBsanBayDen.DisplayMember = "TenSB"; cBsanBayDen.ValueMember = "MaSB"; }
public void xemdulieu() { BUL_LichChuyenBay bUL_LichChuyenBay = new BUL_LichChuyenBay(); BUL_SanBay bUL_SanBay = new BUL_SanBay(); BUL_ChiTietCB bUL_ChiTietCB = new BUL_ChiTietCB(); dGVthemChiTietCB.DataSource = bUL_ChiTietCB.getChiTietCB(); dGVthemChiTietCB.Refresh(); dGVthemChiTietCB.Columns[0].HeaderText = "Mã chi tiết"; dGVthemChiTietCB.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemChiTietCB.Columns[1].HeaderText = "Mã chuyến bay"; dGVthemChiTietCB.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemChiTietCB.Columns[2].HeaderText = "Mã sân bay trung gian"; dGVthemChiTietCB.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemChiTietCB.Columns[3].HeaderText = "Thời gian dừng"; dGVthemChiTietCB.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVthemChiTietCB.Columns[4].HeaderText = "Ghi chú"; dGVthemChiTietCB.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; cBmaCB.DataSource = bUL_LichChuyenBay.getLichChuyenBay(); cBmaCB.DisplayMember = "MaCB"; cBmaCB.ValueMember = "MaCB"; cBsanBayTrungGian.DataSource = bUL_SanBay.getSanBay(); cBsanBayTrungGian.DisplayMember = "TenSB"; cBsanBayTrungGian.ValueMember = "MaSB"; }
public void xemdulieu() { BUL_SanBay bUL_SanBay = new BUL_SanBay(); dGVdanhSachSB.DataSource = bUL_SanBay.getSanBay(); dGVdanhSachSB.Refresh(); dGVdanhSachSB.Columns[0].HeaderText = "Mã sân bay"; dGVdanhSachSB.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVdanhSachSB.Columns[1].HeaderText = "Tên sân bay"; dGVdanhSachSB.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
public void addbinding() { BUL_LichChuyenBay bUL_LichChuyenBay = new BUL_LichChuyenBay(); BUL_SanBay bUL_SanBay = new BUL_SanBay(); txtMaCT.DataBindings.Clear(); txtMaCT.DataBindings.Add("Text", dGVchiTietCB.DataSource, "MaCT"); cBmaCB.DataBindings.Clear(); cBmaCB.DataSource = bUL_LichChuyenBay.getLichChuyenBay(); cBmaCB.DisplayMember = "MaCB"; cBmaCB.ValueMember = "MaCB"; cBsanBayTrungGian.DataBindings.Clear(); cBsanBayTrungGian.DataSource = bUL_SanBay.getSanBay(); cBsanBayTrungGian.DisplayMember = "TenSB"; cBsanBayTrungGian.ValueMember = "MaSB"; txtThoiGianDung.DataBindings.Clear(); txtThoiGianDung.DataBindings.Add("Text", dGVchiTietCB.DataSource, "ThoiGianDung"); txtGhiChu.DataBindings.Clear(); txtGhiChu.DataBindings.Add("Text", dGVchiTietCB.DataSource, "GhiChu"); }
private void btnXacNhan_Click(object sender, EventArgs e) { BUL_SanBay bUL_SanBay = new BUL_SanBay(); if (txtMaSB.Text != "" && txtTenSB.Text != "") { SanBay sb = new SanBay(txtMaSB.Text, txtTenSB.Text); if (bUL_SanBay.themSanBay(sb)) { MessageBox.Show("Thêm thành công"); dGVthemSanBay.DataSource = bUL_SanBay.getSanBay(); // refresh datagridview } else { MessageBox.Show("Đã có lỗi xảy ra", "Lỗi"); } } else { MessageBox.Show("Xin hãy nhập đầy đủ"); } }