public StatusCollection GetStatus() { StatusCollection status = new StatusCollection(); using (StatusDataAdapter adapter = new StatusDataAdapter()) { IDataReader dr = adapter.GetStatus(); while (dr.Read()) { status.Add(PopulateReader(dr)); } dr.Dispose(); adapter.Dispose(); return status; } }
public Status GetStatusById(int id) { Status status = new Status(); using (StatusDataAdapter adapter = new StatusDataAdapter()) { IDataReader dr = adapter.GetStatusById(id); if (dr.Read()) { status = PopulateReader(dr); dr.Dispose(); } adapter.Dispose(); return status; } }