コード例 #1
0
        public bool VerifyQualificaion(AffiliateProgram AffiliateProgram, Order order)
        {
            foreach (var condition in AffiliateProgram.Conditions.ToList())
            {
                if (condition.Operation == LogicalOperation.Is)
                {
                    var valueType = order.GetType().IsValueType;
                    // comparing cart total price, if value is value type
                    if (condition.Value != null)
                    {
                        if (condition.ConditionAttributeName == "CartTotalPrice")
                        {
                            var ans = CompareReferenceTypes <string, string>(condition.OperationSymbol, GetCartTotalPrice().ToString(), condition.Value);
                        }

                        if (condition.ConditionAttributeName == "CartItemsCount")
                        {
                            var ans = CompareReferenceTypes <string, string>(condition.OperationSymbol, GetCartItemsCount().ToString(), condition.Value);
                        }

                        // if value is numeric (including fractions)
                        var match = Regex.Match(condition.Value, @"^\d+(?:\.?\d*|\s\d+\/\d+)$");
                        if (match.Success)
                        {
                        }
                    }
                    else // else reference type
                    {
                    }
                }
            }

            return(true);
        }
コード例 #2
0
        public void UpdateAffiliateProgram(AffiliateProgram affiliateProgram)
        {
            if (affiliateProgram == null)
            {
                throw new ArgumentNullException("affiliateProgram");
            }

            _affiliateProgramRepository.Update(affiliateProgram);

            _eventPublisher.EntityUpdated(affiliateProgram);
        }
コード例 #3
0
        public static IHtmlString GetLink(this AffiliateProgram affiliateProgram)
        {
            var tag = new TagBuilder("a");

            if (affiliateProgram == null)
            {
                return(MvcHtmlString.Create(tag.ToString(TagRenderMode.Normal)));
            }
            var retVal = GetAffiliateProgramLink(affiliateProgram.Id, affiliateProgram.Name);

            return(retVal);
        }
コード例 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = CategoryId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AffiliateProgram != null ? AffiliateProgram.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FriendlyName != null ? FriendlyName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CategoryUrl != null ? CategoryUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CouponsCount.GetHashCode());
         return(hashCode);
     }
 }
コード例 #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = StoreId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AffiliateProgram != null ? AffiliateProgram.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FriendlyName != null ? FriendlyName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ImageUrl != null ? ImageUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StoreUrl != null ? StoreUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CouponsCount.GetHashCode();
         return(hashCode);
     }
 }
コード例 #6
0
        public ActionResult Index()
        {
            AffiliateProgram program   = new AffiliateProgram();
            ProgramCondition condition = new ProgramCondition();

            condition.Name             = "CartTotal";
            condition.Operation        = LogicalOperation.Is;
            condition.Value            = "10";
            condition.AffiliateProgram = program;

            //_affiliateProgramService.InsertAffiliateProgram(program);
            //_affiliateProgramService.InsertProgramCondition(condition);

            program = _affiliateProgramService.GetAffiliateProgramById(1);
            Order order = new Order {
                OrderTotal = 10
            };

            var cart = _workContext.CurrentCustomer.ShoppingCartItems
                       .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart)
                       .LimitPerStore(_storeContext.CurrentStore.Id)
                       .ToList();

            decimal  orderSubTotalDiscountAmountBase;
            Discount orderSubTotalAppliedDiscount;
            decimal  subTotalWithoutDiscountBase;
            decimal  subTotalWithDiscountBase;
            var      subTotalIncludingTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal;

            _orderTotalCalculationService.GetShoppingCartSubTotal(cart, subTotalIncludingTax,
                                                                  out orderSubTotalDiscountAmountBase, out orderSubTotalAppliedDiscount,
                                                                  out subTotalWithoutDiscountBase, out subTotalWithDiscountBase);
            decimal subtotalBase = subTotalWithoutDiscountBase;
            decimal subtotal     = _currencyService.ConvertFromPrimaryStoreCurrency(subtotalBase, _workContext.WorkingCurrency);
            var     subTotal     = _priceFormatter.FormatPrice(subtotal, true, _workContext.WorkingCurrency, _workContext.WorkingLanguage, subTotalIncludingTax);

            //_affiliateProgramService.VerifyQualificaion(program, order);
            var valueType = "qwer".GetType().IsValueType;

            var ans = CompareReferenceTypes <string, string> ("<=", "15.", "12.33");

            //_shoppingCartService.
            return(View());
        }
コード例 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = CouponId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AffiliateProgram != null ? AffiliateProgram.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FriendlyDescription != null ? FriendlyDescription.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Remark != null ? Remark.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Code != null ? Code.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Discount.GetHashCode();
         hashCode = (hashCode * 397) ^ (Store != null ? Store.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Validity.GetHashCode();
         hashCode = (hashCode * 397) ^ (CouponLink != null ? CouponLink.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ New.GetHashCode();
         hashCode = (hashCode * 397) ^ IsPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ Shipping.GetHashCode();
         return(hashCode);
     }
 }