public void LoadOneSpecificationTo(Product product) { int oridinal = GetOridinalFor(nameColumnName); // Не для всех товаров есть технические характеристики bool specExist = !_reader.IsDBNull(oridinal); if (specExist) { string key = _reader.GetString(oridinal); product.Specification[key] = _reader.GetString(GetOridinalFor(valueColumnName)); } }
public Product GetProduct() { Product p = new Product (); p.Id = _reader.GetInt32 (GetOridinalFor(idColumnName)); p.Name = _reader.GetString (GetOridinalFor(nameColumnName)); p.Description = _reader.IsDBNull (GetOridinalFor (descriptionColumnName)) ? null : _reader.GetString (GetOridinalFor (descriptionColumnName)); p.ImageName = _reader.IsDBNull (GetOridinalFor (imageNameColumnName)) ? null : _reader.GetString (GetOridinalFor (imageNameColumnName)); p.Price = _reader.GetDecimal (GetOridinalFor(priceColumnName)); p.ProductType = (ProductType)_reader.GetInt32 (GetOridinalFor(productTypeColumnName)); return p; }