public IList<Core.Business.PageControlList> GetPageControlList(int pageid) { IList<Core.Business.PageControlList> pageControlListlist = new List<Core.Business.PageControlList>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@PageID", SqlDbType.Int, pageid); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetPageControlList); if (reader != null) { while (reader.Read()) { Core.Business.PageControlList pageControlList = new Core.Business.PageControlList(); if (!reader.IsDBNull(0)) pageControlList.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) pageControlList.PageID = reader.GetInt32(1); if (!reader.IsDBNull(2)) pageControlList.ControlID = reader.GetString(2); pageControlList.MarkOld(); pageControlListlist.Add(pageControlList); } reader.Close(); } return pageControlListlist; }
public Core.Business.PageControlList Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectPageControlList); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.PageControlList pageControlList = new Core.Business.PageControlList(); if (!reader.IsDBNull(0)) pageControlList.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) pageControlList.PageID = reader.GetInt32(1); if (!reader.IsDBNull(2)) pageControlList.ControlID = reader.GetString(2); return pageControlList; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }