本文整理汇总了C#中Order.Cancel方法的典型用法代码示例。如果您正苦于以下问题:C# Order.Cancel方法的具体用法?C# Order.Cancel怎么用?C# Order.Cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order.Cancel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Executes Cancel Order operation.
/// Checks if order is in scheduling state, then executes if it is.
/// Otherwise, throws a WorkflowException.
/// </summary>
/// <param name="order"></param>
/// <param name="info"></param>
public void Execute(Order order, OrderCancelInfo info)
{
if (order.Status == OrderStatus.SC)
order.Cancel(info);
else
throw new WorkflowException(string.Format("Order with status {0} cannot be cancelled.", order.Status));
}
示例2: CancelShipping
public ShippingResult CancelShipping(Order order)
{
//do something to cancel the shipping of the order
//question to consider: should the order *really* be cancelled too...?
order.Cancel();
return ShippingResult.Cancelled;
}
示例3: SetUp
public void SetUp()
{
var appHelper = new ResourceHandlerTestBase();
var app = appHelper.CreateAppProxy();
order = new Order();
order.Cancel("You are too slow.");
representation = OrderRepresentationMapper.Map(order, appHelper.Container.Resolve<ResourceLinker>(), app.Get("/order").Context);
}
示例4: Test_Execute_Cancel
public void Test_Execute_Cancel()
{
Order order = new Order();
OrderCancelInfo info = new OrderCancelInfo();
CancelOrderOperation op = new CancelOrderOperation();
order.Cancel(new OrderCancelInfo());
order.UpdateStatus();
Assert.AreEqual(OrderStatus.CA, order.Status);
op.Execute(order, info);
}
示例5: Test_CanExecute_Cancel
public void Test_CanExecute_Cancel()
{
Order order = new Order();
DiscontinueOrderOperation op = new DiscontinueOrderOperation();
order.Cancel(new OrderCancelInfo());
order.UpdateStatus();
Assert.AreEqual(OrderStatus.CA, order.Status);
Assert.IsFalse(op.CanExecute(order));
}