Example #1
0
        /// <summary>
        /// 获的广告列表
        /// </summary>
        protected void GetPostList()
        {
            FrontPage page   = this.Page as FrontPage;
            int       CityId = page.CityId;

            EyouSoft.Model.AdvStructure.AdvPosition PositionType = EyouSoft.Model.AdvStructure.AdvPosition.首页广告公告;
            if (IsDisclose)
            {
                PositionType = EyouSoft.Model.AdvStructure.AdvPosition.首页广告爆料区;
            }
            IList <EyouSoft.Model.AdvStructure.AdvInfo> AdvList = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvs(CityId, PositionType);

            if (AdvList != null && AdvList.Count > 0)
            {
                StringBuilder strAdvList = new StringBuilder();
                strAdvList.Append("<ul>");
                foreach (EyouSoft.Model.AdvStructure.AdvInfo item in AdvList)
                {
                    strAdvList.AppendFormat("<li style='text-align:left;'><a href='/PlaneInfo/NewsDetailInfo.aspx?NewsID={0}&CityId={2}' target=\"_blank\">{1}</a></li>", item.AdvId, EyouSoft.Common.Utils.GetText(item.Title, 16), CityId);
                }
                strAdvList.Append("</ul>");
                strAllPostList = strAdvList.ToString();
            }
            else
            {
                strAllPostList = "<ul><li></li><li></li><li></li><li></li><li>暂无信息</li><li></li><li></li><li></li><li></li></ul>";
            }
        }
Example #2
0
        /// <summary>
        /// 设置广告排序
        /// </summary>
        /// <param name="advId">广告编号</param>
        /// <param name="position">广告位置</param>
        /// <param name="relationId">关联编号</param>
        /// <param name="sortId">排序编号</param>
        /// <returns></returns>
        public bool SetAdvSort(int advId, EyouSoft.Model.AdvStructure.AdvPosition position, int relationId, int sortId)
        {
            string cachename = string.Format(EyouSoft.CacheTag.Adv.SystemAdvUpdateKey, position.ToString());

            EyouSoft.Cache.Facade.EyouSoftCache.Add(cachename, DateTime.Now);

            return(dal.SetAdvSort(advId, this.GetPositionInfo(position).AdvType, relationId, sortId));
        }
Example #3
0
 /// <summary>
 /// 景区集合方法
 /// </summary>
 protected IList<EyouSoft.Model.AdvStructure.AdvInfo> GetList(int relationId, EyouSoft.Model.AdvStructure.AdvPosition advPosition)
 {
     IList<EyouSoft.Model.AdvStructure.AdvInfo> List = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvs(relationId, advPosition);
     if (List.Count > 0)
     {
         return List;
     }
     return null;
 }
Example #4
0
 /// <summary>
 /// 景区广告或者对象方法
 /// </summary>
 protected EyouSoft.Model.AdvStructure.AdvInfo GetAdvsModel(int relationId, EyouSoft.Model.AdvStructure.AdvPosition advPosition)
 {
     EyouSoft.Model.AdvStructure.AdvInfo model = null;
     IList<EyouSoft.Model.AdvStructure.AdvInfo> advInfoList = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvs(relationId, advPosition);
     if (advInfoList.Count > 0)
     {
         model = advInfoList[0];
         if (model != null)
         {
             return model;
         }
     }
     return null;
 }
Example #5
0
        /// <summary>
        /// 获的推荐的信息列表
        /// </summary>
        protected void GetRecommendList()
        {
            FrontPage page   = this.Page as FrontPage;
            int       CityId = page.CityId;

            EyouSoft.Model.AdvStructure.AdvPosition PositionType = EyouSoft.Model.AdvStructure.AdvPosition.首页广告精品推荐文字;

            IList <EyouSoft.Model.AdvStructure.AdvInfo> AdvList = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvs(CityId, PositionType);

            if (AdvList != null && AdvList.Count > 0)
            {
                this.repCommendList.DataSource = AdvList;
                this.repCommendList.DataBind();
            }
            AdvList = null;
        }
Example #6
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));
        }
Example #7
0
        /// <summary>
        /// 获取广告位置信息
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        public virtual EyouSoft.Model.AdvStructure.AdvPositionInfo GetPositionInfo(EyouSoft.Model.AdvStructure.AdvPosition position)
        {
            EyouSoft.Model.AdvStructure.AdvPositionInfo info = null;
            DbCommand cmd = base.SystemStore.GetSqlStringCommand(SQL_SELECT_GetPositionInfo);

            base.SystemStore.AddInParameter(cmd, "PositionId", DbType.Int32, position);

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, base.SystemStore))
            {
                if (rdr.Read())
                {
                    info = new EyouSoft.Model.AdvStructure.AdvPositionInfo();

                    info.AdvCount    = rdr.GetInt32(rdr.GetOrdinal("AdvCount"));
                    info.Catalog     = (EyouSoft.Model.AdvStructure.AdvCatalog)rdr.GetInt32(rdr.GetOrdinal("CatalogId"));
                    info.DisplayType = (EyouSoft.Model.AdvStructure.AdvDisplayType)rdr.GetByte(rdr.GetOrdinal("DisplayType"));
                    info.Position    = position;
                }
            }

            return(info);
        }
