public IList<Core.Business.SupplyAndDemand> GetAllSupplyAndDemand(string strwhere ) { IList<Core.Business.SupplyAndDemand> supplyAndDemandlist = new List<Core.Business.SupplyAndDemand>(); SqlServerUtility sql = new SqlServerUtility(); string sqlSelAll = "SELECT[Id],[Publisher],[PublishDate],[Title],[SequenceNumber],[IsShowinHomePage],[Content],[IsSupplyAndDemand],[IMGURL],[Annex],[LinkInfo]FROM[dbo].[SupplyAndDemand]"; sqlSelAll += strwhere; SqlDataReader reader = sql.ExecuteSqlReader(sqlSelAll); if(reader != null) { while(reader.Read()) { Core.Business.SupplyAndDemand supplyAndDemand = new Core.Business.SupplyAndDemand(); if (!reader.IsDBNull(0)) supplyAndDemand.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) supplyAndDemand.Publisher = reader.GetString(1); if (!reader.IsDBNull(2)) supplyAndDemand.PublishDate = reader.GetDateTime(2); if (!reader.IsDBNull(3)) supplyAndDemand.Title = reader.GetString(3); if (!reader.IsDBNull(4)) supplyAndDemand.SequenceNumber = reader.GetInt32(4); if (!reader.IsDBNull(5)) supplyAndDemand.IsShowinHomePage = reader.GetInt32(5); if (!reader.IsDBNull(6)) supplyAndDemand.Content = reader.GetString(6); if (!reader.IsDBNull(7)) supplyAndDemand.IsSupplyAndDemand = reader.GetInt32(7); if (!reader.IsDBNull(8)) supplyAndDemand.IMGURL = reader.GetString(8); if (!reader.IsDBNull(9)) supplyAndDemand.Annex = reader.GetInt32(9); if (!reader.IsDBNull(10)) supplyAndDemand.LinkInfo = reader.GetString(10); supplyAndDemand.MarkOld(); supplyAndDemandlist.Add(supplyAndDemand); } reader.Close(); } return supplyAndDemandlist; }
public IList<Core.Business.SupplyAndDemand> GetSupplyAndDemandByPage(int pagenumber, int pagesize,string order) { IList<Core.Business.SupplyAndDemand> supplyAndDemandlist = new List<Core.Business.SupplyAndDemand>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Tables", SqlDbType.VarChar, "SupplyAndDemand"); sql.AddParameter("@PK", SqlDbType.VarChar, "Id"); sql.AddParameter("@PageNumber", SqlDbType.Int, pagenumber); sql.AddParameter("@PageSize", SqlDbType.Int, pagesize); sql.AddParameter("@Sort", SqlDbType.VarChar, order); SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount"); if (reader != null) { while (reader.Read()) { Core.Business.SupplyAndDemand supplyAndDemand = new Core.Business.SupplyAndDemand(); if (!reader.IsDBNull(0)) supplyAndDemand.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) supplyAndDemand.Publisher = reader.GetString(1); if (!reader.IsDBNull(2)) supplyAndDemand.PublishDate = reader.GetDateTime(2); if (!reader.IsDBNull(3)) supplyAndDemand.Title = reader.GetString(3); if (!reader.IsDBNull(4)) supplyAndDemand.SequenceNumber = reader.GetInt32(4); if (!reader.IsDBNull(5)) supplyAndDemand.IsShowinHomePage = reader.GetInt32(5); if (!reader.IsDBNull(6)) supplyAndDemand.Content = reader.GetString(6); if (!reader.IsDBNull(7)) supplyAndDemand.IsSupplyAndDemand = reader.GetInt32(7); if (!reader.IsDBNull(8)) supplyAndDemand.IMGURL = reader.GetString(8); if (!reader.IsDBNull(9)) supplyAndDemand.Annex = reader.GetInt32(9); if (!reader.IsDBNull(10)) supplyAndDemand.LinkInfo = reader.GetString(10); supplyAndDemand.MarkOld(); supplyAndDemandlist.Add(supplyAndDemand); } reader.Close(); } return supplyAndDemandlist; }
public Core.Business.SupplyAndDemand Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectSupplyAndDemand"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.SupplyAndDemand supplyAndDemand = new Core.Business.SupplyAndDemand(); if (!reader.IsDBNull(0)) supplyAndDemand.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) supplyAndDemand.Publisher = reader.GetString(1); if (!reader.IsDBNull(2)) supplyAndDemand.PublishDate = reader.GetDateTime(2); if (!reader.IsDBNull(3)) supplyAndDemand.Title = reader.GetString(3); if (!reader.IsDBNull(4)) supplyAndDemand.SequenceNumber = reader.GetInt32(4); if (!reader.IsDBNull(5)) supplyAndDemand.IsShowinHomePage = reader.GetInt32(5); if (!reader.IsDBNull(6)) supplyAndDemand.Content = reader.GetString(6); if (!reader.IsDBNull(7)) supplyAndDemand.IsSupplyAndDemand = reader.GetInt32(7); if (!reader.IsDBNull(8)) supplyAndDemand.IMGURL = reader.GetString(8); if (!reader.IsDBNull(9)) supplyAndDemand.Annex = reader.GetInt32(9); if (!reader.IsDBNull(10)) supplyAndDemand.LinkInfo = reader.GetString(10); reader.Close(); return supplyAndDemand; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }