public void ThemSPTest() { SANPHAM SP = new SANPHAM(); DataTable dt = SP.gettable(); int Sodong = dt.Rows.Count; String TenSP = "SP07"; int Soluong = 3; String TenLSP = "LSP01"; int Dongia = 200000; SP.ThemSP(TenSP, Soluong, TenLSP, Dongia); DataTable da = SP.gettable(); Assert.AreEqual(da.Rows.Count, (Sodong + 1)); Assert.AreEqual(da.Rows[da.Rows.Count - 1].ItemArray[1].ToString(), TenSP); Assert.AreEqual(int.Parse(da.Rows[da.Rows.Count - 1].ItemArray[2].ToString()), Soluong); }
public void Hien(string filter = "") { DataTable dt = new DataTable(); dt = SP.gettable(); DataView dv = new DataView(dt); if (!string.IsNullOrEmpty(filter)) { dv.RowFilter = filter; } DGRSanpham.AutoGenerateColumns = false; DGRSanpham.DataSource = dv; }