private void IsDiscountProduct(System.Web.HttpContext context)
        {
            int num = Globals.RequestFormNum("productId");

            if (num > 0)
            {
                LimitedTimeDiscountProductInfo discountProductInfoByProductId = LimitedTimeDiscountHelper.GetDiscountProductInfoByProductId(num);
                if (discountProductInfoByProductId != null)
                {
                    LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(discountProductInfoByProductId.LimitedTimeDiscountId);
                    MemberInfo currentMember             = MemberProcessor.GetCurrentMember();
                    int        num2 = 0;
                    int        num3 = discountInfo.LimitNumber;
                    if (discountInfo != null)
                    {
                        if (currentMember != null)
                        {
                            if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, currentMember.UserId))
                            {
                                int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(discountProductInfoByProductId.LimitedTimeDiscountId, null, num, currentMember.UserId, false);
                                if (discountInfo.LimitNumber == 0)
                                {
                                    num2 = discountInfo.LimitedTimeDiscountId;
                                }
                                else if (discountInfo.LimitNumber - limitedTimeDiscountUsedNum > 0)
                                {
                                    num2 = discountInfo.LimitedTimeDiscountId;
                                    num3 = discountInfo.LimitNumber - limitedTimeDiscountUsedNum;
                                }
                                else
                                {
                                    num3 = 0;
                                }
                            }
                        }
                        else
                        {
                            num2 = discountInfo.LimitedTimeDiscountId;
                        }
                    }
                    if (discountInfo != null)
                    {
                        context.Response.Write(string.Concat(new object[]
                        {
                            "{\"msg\":\"success\",\"ActivityName\":\"",
                            Globals.String2Json(discountInfo.ActivityName),
                            "\",\"FinalPrice\":\"",
                            discountProductInfoByProductId.FinalPrice.ToString("f2"),
                            "\",\"LimitedTimeDiscountId\":\"",
                            num2,
                            "\",\"LimitNumber\":\"",
                            discountInfo.LimitNumber,
                            "\",\"RemainNumber\":\"",
                            num3,
                            "\"}"
                        }));
                    }
                }
            }
        }
示例#2
0
        private void IsDiscountProduct(HttpContext context)
        {
            int productId = Globals.RequestFormNum("productId");

            if (productId > 0)
            {
                LimitedTimeDiscountProductInfo discountProductInfoByProductId = LimitedTimeDiscountHelper.GetDiscountProductInfoByProductId(productId);
                if (discountProductInfoByProductId != null)
                {
                    LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(discountProductInfoByProductId.LimitedTimeDiscountId);
                    MemberInfo currentMember             = MemberProcessor.GetCurrentMember();
                    int        limitedTimeDiscountId     = 0;
                    if (discountInfo != null)
                    {
                        if (currentMember != null)
                        {
                            if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, currentMember.UserId))
                            {
                                int num3 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(limitedTimeDiscountId, null, productId, currentMember.UserId, false);
                                if ((discountInfo.LimitNumber - num3) > 0)
                                {
                                    limitedTimeDiscountId = discountInfo.LimitedTimeDiscountId;
                                }
                            }
                        }
                        else
                        {
                            limitedTimeDiscountId = discountInfo.LimitedTimeDiscountId;
                        }
                    }
                    if (discountInfo != null)
                    {
                        context.Response.Write(string.Concat(new object[] { "{\"msg\":\"success\",\"ActivityName\":\"", discountInfo.ActivityName, "\",\"FinalPrice\":\"", discountProductInfoByProductId.FinalPrice.ToString("f2"), "\",\"LimitedTimeDiscountId\":\"", limitedTimeDiscountId, "\",\"LimitNumber\":\"", discountInfo.LimitNumber, "\"}" }));
                    }
                }
            }
        }