Ejemplo n.º 1
0
        /// <summary>
        /// 获取指定条数的后台登陆广告
        /// </summary>
        /// <param name="topNumber">要返回的记录数</param>
        /// <param name="companyType">公司类型</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.SystemStructure.CompanyAdv> GetTopNumList(int topNumber, EyouSoft.Model.CompanyStructure.CompanyType companyType)
        {
            IList <EyouSoft.Model.SystemStructure.CompanyAdv> list = new List <EyouSoft.Model.SystemStructure.CompanyAdv>();
            DbCommand dc = null;

            if (topNumber > 0)
            {
                dc = this._database.GetSqlStringCommand(string.Format(SQL_CompanyAdv_SELECTTOPINFO, topNumber, (int)companyType));
            }
            else
            {
                dc = this._database.GetSqlStringCommand(SQL_CompanyAdv_SELECT + string.Format(" where AdvCompanyType={1} and AdvType=0 Order by sortId desc,issuetime desc", (int)companyType));
            }
            if (dc == null)
            {
                return(null);
            }
            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.SystemStructure.CompanyAdv model = new EyouSoft.Model.SystemStructure.CompanyAdv();
                    model.ID        = dr.GetInt32(dr.GetOrdinal("ID"));
                    model.AdvTitle  = dr.GetString(dr.GetOrdinal("AdvTitle"));
                    model.AdvLink   = dr.GetString(dr.GetOrdinal("AdvLink"));
                    model.IsNewOpen = dr.GetString(dr.GetOrdinal("IsNewOpen")) == "1"?true:false;
                    list.Add(model);
                    model = null;
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 运营后台分页获取列表
        /// </summary>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="companyType">公司类型</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.SystemStructure.CompanyAdv> GetList(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.CompanyStructure.CompanyType companyType)
        {
            IList <EyouSoft.Model.SystemStructure.CompanyAdv> list = new List <EyouSoft.Model.SystemStructure.CompanyAdv>();

            EyouSoft.Model.SystemStructure.CompanyAdv model = null;
            string tableName     = "tbl_CompanyAdv";
            string fields        = "ID,AdvTitle,AdvLink,IssueTime,OperatorName,SortId";
            string orderByString = "SortId DESC,IssueTime DESC";
            string primaryKey    = "ID";
            string strWhere      = string.Format(" AdvCompanyType={0} and AdvType=0 ", (int)companyType);

            using (IDataReader dr = DbHelper.ExecuteReader(this._database, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, strWhere, orderByString))
            {
                while (dr.Read())
                {
                    model              = new EyouSoft.Model.SystemStructure.CompanyAdv();
                    model.AdvLink      = dr.GetString(dr.GetOrdinal("AdvLink"));
                    model.AdvTitle     = dr.GetString(dr.GetOrdinal("AdvTitle"));
                    model.ID           = dr.GetInt32(dr.GetOrdinal("ID"));
                    model.IssueTime    = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.OperatorName = dr.GetString(dr.GetOrdinal("OperatorName"));
                    model.SortId       = dr.GetInt32(dr.GetOrdinal("SortId"));
                    list.Add(model);
                    model = null;
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model">广告实体类</param>
        /// <returns>false:失败 true:成功</returns>
        public virtual bool Update(EyouSoft.Model.SystemStructure.CompanyAdv model)
        {
            DbCommand dc = this._database.GetStoredProcCommand(SQL_CompanyAdv_UPDATE);

            this._database.AddInParameter(dc, "ID", DbType.Int32, model.ID);
            this._database.AddInParameter(dc, "AdvTitle", DbType.String, model.AdvTitle);
            this._database.AddInParameter(dc, "AdvContent", DbType.String, model.AdvContent);
            this._database.AddInParameter(dc, "AdvLink", DbType.String, string.IsNullOrEmpty(model.AdvLink)?model.InternalLink + model.ID.ToString():model.AdvLink);
            this._database.AddInParameter(dc, "IsNewOpen", DbType.AnsiStringFixedLength, model.IsNewOpen ? "1" : "0");
            this._database.AddInParameter(dc, "AdvType", DbType.Int16, model.AdvType);
            return(DbHelper.ExecuteSql(dc, this._database) > 0?true:false);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 获取指定公司类型的后台首页图片广告
 /// </summary>
 /// <param name="companyType">公司类型</param>
 /// <returns></returns>
 public EyouSoft.Model.SystemStructure.CompanyAdv GetIndexPicAdv(EyouSoft.Model.CompanyStructure.CompanyType companyType)
 {
     EyouSoft.Model.SystemStructure.CompanyAdv model = null;
     model = (EyouSoft.Model.SystemStructure.CompanyAdv)EyouSoft.Cache.Facade.EyouSoftCache.GetCache(EyouSoft.CacheTag.System.CategoryAdv + string.Format(CacheIndexPicAdv, (int)companyType));
     if (model == null)
     {
         model = dal.GetIndexPicAdv(companyType);
         if (model != null)
         {
             EyouSoft.Cache.Facade.EyouSoftCache.Add(EyouSoft.CacheTag.System.CategoryAdv + string.Format(CacheIndexPicAdv, (int)companyType), model);
         }
     }
     return(model);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <returns>false:失败 true:成功</returns>
        public bool Update(EyouSoft.Model.SystemStructure.CompanyAdv model)
        {
            if (model == null)
            {
                return(false);
            }
            bool flag = dal.Update(model);

            if (flag)
            {
                //清除缓存
                EyouSoft.Cache.Facade.EyouSoftCache.Remove(EyouSoft.CacheTag.System.CategoryAdv + string.Format(CacheGetList, (int)model.AdvCompanyType));
                EyouSoft.Cache.Facade.EyouSoftCache.Remove(EyouSoft.CacheTag.System.CategoryAdv + string.Format(CacheGetTopNumberList, (int)model.AdvCompanyType));
            }
            return(flag);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加文字广告
        /// </summary>
        /// <returns>false:失败 true:成功</returns>
        public virtual bool Add(EyouSoft.Model.SystemStructure.CompanyAdv model)
        {
            DbCommand dc = this._database.GetStoredProcCommand("proc_CompanyAdv_Insert");

            this._database.AddInParameter(dc, "AdvTitle", DbType.String, model.AdvTitle);
            this._database.AddInParameter(dc, "AdvContent", DbType.String, model.AdvContent);
            this._database.AddInParameter(dc, "AdvLink", DbType.String, model.AdvLink);
            this._database.AddInParameter(dc, "IsNewOpen", DbType.AnsiStringFixedLength, model.IsNewOpen ? "1" : "0");
            this._database.AddInParameter(dc, "AdvCompanyType", DbType.Int16, model.AdvCompanyType);
            this._database.AddInParameter(dc, "AdvType", DbType.Int16, model.AdvType);
            this._database.AddInParameter(dc, "OperatorID", DbType.Int32, model.OperatorId);
            this._database.AddInParameter(dc, "OperatorName", DbType.String, model.OperatorName);
            this._database.AddInParameter(dc, "IssueTime", DbType.DateTime, DateTime.Now);
            this._database.AddInParameter(dc, "InternalLink", DbType.String, model.InternalLink);
            return(DbHelper.ExecuteSql(dc, this._database) > 0?true:false);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取指定公司类型的后台首页图片广告
        /// </summary>
        /// <param name="companyType">公司类型</param>
        /// <returns></returns>
        public virtual EyouSoft.Model.SystemStructure.CompanyAdv GetIndexPicAdv(EyouSoft.Model.CompanyStructure.CompanyType companyType)
        {
            EyouSoft.Model.SystemStructure.CompanyAdv model = null;
            DbCommand dc = this._database.GetSqlStringCommand(string.Format(SQL_CompanyAdv_GETINDEXPICADV, (int)companyType));

            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database))
            {
                if (dr.Read())
                {
                    model.ID      = dr.GetInt32(0);
                    model.ImgPath = dr.GetString(1);
                    model.AdvLink = dr.GetString(2);
                }
            }
            return(model);
        }