public IList<Core.Business.SubsidyRecordForStudent> GetAllSubsidyRecordForStudent() { IList<Core.Business.SubsidyRecordForStudent> subsidyRecordForStudentlist = new List<Core.Business.SubsidyRecordForStudent>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllSubsidyRecordForStudent); if (reader != null) { while (reader.Read()) { Core.Business.SubsidyRecordForStudent subsidyRecordForStudent = new Core.Business.SubsidyRecordForStudent(); if (!reader.IsDBNull(0)) subsidyRecordForStudent.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) subsidyRecordForStudent.AcidLevel = reader.GetByte(1); if (!reader.IsDBNull(2)) subsidyRecordForStudent.CheckState = reader.GetByte(2); if (!reader.IsDBNull(3)) subsidyRecordForStudent.SubsidyID = reader.GetInt32(3); if (!reader.IsDBNull(4)) subsidyRecordForStudent.Year = reader.GetInt32(4); if (!reader.IsDBNull(5)) subsidyRecordForStudent.Term = reader.GetInt32(5); if (!reader.IsDBNull(6)) subsidyRecordForStudent.Date = reader.GetDateTime(6); if (!reader.IsDBNull(7)) subsidyRecordForStudent.Amount = reader.GetDecimal(7); if (!reader.IsDBNull(8)) subsidyRecordForStudent.Receiver = reader.GetString(8); if (!reader.IsDBNull(9)) subsidyRecordForStudent.Description = reader.GetString(9); if (!reader.IsDBNull(10)) subsidyRecordForStudent.DiffcultReason = reader.GetString(10); if (!reader.IsDBNull(11)) subsidyRecordForStudent.FamiliesType = reader.GetString(11); if (!reader.IsDBNull(12)) subsidyRecordForStudent.HelpReason = reader.GetString(12); if (!reader.IsDBNull(13)) subsidyRecordForStudent.ClassView = reader.GetString(13); if (!reader.IsDBNull(14)) subsidyRecordForStudent.SchoolView = reader.GetString(14); subsidyRecordForStudent.MarkOld(); subsidyRecordForStudentlist.Add(subsidyRecordForStudent); } reader.Close(); } return subsidyRecordForStudentlist; }
public Core.Business.SubsidyRecordForStudent SelectByStdcodeAndTime(string stdcode, int year, int subid) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Receiver", SqlDbType.NVarChar, stdcode); sql.AddParameter("@Year", SqlDbType.Int, year); sql.AddParameter("@SubsidyID", SqlDbType.Int, subid); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectSubsidyRecordForStudentByStdCodeAndTime); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.SubsidyRecordForStudent subsidyRecordForStudent = new Core.Business.SubsidyRecordForStudent(); if (!reader.IsDBNull(0)) subsidyRecordForStudent.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) subsidyRecordForStudent.AcidLevel = reader.GetByte(1); if (!reader.IsDBNull(2)) subsidyRecordForStudent.CheckState = reader.GetByte(2); if (!reader.IsDBNull(3)) subsidyRecordForStudent.SubsidyID = reader.GetInt32(3); if (!reader.IsDBNull(4)) subsidyRecordForStudent.Year = reader.GetInt32(4); if (!reader.IsDBNull(5)) subsidyRecordForStudent.Term = reader.GetInt32(5); if (!reader.IsDBNull(6)) subsidyRecordForStudent.Date = reader.GetDateTime(6); if (!reader.IsDBNull(7)) subsidyRecordForStudent.Amount = reader.GetDecimal(7); if (!reader.IsDBNull(8)) subsidyRecordForStudent.Receiver = reader.GetString(8); if (!reader.IsDBNull(9)) subsidyRecordForStudent.Description = reader.GetString(9); if (!reader.IsDBNull(10)) subsidyRecordForStudent.DiffcultReason = reader.GetString(10); if (!reader.IsDBNull(11)) subsidyRecordForStudent.FamiliesType = reader.GetString(11); if (!reader.IsDBNull(12)) subsidyRecordForStudent.HelpReason = reader.GetString(12); if (!reader.IsDBNull(13)) subsidyRecordForStudent.ClassView = reader.GetString(13); if (!reader.IsDBNull(14)) subsidyRecordForStudent.SchoolView = reader.GetString(14); reader.Close(); subsidyRecordForStudent.MarkOld(); return subsidyRecordForStudent; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }