public MainForm() { InitializeComponent(); bllTS = new ThamSoBLL(); bllPDC = new PhieuDatChoBLL(); bllDSG = new DanhSachGheBLL(); pnSelect.Location = new Point(-1, -1); pnSelect.Visible = false; }
public ReservateForm() { InitializeComponent(); bllPDC = new PhieuDatChoBLL(); bllTS = new ThamSoBLL(); bllDSG = new DanhSachGheBLL(); bllCB = new ChuyenBayBLL(); lbNotify.Visible = false; lbNotify1.Visible = false; cbHangVe.DisplayMember = "HangVe"; cbHangVe.ValueMember = "TiLe"; }
public TicketForm() { InitializeComponent(); ShowTicket(); bllDSG = new DanhSachGheBLL(); bllCB = new ChuyenBayBLL(); bllVCB = new VeChuyenBayBLL(); bllPDC = new PhieuDatChoBLL(); bllTS = new ThamSoBLL(); lbNotify.Visible = false; lbNotify1.Visible = false; cbHangVe.DisplayMember = "HangVe"; cbHangVe.ValueMember = "TiLe"; cbTrangThai.Text = "Chưa thanh toán"; LockCotrol(); }
private void DataGrid_DanhSachChuyenBay_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (Index == DataGrid_DanhSachChuyenBay.RowCount) { return; } if (e.RowIndex >= 0 && DataGrid_DanhSachChuyenBay.Rows[Index].Cells[2].ReadOnly) { DataGrid_SanBayTrungGianP2.Columns.Clear(); DataGrid_DanhSachGheP2.Columns.Clear(); DanhSachGheBLL bllDSG = new DanhSachGheBLL(); SanBayTrungGianBLL bllSBTG = new SanBayTrungGianBLL(); DataTable tbDSG = bllDSG.getDanhSachGhe(DataGrid_DanhSachChuyenBay.Rows[Index].Cells[2].Value.ToString()); DataTable tbSBTG = bllSBTG.getSanBayTrungGian(DataGrid_DanhSachChuyenBay.Rows[Index].Cells[2].Value.ToString()); DataGridViewTextBoxColumn col_STT = new DataGridViewTextBoxColumn(); col_STT.HeaderText = "STT"; col_STT.Name = "colSTT"; DataGrid_SanBayTrungGianP2.Columns.Add(col_STT); DataGrid_DanhSachGheP2.DataSource = tbDSG; DataGrid_SanBayTrungGianP2.DataSource = tbSBTG; for (int i = 0; i < DataGrid_SanBayTrungGianP2.RowCount - 1; i++) { DataGrid_SanBayTrungGianP2.Rows[i].Cells[0].Value = (i + 1).ToString(); } DataGrid_DanhSachGheP2.ReadOnly = true; DataGrid_SanBayTrungGianP2.ReadOnly = true; DataGrid_DanhSachGheP2.Columns[0].HeaderText = "Hạng Vé"; DataGrid_DanhSachGheP2.Columns[1].HeaderText = "Số Lượng Ghế"; DataGrid_SanBayTrungGianP2.Columns[1].HeaderText = "Sân Bay Trung Gian"; DataGrid_SanBayTrungGianP2.Columns[2].HeaderText = "Thời Gian Dừng"; DataGrid_SanBayTrungGianP2.Columns[3].HeaderText = "Ghi Chú"; } // Click null Icon if (e.ColumnIndex == 1) { if (DataGrid_DanhSachChuyenBay.Rows[Index].Cells[2].ReadOnly == false) /* { * DialogResult dlg = MessageBox.Show("Bạn có thật sự muốn xóa thông tin chuyến bay này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); * if (dlg == DialogResult.Yes) * { * if (bllCB.DeleteChuyenBay(DataGrid_DanhSachChuyenBay.Rows[Index].Cells[2].Value.ToString())) * { * DataGrid_DanhSachChuyenBay.Rows.Remove(DataGrid_DanhSachChuyenBay.Rows[Index]); * lblNotify1.ForeColor = Color.Lime; * lblNotify1.Text = "Xóa chuyến bay thành công"; * } * else * { * lblNotify1.ForeColor = Color.Red; * lblNotify1.Text = " Đã có lỗi xảy ra, vui lòng thử lại sau"; * } * } * } * else */ { DataGrid_SanBayTrungGianP2.Columns.Clear(); DataGrid_DanhSachGheP2.Columns.Clear(); for (int i = 2; i <= 7; i++) { DataGrid_DanhSachChuyenBay.Rows[Index].Cells[i].ReadOnly = true; } DataGrid_DanhSachChuyenBay.Rows[Index].Cells[0].Value = global::Flight.Properties.Resources.edit; DataGrid_DanhSachChuyenBay.Rows[Index].Cells[1].Value = global::Flight.Properties.Resources.transparency; } } //Click Edit Icon else if (e.ColumnIndex == 0) { if (DataGrid_DanhSachChuyenBay.Rows[Index].Cells[2].ReadOnly) { DataGrid_DanhSachChuyenBay.Rows[Index].Cells[0].Value = global::Flight.Properties.Resources.save; DataGrid_DanhSachChuyenBay.Rows[Index].Cells[1].Value = global::Flight.Properties.Resources.close; for (int i = 2; i <= 7; i++) { DataGrid_DanhSachChuyenBay.Rows[Index].Cells[i].ReadOnly = false; } DataGrid_DanhSachGheP2.ReadOnly = false; DataGrid_SanBayTrungGianP2.ReadOnly = false; } else { if (CheckInputDataGrid()) { for (int i = 2; i <= 7; i++) { DataGrid_DanhSachChuyenBay.Rows[Index].Cells[i].ReadOnly = true; } DataGrid_DanhSachGheP2.ReadOnly = true; DataGrid_SanBayTrungGianP2.ReadOnly = true; if (bllCB.UpdateChuyenBay(SetInfoFlightFromDataGridView()) && bllDSG.UpdateDanhSachGhe(CapNhatDanhSachGhe()) && bllSBTG.UpdateSanBayTrungGian(CapNhatSanBayTrungGian())) { lblNotify1.ForeColor = Color.Green; lblNotify1.Text = "Lưu thành công"; } else { lblNotify1.ForeColor = Color.Red; lblNotify1.Text = "Đã có lỗi xảy ra, vui lòng thử lại sau"; } DataGrid_DanhSachChuyenBay.Rows[Index].Cells[0].Value = global::Flight.Properties.Resources.edit; DataGrid_DanhSachChuyenBay.Rows[Index].Cells[1].Value = global::Flight.Properties.Resources.transparency; } } } }