public Core.Business.LinkClass Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectLinkClas"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.LinkClass linkClass = new Core.Business.LinkClass(); if (!reader.IsDBNull(0)) linkClass.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) linkClass.ClassName = reader.GetString(1); if (!reader.IsDBNull(2)) linkClass.Index = reader.GetInt32(2); reader.Close(); return linkClass; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.LinkClass> GetAllLinkClass() { IList<Core.Business.LinkClass> linkClasslist = new List<Core.Business.LinkClass>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectLinkClassesAll"); if(reader != null) { while(reader.Read()) { Core.Business.LinkClass linkClass = new Core.Business.LinkClass(); if (!reader.IsDBNull(0)) linkClass.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) linkClass.ClassName = reader.GetString(1); if (!reader.IsDBNull(2)) linkClass.Index = reader.GetInt32(2); linkClass.MarkOld(); linkClasslist.Add(linkClass); } reader.Close(); } return linkClasslist; }