public Core.Business.Glorious Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectGlorious"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Glorious glorious = new Core.Business.Glorious(); if (!reader.IsDBNull(0)) glorious.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) glorious.SubjectID = reader.GetGuid(1); if (!reader.IsDBNull(2)) glorious.SequenceNumber = reader.GetInt32(2); if (!reader.IsDBNull(3)) glorious.SortID = reader.GetGuid(3); if (!reader.IsDBNull(4)) glorious.IssueID = reader.GetGuid(4); reader.Close(); return glorious; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.Glorious> GetAllGlorious() { IList<Core.Business.Glorious> gloriouslist = new List<Core.Business.Glorious>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectGlorioussAll"); if(reader != null) { while(reader.Read()) { Core.Business.Glorious glorious = new Core.Business.Glorious(); if (!reader.IsDBNull(0)) glorious.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) glorious.SubjectID = reader.GetGuid(1); if (!reader.IsDBNull(2)) glorious.SequenceNumber = reader.GetInt32(2); if (!reader.IsDBNull(3)) glorious.SortID = reader.GetGuid(3); if (!reader.IsDBNull(4)) glorious.IssueID = reader.GetGuid(4); glorious.MarkOld(); gloriouslist.Add(glorious); } reader.Close(); } return gloriouslist; }