Beispiel #1
0
        //检查优惠券id是否可用
        public static CheckPidResult CheckCouponPid(string PID, DateTime beginDateTime, DateTime endDateTime)
        {
            var result = new CheckPidResult();
            var dat    = DALShareBargain.CheckBargainProductByPid(PID, beginDateTime, endDateTime);

            if (dat)
            {
                result.Code = 2;
                result.Info = "该优惠券已在活动中";
            }
            else
            {
                using (var memberClient = new Tuhu.Service.Member.PromotionClient())
                {
                    if (!Guid.TryParse(PID, out Guid rr))
                    {
                        result.Code = 4;
                        result.Info = "优惠券pid格式错误";
                        return(result);
                    }

                    var couponInfo = memberClient.GetCouponRule(new Guid(PID));
                    if (!couponInfo.Success)
                    {
                        result.Code = 3;
                        result.Info = "获取优惠券信息失败";
                        return(result);
                    }

                    result.Code = 1;
                    result.Info = couponInfo.Result.PromotionName;
                }
            }
            return(result);
        }
Beispiel #2
0
        public static CheckPidResult CheckPid(string PID, DateTime beginDateTime, DateTime endDateTime)
        {
            var result = new CheckPidResult();
            var dat    = DALShareBargain.CheckBargainProductByPid(PID, beginDateTime, endDateTime);

            if (dat)
            {
                result.Code = 2;
                result.Info = "该商品已在活动中";
            }
            else
            {
                result = DALShareBargain.CheckProductByPid(PID);
            }
            return(result);
        }