/// <summary> /// Gets a product variant attribute mapping /// </summary> /// <param name="ProductVariantAttributeID">Product variant attribute mapping identifier</param> /// <returns>Product variant attribute mapping</returns> public static ProductVariantAttribute GetProductVariantAttributeByID(int ProductVariantAttributeID) { if (ProductVariantAttributeID == 0) { return(null); } string key = string.Format(PRODUCTVARIANTATTRIBUTES_BY_ID_KEY, ProductVariantAttributeID); object obj2 = NopCache.Get(key); if (ProductAttributeManager.CacheEnabled && (obj2 != null)) { return((ProductVariantAttribute)obj2); } DBProductVariantAttribute dbItem = DBProviderManager <DBProductAttributeProvider> .Provider.GetProductVariantAttributeByID(ProductVariantAttributeID); ProductVariantAttribute productVariantAttribute = DBMapping(dbItem); if (ProductAttributeManager.CacheEnabled) { NopCache.Max(key, productVariantAttribute); } return(productVariantAttribute); }
private DBProductVariantAttribute GetProductVariantAttributeFromReader(IDataReader dataReader) { DBProductVariantAttribute productVariantAttribute = new DBProductVariantAttribute(); productVariantAttribute.ProductVariantAttributeID = NopSqlDataHelper.GetInt(dataReader, "ProductVariantAttributeID"); productVariantAttribute.ProductVariantID = NopSqlDataHelper.GetInt(dataReader, "ProductVariantID"); productVariantAttribute.ProductAttributeID = NopSqlDataHelper.GetInt(dataReader, "ProductAttributeID"); productVariantAttribute.TextPrompt = NopSqlDataHelper.GetString(dataReader, "TextPrompt"); productVariantAttribute.IsRequired = NopSqlDataHelper.GetBoolean(dataReader, "IsRequired"); productVariantAttribute.AttributeControlTypeID = NopSqlDataHelper.GetInt(dataReader, "AttributeControlTypeID"); productVariantAttribute.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder"); return productVariantAttribute; }
/// <summary> /// Updates the product variant attribute mapping /// </summary> /// <param name="ProductVariantAttributeID">The product variant attribute mapping identifier</param> /// <param name="ProductVariantID">The product variant identifier</param> /// <param name="ProductAttributeID">The product attribute identifier</param> /// <param name="TextPrompt">The text prompt</param> /// <param name="IsRequired">The value indicating whether the entity is required</param> /// <param name="AttributeControlType">The attribute control type</param> /// <param name="DisplayOrder">The display order</param> /// <returns>Product variant attribute mapping</returns> public static ProductVariantAttribute UpdateProductVariantAttribute(int ProductVariantAttributeID, int ProductVariantID, int ProductAttributeID, string TextPrompt, bool IsRequired, AttributeControlTypeEnum AttributeControlType, int DisplayOrder) { DBProductVariantAttribute dbItem = DBProviderManager <DBProductAttributeProvider> .Provider.UpdateProductVariantAttribute(ProductVariantAttributeID, ProductVariantID, ProductAttributeID, TextPrompt, IsRequired, (int)AttributeControlType, DisplayOrder); ProductVariantAttribute productVariantAttribute = DBMapping(dbItem); if (ProductAttributeManager.CacheEnabled) { NopCache.RemoveByPattern(PRODUCTATTRIBUTES_PATTERN_KEY); NopCache.RemoveByPattern(PRODUCTVARIANTATTRIBUTES_PATTERN_KEY); NopCache.RemoveByPattern(PRODUCTVARIANTATTRIBUTEVALUES_PATTERN_KEY); } return(productVariantAttribute); }
private static ProductVariantAttribute DBMapping(DBProductVariantAttribute dbItem) { if (dbItem == null) { return(null); } ProductVariantAttribute item = new ProductVariantAttribute(); item.ProductVariantAttributeID = dbItem.ProductVariantAttributeID; item.ProductVariantID = dbItem.ProductVariantID; item.ProductAttributeID = dbItem.ProductAttributeID; item.TextPrompt = dbItem.TextPrompt; item.IsRequired = dbItem.IsRequired; item.AttributeControlTypeID = dbItem.AttributeControlTypeID; item.DisplayOrder = dbItem.DisplayOrder; return(item); }