private void btnFilter_Click(object sender, EventArgs e) { #region old //string dk = "1=1"; //if (!String.IsNullOrEmpty(txtFilterMa.Text)) { // dk += String.Format(" and MaSanPham like '{0}'", txtFilterMa.Text); //} //if (!String.IsNullOrEmpty(txtFilterTen.Text)) { // dk += String.Format(" and TenSanPham like N'{0}'", txtFilterTen.Text); //} //string sql = "Select * from tbl_SanPham where " + dk; //this.dtHangHoa = DBTools.getData("tbl_SanPham", sql).Tables["tbl_SanPham"]; //this.ThemTruongSoTT(); //this.dv = this.dtHangHoa.DefaultView; //this.CapNhatDuLieuCotSoTT(0); //this.dgvDanhSachMatHang.DataSource = dv; //this.LuoiHienThi_CotAn(); //cm = (CurrencyManager)this.BindingContext[this.dv]; //cm.PositionChanged += new EventHandler(this.Position_Changed); //this.HienThiThongTin(this.cm.Position); #endregion dgvDanhSachMatHang.DataSource = null; dgvDanhSachMatHang.DataSource = DmSanPhamProvider.Search(new DMSanPhamInfo { TenSanPham = txtFilterTen.Text.Trim(), MaSanPham = txtFilterMa.Text.Trim() }); }
private void btnFilter_Click(object sender, EventArgs e) { liSanPham.Clear(); liSanPham = DmSanPhamProvider.Search(new DMSanPhamInfo { MaSanPham = txtFilterMa.Text.Trim(), TenSanPham = txtFilterTen.Text.Trim().ToUpper() }); grcBase.DataSource = liSanPham; }
public void TestMatHang05_InsertSuccess() { frmDM_HangHoa frm = new frmDM_HangHoa(); frm.Oid = 0; frm.isAdd = true; frmChiTiet_MatHang frmChiTietListDM = new frmChiTiet_MatHang(frm); frmChiTietListDM.SetInput("sản phẩm 1", "11111", "SP1", "123654", 120000, "UnitsTest sản phẩm", 1, 0, 0); frmChiTietListDM.TestSave(); List <DMSanPhamInfo> list = DmSanPhamProvider.Search(new DMSanPhamInfo { MaSanPham = "11111" }); Assert.AreEqual(1, list.Count); }