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


C# ICustomerBase.Backoffice方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:ProNotion,项目名称:Merchello,代码行数:44,代码来源:OrderApiController.cs

示例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;
        }
开发者ID:ProNotion,项目名称:Merchello,代码行数:47,代码来源:OrderApiController.cs

示例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();
        }
开发者ID:ProNotion,项目名称:Merchello,代码行数:9,代码来源:OrderApiController.cs


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