Exemplo n.º 1
0
        public static List <Product> LayDSThietBiTheoMaLoai(string maLoai)
        {
            List <Product> _ds = new List <Product>();
            string         sql = "select * from Product where id_cate = " + maLoai;
            DataTable      dt  = SqlDataAccessHelper.ExecuteQuery(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Product td = new Product();
                td.Id       = dt.Rows[i]["id"].ToString();
                td.Id_cate  = dt.Rows[i]["id_cate"].ToString();
                td.Name_pro = dt.Rows[i]["name_pro"].ToString();
                td.Qty      = int.Parse(dt.Rows[i]["qty"].ToString());
                td.Price    = int.Parse(dt.Rows[i]["price"].ToString());
                _ds.Add(td);
            }
            return(_ds);
        }