public IList<Core.Business.Recommend> GetAllRecommend()
        {
            IList<Core.Business.Recommend> recommendlist = new List<Core.Business.Recommend>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllRecommend);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.Recommend recommend = new Core.Business.Recommend();

                    if (!reader.IsDBNull(0)) recommend.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) recommend.IsSystemRecom = reader.GetBoolean(1);
                    if (!reader.IsDBNull(2)) recommend.RecommendNumber = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) recommend.SourceId = reader.GetString(3);
                    if (!reader.IsDBNull(4)) recommend.SourceName = reader.GetString(4);
                    if (!reader.IsDBNull(5)) recommend.Content = reader.GetString(5);
                    if (!reader.IsDBNull(6)) recommend.Type = reader.GetString(6);
                    if (!reader.IsDBNull(7)) recommend.InstanceId = reader.GetString(7);

                    recommend.MarkOld();
                    recommendlist.Add(recommend);
                }
                reader.Close();
            }
            return recommendlist;
        }
        public IList<CY.UME.Core.Business.Recommend> GetRecommendByType_Page(PagingInfo pinfo,string type)
        {
            IList<Core.Business.Recommend> recommendlist = new List<Core.Business.Recommend>();

            SqlServerUtility sql = new SqlServerUtility(connectionString);

            #region 参数

            string tables = "Recommend";
            string pK = "Id";
            string sort = "RecommendNumber Desc";
            int pageNum = 0;
            int pageSize = int.MaxValue;
            if (pinfo != null)
            {
                pageNum = pinfo.CurrentPage;
                pageSize = pinfo.PageSize;
            }
            string fields = "*";
            string filter = string.Empty;
            if (type != string.Empty)
            {
                filter = "Type='" + type+"'";
            }
            string group = String.Empty;

            #endregion

            sql.AddParameter("@Tables", SqlDbType.VarChar, tables);
            sql.AddParameter("@PK", SqlDbType.VarChar, pK);
            sql.AddParameter("@Sort", SqlDbType.VarChar, sort);
            sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageSize);
            sql.AddParameter("@Fields", SqlDbType.VarChar, fields);
            sql.AddParameter("@Filter", SqlDbType.VarChar, filter);
            sql.AddParameter("@Group", SqlDbType.VarChar, group);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if(reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Recommend recommend = new Core.Business.Recommend();

                    long id = reader.GetInt64(0);
                    recommend = Core.Business.Recommend.Load(id);

                    recommend.MarkOld();
                    recommendlist.Add(recommend);
                }
                reader.Close();
            }
            return recommendlist;
        }
        public Core.Business.Recommend Select(Int64 id)
        {
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            sql.AddParameter("@Id", SqlDbType.BigInt, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectRecommend);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Recommend recommend = new Core.Business.Recommend();

                if (!reader.IsDBNull(0)) recommend.Id = reader.GetInt64(0);
                if (!reader.IsDBNull(1)) recommend.IsSystemRecom = reader.GetBoolean(1);
                if (!reader.IsDBNull(2)) recommend.RecommendNumber = reader.GetInt64(2);
                if (!reader.IsDBNull(3)) recommend.SourceId = reader.GetString(3);
                if (!reader.IsDBNull(4)) recommend.SourceName = reader.GetString(4);
                if (!reader.IsDBNull(5)) recommend.Content = reader.GetString(5);
                if (!reader.IsDBNull(6)) recommend.Type = reader.GetString(6);
                if (!reader.IsDBNull(7)) recommend.InstanceId = reader.GetString(7);

                reader.Close();
                recommend.MarkOld();
                return recommend;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
        public CY.UME.Core.Business.Recommend IsRecommend(string InstanceId, string Type)
        {
            IList<Core.Business.Recommend> recommendlist = new List<Core.Business.Recommend>();

            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string str = "select Id from Recommend where Type='" + Type + "' and InstanceId='" + InstanceId + "'";
            SqlDataReader reader = sql.ExecuteSqlReader(str);
            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Recommend recommend = new Core.Business.Recommend();

                if (!reader.IsDBNull(0)) recommend.Id = reader.GetInt64(0);

                Core.Business.Recommend recommend2 = Core.Business.Recommend.Load(recommend.Id);
                reader.Close();
                recommend2.MarkOld();
                return recommend2;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }