本文整理汇总了C#中ICustomerBase.Backoffice方法的典型用法代码示例。如果您正苦于以下问题:C# ICustomerBase.Backoffice方法的具体用法?C# ICustomerBase.Backoffice怎么用?C# ICustomerBase.Backoffice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICustomerBase
的用法示例。
在下文中一共展示了ICustomerBase.Backoffice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessesProductsToBackofficeOrder
public BackofficeOrderSummary ProcessesProductsToBackofficeOrder(BackofficeAddItemModel model)
{
_customer = MerchelloContext.Services.CustomerService.GetAnyByKey(new Guid(model.CustomerKey));
_backoffice = _customer.Backoffice();
_backoffice.Empty();
_backoffice.Save();
if (model.ProductKeys != null && model.ProductKeys.Any())
{
foreach (var key in model.ProductKeys)
{
var extendedData = new ExtendedDataCollection();
//extendedData.SetValue("umbracoContentId", model.ContentId.ToString(CultureInfo.InvariantCulture));
var product = MerchelloContext.Services.ProductService.GetByKey(new Guid(key));
//if (model.OptionChoices != null && model.OptionChoices.Any())
//{
// var variant = MerchelloContext.Services.ProductVariantService.GetProductVariantWithAttributes(product, model.OptionChoices);
// extendedData.SetValue("isVariant", "true");
// _backoffice.AddItem(variant, variant.Name, 1, extendedData);
//}
//else
//{
_backoffice.AddItem(product, product.Name, 1, extendedData);
//}
}
var salesPreparation = _customer.Backoffice().SalePreparation();
salesPreparation.SaveBillToAddress(model.BillingAddress.ToAddress());
salesPreparation.SaveShipToAddress(model.ShippingAddress.ToAddress());
return GetBackofficeOrderSummary(salesPreparation);
}
else
{
return new BackofficeOrderSummary();
}
}
示例2: FinalizeBackofficeOrder
public bool FinalizeBackofficeOrder(BackofficeAddItemModel model)
{
_customer = MerchelloContext.Services.CustomerService.GetAnyByKey(new Guid(model.CustomerKey));
_backoffice = _customer.Backoffice();
// This check asserts that we have enough
// this should be handled a bit nicer for the customer.
if (!_backoffice.SalePreparation().IsReadyToInvoice()) return false;
var preparation = _backoffice.SalePreparation();
// Get the shipment again
var shippingAddress = _backoffice.SalePreparation().GetShipToAddress();
var shipment = _backoffice.PackageBackoffice(shippingAddress).FirstOrDefault();
// Clear any previously saved quotes (eg. the user went back to their basket and started the process over again).
_backoffice.SalePreparation().ClearShipmentRateQuotes();
// get the quote using the "approved shipping method"
var quote = shipment.ShipmentRateQuoteByShipMethod(model.ShipmentKey);
// save the quote
_backoffice.SalePreparation().SaveShipmentRateQuote(quote);
// for cash providers we only want to authorize the payment
var paymentMethod = _backoffice.SalePreparation().GetPaymentMethod();
IPaymentResult attempt;
if (Merchello.Core.Constants.ProviderKeys.Payment.CashPaymentProviderKey == new Guid(model.PaymentProviderKey))
{
// AuthorizePayment will save the invoice with an Invoice Number.
//
attempt = preparation.AuthorizePayment(new Guid(model.PaymentKey));
}
else // we
{
// TODO wire in redirect to Credit Card view or PayPal ... etc.
throw new NotImplementedException();
}
_backoffice.Empty();
_backoffice.Save();
return true;
}
示例3: GetShippingMethods
public IEnumerable<IShipmentRateQuote> GetShippingMethods(BackofficeAddItemModel model)
{
_customer = MerchelloContext.Services.CustomerService.GetAnyByKey(new Guid(model.CustomerKey));
_backoffice = _customer.Backoffice();
var shipment = _backoffice.PackageBackoffice(model.ShippingAddress.ToAddress()).FirstOrDefault();
return shipment.ShipmentRateQuotes();
}