public IList<Core.Business.RoomManaRcd> GetAllRoomManaRcd() { IList<Core.Business.RoomManaRcd> roomManaRcdlist = new List<Core.Business.RoomManaRcd>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllRoomManaRcd); if(reader != null) { while(reader.Read()) { Core.Business.RoomManaRcd roomManaRcd = new Core.Business.RoomManaRcd(); if (!reader.IsDBNull(0)) roomManaRcd.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) roomManaRcd.TeacherCode = reader.GetString(1); if (!reader.IsDBNull(2)) roomManaRcd.AddDate = reader.GetDateTime(2); if (!reader.IsDBNull(3)) roomManaRcd.YearNum = reader.GetString(3); if (!reader.IsDBNull(4)) roomManaRcd.Term = reader.GetInt32(4); if (!reader.IsDBNull(5)) roomManaRcd.Month = reader.GetInt32(5); if (!reader.IsDBNull(6)) roomManaRcd.RoomCate = reader.GetString(6); if (!reader.IsDBNull(7)) roomManaRcd.RoomNum = reader.GetInt32(7); roomManaRcd.MarkOld(); roomManaRcdlist.Add(roomManaRcd); } reader.Close(); } return roomManaRcdlist; }
public Core.Business.RoomManaRcd Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectRoomManaRcd); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.RoomManaRcd roomManaRcd = new Core.Business.RoomManaRcd(); if (!reader.IsDBNull(0)) roomManaRcd.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) roomManaRcd.TeacherCode = reader.GetString(1); if (!reader.IsDBNull(2)) roomManaRcd.AddDate = reader.GetDateTime(2); if (!reader.IsDBNull(3)) roomManaRcd.YearNum = reader.GetString(3); if (!reader.IsDBNull(4)) roomManaRcd.Term = reader.GetInt32(4); if (!reader.IsDBNull(5)) roomManaRcd.Month = reader.GetInt32(5); if (!reader.IsDBNull(6)) roomManaRcd.RoomCate = reader.GetString(6); if (!reader.IsDBNull(7)) roomManaRcd.RoomNum = reader.GetInt32(7); reader.Close(); return roomManaRcd; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }