Ejemplo n.º 1
0
        public ProductImageInfo GetImgWithKey(int pi_id)
        {
            ProductImageInfo info   = new Model.ProductImageInfo();
            IDataReader      reader = db.GetImageWithKey(pi_id).CreateDataReader();

            if (reader.Read())
            {
                info = ProductImageInfo.Populate(reader);
            }
            return(info);
        }
Ejemplo n.º 2
0
        public static ProductImageInfo Populate(IDataReader reader)
        {
            ProductImageInfo info = new ProductImageInfo();

            for (int i = 0; i < reader.FieldCount; i++)
            {
                PropertyInfo property = info.GetType().GetProperty(reader.GetName(i));
                Type         propType = property.PropertyType;
                TypeConverters.ITypeConverter typeConverter = TypeConverters.TypeConverterFactory.GetConvertType(propType);
                property.SetValue(info, Convert.ChangeType(typeConverter.Convert(reader.GetValue(i)), propType), null);
            }
            return(info);
        }