/// <summary> /// Executes the operations associated with the cmdlet. /// </summary> public override void ExecuteCmdlet() { CartLineItem lineItem; try { if (!ShouldProcess(Resources.NewPartnerCustomerCartLineItemWhatIf)) { return; } lineItem = new CartLineItem { CatalogItemId = CatalogItemId, BillingCycle = BillingCycle, CurrencyCode = CurrencyCode, FriendlyName = FriendlyName, OrderGroup = OrderGroup, ProvisioningContext = new Dictionary <string, string>(), Quantity = Quantity }; if (ProvisioningContext != null) { foreach (KeyValuePair <object, object> value in ProvisioningContext.Cast <DictionaryEntry>() .ToDictionary(d => d.Key, d => d.Value)) { lineItem.ProvisioningContext.Add(value.Key.ToString(), value.Value.ToString()); } } WriteObject(new PSCartLineItem(lineItem)); } finally { lineItem = null; } }
/// <summary> /// Executes the operations associated with the cmdlet. /// </summary> public override void ExecuteCmdlet() { PSOrderLineItem orderLineItem; try { if (!ShouldProcess(Resources.NewPartnerCustomerOrderLineItemWhatIf)) { return; } orderLineItem = new PSOrderLineItem { FriendlyName = FriendlyName, LineItemNumber = LineItemNumber, OfferId = OfferId, ParentSubscriptionId = ParentSubscriptionId, PartnerIdOnRecord = PartnerIdOnRecord, Quantity = Quantity, SubscriptionId = SubscriptionId }; if (ProvisioningContext != null) { foreach (KeyValuePair <object, object> value in ProvisioningContext.Cast <DictionaryEntry>() .ToDictionary(d => d.Key, d => d.Value)) { orderLineItem.ProvisioningContext.Add(value.Key.ToString(), value.Value.ToString()); } } WriteObject(orderLineItem); } finally { orderLineItem = null; } }