private void Edit(DataGridViewRow row) { if ((int)row.Cells["TinhTrang"].Value == 1 && (((DateTime)row.Cells["ThoiGian"].Value) - DateTime.Now).Hours < ThamSo.TGHuyDatVe) { Notification.Show("Phiếu đặt chỗ đã quá thời gian", Status.WARNING); var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã quá thời gian\n-->Tiến hành hủy"); dialog1.ShowDialog(); return; } else if ((int)row.Cells["TinhTrang"].Value == 2) { Notification.Show("Phiếu đặt chỗ đã bán không thể chỉnh sửa", Status.WARNING); var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã bán không thể chỉnh sửa"); dialog1.ShowDialog(); return; } else if ((int)row.Cells["TinhTrang"].Value == 3) { Notification.Show("Phiếu đặt chỗ đã hủy không thể chỉnh sửa", Status.WARNING); var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã hủy không thể chỉnh sửa"); dialog1.ShowDialog(); return; } AppState.state = Actions.EDIT; int maVe = (int)row.Cells["MaVe"].Value; int maCB = (int)row.Cells["MaCB"].Value; string tenHK = (string)row.Cells["TenHK"].Value; string cmnd = (string)row.Cells["CMND"].Value; string dienThoai = (string)row.Cells["DienThoai"].Value; DateTime thoiGian = (DateTime)row.Cells["ThoiGian"].Value; HangVe hv = (HangVe)row.Cells["HV"].Value; int giaVe = (int)row.Cells["GiaVe"].Value; int tt = (int)row.Cells["TinhTrang"].Value; PhieuDatCho pdc = new PhieuDatCho(maVe, maCB, tenHK, cmnd, dienThoai, thoiGian, hv, giaVe, tt); var dialog = new frmPhieuDatChoEditing(pdc); DialogResult res = dialog.ShowDialog(); if (res == DialogResult.OK) { if (BLL_PhieuDatCho.UpdatePhieuDatCho(dialog.pdc)) { Notification.Show("Chỉnh sửa phiếu đặt chỗ thành công", Status.SUCCESS); } reloadData(); } AppState.state = Actions.NOTHING; }
public override void Create() { AppState.state = Actions.ADD; var dialog = new frmPhieuDatChoEditing(); DialogResult res = dialog.ShowDialog(); if (res == DialogResult.OK) { int newMave = BLL_IdenMaVe.GetNewMaVe(); if (BLL_PhieuDatCho.InsertPhieuDatCho(dialog.pdc, newMave)) { Notification.Show("Thêm phiếu đặt chỗ thành công", Status.SUCCESS); BLL_IdenMaVe.ClearIden(); } reloadData(); } AppState.state = Actions.NOTHING; }
private void Detail(DataGridViewRow row) { int maVe = (int)row.Cells["MaVe"].Value; int maCB = (int)row.Cells["MaCB"].Value; string tenHK = (string)row.Cells["TenHK"].Value; string cmnd = (string)row.Cells["CMND"].Value; string dienThoai = (string)row.Cells["DienThoai"].Value; DateTime thoiGian = (DateTime)row.Cells["ThoiGian"].Value; HangVe hv = (HangVe)row.Cells["HV"].Value; int giaVe = (int)row.Cells["GiaVe"].Value; int tt = (int)row.Cells["TinhTrang"].Value; PhieuDatCho pdc = new PhieuDatCho(maVe, maCB, tenHK, cmnd, dienThoai, thoiGian, hv, giaVe, tt); var dialog = new frmPhieuDatChoEditing(pdc); DialogResult res = dialog.ShowDialog(); if (res == DialogResult.OK) { } }