コード例 #1
0
        public List <ChamadaView> ReadEventosUsuario()
        {
            List <ChamadaView> lista = new List <ChamadaView>();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = connection;

            cmd.CommandText = @"select * from v_nChamada";

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ChamadaView cv = new ChamadaView();

                // <Usuarios> \\
                cv.ID    = (int)reader["usuarioId"];
                cv.Nome  = (string)reader["nomeUsuario"];
                cv.Email = (string)reader["email"];
                cv.Login = (string)reader["login"];
                cv.Curso = (string)reader["curso"];
                cv.RG    = (string)reader["rg"];
                cv.RA    = (string)reader["ra"];
                // </Usuarios> \\

                // <Atividades> \\
                cv.EventoId       = (int)reader["eventoId"];
                cv.Nome_Evento    = (string)reader["nome_evento"];
                cv.Descricao      = (string)reader["descricao"];
                cv.NomeConferente = (string)reader["nomeConferente"];
                cv.Assunto        = (string)reader["assunto"];
                cv.Conteudo       = (string)reader["conteudo"];
                cv.TipoEvento     = (string)reader["tipoEvento"];
                cv.Valor          = (decimal)reader["valor"];
                cv.Data           = (string)reader["data"];
                cv.HoraInicio     = (string)reader["horaInicio"];
                cv.HoraFinal      = (string)reader["horaFinal"];
                cv.CargaHoraria   = (int)reader["cargaHoraria"];
                // </Atividades> \\

                lista.Add(cv);
            }
            return(lista);
        }
コード例 #2
0
        public List <ChamadaView> ReadAll(int id)
        {
            List <ChamadaView> lista = new List <ChamadaView>();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = connection;

            cmd.CommandText = @"select * from v_nChamada where usuarioId = @id";

            cmd.Parameters.AddWithValue("@id", id);

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ChamadaView c = new ChamadaView();

                // <Usuario> \\
                c.ID    = (int)reader["usuarioId"];
                c.Login = (string)reader["login"];
                c.RG    = (string)reader["rg"];
                c.RA    = (string)reader["ra"];
                c.Email = (string)reader["email"];
                c.Curso = (string)reader["curso"];
                // </Usuario> \\

                // <Atividade> \\
                c.NomeConferente = (string.IsNullOrEmpty(c.NomeConferente) ? "null" : c.NomeConferente);
                c.Nome_Evento    = (string)reader["nome_evento"];
                c.Data           = (string)reader["data"];
                c.Conteudo       = (string)reader["conteudo"];
                c.Assunto        = (string)reader["assunto"];
                c.CargaHoraria   = (int)reader["cargaHoraria"];
                c.Descricao      = (string.IsNullOrEmpty(c.Descricao) ? "null" : c.Descricao);
                c.TipoEvento     = (string)reader["tipoEvento"];
                c.Valor          = (decimal)reader["valor"];
                c.HoraInicio     = (string)reader["horaInicio"];
                c.HoraFinal      = (string)reader["horaFinal"];
                // </Atividade> \\

                lista.Add(c);
            }
            return(lista);
        }