Beispiel #1
0
        /// <summary>
        /// 运营后台分页获取列表
        /// </summary>
        /// <param name="siteId">分站ID >0时返回该分站下的下广告 =0时返回全部</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="pageIndex">当前页码数</param>
        /// <param name="recordeCount">总记录数</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.SystemStructure.SysIndexAdv> GetList(int siteId, int pageSize, int pageIndex, ref int recordeCount)
        {
            IList <EyouSoft.Model.SystemStructure.SysIndexAdv> list = new List <EyouSoft.Model.SystemStructure.SysIndexAdv>();
            string tableName     = "tbl_SysIndexAdv";
            string fields        = "ID,SiteId,ImgPath,LinkAdress,ImgRemark,SortId,IssueTime";
            string primaryKey    = "ID";
            string orderByString = " SortId DESC,IssueTime DESC ";
            string strWhere      = string.Empty;

            if (siteId > 0)
            {
                strWhere = string.Format("siteid={0}", siteId);
            }
            using (IDataReader dr = DbHelper.ExecuteReader(this._database, pageSize, pageIndex, ref recordeCount, tableName, primaryKey, fields, strWhere, orderByString))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.SystemStructure.SysIndexAdv model = new EyouSoft.Model.SystemStructure.SysIndexAdv();
                    model.ID         = dr.GetInt32(dr.GetOrdinal("ID"));
                    model.SiteId     = dr.GetInt32(dr.GetOrdinal("SiteId"));
                    model.SortId     = dr.GetInt32(dr.GetOrdinal("SortId"));
                    model.ImgPath    = dr.GetString(dr.GetOrdinal("ImgPath"));
                    model.LinkAdress = dr.GetString(dr.GetOrdinal("LinkAdress"));
                    model.ImgRemark  = dr.GetString(dr.GetOrdinal("ImgRemark"));
                    model.IssueTime  = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    list.Add(model);
                    model = null;
                }
            }
            return(list);
        }
Beispiel #2
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model">首页广告实体</param>
 /// <returns>false:失败 true:成功</returns>
 public bool Update(EyouSoft.Model.SystemStructure.SysIndexAdv model)
 {
     if (model == null)
     {
         return(false);
     }
     return(dal.Update(model));
 }
Beispiel #3
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <returns>false:失败 true:成功</returns>
        public virtual bool Add(EyouSoft.Model.SystemStructure.SysIndexAdv model)
        {
            DbCommand dc = this._database.GetSqlStringCommand(SQL_SysIndexAdv_ADD);

            this._database.AddInParameter(dc, "AdvType", DbType.Int16, model.AdvType);
            this._database.AddInParameter(dc, "SiteId", DbType.Int32, model.SiteId);
            this._database.AddInParameter(dc, "ImgPath", DbType.String, model.ImgPath);
            this._database.AddInParameter(dc, "LinkAdress", DbType.String, model.LinkAdress);
            this._database.AddInParameter(dc, "ImgRemark", DbType.String, model.ImgRemark);
            return(DbHelper.ExecuteSql(dc, this._database) > 0?true:false);
        }
Beispiel #4
0
        /// <summary>
        /// 获取指定条数的前台轮换广告列表
        /// </summary>
        /// <param name="siteId">分站ID >0时返回该分站下的轮换广告信息 =0时返回全部</param>
        /// <param name="topnumber">指定返回条数 >0时返回指定条数记录 =0返回全部</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.SystemStructure.SysIndexAdv> GetTopList(int siteId, int topnumber)
        {
            IList <EyouSoft.Model.SystemStructure.SysIndexAdv> list = new List <EyouSoft.Model.SystemStructure.SysIndexAdv>();

            EyouSoft.Model.SystemStructure.SysIndexAdv model = null;

            #region 格式化查询语句
            StringBuilder strSql = new StringBuilder();
            if (topnumber > 0)
            {
                strSql.AppendFormat(SQL_SysIndexAdv_SELECTTOPINFO, string.Format("top {0} ", topnumber));
            }
            else
            {
                strSql.AppendFormat(SQL_SysIndexAdv_SELECTTOPINFO, string.Empty);
            }
            if (siteId > 0)
            {
                strSql.AppendFormat(" where SiteId={0}", siteId);
            }
            strSql.Append(" order by sortId desc,issuetime desc");
            #endregion

            DbCommand dc = this._database.GetSqlStringCommand(strSql.ToString());
            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database))
            {
                while (dr.Read())
                {
                    model            = new EyouSoft.Model.SystemStructure.SysIndexAdv();
                    model.ID         = dr.GetInt32(dr.GetOrdinal("ID"));
                    model.AdvType    = dr.GetInt32(dr.GetOrdinal("AdvType"));
                    model.ImgPath    = dr.GetString(dr.GetOrdinal("ImgPath"));
                    model.LinkAdress = dr.GetString(dr.GetOrdinal("LinkAdress"));
                    model.ImgRemark  = dr.GetString(dr.GetOrdinal("ImgRemark"));
                    list.Add(model);
                    model = null;
                }
            }
            return(list);
        }
Beispiel #5
0
        /// <summary>
        /// 获取轮换广告实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual EyouSoft.Model.SystemStructure.SysIndexAdv GetModel(int id)
        {
            EyouSoft.Model.SystemStructure.SysIndexAdv model = null;
            DbCommand dc = this._database.GetSqlStringCommand(SQL_SysIndexAdv_GETMODEL);

            this._database.AddInParameter(dc, "ID", DbType.Int32, id);
            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database))
            {
                if (dr.Read())
                {
                    model            = new EyouSoft.Model.SystemStructure.SysIndexAdv();
                    model.ID         = dr.GetInt32(dr.GetOrdinal("ID"));
                    model.AdvType    = dr.GetInt16(dr.GetOrdinal("AdvType"));
                    model.SiteId     = dr.GetInt32(dr.GetOrdinal("SiteId"));
                    model.SortId     = dr.GetInt32(dr.GetOrdinal("SortId"));
                    model.ImgPath    = dr.GetString(dr.GetOrdinal("ImgPath"));
                    model.LinkAdress = dr.GetString(dr.GetOrdinal("LinkAdress"));
                    model.ImgRemark  = dr.GetString(dr.GetOrdinal("ImgRemark"));
                }
            }
            return(model);
        }