public IList<Core.Business.Location> GetAllLocation() { IList<Core.Business.Location> locationlist = new List<Core.Business.Location>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllLocation); if (reader != null) { while (reader.Read()) { Core.Business.Location location = new Core.Business.Location(); if (!reader.IsDBNull(0)) location.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) location.Name = reader.GetString(1); if (!reader.IsDBNull(2)) location.Description = reader.GetString(2); location.MarkOld(); locationlist.Add(location); } reader.Close(); } return locationlist; }
public ICollection<Location> Search(string s) { IList<Core.Business.Location> locationlist = new List<Core.Business.Location>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@name", SqlDbType.NVarChar, s); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetLocation); if (reader != null) { while (reader.Read()) { Core.Business.Location location = new Core.Business.Location(); if (!reader.IsDBNull(0)) location.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) location.Name = reader.GetString(1); if (!reader.IsDBNull(2)) location.Description = reader.GetString(2); location.MarkOld(); locationlist.Add(location); } reader.Close(); } return locationlist; }