private void loadData() { hvs = BLL_HangVe.GetHangVes(); dsSBDi = BLL_SanBay.GetSanBays(); if (chuyenBay == null) { dsSBDen = BLL_SanBay.GetSanBays(); } else { dsSBDen = BLL_TuyenBay.GetSanBaysFrom(chuyenBay.TB.SBDi.maSB); } sbtgs = BLL_SanBay.GetSanBays(); cbSBDi.DisplayMember = "TenSB"; cbSBDi.ValueMember = "MaSB"; cbSBDen.DisplayMember = "TenSB"; cbSBDen.ValueMember = "MaSB"; cbSBTG.DisplayMember = "TenSB"; cbSBTG.ValueMember = "MaSB"; cbSBTG.DataSource = sbtgs; cbSBDi.DataSource = dsSBDi; cbSBDen.DataSource = dsSBDen; onloading = false; state = Actions.NOTHING; dtpNgay.Value = DateTime.Now; }
private void btnSearch_Click(object sender, EventArgs e) { if (AppState.state != Actions.NOTHING) { var dialog = new frmWarning("Cảnh Báo", "Bạn có muốn hủy bỏ chỉnh sửa?"); DialogResult res = dialog.ShowDialog(); if (res == DialogResult.OK) { DisablePanelEdit(); } else if (res == DialogResult.Cancel) { return; } } if (cbSearch.SelectedValue.ToString() == "MaSB") { tuyenBays = BLL_TuyenBay.searchMaTB(tbSearch.Text); } else if (cbSearch.SelectedValue.ToString() == "SBDi") { tuyenBays = BLL_TuyenBay.searchTenSBDi(tbSearch.Text); } else if (cbSearch.SelectedValue.ToString() == "SBDen") { tuyenBays = BLL_TuyenBay.searchTenSBDen(tbSearch.Text); } bl = new SortableBindingList <TuyenBay>(tuyenBays); dgvTuyenBays.DataSource = bl; }
private void btnAdd_Click(object sender, EventArgs e) { if (AppState.state == Actions.NOTHING) { ActivePanelEdit(Actions.ADD); } else if (AppState.state == Actions.ADD) { if (!checkTB()) { var dialog = new frmWarning("Sai Định Dạng", "Sân bay đi phải khác sân bay đến"); dialog.ShowDialog(); return; } if (BLL_TuyenBay.CheckTuyenbay(currentTB)) { var dialog = new frmWarning("Sai Định Dạng", "Tuyến bay này đã tồn tại"); dialog.ShowDialog(); return; } DisablePanelEdit(); if (BLL_TuyenBay.InsertTuyenBay(currentTB)) { Notification.Show("Thêm tuyến bay thành công", Status.SUCCESS); } reloadData(); } else if (AppState.state == Actions.EDIT) { if (!checkTB()) { var dialog = new frmWarning("Sai Định Dạng", "Sân bay đi phải khác sân bay đến"); dialog.ShowDialog(); return; } DisablePanelEdit(); if (BLL_TuyenBay.UpdateTuyenBay(currentTB)) { Notification.Show("Chỉnh sửa tuyến bay thành công", Status.SUCCESS); } reloadData(); } }
private void frmTuyenBay_Load(object sender, EventArgs e) { cbSearch.DataSource = sources(); cbSearch.DisplayMember = "Name"; cbSearch.ValueMember = "ID"; tuyenBays = BLL_TuyenBay.GetTuyenBays(); bl = new SortableBindingList <TuyenBay>(tuyenBays); dgvTuyenBays.DataSource = bl; CustomDgv(); cbSBDi.DataSource = BLL_SanBay.GetSanBays(); cbSBDi.DisplayMember = "TenSB"; cbSBDi.ValueMember = "MaSB"; cbSBDen.DataSource = BLL_SanBay.GetSanBays(); cbSBDen.DisplayMember = "TenSB"; cbSBDen.ValueMember = "MaSB"; checkPer(); }
private void cbSBDi_SelectedIndexChanged(object sender, EventArgs e) { //if (onloading) return; dsSBDen = BLL_TuyenBay.GetSanBaysFrom((int)cbSBDi.SelectedValue); cbSBDen.DataSource = dsSBDen; }
private void reloadData() { tuyenBays = BLL_TuyenBay.GetTuyenBays(); bl = new SortableBindingList <TuyenBay>(tuyenBays); dgvTuyenBays.DataSource = bl; }