public DestaquesVOCollection GetAllPaged(long startRowIndex, int maximumRows) { DestaquesVOCollection listaDestaquesVO = new DestaquesVOCollection(); DestaquesVO destaquesVO = null; DbCommand command = db.GetStoredProcCommand("dbo.DW_DestaquesSelectAllPaged"); db.AddInParameter(command, "@startRowIndex", DbType.Int64, startRowIndex); db.AddInParameter(command, "@maximumRows", DbType.Int64, maximumRows); using (IDataReader reader = db.ExecuteReader(command)) { while (reader.Read()) { if (listaDestaquesVO.Count == 0) listaDestaquesVO.TotalRows = int.Parse(reader.GetValue(reader.GetOrdinal("TotalRows")).ToString()); destaquesVO = new DestaquesVO(); destaquesVO.IsPersisted = true; if (!reader.IsDBNull(reader.GetOrdinal("IdDestaque"))) destaquesVO.IdDestaque = reader.GetInt32(reader.GetOrdinal("IdDestaque")); if (!reader.IsDBNull(reader.GetOrdinal("Destaque"))) destaquesVO.Destaque = reader.GetString(reader.GetOrdinal("Destaque")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("DescricaoSimples"))) destaquesVO.DescricaoSimples = reader.GetString(reader.GetOrdinal("DescricaoSimples")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("DescricaoComplexa"))) destaquesVO.DescricaoComplexa = reader.GetString(reader.GetOrdinal("DescricaoComplexa")).Trim(); listaDestaquesVO.Add(destaquesVO); } } listaDestaquesVO.PageSize = maximumRows; return listaDestaquesVO; }
public DestaquesVOCollection GetAll() { DestaquesVOCollection listaDestaquesVO = new DestaquesVOCollection(); DestaquesVO destaquesVO = null; DbCommand command = db.GetStoredProcCommand("dbo.DW_DestaquesSelectAll"); using (IDataReader reader = db.ExecuteReader(command)) { while (reader.Read()) { destaquesVO = new DestaquesVO(); destaquesVO.IsPersisted = true; if (!reader.IsDBNull(reader.GetOrdinal("IdDestaque"))) destaquesVO.IdDestaque = reader.GetInt32(reader.GetOrdinal("IdDestaque")); if (!reader.IsDBNull(reader.GetOrdinal("Destaque"))) destaquesVO.Destaque = reader.GetString(reader.GetOrdinal("Destaque")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("DescricaoSimples"))) destaquesVO.DescricaoSimples = reader.GetString(reader.GetOrdinal("DescricaoSimples")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("DescricaoComplexa"))) destaquesVO.DescricaoComplexa = reader.GetString(reader.GetOrdinal("DescricaoComplexa")).Trim(); listaDestaquesVO.Add(destaquesVO); } } return listaDestaquesVO; }