Exemplo n.º 1
0
        public FormacoesVOCollection GetAll()
        {
            FormacoesVOCollection listaFormacoesVO = new FormacoesVOCollection();
            FormacoesVO formacoesVO = null;

            DbCommand command = db.GetStoredProcCommand("dbo.DW_FormacoesSelectAll");

            using (IDataReader reader = db.ExecuteReader(command))
            {
                while (reader.Read())
                {
                    formacoesVO = new FormacoesVO();
                    formacoesVO.IsPersisted = true;
                    if (!reader.IsDBNull(reader.GetOrdinal("IdFormacao")))
                        formacoesVO.IdFormacao = reader.GetInt32(reader.GetOrdinal("IdFormacao"));
                    if (!reader.IsDBNull(reader.GetOrdinal("Curso")))
                        formacoesVO.Curso = reader.GetString(reader.GetOrdinal("Curso")).Trim();
                    if (!reader.IsDBNull(reader.GetOrdinal("Descricao")))
                        formacoesVO.Descricao = reader.GetString(reader.GetOrdinal("Descricao")).Trim();
                    if (!reader.IsDBNull(reader.GetOrdinal("Instituicao")))
                        formacoesVO.Instituicao = reader.GetString(reader.GetOrdinal("Instituicao")).Trim();
                    if (!reader.IsDBNull(reader.GetOrdinal("PeridoDe")))
                        formacoesVO.PeridoDe = reader.GetDateTime(reader.GetOrdinal("PeridoDe"));
                    if (!reader.IsDBNull(reader.GetOrdinal("PeriodoAte")))
                        formacoesVO.PeriodoAte = reader.GetDateTime(reader.GetOrdinal("PeriodoAte"));
                    listaFormacoesVO.Add(formacoesVO);
                }
            }

            return listaFormacoesVO;
        }
Exemplo n.º 2
0
        public FormacoesVOCollection GetAllPaged(long startRowIndex, int maximumRows)
        {
            FormacoesVOCollection listaFormacoesVO = new FormacoesVOCollection();
            FormacoesVO formacoesVO = null;

            DbCommand command = db.GetStoredProcCommand("dbo.DW_FormacoesSelectAllPaged");
            db.AddInParameter(command, "@startRowIndex", DbType.Int64, startRowIndex);
            db.AddInParameter(command, "@maximumRows", DbType.Int64, maximumRows);

            using (IDataReader reader = db.ExecuteReader(command))
            {
                while (reader.Read())
                {
                    if (listaFormacoesVO.Count == 0) listaFormacoesVO.TotalRows = int.Parse(reader.GetValue(reader.GetOrdinal("TotalRows")).ToString());
                    formacoesVO = new FormacoesVO();
                    formacoesVO.IsPersisted = true;
                    if (!reader.IsDBNull(reader.GetOrdinal("IdFormacao")))
                        formacoesVO.IdFormacao = reader.GetInt32(reader.GetOrdinal("IdFormacao"));
                    if (!reader.IsDBNull(reader.GetOrdinal("Curso")))
                        formacoesVO.Curso = reader.GetString(reader.GetOrdinal("Curso")).Trim();
                    if (!reader.IsDBNull(reader.GetOrdinal("Descricao")))
                        formacoesVO.Descricao = reader.GetString(reader.GetOrdinal("Descricao")).Trim();
                    if (!reader.IsDBNull(reader.GetOrdinal("Instituicao")))
                        formacoesVO.Instituicao = reader.GetString(reader.GetOrdinal("Instituicao")).Trim();
                    if (!reader.IsDBNull(reader.GetOrdinal("PeridoDe")))
                        formacoesVO.PeridoDe = reader.GetDateTime(reader.GetOrdinal("PeridoDe"));
                    if (!reader.IsDBNull(reader.GetOrdinal("PeriodoAte")))
                        formacoesVO.PeriodoAte = reader.GetDateTime(reader.GetOrdinal("PeriodoAte"));
                    listaFormacoesVO.Add(formacoesVO);
                }
            }

            listaFormacoesVO.PageSize = maximumRows;

            return listaFormacoesVO;
        }