public IList<Core.Business.SubCenterNote> GetAllSubCenterNote() { IList<Core.Business.SubCenterNote> subCenterNotelist = new List<Core.Business.SubCenterNote>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectSubCenterNotesAll"); if(reader != null) { while(reader.Read()) { Core.Business.SubCenterNote subCenterNote = new Core.Business.SubCenterNote(); if (!reader.IsDBNull(0)) subCenterNote.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) subCenterNote.SubCenterID = reader.GetGuid(1); if (!reader.IsDBNull(2)) subCenterNote.Title = reader.GetString(2); if (!reader.IsDBNull(3)) subCenterNote.Content = reader.GetString(3); if (!reader.IsDBNull(4)) subCenterNote.Annex = reader.GetGuid(4); if (!reader.IsDBNull(5)) subCenterNote.Author = reader.GetString(5); if (!reader.IsDBNull(6)) subCenterNote.Addtime = reader.GetDateTime(6); subCenterNote.MarkOld(); subCenterNotelist.Add(subCenterNote); } reader.Close(); } return subCenterNotelist; }
public Core.Business.SubCenterNote Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectSubCenterNote"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.SubCenterNote subCenterNote = new Core.Business.SubCenterNote(); if (!reader.IsDBNull(0)) subCenterNote.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) subCenterNote.SubCenterID = reader.GetGuid(1); if (!reader.IsDBNull(2)) subCenterNote.Title = reader.GetString(2); if (!reader.IsDBNull(3)) subCenterNote.Content = reader.GetString(3); if (!reader.IsDBNull(4)) subCenterNote.Annex = reader.GetGuid(4); if (!reader.IsDBNull(5)) subCenterNote.Author = reader.GetString(5); if (!reader.IsDBNull(6)) subCenterNote.Addtime = reader.GetDateTime(6); reader.Close(); return subCenterNote; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }