public ExperienciaVOCollection GetAll() { ExperienciaVOCollection listaExperienciaVO = new ExperienciaVOCollection(); ExperienciaVO experienciaVO = null; DbCommand command = db.GetStoredProcCommand("dbo.DW_ExperienciaSelectAll"); using (IDataReader reader = db.ExecuteReader(command)) { while (reader.Read()) { experienciaVO = new ExperienciaVO(); experienciaVO.IsPersisted = true; if (!reader.IsDBNull(reader.GetOrdinal("IdExperiencia"))) experienciaVO.IdExperiencia = reader.GetInt32(reader.GetOrdinal("IdExperiencia")); if (!reader.IsDBNull(reader.GetOrdinal("Funcao"))) experienciaVO.Funcao = reader.GetString(reader.GetOrdinal("Funcao")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("Descricao"))) experienciaVO.Descricao = reader.GetString(reader.GetOrdinal("Descricao")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("PeriodoDe"))) experienciaVO.PeriodoDe = reader.GetDateTime(reader.GetOrdinal("PeriodoDe")); if (!reader.IsDBNull(reader.GetOrdinal("PeriodoAte"))) experienciaVO.PeriodoAte = reader.GetDateTime(reader.GetOrdinal("PeriodoAte")); if (!reader.IsDBNull(reader.GetOrdinal("Empresa"))) experienciaVO.Empresa = reader.GetString(reader.GetOrdinal("Empresa")).Trim(); listaExperienciaVO.Add(experienciaVO); } } return listaExperienciaVO; }
public ExperienciaVOCollection GetAllPaged(long startRowIndex, int maximumRows) { ExperienciaVOCollection listaExperienciaVO = new ExperienciaVOCollection(); ExperienciaVO experienciaVO = null; DbCommand command = db.GetStoredProcCommand("dbo.DW_ExperienciaSelectAllPaged"); db.AddInParameter(command, "@startRowIndex", DbType.Int64, startRowIndex); db.AddInParameter(command, "@maximumRows", DbType.Int64, maximumRows); using (IDataReader reader = db.ExecuteReader(command)) { while (reader.Read()) { if (listaExperienciaVO.Count == 0) listaExperienciaVO.TotalRows = int.Parse(reader.GetValue(reader.GetOrdinal("TotalRows")).ToString()); experienciaVO = new ExperienciaVO(); experienciaVO.IsPersisted = true; if (!reader.IsDBNull(reader.GetOrdinal("IdExperiencia"))) experienciaVO.IdExperiencia = reader.GetInt32(reader.GetOrdinal("IdExperiencia")); if (!reader.IsDBNull(reader.GetOrdinal("Funcao"))) experienciaVO.Funcao = reader.GetString(reader.GetOrdinal("Funcao")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("Descricao"))) experienciaVO.Descricao = reader.GetString(reader.GetOrdinal("Descricao")).Trim(); if (!reader.IsDBNull(reader.GetOrdinal("PeriodoDe"))) experienciaVO.PeriodoDe = reader.GetDateTime(reader.GetOrdinal("PeriodoDe")); if (!reader.IsDBNull(reader.GetOrdinal("PeriodoAte"))) experienciaVO.PeriodoAte = reader.GetDateTime(reader.GetOrdinal("PeriodoAte")); if (!reader.IsDBNull(reader.GetOrdinal("Empresa"))) experienciaVO.Empresa = reader.GetString(reader.GetOrdinal("Empresa")).Trim(); listaExperienciaVO.Add(experienciaVO); } } listaExperienciaVO.PageSize = maximumRows; return listaExperienciaVO; }