Пример #1
0
        /// <summary>
        /// 获取广告投放范围集合
        /// </summary>
        /// <param name="advId">广告编号</param>
        /// <param name="range">广告投放范围</param>
        /// <returns></returns>
        private IList <int> GetAdvRelations(int advId, EyouSoft.Model.AdvStructure.AdvRange range)
        {
            IList <int> relations = new List <int>();

            switch (range)
            {
            case EyouSoft.Model.AdvStructure.AdvRange.全国:
                relations = null;
                break;

            case EyouSoft.Model.AdvStructure.AdvRange.全省:
                relations = dal.GetAdvRelation(advId);

                IList <EyouSoft.Model.SystemStructure.CityBase> citys = new List <EyouSoft.Model.SystemStructure.CityBase>();
                foreach (int cityId in relations)
                {
                    EyouSoft.Model.SystemStructure.CityBase tmp = new EyouSoft.Model.SystemStructure.CityBase();
                    tmp.CityId = cityId;

                    citys.Add(tmp);
                }

                citys = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance().GetCityList(citys);

                relations = new List <int>();

                if (citys != null && citys.Count > 0)
                {
                    foreach (EyouSoft.Model.SystemStructure.CityBase city in citys)
                    {
                        if (!relations.Contains(city.ProvinceId))
                        {
                            relations.Add(city.ProvinceId);
                        }
                    }
                }
                break;

            default:
                relations = dal.GetAdvRelation(advId);
                break;
            }

            return(relations);
        }
Пример #2
0
        /// <summary>
        /// 是否有效(修改时用)
        /// </summary>
        /// <param name="position">广告位置</param>
        /// <param name="startDate">开始时间</param>
        /// <param name="endDate">结束时间</param>
        /// <param name="range">投放范围</param>
        /// <param name="relation">关联信息(城市或单位类型编号)集合</param>
        /// <param name="advId">广告编号</param>
        /// <returns></returns>
        public bool IsValid(EyouSoft.Model.AdvStructure.AdvPosition position, DateTime startDate, DateTime endDate
                            , EyouSoft.Model.AdvStructure.AdvRange range, IList <int> relation, int advId)
        {
            EyouSoft.Model.AdvStructure.AdvInfo info = new EyouSoft.Model.AdvStructure.AdvInfo();

            info.Position  = position;
            info.StartDate = startDate;
            info.EndDate   = endDate;

            if (info.EndDate != DateTime.MaxValue)
            {
                info.EndDate = info.EndDate.AddDays(1).AddSeconds(-1);
            }

            info.Range    = range;
            info.Relation = relation;
            info.AdvId    = advId;

            return(dal.IsValid(info));
        }
Пример #3
0
 /// <summary>
 /// 是否有效(添加时用)
 /// </summary>
 /// <param name="position">广告位置</param>
 /// <param name="startDate">开始时间</param>
 /// <param name="endDate">结束时间</param>
 /// <param name="range">投放范围</param>
 /// <param name="relation">关联信息(城市或单位类型编号)集合</param>
 /// <returns></returns>
 public bool IsValid(EyouSoft.Model.AdvStructure.AdvPosition position, DateTime startDate, DateTime endDate
                     , EyouSoft.Model.AdvStructure.AdvRange range, IList <int> relation)
 {
     return(this.IsValid(position, startDate, endDate, range, relation, 0));
 }