public override void Create() { AppState.state = Actions.ADD; var dialog = new frmFlightEditing(); DialogResult res = dialog.ShowDialog(); if (res == DialogResult.OK) { if (BLL_ChuyenBay.InsertChuyenBay(dialog.chuyenBay)) { int lastCB = BLL_ChuyenBay.GetLastMaCB(); for (int i = 0; i < dialog.ctcbs.Count; i++) { BLL_CTCB.InsertCTCB(dialog.ctcbs[i], lastCB); } for (int i = 0; i < dialog.cthvs.Count; i++) { BLL_CTHV.InsertCTHV(dialog.cthvs[i], lastCB); } reloadData(); Notification.Show("Thêm chuyến bay thành công", Status.SUCCESS); } } AppState.state = Actions.NOTHING; }
private void Edit(DataGridViewRow row) { AppState.state = Actions.EDIT; var dialog = new frmFlightEditing(currentCB); DialogResult res = dialog.ShowDialog(); if (res == DialogResult.OK) { BLL_ChuyenBay.UpdateChuyenBay(dialog.chuyenBay); BLL_CTCB.DeleteCTCB(dialog.chuyenBay.maCB); for (int i = 0; i < dialog.ctcbs.Count; i++) { BLL_CTCB.InsertCTCB(dialog.ctcbs[i], dialog.chuyenBay.maCB); } for (int i = 0; i < dialog.cthvs.Count; i++) { BLL_CTHV.UpdateCTHV(dialog.cthvs[i]); } reloadData(); } AppState.state = Actions.NOTHING; }