当前位置: 首页>>代码示例>>C#>>正文


C# LineItem.Delete方法代码示例

本文整理汇总了C#中LineItem.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# LineItem.Delete方法的具体用法?C# LineItem.Delete怎么用?C# LineItem.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LineItem的用法示例。


在下文中一共展示了LineItem.Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteInvalidItem

 private static void DeleteInvalidItem(OrderForm[] orderForms, LineItem lineItem)
 {
     foreach (var form in orderForms)
     {
         form.RemoveLineItemFromShipments(lineItem);
     }
     lineItem.Delete();
 }
开发者ID:smchristenson,项目名称:CommerceStarterKit,代码行数:8,代码来源:ValidateLineItemsActivity.cs

示例2: RequestInventory

        private void RequestInventory(OrderForm orderForm, Shipment shipment, LineItem lineItem)
        {
            var lineItemIndex = orderForm.LineItems.IndexOf(lineItem);
            InventoryRequest request;
            var outOfStock = false;
            InventoryResponse response = null;

            lock (_lockObject)
            {
                // Check quantity of order again to make sure there is enough quantity.
                outOfStock = this.GetNewLineItemQty(lineItem, new List<string>(), shipment) <= 0;

                if (!outOfStock)
                {
                    request = AdjustStockItemQuantity(shipment, lineItem);
                    if (request != null)
                    {
                        response = _inventoryService.Service.Request(request);
                    }
                }
            }

            // if out of stock, delete line item and remove line item from the shipment.
            if (outOfStock)
            {
                Warnings.Add("LineItemRemoved-" + lineItem.LineItemId.ToString(), String.Format("Item \"{0}\" has been removed from the cart because there is not enough available quantity.", lineItem.DisplayName));
                lineItem.Delete();
                shipment.RemoveLineItemIndex(lineItemIndex);

                // Delete the shipment and cancel operation keys if it has no more line item.
                if (shipment.LineItemIndexes.Length == 0)
                {
                    CancelOperationKeys(shipment);
                    shipment.Delete();
                    shipment.AcceptChanges();
                }
                return;
            }

            if (response != null && response.IsSuccess)
            {
                lineItem.IsInventoryAllocated = true;

                // Store operation keys to Shipment for each line item, to use later for complete request
                var existedIndex = shipment.OperationKeysMap.ContainsKey(lineItemIndex);
                var operationKeys = response.Items.Select(c => c.OperationKey);
                if (!existedIndex)
                {
                    shipment.AddInventoryOperationKey(lineItemIndex, operationKeys);
                }
                else
                {
                    shipment.InsertOperationKeys(lineItemIndex, operationKeys);
                }
            }
        }
开发者ID:valdisiljuconoks,项目名称:Ascend15,代码行数:56,代码来源:AdjustInventoryActivity.cs


注:本文中的LineItem.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。