Exemple #1
0
        /// <summary>
        /// 获取广告配置
        /// </summary>
        /// <param name="adtype">活动类型</param>
        /// <param name="adplatform">显示平台</param>
        /// <returns></returns>
        public IntegralMallAdInfo GetAdInfo(IntegralMallAdInfo.AdActivityType adtype, IntegralMallAdInfo.AdShowPlatform adplatform)
        {
            int sadtype               = adtype.GetHashCode();
            int sadplatform           = adplatform.GetHashCode();
            int sstatus               = IntegralMallAdInfo.AdShowStatus.Show.GetHashCode();
            IntegralMallAdInfo result = Context.IntegralMallAdInfo.FirstOrDefault(d => d.ActivityType == sadtype && d.ShowPlatform == sadplatform && d.ShowStatus == sstatus);

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 获取广告配置
        /// </summary>
        /// <param name="adtype">活动类型</param>
        /// <param name="adplatform">显示平台</param>
        /// <returns></returns>
        public IntegralMallAdInfo GetAdInfo(IntegralMallAdInfo.AdActivityType adtype, IntegralMallAdInfo.AdShowPlatform adplatform)
        {
            int sadtype               = adtype.GetHashCode();
            int sadplatform           = adplatform.GetHashCode();
            int sstatus               = IntegralMallAdInfo.AdShowStatus.Show.GetHashCode();
            IntegralMallAdInfo result = DbFactory.Default.Get <IntegralMallAdInfo>().Where(d => d.ActivityType == sadtype && d.ShowPlatform == sadplatform && d.ShowStatus == sstatus).FirstOrDefault();

            if (result != null)
            {
                var nowdate = DateTime.Now;
                var isExist = DbFactory.Default.Get <WeiActivityInfoInfo>().Where(d => d.Id == result.ActivityId && d.EndTime > nowdate && d.BeginTime <= nowdate).Exist();
                if (!isExist)
                {
                    return(null);
                }
            }
            return(result);
        }