本文整理汇总了C#中OrderInfo.ResetDiscounts方法的典型用法代码示例。如果您正苦于以下问题:C# OrderInfo.ResetDiscounts方法的具体用法?C# OrderInfo.ResetDiscounts怎么用?C# OrderInfo.ResetDiscounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderInfo
的用法示例。
在下文中一共展示了OrderInfo.ResetDiscounts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPaymentProvider
public ProviderActionResult AddPaymentProvider(OrderInfo order, int paymentProviderId, string paymentProviderMethodId, ILocalization store)
{
if (ChangeOrderToIncompleteAndReturnTrueIfNotAllowed(order))
return ProviderActionResult.NotPermitted;
if (paymentProviderId == 0)
{
Log.Instance.LogError("AddPaymentProvider AddPaymentMethod ProviderActionResult.ProviderIdZero");
return ProviderActionResult.ProviderIdZero;
}
var paymentProvider = PaymentProviderHelper.GetPaymentProvidersForOrder(order).SingleOrDefault(x => x.Id == paymentProviderId);
if (paymentProvider == null)
{
Log.Instance.LogError("AddPaymentProvider AddPaymentMethod paymentProvider == null");
return ProviderActionResult.NoCorrectInput;
}
order.PaymentInfo.Id = paymentProviderId;
order.PaymentInfo.Title = paymentProvider.Title;
order.PaymentInfo.PaymentType = paymentProvider.Type;
var paymentMethod = paymentProvider.PaymentProviderMethods.SingleOrDefault(x => x.Id == paymentProviderMethodId);
if (paymentMethod == null)
{
Log.Instance.LogError("AddPaymentProvider AddPaymentMethod paymentMethod == null");
return ProviderActionResult.NoCorrectInput;
}
order.PaymentInfo.MethodId = paymentProviderMethodId;
order.PaymentInfo.MethodTitle = paymentMethod.Title;
if (paymentMethod.AmountType == PaymentProviderAmountType.Amount)
order.PaymentProviderAmount = paymentMethod.PriceInCents;
else
order.PaymentProviderOrderPercentage = paymentMethod.PriceInCents;
order.ResetDiscounts();
return ProviderActionResult.Success;
}
示例2: AddShippingProvider
public ProviderActionResult AddShippingProvider(OrderInfo order, int shippingProviderId, string shippingProviderMethodId, ILocalization localization)
{
if (ChangeOrderToIncompleteAndReturnTrueIfNotAllowed(order))
{
Log.Instance.LogDebug("AddShippingMethod: " + ProviderActionResult.NotPermitted);
return ProviderActionResult.NotPermitted;
}
if (shippingProviderId == 0)
{
Log.Instance.LogDebug("AddShippingMethod: " + ProviderActionResult.ProviderIdZero);
return ProviderActionResult.ProviderIdZero;
}
// todo: move logic and update API
var shippingProvider = ShippingProviderHelper.GetAllShippingProviders(localization.StoreAlias, localization.CurrencyCode).FirstOrDefault(x => x.Id == shippingProviderId);
if (shippingProvider == null)
{
Log.Instance.LogDebug("AddShippingMethod shippingProvider " + ProviderActionResult.NoCorrectInput + " shippingProviderId: " + shippingProviderId);
return ProviderActionResult.NoCorrectInput;
}
order.ShippingInfo.Id = shippingProviderId;
order.ShippingInfo.Title = shippingProvider.Title;
order.ShippingInfo.ShippingType = shippingProvider.Type;
var shippingMethod = shippingProvider.ShippingProviderMethods.FirstOrDefault(x => x.Id == shippingProviderMethodId);
if (shippingMethod == null)
{
Log.Instance.LogDebug("AddShippingMethod shippingMethod " + ProviderActionResult.NoCorrectInput + " shippingProviderMethodId: " + shippingProviderMethodId);
return ProviderActionResult.NoCorrectInput;
}
order.ShippingInfo.MethodId = shippingProviderMethodId;
order.ShippingInfo.MethodTitle = shippingMethod.Title;
shippingMethod.UpdatePriceFromCustomShippingProvider(order);
order.ResetDiscounts();
return ProviderActionResult.Success;
}