コード例 #1
0
        public IList<Core.Business.PageList> GetAllPageList()
        {
            IList<Core.Business.PageList> pageListlist = new List<Core.Business.PageList>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllPageList);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.PageList pageList = new Core.Business.PageList();

                    if (!reader.IsDBNull(0)) pageList.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) pageList.PageName = reader.GetString(1);
                    if (!reader.IsDBNull(2)) pageList.PageURI = reader.GetString(2);

                    pageList.MarkOld();
                    pageListlist.Add(pageList);
                }
                reader.Close();
            }
            return pageListlist;
        }
コード例 #2
0
        public Core.Business.PageList Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) pageList.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) pageList.PageName = reader.GetString(1);
                if (!reader.IsDBNull(2)) pageList.PageURI = reader.GetString(2);

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

                return null;
            }
        }