Example #8
0
        /// <summary>
        /// 获取指定位置的广告信息集合
        /// </summary>
        /// <param name="advType">广告投放类型</param>
        /// <param name="relationId">关联编号(城市或单位类型编号)</param>
        /// <param name="position">广告位置</param>
        /// <param name="date">日期</param>
        /// <param name="expression">指定返回行数的数值表达式</param>
        /// <param name="isPlatformAd">是否取广告类别为同业114广告</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.AdvStructure.AdvInfo> GetAdvs(EyouSoft.Model.AdvStructure.AdvType advType, int relationId, EyouSoft.Model.AdvStructure.AdvPosition position, DateTime date, int expression, bool isPlatformAd)
        {
            IList <EyouSoft.Model.AdvStructure.AdvInfo> advs = new List <EyouSoft.Model.AdvStructure.AdvInfo>();

            StringBuilder cmdText = new StringBuilder();

            cmdText.Append(" SELECT TOP (@Expression) A.Id,A.AdvDescript,A.AdvLink,B.AdvImg,B.AdvThumbnail,A.CompanyId,A.CompanyName,A.IssueTime,A.AdvRemark,D.MQ FROM tbl_SysAdv AS A ");
            cmdText.Append(" LEFT OUTER JOIN tbl_SysAdvImg AS B ON A.Id=B.AdvId ");
            cmdText.Append(" INNER JOIN tbl_SysAdvAreaControl AS C ON A.Id=C.AdvId AND C.AreaType=@AdvType AND C.AreaId=@RelationId ");
            cmdText.Append(" LEFT OUTER JOIN tbl_CompanyUser AS D ON A.CompanyId=D.CompanyId AND IsAdmin='1' ");
            cmdText.Append(" WHERE A.AreaId=@PositionId AND @Date BETWEEN A.StartDate AND A.EndDate ");

            if (isPlatformAd)
            {
                cmdText.Append(" AND A.ClassId=3 ");
            }
            else
            {
                cmdText.Append(" AND A.ClassId<3 ");
            }

            cmdText.Append(" ORDER BY C.SortId ASC,A.IssueTime ASC ");

            DbCommand cmd = base.SystemStore.GetSqlStringCommand(cmdText.ToString());

            base.SystemStore.AddInParameter(cmd, "Expression", DbType.Int32, expression);
            base.SystemStore.AddInParameter(cmd, "AdvType", DbType.Byte, advType);
            base.SystemStore.AddInParameter(cmd, "RelationId", DbType.Int32, relationId);
            base.SystemStore.AddInParameter(cmd, "PositionId", DbType.Int32, position);
            base.SystemStore.AddInParameter(cmd, "Date", DbType.DateTime, date);

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, base.SystemStore))
            {
                while (rdr.Read())
                {
                    EyouSoft.Model.AdvStructure.AdvInfo tmp = new EyouSoft.Model.AdvStructure.AdvInfo();

                    tmp.AdvId       = rdr.GetInt32(0);
                    tmp.Title       = rdr[1].ToString();
                    tmp.RedirectURL = rdr[2].ToString();
                    tmp.ImgPath     = rdr[3].ToString();

                    tmp.AdvThumb = rdr[4].ToString();

                    tmp.CompanyId   = rdr.GetString(5);
                    tmp.CompanyName = rdr[6].ToString();
                    tmp.IssueTime   = rdr.GetDateTime(7);
                    tmp.Remark      = rdr[8].ToString();
                    tmp.ContactMQ   = rdr[9].ToString();

                    advs.Add(tmp);
                }
            }

            return(advs);
        }
