Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        private void Sale(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", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã bán");
                dialog1.ShowDialog();
                return;
            }
            else if ((int)row.Cells["TinhTrang"].Value == 3)
            {
                Notification.Show("Phiếu đặt chỗ đã hủy không thể bán", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã hủy không thể bán");
                dialog1.ShowDialog();
                return;
            }
            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 frmWarning("Cảnh Báo!!!", "Bạn có muốn bán vé không?");
            var         res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                pdc.tinhTrang = 2;
                if (BLL_PhieuDatCho.SalePhieuDatCho(pdc))
                {
                    Notification.Show("Bán vé thành công", Status.SUCCESS);
                }
                BLL_PhieuDatCho.UpdatePhieuDatCho(pdc);
                reloadData();
            }
        }
Esempio n. 3
0
        private void cancel(DataGridViewRow row)
        {
            if ((int)row.Cells["TinhTrang"].Value == 2)
            {
                Notification.Show("Phiếu đặt chỗ đã bán không thể hủy", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã bán không thể hủy");
                dialog1.ShowDialog();
                return;
            }
            else if ((int)row.Cells["TinhTrang"].Value == 3)
            {
                Notification.Show("Phiếu đặt chỗ đã hủy", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã hủy");
                dialog1.ShowDialog();
                return;
            }
            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 frmWarning("Cảnh Báo!!!", "Bạn có muốn hủy phiếu đặt ghế không?");
            var         res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                pdc.tinhTrang = 3;
                if (BLL_PhieuDatCho.UpdatePhieuDatCho(pdc))
                {
                    Notification.Show("Hủy phiếu đặt chỗ thành công", Status.SUCCESS);
                }
                reloadData();
            }
        }