//Kiểm tra mã sp
        private bool KiemTraMaSP()
        {
            string _strTim = txtMaTenSP.Text;

            if (_strTim.StartsWith(">"))
            {
                string _StrNumber  = "^([0-9]*)$";
                string _strSoLuong = _strTim.Substring(1);
                if (System.Text.RegularExpressions.Regex.IsMatch(_strSoLuong, _StrNumber))
                {
                    int _sl = Convert.ToInt32(_strSoLuong);
                    _listSP = KiemKeBusiness.LaySPTheoNhom(cboNhomSP.SelectedValue.ToString());
                    _listSP.RemoveAll(item => item.SoLuong_SP < _sl);
                    dgDsSanPham.ItemsSource = _listSP;
                    dgDsSanPham.Items.Refresh();
                    return(false);
                }
            }

            if (_strTim.StartsWith("<"))
            {
                string _StrNumber  = "^([0-9]*)$";
                string _strSoLuong = _strTim.Substring(1);
                if (System.Text.RegularExpressions.Regex.IsMatch(_strSoLuong, _StrNumber))
                {
                    int _sl = Convert.ToInt32(_strSoLuong);
                    _listSP = KiemKeBusiness.LaySPTheoNhom(cboNhomSP.SelectedValue.ToString());
                    _listSP.RemoveAll(item => item.SoLuong_SP > _sl);
                    dgDsSanPham.ItemsSource = _listSP;
                    dgDsSanPham.Items.Refresh();
                    return(false);
                }
            }

            string _maSP = txtMaTenSP.Text.Trim();

            if (String.IsNullOrEmpty(_maSP))
            {
                lbWarning.Visibility = System.Windows.Visibility.Visible;
                lbWarning.Content    = "Nhập mã sản phẩm!";
                txtMaTenSP.Focus();
                txtMaTenSP.SelectAll();
                return(false);
            }

            string _strKiemTraMaSP = @"^([a-zA-Z0-9.?-]*)$";

            if (!System.Text.RegularExpressions.Regex.IsMatch(_maSP, _strKiemTraMaSP))
            {
                lbWarning.Visibility = System.Windows.Visibility.Visible;
                lbWarning.Content    = "Nhập sai định dạng.";
                txtMaTenSP.Focus();
                txtMaTenSP.SelectAll();
                return(false);
            }

            lbWarning.Visibility = System.Windows.Visibility.Hidden;
            return(true);
        }
 //Nút reset
 private void btnReset_Click(object sender, RoutedEventArgs e)
 {
     _listSP.Clear();
     _listSP = KiemKeBusiness.LaySPTheoNhom(cboNhomSP.SelectedValue.ToString());
     dgDsSanPham.ItemsSource = _listSP;
     dgDsSanPham.Items.Refresh();
     txtMaTenSP.Clear();
 }
 //CBO worker dowork
 private void CboSelectionChange_dowork(string _maNSP)
 {
     //Lấy danh sách sản phẩm theo nhóm
     _listSP.Clear();
     _listSP = KiemKeBusiness.LaySPTheoNhom(_maNSP);
 }
 //Loaded worker dowork
 private void Loaded_dowork()
 {
     //Load dữ liệu cho combobox
     _ListNhomSP = KiemKeBusiness.LayNSP();
     _listSP     = KiemKeBusiness.LaySPTheoNhom(_ListNhomSP[0].MaNSP_NSP);
 }