コード例 #1
0
 public ProductImageGalleryNode(ISalesAttachment imageSalesAttachment, ISalesAttachment thumbnailImageSalesAttachment, string imageURL, string thumbnailImageURL)
 {
     ImageSalesAttachment          = imageSalesAttachment;
     ImageURL                      = imageURL;
     ThumbnailImageSalesAttachment = thumbnailImageSalesAttachment;
     ThumbnailImageURL             = thumbnailImageURL;
 }
コード例 #2
0
        /// <summary>
        /// Product initialization
        /// </summary>
        /// <param name="product">Product entity record</param>
        /// <param name="productMetadata">Product entity metadata</param>
        /// <param name="pricingInfo">Product Pricing Info</param>
        /// <param name="primaryImageAttachment">Primary Image Sales Attachment</param>
        /// <param name="thumbnailImageAttachment">Thumbnail Image Sales Attachment</param>
        public Product(Entity product, EntityMetadata productMetadata, IProductPricingInfo pricingInfo, ISalesAttachment primaryImageAttachment, ISalesAttachment thumbnailImageAttachment)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product");
            }
            if (productMetadata == null)
            {
                throw new ArgumentNullException("productMetadata");
            }
            if (product.LogicalName != "product")
            {
                throw new ArgumentException(string.Format(ResourceManager.GetString("Value_Missing_For_LogicalName"), product.LogicalName), "product");
            }

            Brand             = product.GetAttributeValue <EntityReference>("adx_brand");
            Currency          = product.GetAttributeValue <EntityReference>("transactioncurrencyid");
            DefaultPriceList  = product.GetAttributeValue <EntityReference>("priceleveid");
            DefaultUnit       = product.GetAttributeValue <EntityReference>("defaultuomid");
            Entity            = product;
            EntityReference   = product.ToEntityReference();
            ImageURL          = primaryImageAttachment == null ? string.Empty : primaryImageAttachment.URL;
            ImageThumbnailURL = thumbnailImageAttachment == null ? string.Empty : thumbnailImageAttachment.URL;
            PricingInfo       = pricingInfo;
            Subject           = product.GetAttributeValue <EntityReference>("subjectid");
            UnitGroup         = product.GetAttributeValue <EntityReference>("defaultuomscheduleid");

            if (FeatureCheckHelper.IsFeatureEnabled(FeatureNames.TelemetryFeatureUsage))
            {
                PortalFeatureTrace.TraceInstance.LogFeatureUsage(FeatureTraceCategory.Product, HttpContext.Current, "create_note", 1, product.ToEntityReference(), "create");
            }
        }