本文整理汇总了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();
}
示例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);
}
}
}