public IList<FreshNews> GetAllFreshListTopN(string TopN, string OderBy)
        {
            IList<Core.Business.FreshNews> freshNewslist = new List<Core.Business.FreshNews>();
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = "SELECT" + TopN + " * FROM [dbo].[FreshNews] ";
            sqlstr += " ORDER BY " + OderBy;
            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

            if (reader != null)
            {
                while (reader.Read())
                {

                    Core.Business.FreshNews freshNews = new Core.Business.FreshNews();

                    if (!reader.IsDBNull(0)) freshNews.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) freshNews.Sponsor = reader.GetString(1);
                    if (!reader.IsDBNull(2)) freshNews.FreshEvent = reader.GetString(2);
                    if (!reader.IsDBNull(3)) freshNews.Embracer = reader.GetString(3);
                    if (!reader.IsDBNull(4)) freshNews.EmbracerId = reader.GetGuid(4);
                    if (!reader.IsDBNull(5)) freshNews.UnitId = reader.GetGuid(5);
                    if (!reader.IsDBNull(6)) freshNews.EventType = reader.GetInt32(6);
                    if (!reader.IsDBNull(7)) freshNews.EventTime = reader.GetDateTime(7);
                    freshNews.MarkOld();
                    freshNewslist.Add(freshNews);

                }
                reader.Close();
            }
            return freshNewslist;
        }
        public IList<FreshNews> GetFreshListByUnit(Guid UnitId)
        {
            IList<Core.Business.FreshNews> freshNewslist = new List<Core.Business.FreshNews>();
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = "SELECT * FROM [dbo].[FreshNews] where (UnitId='";
            sqlstr += UnitId + "' or EventType=6) ORDER BY [EventTime] DESC";
            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

               if (reader != null)
            {
                while (reader.Read())
                {

                Core.Business.FreshNews freshNews = new Core.Business.FreshNews();

                if (!reader.IsDBNull(0)) freshNews.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) freshNews.Sponsor = reader.GetString(1);
                if (!reader.IsDBNull(2)) freshNews.FreshEvent = reader.GetString(2);
                if (!reader.IsDBNull(3)) freshNews.Embracer = reader.GetString(3);
                if (!reader.IsDBNull(4)) freshNews.EmbracerId = reader.GetGuid(4);
                if (!reader.IsDBNull(5)) freshNews.UnitId = reader.GetGuid(5);
                if (!reader.IsDBNull(6)) freshNews.EventType = reader.GetInt32(6);
                if (!reader.IsDBNull(7)) freshNews.EventTime = reader.GetDateTime(7);
                freshNews.MarkOld();
                freshNewslist.Add(freshNews);

            }
            reader.Close();
            }
               return freshNewslist;
        }
        public Core.Business.FreshNews Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@ID", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectFreshNews");

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

                if (!reader.IsDBNull(0)) freshNews.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) freshNews.Sponsor = reader.GetString(1);
                if (!reader.IsDBNull(2)) freshNews.FreshEvent = reader.GetString(2);
                if (!reader.IsDBNull(3)) freshNews.Embracer = reader.GetString(3);
                if (!reader.IsDBNull(4)) freshNews.EmbracerId = reader.GetGuid(4);
                if (!reader.IsDBNull(5)) freshNews.UnitId = reader.GetGuid(5);
                if (!reader.IsDBNull(6)) freshNews.EventType = reader.GetInt32(6);
                if (!reader.IsDBNull(7)) freshNews.EventTime = reader.GetDateTime(7);
                freshNews.MarkOld();
                reader.Close();
                return freshNews;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }