Esempio n. 1
0
        public IList<Core.Business.NewsModule> GetAllNewsModule()
        {
            IList<Core.Business.NewsModule> newsModulelist = new List<Core.Business.NewsModule>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectNewsModulesAll");

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.NewsModule newsModule = new Core.Business.NewsModule();

                    if (!reader.IsDBNull(0)) newsModule.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) newsModule.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) newsModule.Center = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) newsModule.Site = reader.GetGuid(3);
                    if (!reader.IsDBNull(4)) newsModule.WBS = reader.GetString(4);
                    if (!reader.IsDBNull(5)) newsModule.TypeID = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) newsModule.AddTime = reader.GetDateTime(6);
                    if (!reader.IsDBNull(7)) newsModule.AddPerson = reader.GetString(7);
                    if (!reader.IsDBNull(8)) newsModule.CheckStatus = reader.GetInt32(8);
                    if (!reader.IsDBNull(9)) newsModule.News = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) newsModule.Index = reader.GetInt32(10);

                    newsModule.MarkOld();
                    newsModulelist.Add(newsModule);
                }
                reader.Close();
            }
            return newsModulelist;
        }
Esempio n. 2
0
        public IList<Core.Business.NewsModule> GetNewsModuleList(string sqlwhere)
        {
            IList<Core.Business.NewsModule> newsModulelist = new List<Core.Business.NewsModule>();
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = "SELECT * FROM [dbo].[NewsModule] where ";
            sqlstr += sqlwhere + " ORDER BY [Index] DESC,AddTime ASC";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.NewsModule newsModule = new Core.Business.NewsModule();

                    if (!reader.IsDBNull(0)) newsModule.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) newsModule.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) newsModule.Center = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) newsModule.Site = reader.GetGuid(3);
                    if (!reader.IsDBNull(4)) newsModule.WBS = reader.GetString(4);
                    if (!reader.IsDBNull(5)) newsModule.TypeID = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) newsModule.AddTime = reader.GetDateTime(6);
                    if (!reader.IsDBNull(7)) newsModule.AddPerson = reader.GetString(7);
                    if (!reader.IsDBNull(8)) newsModule.CheckStatus = reader.GetInt32(8);
                    if (!reader.IsDBNull(9)) newsModule.News = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) newsModule.Index = reader.GetInt32(10);

                    newsModule.MarkOld();
                    newsModulelist.Add(newsModule);
                }
                reader.Close();
            }
            return newsModulelist;
        }
Esempio n. 3
0
        public NewsModule NewsModuleWhere(string sqlwhere)
        {
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = "SELECT [ID],[Name],[Center],[Site],[WBS],[TypeID],[AddTime],[AddPerson],[CheckStatus],[News],[index] FROM [dbo].[NewsModule] where ";
            sqlstr += sqlwhere;
            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

            if (reader != null && !reader.IsClosed && reader.Read())
            {

                    Core.Business.NewsModule newsModule = new Core.Business.NewsModule();

                    if (!reader.IsDBNull(0)) newsModule.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) newsModule.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) newsModule.Center = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) newsModule.Site = reader.GetGuid(3);
                    if (!reader.IsDBNull(4)) newsModule.WBS = reader.GetString(4);
                    if (!reader.IsDBNull(5)) newsModule.TypeID = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) newsModule.AddTime = reader.GetDateTime(6);
                    if (!reader.IsDBNull(7)) newsModule.AddPerson = reader.GetString(7);
                    if (!reader.IsDBNull(8)) newsModule.CheckStatus = reader.GetInt32(8);
                    if (!reader.IsDBNull(9)) newsModule.News = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) newsModule.Index = reader.GetInt32(10);
                    reader.Close();
                    newsModule.MarkOld();
                    return newsModule;

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

                return null;
            }
        }