public IList<Core.Business.TeachReachRcd> GetAllTeachReachRcd() { IList<Core.Business.TeachReachRcd> teachReachRcdlist = new List<Core.Business.TeachReachRcd>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllTeachReachRcd); if(reader != null) { while(reader.Read()) { Core.Business.TeachReachRcd teachReachRcd = new Core.Business.TeachReachRcd(); if (!reader.IsDBNull(0)) teachReachRcd.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) teachReachRcd.TRCode = reader.GetString(1); if (!reader.IsDBNull(2)) teachReachRcd.StartTime = reader.GetDateTime(2); if (!reader.IsDBNull(3)) teachReachRcd.EndTime = reader.GetDateTime(3); if (!reader.IsDBNull(4)) teachReachRcd.ConsistTime = reader.GetDateTime(4); if (!reader.IsDBNull(5)) teachReachRcd.Partners = reader.GetString(5); if (!reader.IsDBNull(6)) teachReachRcd.Subject = reader.GetString(6); if (!reader.IsDBNull(7)) teachReachRcd.Des = reader.GetString(7); if (!reader.IsDBNull(8)) teachReachRcd.AttachmentCode = reader.GetString(8); if (!reader.IsDBNull(9)) teachReachRcd.YearNum = reader.GetString(9); if (!reader.IsDBNull(10)) teachReachRcd.Term = reader.GetInt32(10); teachReachRcd.MarkOld(); teachReachRcdlist.Add(teachReachRcd); } reader.Close(); } return teachReachRcdlist; }
public Core.Business.TeachReachRcd Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectTeachReachRcd); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.TeachReachRcd teachReachRcd = new Core.Business.TeachReachRcd(); if (!reader.IsDBNull(0)) teachReachRcd.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) teachReachRcd.TRCode = reader.GetString(1); if (!reader.IsDBNull(2)) teachReachRcd.StartTime = reader.GetDateTime(2); if (!reader.IsDBNull(3)) teachReachRcd.EndTime = reader.GetDateTime(3); if (!reader.IsDBNull(4)) teachReachRcd.ConsistTime = reader.GetDateTime(4); if (!reader.IsDBNull(5)) teachReachRcd.Partners = reader.GetString(5); if (!reader.IsDBNull(6)) teachReachRcd.Subject = reader.GetString(6); if (!reader.IsDBNull(7)) teachReachRcd.Des = reader.GetString(7); if (!reader.IsDBNull(8)) teachReachRcd.AttachmentCode = reader.GetString(8); if (!reader.IsDBNull(9)) teachReachRcd.YearNum = reader.GetString(9); if (!reader.IsDBNull(10)) teachReachRcd.Term = reader.GetInt32(10); reader.Close(); return teachReachRcd; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }