public Core.Business.City Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectCity"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.City city = new Core.Business.City(); if (!reader.IsDBNull(0)) city.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) city.Name = reader.GetString(1); if (!reader.IsDBNull(2)) city.ProvinceID = reader.GetGuid(2); reader.Close(); return city; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<CY.UME.Core.Business.City> getCityByProvinceId(int pId) { IList<Core.Business.City> citylist = new List<Core.Business.City>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); sql.AddParameter("@PId", SqlDbType.Int, pId); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetCityByPId); if (reader != null) { while (reader.Read()) { Core.Business.City city = new Core.Business.City(); if (!reader.IsDBNull(0)) city.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) city.ProvinceId = reader.GetInt32(1); if (!reader.IsDBNull(2)) city.Name = reader.GetString(2); city.MarkOld(); citylist.Add(city); } reader.Close(); } return citylist; }
public IList<Core.Business.City> GetAllCity() { IList<Core.Business.City> citylist = new List<Core.Business.City>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllCity); if(reader != null) { while(reader.Read()) { Core.Business.City city = new Core.Business.City(); if (!reader.IsDBNull(0)) city.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) city.ProvinceId = reader.GetInt32(1); if (!reader.IsDBNull(2)) city.Name = reader.GetString(2); city.MarkOld(); citylist.Add(city); } reader.Close(); } return citylist; }
public IList<Core.Business.City> GetAllCity() { IList<Core.Business.City> citylist = new List<Core.Business.City>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectCitysAll"); if (reader != null) { while (reader.Read()) { Core.Business.City city = new Core.Business.City(); if (!reader.IsDBNull(0)) city.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) city.Name = reader.GetString(1); if (!reader.IsDBNull(2)) city.ProvinceID = reader.GetGuid(2); city.MarkOld(); citylist.Add(city); } reader.Close(); } return citylist; }
public Core.Business.City Select(int id) { SqlServerUtility sql = new SqlServerUtility(SqlConnection); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSPReader("USP_City_Select_By_Id"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.City city = new Core.Business.City(); if (!reader.IsDBNull(0)) city.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) city.ProvinceId = reader.GetInt32(1); if (!reader.IsDBNull(2)) city.Name = reader.GetString(2); reader.Close(); return city; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }