public Core.Business.ExamineCode Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectExamineCode"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.ExamineCode examineCode = new Core.Business.ExamineCode(); if (!reader.IsDBNull(0)) examineCode.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) examineCode.Name = reader.GetString(1); reader.Close(); return examineCode; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.ExamineCode> GetAllExamineCode() { IList<Core.Business.ExamineCode> examineCodelist = new List<Core.Business.ExamineCode>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectExamineCodesAll"); if(reader != null) { while(reader.Read()) { Core.Business.ExamineCode examineCode = new Core.Business.ExamineCode(); if (!reader.IsDBNull(0)) examineCode.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) examineCode.Name = reader.GetString(1); examineCode.MarkOld(); examineCodelist.Add(examineCode); } reader.Close(); } return examineCodelist; }