Ejemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="IProductDataTableRow"/> from <see cref="ProductDisplayBase"/>.
        /// </summary>
        /// <param name="baseProduct">
        /// The <see cref="ProductDisplayBase"/>.
        /// </param>
        /// <param name="isVariant">
        /// A value indicating whether or not the row represents a variant.
        /// </param>
        /// <returns>
        /// The <see cref="TRow"/>.
        /// </returns>
        public TRow Create(ProductDisplayBase baseProduct, bool isVariant = true)
        {
            var row = new TRow {
                IsForVariant = isVariant
            };

            return(this.OnCreate(row, baseProduct));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductContentBase"/> class.
 /// </summary>
 /// <param name="productBase">
 /// The product base.
 /// </param>
 /// <param name="contentType">
 /// The content Type.
 /// </param>
 /// <param name="specificCulture">
 /// Specifically sets the culture
 /// </param>
 protected ProductContentBase(ProductDisplayBase productBase, PublishedContentType contentType, string specificCulture)
 {
     Mandate.ParameterNotNull(productBase, "productBase");
     _productBase     = productBase;
     this.CultureName = specificCulture;
     _contentType     = contentType;
     this.Initialize();
 }
 /// <summary>
 /// Utility for setting the IsForBackOfficeEditor property.
 /// </summary>
 /// <param name="display">
 /// The display.
 /// </param>
 /// <param name="conversionType">
 /// The value conversion type.
 /// </param>
 internal static void EnsureValueConversion(this ProductDisplayBase display, DetachedValuesConversionType conversionType = DetachedValuesConversionType.Db)
 {
     if (display.DetachedContents.Any())
     {
         foreach (var dc in display.DetachedContents)
         {
             var contentType = DetachedValuesConverter.Current.GetContentTypeByKey(dc.DetachedContentType.UmbContentType.Key);
             if (dc.ValueConversion != conversionType && contentType != null)
             {
                 dc.DetachedDataValues = DetachedValuesConverter.Current.Convert(contentType, dc.DetachedDataValues, conversionType);
                 dc.ValueConversion    = conversionType;
             }
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Utility for setting the IsForBackOfficeEditor property.
        /// </summary>
        /// <param name="display">
        /// The display.
        /// </param>
        /// <param name="conversionType">
        /// The value conversion type.
        /// </param>
        public static void EnsureValueConversion(this ProductDisplayBase display, DetachedValuesConversionType conversionType = DetachedValuesConversionType.Db)
        {
            if (display == null)
            {
                return;
            }
            var dtC = display.DetachedContents.ToList();

            if (dtC.Any())
            {
                foreach (var dc in dtC)
                {
                    var contentType = DetachedValuesConverter.Current.GetContentTypeByKey(dc.DetachedContentType.UmbContentType.Key);
                    if (dc.ValueConversion != conversionType && contentType != null)
                    {
                        dc.DetachedDataValues = DetachedValuesConverter.Current.Convert(contentType, dc.DetachedDataValues.ToList(), conversionType);
                        dc.ValueConversion    = conversionType;
                    }
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Allows for overriding the creation of <see cref="TRow"/> from <see cref="ProductDisplayBase"/>.
 /// </summary>
 /// <param name="row">
 /// The <see cref="TRow"/>.
 /// </param>
 /// <param name="baseDisplay">
 /// The <see cref="ProductDisplayBase"/>.
 /// </param>
 /// <returns>
 /// The modified <see cref="TRow"/>.
 /// </returns>
 public TRow OnCreate(TRow row, ProductDisplayBase baseDisplay)
 {
     return(row);
 }