Esempio n. 1
0
        /// <summary>
        /// Adds shipment replaceable patters.
        /// </summary>
        /// <param name="shipment">
        /// The shipment.
        /// </param>
        /// <param name="currencySymbol">
        /// The currency Symbol.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{IReplaceablePattern}"/>.
        /// </returns>
        internal static IEnumerable <IReplaceablePattern> ReplaceablePatterns(this IShipment shipment, string currencySymbol)
        {
            var patterns = new List <IReplaceablePattern>
            {
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShippedDate", shipment.ShippedDate.FormatAsStoreDate()),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToOrganization", shipment.ToOrganization),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToName", shipment.ToName),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToAddress1", shipment.ToAddress1),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToAddress2", shipment.ToAddress2),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToLocality", shipment.ToLocality),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToRegion", shipment.ToRegion),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToPostalCode", shipment.ToPostalCode),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToCountryCode", shipment.ToCountryCode),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToEmail", shipment.Email),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToPhone", shipment.Phone),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToOrganization", shipment.ToOrganization),
                ReplaceablePattern.GetConfigurationReplaceablePattern("TrackingCode", shipment.TrackingCode)
            };

            patterns.AddRange(shipment.LineItemReplaceablePatterns(currencySymbol));

            return(patterns.Where(x => x != null));
        }
        /// <summary>
        /// Gets a collection of <see cref="IReplaceablePattern"/> for the invoice
        /// </summary>
        /// <param name="invoice">
        /// The invoice.
        /// </param>
        /// <returns>
        /// The collection of replaceable patterns
        /// </returns>
        internal static IEnumerable <IReplaceablePattern> ReplaceablePatterns(this IShipment shipment)
        {
            // TODO localization needed on pricing and datetime
            var patterns = new List <IReplaceablePattern>
            {
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShippedDate", shipment.ShippedDate.ToShortDateString()),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToOrganization", shipment.ToOrganization),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToName", shipment.ToName),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToAddress1", shipment.ToAddress1),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToAddress2", shipment.ToAddress2),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToLocality", shipment.ToLocality),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToRegion", shipment.ToRegion),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToPostalCode", shipment.ToPostalCode),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToCountryCode", shipment.ToCountryCode),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToEmail", shipment.Email),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToPhone", shipment.Phone),
                ReplaceablePattern.GetConfigurationReplaceablePattern("ShipToOrganization", shipment.ToOrganization),
                ReplaceablePattern.GetConfigurationReplaceablePattern("TrackingCode", shipment.TrackingCode)
            };

            patterns.AddRange(shipment.LineItemReplaceablePatterns());

            return(patterns);
        }