public Core.Business.EnterpriseSort Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectEnterpriseSort"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.EnterpriseSort enterpriseSort = new Core.Business.EnterpriseSort(); if (!reader.IsDBNull(0)) enterpriseSort.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) enterpriseSort.EnterpriseSortName = reader.GetString(1); reader.Close(); return enterpriseSort; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.EnterpriseSort> GetAllEnterpriseSort() { IList<Core.Business.EnterpriseSort> enterpriseSortlist = new List<Core.Business.EnterpriseSort>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectEnterpriseSortsAll"); if(reader != null) { while(reader.Read()) { Core.Business.EnterpriseSort enterpriseSort = new Core.Business.EnterpriseSort(); if (!reader.IsDBNull(0)) enterpriseSort.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) enterpriseSort.EnterpriseSortName = reader.GetString(1); enterpriseSort.MarkOld(); enterpriseSortlist.Add(enterpriseSort); } reader.Close(); } return enterpriseSortlist; }