public IList<Core.Business.Subsidies> GetAllSubsidies() { IList<Core.Business.Subsidies> subsidieslist = new List<Core.Business.Subsidies>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectSubsidiesAll"); if(reader != null) { while(reader.Read()) { Core.Business.Subsidies subsidies = new Core.Business.Subsidies(); if (!reader.IsDBNull(0)) subsidies.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) subsidies.Name = reader.GetString(1); if (!reader.IsDBNull(2)) subsidies.Des = reader.GetString(2); if (!reader.IsDBNull(3)) subsidies.AddPerson = reader.GetString(3); if (!reader.IsDBNull(4)) subsidies.AddTime = reader.GetDateTime(4); if (!reader.IsDBNull(5)) subsidies.Status = reader.GetInt32(5); subsidies.MarkOld(); subsidieslist.Add(subsidies); } reader.Close(); } return subsidieslist; }
public Core.Business.Subsidies Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectSubsidy"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Subsidies subsidies = new Core.Business.Subsidies(); if (!reader.IsDBNull(0)) subsidies.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) subsidies.Name = reader.GetString(1); if (!reader.IsDBNull(2)) subsidies.Des = reader.GetString(2); if (!reader.IsDBNull(3)) subsidies.AddPerson = reader.GetString(3); if (!reader.IsDBNull(4)) subsidies.AddTime = reader.GetDateTime(4); if (!reader.IsDBNull(5)) subsidies.Status = reader.GetInt32(5); reader.Close(); return subsidies; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public Core.Business.Subsidies SelectNew(int status) { SqlServerUtility sql = new SqlServerUtility(); string sqlstr = "SELECT [Id],[Name],[Des],[AddPerson],[AddTime],[Status] FROM [dbo].[Subsidies] WHERE[Status] = @Status"; sql.AddParameter("@Status", SqlDbType.Int, status); SqlDataReader reader = sql.ExecuteSqlReader(sqlstr); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Subsidies subsidies = new Core.Business.Subsidies(); if (!reader.IsDBNull(0)) subsidies.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) subsidies.Name = reader.GetString(1); if (!reader.IsDBNull(2)) subsidies.Des = reader.GetString(2); if (!reader.IsDBNull(3)) subsidies.AddPerson = reader.GetString(3); if (!reader.IsDBNull(4)) subsidies.AddTime = reader.GetDateTime(4); if (!reader.IsDBNull(5)) subsidies.Status = reader.GetInt32(5); reader.Close(); subsidies.MarkOld(); return subsidies; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }