Пример #1
0
        public void PerformOrderManagementRules(ShoppingCart_V02 cart,
                                                Order_V01 order,
                                                string locale,
                                                OrderManagementRuleReason reason)
        {
            if (IsRuleTime() && reason == OrderManagementRuleReason.OrderBeingSubmitted)
            {
                var session = SessionInfo.GetSessionInfo(cart.DistributorID, locale);
                var hlCart  = cart as MyHLShoppingCart;
                var promo   = ShoppingCartProvider.GetEligibleForPromo(cart.DistributorID, cart.Locale);
                PromoSKUs = HLConfigManager.Configurations.ShoppingCartConfiguration.PromotionalSku.Split(',').ToList();

                var promoSkuInCart = promo != null?
                                     cart.CartItems.Where(i => i.SKU == promo.Sku).Select(i => i.SKU).ToList() :
                                         cart.CartItems.Where(i => PromoSKUs.Contains(i.SKU)).Select(i => i.SKU).ToList();

                if (session != null && session.SelectedPaymentMethod > 1 && hlCart != null && promoSkuInCart.Count > 0)
                {
                    if (session.SelectedPaymentMethod > 1)
                    {
                        // Remove any promo sku in cart when order is unpaid
                        hlCart.DeleteItemsFromCart(promoSkuInCart, true);
                    }
                    else
                    {
                        // Validate if distributor is still eligible
                        if (promo == null && promoSkuInCart.Count > 0)
                        {
                            // Remove promo sku from cart
                            hlCart.DeleteItemsFromCart(promoSkuInCart, true);
                        }
                    }
                }
                if (session != null && session.SelectedPaymentMethod > 1)
                {
                    hlCart.IsPromoDiscarted = true;
                }
            }
        }
 public void PerformOrderManagementRules(ShoppingCart_V02 cart, Order_V01 order, string locale, OrderManagementRuleReason reason)
 {
     if (reason == OrderManagementRuleReason.OrderBeingSubmitted && cart != null)
     {
         var myHLCart = cart as MyHLShoppingCart;
         validateAndUpdateWH(ref myHLCart);
     }
 }
 public void PerformOrderManagementRules(ShoppingCart_V02 cart, Order_V01 order, string locale, OrderManagementRuleReason reason)
 {
     if (reason == OrderManagementRuleReason.OrderFilled)
     {
         if (order.PurchasingLimits != null)
         {
             var limits = (order.PurchasingLimits as PurchasingLimits_V01);
             if (limits != null && string.IsNullOrEmpty(limits.PurchaseSubType))
             {
                 var myHLCart = cart as MyHLShoppingCart;
                 if (myHLCart != null && string.IsNullOrEmpty(myHLCart.SelectedDSSubType))
                 {
                     limits.PurchaseSubType = myHLCart.SelectedDSSubType;
                 }
                 else
                 {
                     var dsProfile = DistributorOrderingProfileProvider.GetProfile(cart.DistributorID, order.CountryOfProcessing);
                     limits.PurchaseSubType = dsProfile.OrderSubType;
                 }
             }
         }
     }
 }
        public void PerformOrderManagementRules(ShoppingCart_V02 cart, Order_V01 order, string locale, OrderManagementRuleReason reason)
        {
            if (System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar != null)
            {
                //System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = new System.Globalization.GregorianCalendar();

                if (order.OrderMonth != null)
                {
                    var oM            = order.OrderMonth;
                    var gregorianYear = DateTime.Now.Year.ToString().Substring(2, 2);
                    //If not contain the GregorianYear
                    if (oM.Contains(gregorianYear))
                    {
                        oM = gregorianYear + oM.Substring(2);
                        order.OrderMonth = oM;
                    }
                }
            }
        }