public IList<Core.Business.Families> GetAllFamilies() { IList<Core.Business.Families> familieslist = new List<Core.Business.Families>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllFamilies); if (reader != null) { while (reader.Read()) { Core.Business.Families families = new Core.Business.Families(); if (!reader.IsDBNull(0)) families.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) families.Age = reader.GetInt32(1); if (!reader.IsDBNull(2)) families.StdCode = reader.GetString(2); if (!reader.IsDBNull(3)) families.Name = reader.GetString(3); if (!reader.IsDBNull(4)) families.Job = reader.GetString(4); if (!reader.IsDBNull(5)) families.Phone = reader.GetString(5); if (!reader.IsDBNull(6)) families.Relations = reader.GetString(6); families.MarkOld(); familieslist.Add(families); } reader.Close(); } return familieslist; }
public IList<CY.GFive.Core.Business.Families> GetListByStudentCode(string StdCode) { IList<Core.Business.Families> familieslist = new List<Core.Business.Families>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@StdCode", SqlDbType.NVarChar, StdCode); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetFamiliesByStdCode); if (reader != null && !reader.IsClosed) { while (reader.Read()) { Core.Business.Families families = new Core.Business.Families(); if (!reader.IsDBNull(0)) families.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) families.Age = reader.GetInt32(1); if (!reader.IsDBNull(2)) families.StdCode = reader.GetString(2); if (!reader.IsDBNull(3)) families.Name = reader.GetString(3); if (!reader.IsDBNull(4)) families.Job = reader.GetString(4); if (!reader.IsDBNull(5)) families.Phone = reader.GetString(5); if (!reader.IsDBNull(6)) families.Relations = reader.GetString(6); families.MarkOld(); familieslist.Add(families); } reader.Close(); } return familieslist; }
public Core.Business.Families Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectFamilies); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Families families = new Core.Business.Families(); if (!reader.IsDBNull(0)) families.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) families.Age = reader.GetInt32(1); if (!reader.IsDBNull(2)) families.StdCode = reader.GetString(2); if (!reader.IsDBNull(3)) families.Name = reader.GetString(3); if (!reader.IsDBNull(4)) families.Job = reader.GetString(4); if (!reader.IsDBNull(5)) families.Phone = reader.GetString(5); if (!reader.IsDBNull(6)) families.Relations = reader.GetString(6); reader.Close(); return families; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }