private void btnLuu_Click(object sender, EventArgs e)
        {
            //GetDuLieu nhap
            DateTime Ngay         = DateTime.MinValue;
            string   GhiChu       = "";
            string   TenKhachHang = "";
            int      MaDonViVe    = 0;
            string   MaSoThe      = "";

            try
            {
                Ngay         = calNgayPhatHanh.Value;
                TenKhachHang = StringTools.TrimSpace(txtTenKhachHang.Text);
                MaDonViVe    = Convert.ToInt32(cboCongTy.SelectedValue.ToString());
                GhiChu       = StringTools.TrimSpace(txtGhiChu.Text);
                MaSoThe      = StringTools.TrimSpace(txtMaSoThe.Text);
            }
            catch (Exception ex)
            {
                new MessageBox.MessageBoxBA().Show("Có lỗi dữ liệu nhập. Bạn cần kiểm tra lại."); return;
            }
            if (g_ThemMoi) // chen mới
            {
                DataTable dt = The.GetChiTietThe(MaSoThe, MaDonViVe, calNgayPhatHanh.Value.Year);
                if ((dt != null) && (dt.Rows.Count > 0))
                {
                    new MessageBox.MessageBoxBA().Show("Đã tồn tại mã thẻ.Bạn cần kiểm tra lại.");
                    return;
                }

                bool bSuccess = The.Insert(MaSoThe, Ngay, TenKhachHang, GhiChu, MaDonViVe);
                if (bSuccess)
                {
                    LoadDSTheHuy();
                    new MessageBox.MessageBoxBA().Show("Thêm mới thành công.");
                    UnLockControl();
                }
                else
                {
                    new MessageBox.MessageBoxBA().Show("Lỗi thêm mới.");
                }
                LockControl(); return;
            }
            else
            {
            }
        }
        private void TraCuu()
        {
            int MaDonVi = Convert.ToInt32(cboCongTy.SelectedValue.ToString());
            int Nam     = Convert.ToInt32(txtNam.Text);

            if (Nam < 2009)
            {
                new MessageBox.MessageBox().Show("Bạn phải nhập thông tin năm vé hủy lớn hơn bằng 2009.");
                return;
            }
            if (radVe.Checked)
            {
                int Seri = int.Parse(numSeriDau.Value.ToString());

                if (Seri <= 0 || MaDonVi <= 0)
                {
                    new MessageBox.MessageBox().Show("Bạn phải nhập thông tin vé cần tra cứu.");
                }
                else
                {
                    DataTable dt = Ve.TimKiemThongTinVe(MaDonVi, Seri, Nam);
                    if ((dt != null) && (dt.Rows.Count > 0))
                    {
                        lblGiaTriSuDung.Text = "VÉ ĐÃ HỦY.";
                        if (dt.Rows[0]["GhiChu"] != null)
                        {
                            lblGhiChu.Text = dt.Rows[0]["GhiChu"].ToString();
                        }
                        if (Convert.ToBoolean(dt.Rows[0]["IsTamNhap"].ToString()))
                        {
                            lblGiaTriSuDung.Text += " [Tạm nhập ]";
                        }
                    }
                    else
                    {
                        lblGiaTriSuDung.Text = "VÉ CHƯA ĐƯỢC NHẬP THÔNG TIN HỦY.";
                    }
                }
            }
            else if (radThe.Checked)
            {
                string    MaSoThe = StringTools.TrimSpace(txtMaSoThe.Text);
                DataTable dt      = The.GetChiTietThe(MaSoThe, MaDonVi, Nam);
                if ((dt != null) && (dt.Rows.Count > 0))
                {
                    lblGiaTriSuDung.Text = "THẺ ĐÃ HỦY.(" + dt.Rows[0]["TenCongTy"].ToString() + ")";
                    if (dt.Rows[0]["GhiChu"] != null)
                    {
                        lblGhiChu.Text = dt.Rows[0]["GhiChu"].ToString();
                    }
                }
                else
                {
                    lblGiaTriSuDung.Text = "THẺ CHƯA ĐƯỢC NHẬP THÔNG TIN HỦY";
                }
            }
            else if (radHopDong.Checked)
            {
                int SoHopDong = int.Parse(numSeriDau.Value.ToString());

                if (SoHopDong <= 0)
                {
                    new MessageBox.MessageBox().Show("Bạn phải nhập thông tin số hợp đồng cần tra cứu.");
                }
                else
                {
                    DataTable dt = Ve.TimKiemThongTinSoHopDong(MaDonVi, SoHopDong, Nam);
                    if ((dt != null) && (dt.Rows.Count > 0))
                    {
                        lblGiaTriSuDung.Text = "SỐ HỢP ĐỒNG ĐÃ HỦY.";
                        if (dt.Rows[0]["GhiChu"] != null)
                        {
                            lblGhiChu.Text = dt.Rows[0]["GhiChu"].ToString();
                        }
                    }
                    else
                    {
                        lblGiaTriSuDung.Text = "SỐ HỢP ĐỒNG CHƯA ĐƯỢC NHẬP THÔNG TIN HỦY.";
                    }
                }
            }
        }