public List <DTOTinhTrangKho> LoadData() { List <DTOTinhTrangKho> tableList = new List <DTOTinhTrangKho>(); DataTable data = DataProvider.Instance.ExcuteQuery("USP_GetListMaterial"); foreach (DataRow item in data.Rows) { DTOTinhTrangKho table = new DTOTinhTrangKho(item); tableList.Add(table); } return(tableList); }
public List <DTOTinhTrangKho> SearchData(string keyword) { List <DTOTinhTrangKho> tableList = new List <DTOTinhTrangKho>(); DataTable data = DataProvider.Instance.ExcuteQuery("EXEC USP_SearchMaterialByName @keyword", new object[] { keyword }); //Procedure in sql, also can use select *... foreach (DataRow item in data.Rows) { DTOTinhTrangKho table = new DTOTinhTrangKho(item); tableList.Add(table); } return(tableList); }
DTOTinhTrangKho getMaterialById(int id) { List <DTOTinhTrangKho> table = DAOTinhTrangKho.Instance.LoadData(); DTOTinhTrangKho temp = null; foreach (DTOTinhTrangKho item in table) { if (item.ID == id) { temp = item; } } return(temp); }