Esempio n. 1
0
        public static List <SanPhamDTO> LaySPTheoTuKhoa(string tukhoa)
        {
            SqlDataReader     reader = DataProvider.TruyVanSPTheoTuKhoa("LaySPTheoTuKhoa", tukhoa);
            List <SanPhamDTO> lsp    = new List <SanPhamDTO>();

            try
            {
                while (reader.Read())
                {
                    SanPhamDTO sp = new SanPhamDTO();
                    sp.MaSP       = reader.GetString(0);
                    sp.TenSP      = reader.GetString(1);
                    sp.TenLoaiSP  = reader.GetString(3);
                    sp.TenDanhMuc = reader.GetString(2);
                    sp.XuatXu     = reader.GetString(4);
                    sp.DonViTinh  = reader.GetString(5);
                    sp.GiaBan     = (int)reader.GetDecimal(6);
                    sp.SoLuong    = reader.GetInt32(7);
                    lsp.Add(sp);
                }
                reader.Close();
            }
            catch
            {
            }

            return(lsp);
        }