Example #9
0
        /// <summary>
        /// 获取指定位置的广告信息集合
        /// </summary>
        /// <param name="relationId">城市或单位类型(MQ)编号</param>
        /// <param name="position">广告位置</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.AdvStructure.AdvInfo> GetNotFillAdvs(int relationId, EyouSoft.Model.AdvStructure.AdvPosition position)
        {
            string cachename = string.Format(EyouSoft.CacheTag.Adv.SystemAdv, position.ToString(), relationId);

            EyouSoft.Cache.Facade.EyouSoftCacheTime <List <EyouSoft.Model.AdvStructure.AdvInfo> > list = (EyouSoft.Cache.Facade.EyouSoftCacheTime <List <EyouSoft.Model.AdvStructure.AdvInfo> >)
                                                                                                         EyouSoft.Cache.Facade.EyouSoftCache.GetCache(cachename);

            object UpdateTime = EyouSoft.Cache.Facade.EyouSoftCache.GetCache(string.Format(EyouSoft.CacheTag.Adv.SystemAdvUpdateKey, position.ToString()));

            if (UpdateTime == null)
            {
                EyouSoft.Cache.Facade.EyouSoftCache.Add(string.Format(EyouSoft.CacheTag.Adv.SystemAdvUpdateKey, position.ToString()), DateTime.Now);
            }
            if (list != null && UpdateTime != null && list.UpdateTime > (DateTime)UpdateTime)
            {
                return(list.Data);
            }
            else
            {
                list = new EyouSoft.Cache.Facade.EyouSoftCacheTime <List <EyouSoft.Model.AdvStructure.AdvInfo> >();

                EyouSoft.Model.AdvStructure.AdvPositionInfo positionInfo = this.GetPositionInfo(position);

                IList <EyouSoft.Model.AdvStructure.AdvInfo> advs = dal.GetAdvs(positionInfo.AdvType, relationId, position, DateTime.Today, positionInfo.AdvCount, false);

                int appendItems = positionInfo.AdvCount;

                #region 补平台广告
                if (advs != null && advs.Count > 0)
                {
                    appendItems = positionInfo.AdvCount - advs.Count;
                }
                else
                {
                    advs = new List <EyouSoft.Model.AdvStructure.AdvInfo>();
                }

                if (appendItems > 0)
                {
                    IList <EyouSoft.Model.AdvStructure.AdvInfo> platformAdvs = dal.GetAdvs(positionInfo.AdvType, relationId, position, DateTime.Today, appendItems, true);

                    if (platformAdvs != null && platformAdvs.Count > 0)
                    {
                        //advs = advs.Union(platformAdvs).ToList();
                        foreach (EyouSoft.Model.AdvStructure.AdvInfo advInfo in platformAdvs)
                        {
                            advs.Add(advInfo);
                        }
                    }
                }
                #endregion

                list.Data       = advs.ToList();
                list.UpdateTime = DateTime.Now;

                EyouSoft.Cache.Facade.EyouSoftCache.Add(cachename, list, DateTime.Today.AddDays(1).AddMinutes(10));
            }

            return(list.Data);
        }
Example #10
0
        /// <summary>
        /// 按照指定条件获取广告信息集合
        /// </summary>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="position">广告位置</param>
        /// <param name="relationId">关联编号(城市或单位类型编号)</param>
        /// <param name="companyName">公司名称 为null时不做为查询条件</param>
        /// <param name="category">广告类别 为null时不做为查询条件</param>
        /// <param name="startDate">有效期起始时间 为null时不做为查询条件</param>
        /// <param name="endDate">有效期截止时间 为null时不做为查询条件</param>
        /// <param name="title">广告标题 为null时不做为查询条件</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.AdvStructure.AdvInfo> GetAdvs(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.AdvStructure.AdvPosition position
                                                                   , int relationId, string companyName, EyouSoft.Model.AdvStructure.AdvCategory?category, DateTime?startDate, DateTime?endDate, string title)
        {
            if (endDate.HasValue)
            {
                endDate = endDate.Value.AddDays(1);
            }

            IList <EyouSoft.Model.AdvStructure.AdvInfo> advs = dal.GetAdvs(pageSize, pageIndex, ref recordCount, position, this.GetPositionInfo(position).AdvType
                                                                           , relationId, companyName, category, startDate, endDate, null, title);

            if (advs != null && advs.Count > 0)
            {
                foreach (EyouSoft.Model.AdvStructure.AdvInfo tmp in advs)
                {
                    tmp.Relation = this.GetAdvRelations(tmp.AdvId, tmp.Range);
                }
            }

            return(advs);
        }
Example #11
0
        /*/// <summary>
         * /// 获取广告关系集合
         * /// </summary>
         * /// <param name="advId">广告编号</param>
         * /// <returns></returns>
         * public IList<int> GetAdvRelation(int advId)
         * {
         *  return dal.GetAdvRelation(advId);
         * }*/

        /// <summary>
        /// 获取广告位置信息
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        public EyouSoft.Model.AdvStructure.AdvPositionInfo GetPositionInfo(EyouSoft.Model.AdvStructure.AdvPosition position)
        {
            return(dal.GetPositionInfo(position));
        }
Example #12
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));
 }