Example #1
0
        /// <summary>
        /// 根据客户系统编号获取客户所有优惠券信息(已经优惠卡号)
        /// </summary>
        /// <param name="customerSysNo">客户系统编号</param>
        /// <param name="status">优惠券状态(Null:所有)</param>
        /// <param name="platformType">使用平台</param>
        /// <returns>优惠券信息集合</returns>
        /// <remarks>2014-06-18 朱成果 创建</remarks>
        public override IList <CBSpCoupon> GetCustomerCouponsWithCard(int customerSysNo, PromotionStatus.优惠券状态 status, PromotionStatus.促销使用平台[] platformType)
        {
            if (platformType == null)
            {
                platformType = new PromotionStatus.促销使用平台[] { };
            }

            const string strSql = @"
                        select a.*,b.CouponCardNo from SpCoupon a
                        left join SpCouponReceiveLog b on  a.SysNo=b.CouponSysNo
                        where CustomerSysNo = @CustomerSysNo
                          and (WebPlatform = (@WebPlatform)
                              or ShopPlatform = (@ShopPlatform)
                              or MallAppPlatform = (@MallAppPlatform)
                              or LogisticsAppPlatform = (@LogisticsAppPlatform)
                                )
                          and (0 = @Status or Status = @Status)";

            var entity = Context.Sql(strSql)
                         .Parameter("CustomerSysNo", customerSysNo)
                         .Parameter("WebPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.PC商城) ? (int)PromotionStatus.商城使用.是 : -1)
                         .Parameter("ShopPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.门店) ? (int)PromotionStatus.门店使用.是 : -1)
                         .Parameter("MallAppPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.手机商城) ? (int)PromotionStatus.手机商城使用.是 : -1)
                         .Parameter("LogisticsAppPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.物流App) ? (int)PromotionStatus.物流App使用.是 : -1)
                         //.Parameter("Status", status)
                         .Parameter("Status", status)
                         .QueryMany <CBSpCoupon>();

            return(entity);
        }
Example #2
0
        /// <summary>
        /// 获取有效促销
        /// </summary>
        /// <param name="platformType">使用平台</param>
        /// <returns>有效促销集合</returns>
        /// <remarks>2013-08-13 吴文强 创建</remarks>
        public override List <SpPromotion> GetValidPromotions(PromotionStatus.促销使用平台[] platformType)
        {
            if (platformType == null)
            {
                platformType = new PromotionStatus.促销使用平台[] { };
            }

            const string strSql = @"
                        select * 
                        from SpPromotion 
                        where SYSDATETIME() between StartTime and EndTime 
                          and IsUsePromotionCode = 0 
                          and Status = 20
                          and (WebPlatform = (@WebPlatform)
                              or ShopPlatform = (@ShopPlatform)
                              or MallAppPlatform = (@MallAppPlatform)
                              or LogisticsAppPlatform = (@LogisticsAppPlatform))
                        ";

            var entity = Context.Sql(strSql)
                         .Parameter("WebPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.PC商城) ? (int)PromotionStatus.商城使用.是 : -1)
                         .Parameter("ShopPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.门店) ? (int)PromotionStatus.门店使用.是 : -1)
                         .Parameter("MallAppPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.手机商城) ? (int)PromotionStatus.手机商城使用.是 : -1)
                         .Parameter("LogisticsAppPlatform", platformType.Any(p => p == PromotionStatus.促销使用平台.物流App) ? (int)PromotionStatus.物流App使用.是 : -1)
                         .QueryMany <SpPromotion>();

            return(entity);
        }