示例#1
0
        public List <EstadoCivil> ListarEstadoCivil()// retorna uma lista de estado civil
        {
            List <EstadoCivil> estados = new List <EstadoCivil>();


            try {
                SqlCommand comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "SELECT id,estado FROM [ExtranetFenix].[dbo].[estadoCivil]ORDER BY [dbo].[estadoCivil].estado ASC";

                SqlDataReader dr = ConexaoBanco.Selecionar(comando);



                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        EstadoCivil estado = new EstadoCivil();

                        estado.estado = (String)dr["estado"];
                        estado.id     = (int)dr["id"];
                        estados.Add(estado);
                    }
                }
            } catch {
                estados = null;
                throw;
            }



            return(estados);
        }
        public CadastroMenu ReadById(int id)
        {
            CadastroMenu menu = new CadastroMenu();

            try {
                SqlCommand comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "SELECT * FROM Menu WHERE id=@menuId ";

                comando.Parameters.AddWithValue("@menuId", id);

                SqlDataReader dr = ConexaoBanco.Selecionar(comando);



                if (dr.HasRows)
                {
                    dr.Read();
                    menu.nome  = Convert.ToString(dr["nome"]);
                    menu.url   = Convert.ToString(dr["url"]);
                    menu.ordem = Convert.ToInt32(dr["ordem"]);

                    menu.codigoPai = Convert.ToInt32(dr["codigoPai"]);
                    menu.id        = Convert.ToInt32(dr["id"]);
                }
            } catch {
                menu = null;
                throw;
            }



            return(menu);
        }
示例#3
0
        public void Update(Postagem postagem, DateTime dataHora, List <Imagem> lista, Imagem arq, int post, int id) // realiza alterações nas postagens
        {
            Usuario usuario    = HttpContext.Current.Session["UsuarioAtual"] as Usuario;
            int     postagemId = postagem.id;

            try
            {
                SqlConnection conn    = new SqlConnection();
                SqlCommand    comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "UPDATE  postagem set usuario_fk=@usuario_fk,corpo=@corpo,dataHora=@dataHora,titulo=@titulo," +
                                      "etiqueta=@etiqueta,rascunho=@rascunho WHERE postagem.id=@id SELECT scope_identity();";

                comando.Parameters.AddWithValue("@usuario_fk", usuario.id);
                comando.Parameters.AddWithValue("@corpo", postagem.corpo);
                comando.Parameters.AddWithValue("@titulo", postagem.titulo);
                comando.Parameters.AddWithValue("@etiqueta", postagem.etiqueta);
                comando.Parameters.AddWithValue("@dataHora", dataHora);
                comando.Parameters.AddWithValue("@rascunho", post);
                comando.Parameters.AddWithValue("@id", postagemId);

                conn = ConexaoBanco.Conectar();
                comando.Connection = conn;
                Int32 idPostagem = Convert.ToInt32(comando.ExecuteScalar());

                ImagemBO imagemBO = new ImagemBO();
                imagemBO.Gravar(lista, arq, idPostagem);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        public Anexo ReadById(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM anexo WHERE id=@anexoId ";

            comando.Parameters.AddWithValue("@anexoId", id);

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            Anexo anexo = new Anexo();

            if (dr.HasRows) //verifica se o dr tem alguma coisa
            {
                dr.Read();
                anexo.nome        = (string)dr["nome"];
                anexo.arquivo     = (Byte[])dr["arquivo"];
                anexo.tipoArquivo = (string)dr["tipoArquivo"];
                anexo.id          = (int)dr["id"];
            }
            else
            {
                anexo = null;
            }

            return(anexo);
        }
示例#5
0
        public void Insert(Usuario usuario) // insere usuario na tbael ausuario
        {
            try
            {
                SqlCommand comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "INSERT INTO usuario(nome,cargo,usuarioLogin,senha,centroCusto,email,bU,setor,situacao) " +
                                      "values(@nome,@cargo,@usuarioLogin,@senha,@centroCusto,@email,@bU,@setor,@situacao)  ";

                comando.Parameters.AddWithValue("@nome", usuario.nome);
                comando.Parameters.AddWithValue("@cargo", usuario.cargo);
                comando.Parameters.AddWithValue("@usuarioLogin", usuario.usuarioLogin);
                comando.Parameters.AddWithValue("@senha", usuario.senha);
                comando.Parameters.AddWithValue("@centroCusto", usuario.centroCusto);
                comando.Parameters.AddWithValue("@email", usuario.email);
                comando.Parameters.AddWithValue("@bU", usuario.bU);
                comando.Parameters.AddWithValue("@setor", usuario.setor);
                comando.Parameters.AddWithValue("@situacao", usuario.situacao);



                ConexaoBanco.CRUD(comando);
            }
            catch (Exception e) {
                throw e;
            }
        }
        public String pegarPrivilegios(int idUsuario) // retona os provilegios de um usuario
        {
            String privilegios = "";


            try {
                SqlCommand comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "Select privilegios from [ExtranetFenix].[dbo].usuarioXGrupo join [ExtranetFenix].[dbo].usuario on usuario_fk = usuario.id join [ExtranetFenix].[dbo].grupoUsuario on grupoUsuario_fk = grupoUsuario.id where [ExtranetFenix].[dbo].usuarioXGrupo.usuario_fk = @id";

                comando.Parameters.AddWithValue("@id", idUsuario);

                SqlDataReader dr = ConexaoBanco.Selecionar(comando);

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        var temp = Convert.ToString(dr["privilegios"]);

                        privilegios = privilegios + String.Join(",", temp);
                    }
                }
            }
            catch  {
                throw;
            }


            return(privilegios);
        }
        public Boolean VerificaUsuarioDoGrupo(GrupoUsuario grupoUsuario) //procura usuario existene em um grupo
        {
            Boolean retorno = true;

            try
            {
                SqlCommand comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "SELECT usuario_fk FROM [ExtranetFenix].[dbo].[usuarioXGrupo] WHERE grupoUsuario_fk = @grupoUsuario_fk";

                comando.Parameters.AddWithValue("@grupoUsuario_fk", grupoUsuario.id);

                SqlDataReader dr = ConexaoBanco.Selecionar(comando);

                UsuarioDAO      usuarioDao = new UsuarioDAO();
                GrupoUsuarioDAO grupoDao   = new GrupoUsuarioDAO();

                if (dr.HasRows) //verifica se o dr tem alguma coisa
                {
                    retorno = true;
                }
                else
                {
                    retorno = false;
                }
            }
            catch
            {
                retorno = true;
                throw;
            }


            return(retorno);
        }
示例#8
0
        public List <EstadoCivil> ListarPorEstado(string estado)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM estadoCivil WHERE estado LIKE @estado" +


                                  comando.Parameters.AddWithValue("@estado", "%" + estado + "%");

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            List <EstadoCivil> estados = new List <EstadoCivil>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    EstadoCivil estadoCivil = new EstadoCivil();

                    estadoCivil.estado = (string)dr["estado"];
                    estadoCivil.id     = (int)dr["id"];

                    estados.Add(estadoCivil);
                }
            }
            else
            {
                estados = null;
            }

            return(estados);
        }
示例#9
0
        public Usuario PesquisarUsuario(string usuarioLogin, string senha) //realiza uma pesquisa de usuario se esta cadastrado e com a scredenciais correta para libera acesso
        {
            Usuario    usuario = new Usuario();
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM [ExtranetFenix].[dbo].[usuario]  Where usuario.usuarioLogin like @usuarioLogin and usuario.senha = @senha and usuario.situacao=1"; //and ativo =1

            comando.Parameters.AddWithValue("@usuarioLogin", usuarioLogin + "%");
            comando.Parameters.AddWithValue("@senha", senha);

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            if (dr.HasRows)
            {
                dr.Read();
                usuario.usuarioLogin = (string)dr["usuarioLogin"];
                usuario.senha        = (string)dr["senha"];
                usuario.id           = Convert.ToInt32(dr["id"]);
                usuario.nome         = Convert.ToString(dr["nome"]);
            }
            else
            {
                usuario = null;
            }
            return(usuario);
        }
示例#10
0
        public Historico BuscarPorId(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM historico WHERE Id=@Id ";

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

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            Historico historico = new Historico();

            if (dr.HasRows) //verifica se o dr tem alguma coisa
            {
                //preenche o objeto historico
                dr.Read();
                historico.id         = (int)dr["id"];
                historico.dataHora   = (DateTime)dr["dataHora"];
                historico.usuario.id = (int)dr["usuario"];
            }
            else
            {
                historico = null;
            }
            return(historico);
        }
        public List <AreaPretendida> ListarAreas() // lista todas as areas pretendidas
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM areaPretendida";

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            List <AreaPretendida> areas = new List <AreaPretendida>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    AreaPretendida area = new AreaPretendida();

                    area.cargo = (string)dr["cargo"];
                    area.id    = (int)dr["id"];
                    areas.Add(area);
                }
            }
            else
            {
                areas = null;
            }

            return(areas);
        }
示例#12
0
        public void Alterar(List <Imagem> lista, Imagem arq, int idPostagem) // altera a imagem de acordo com o ID
        {
            try
            {
                int x = 0;

                while (lista != null && x < lista.Count)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "UPDATE  imagem set nome=@nome, imagem=@imagem, postagem_fk=@postagem_fk, tipoArquivo=@tipoArquivo" +
                                      "  WHERE imagem.postagem_fk= @postagem_fk;";

                    cmd.Parameters.AddWithValue("@nome", lista[x].nome);
                    cmd.Parameters.AddWithValue("@imagem", lista[x].imagem);
                    cmd.Parameters.AddWithValue("@postagem_fk", idPostagem);
                    cmd.Parameters.AddWithValue("@tipoArquivo", lista[x].tipoArquivo);

                    ConexaoBanco.CRUD(cmd);
                    x++;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#13
0
        public void Delete(int id)
        {
            try {
                Curriculo curriculo = new Curriculo();
                Anexo     anexo     = new Anexo();
                AnexoBO   anx       = new AnexoBO();

                CurriculoBO curriculoBO = new CurriculoBO();
                curriculo = curriculoBO.ReadById(id);

                SqlConnection conn    = new SqlConnection();
                SqlCommand    comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "DELETE  FROM curriculo WHERE id=@curriculoId ";
                comando.Parameters.AddWithValue("@curriculoId", id);

                ConexaoBanco.CRUD(comando);

                conn                = ConexaoBanco.Conectar();
                comando             = new SqlCommand();
                comando.CommandType = CommandType.Text;

                if (curriculo.anexo.id != 0)
                {
                    int anexoId = curriculo.anexo.id;
                    comando.CommandText = "DELETE  from anexo where id=@id ";
                    comando.Parameters.AddWithValue("@id", anexoId);

                    ConexaoBanco.CRUD(comando);
                }
            }
            catch {
                throw;
            }
        }
示例#14
0
        public Imagem ReadById(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM imagem WHERE Id=@Id ";

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

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            Imagem imagem = new Imagem();

            if (dr.HasRows) //verifica se o dr tem alguma coisa
            {
                dr.Read();
                imagem.id   = (int)dr["id"];
                imagem.nome = (string)dr["nome"];
            }
            else
            {
                imagem = null;
            }
            return(imagem);
        }
示例#15
0
        public List <Imagem> ListarImagens(int postagemId) // retorna uma lista de imagens de acordo com o ID de postagem associado
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT imagem.imagem, imagem.tipoArquivo from imagem left join postagem on postagem.id= imagem.postagem_fk " +
                                  "where imagem.postagem_fk = @id and imagem.imagem is not null";



            comando.Parameters.AddWithValue("@id", postagemId);

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            List <Imagem> imagensPostagens = new List <Imagem>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Imagem imagem = new Imagem();

                    imagem.imagem      = (byte[])dr["imagem"];
                    imagem.tipoArquivo = (string)dr["tipoArquivo"];
                    imagensPostagens.Add(imagem);
                }
            }

            else
            {
                imagensPostagens = null;
            }

            return(imagensPostagens);
        }
示例#16
0
        public void Insert(List <Imagem> lista, Imagem arq, int id) //insere uma ou mais  imagens na tabela imagem
        {
            try
            {
                int x = 0;

                while (lista != null && x < lista.Count)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "INSERT INTO imagem (nome,imagem,postagem_fk,tipoArquivo)values(@nome,@imagem,@postagem_fk,@tipoArquivo);";

                    cmd.Parameters.AddWithValue("@nome", lista[x].nome);
                    cmd.Parameters.AddWithValue("@imagem", lista[x].imagem);
                    cmd.Parameters.AddWithValue("@postagem_fk", id);
                    cmd.Parameters.AddWithValue("@tipoArquivo", lista[x].tipoArquivo);

                    ConexaoBanco.CRUD(cmd);
                    x++;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IList <AreaPretendida> listarPorArea(string cargo) // retorna uma lista de áreas pretendidas onde o cargo bate
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT areaPrentedida.cargo FROM areaPretendida WHERE cargo LIKE @cargo" +


                                  comando.Parameters.AddWithValue("@cargo", "%" + cargo + "%");

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            IList <AreaPretendida> areas = new List <AreaPretendida>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    AreaPretendida area = new AreaPretendida();

                    area.cargo = (string)dr["cargo"];
                    area.id    = (int)dr["id"];

                    areas.Add(area);
                }
            }
            else
            {
                areas = null;
            }

            return(areas);
        }
        public List <int> listaDeGrupoAQualPertence(int idUsuario) // retorna o grupos que um determinado usuario pertence
        {
            List <int> ids = null;

            try
            {
                SqlCommand comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "SELECT grupoUsuario_fk FROM [ExtranetFenix].[dbo].[usuarioXGrupo] WHERE [usuario_fk] = @idUsuario";
                comando.Parameters.AddWithValue("@idUsuario", idUsuario);
                SqlDataReader dr = ConexaoBanco.Selecionar(comando);

                if (dr.HasRows)
                {
                    int id = 0;

                    ids = new List <int>();

                    while (dr.Read())
                    {
                        id = (int)dr["grupoUsuario_fk"];

                        ids.Add(id);
                    }
                }
            }
            catch (Exception ex)
            {
                ids = null;

                throw ex;
            }

            return(ids);
        }
示例#19
0
        public void Update(Curriculo curriculo)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "UPDATE curriculo SET(nome=@nome, cpf=@cpf, dataNascimento=@dataNascimento, uf=@uf, cep=@cep, " +
                                  "cidade=@cidade,bairro=@bairro,rua=@rua,numero=@numero,descricao=@descricao,telefoneFixo=@telefoneFixo," +
                                  "telefoneCelular=@telefoneCelular,email=@email,siteBlog=@siteBlog,skype=@skype,remuneracao=@remuneracao," +
                                  "genero=@genero,estadoCivil_fk=@estado,areaPretendida_fk=@area,anexo_fk=@anexo WHERE id=@curriculoId ";

            comando.Parameters.AddWithValue("@nome", curriculo.nome);
            comando.Parameters.AddWithValue("@cpf", curriculo.cpf);
            comando.Parameters.AddWithValue("@dataNascimento", curriculo.dataNascimento);
            comando.Parameters.AddWithValue("@uf", curriculo.uf);
            comando.Parameters.AddWithValue("@cep", curriculo.cep);
            comando.Parameters.AddWithValue("@cidade", curriculo.cidade);
            comando.Parameters.AddWithValue("@bairro", curriculo.bairro);
            comando.Parameters.AddWithValue("@rua", curriculo.rua);
            comando.Parameters.AddWithValue("@numero", curriculo.numero);
            comando.Parameters.AddWithValue("@descricao", curriculo.descricao);
            comando.Parameters.AddWithValue("@telefoneFixo", curriculo.telefoneFixo);
            comando.Parameters.AddWithValue("@telefoneCelular", curriculo.telefoneCelular);
            comando.Parameters.AddWithValue("@email", curriculo.email);
            comando.Parameters.AddWithValue("@siteBlog", curriculo.siteBlog);
            comando.Parameters.AddWithValue("@skype", curriculo.skype);
            comando.Parameters.AddWithValue("@remuneracao", curriculo.remuneracao);
            comando.Parameters.AddWithValue("@genero", curriculo.genero);
            comando.Parameters.AddWithValue("@estadoCivil_fk", curriculo.estado.id);
            comando.Parameters.AddWithValue("@areaPretendida_fk", curriculo.area.id);
            comando.Parameters.AddWithValue("@anexo_fk", curriculo.anexo.id);

            ConexaoBanco.CRUD(comando);
        }
示例#20
0
        public EstadoCivil ReadById(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM estadoCivil WHERE id=@estadoId ";

            comando.Parameters.AddWithValue("@estadoId", id);

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            EstadoCivil estado = new EstadoCivil();

            if (dr.HasRows) //verifica se o dr tem alguma coisa
            {
                dr.Read();
                estado.estado = (String)dr["estado"];
                estado.id     = (int)dr["id"];
            }
            else
            {
                estado = null;
            }

            return(estado);
        }
        public AreaPretendida ReadById(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM areaPretendida WHERE id=@areaId ";

            comando.Parameters.AddWithValue("@areaId", id);

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            AreaPretendida area = new AreaPretendida();

            if (dr.HasRows) //verifica se o dr tem alguma coisa
            {
                dr.Read();
                area.cargo = (string)dr["cargo"];
                area.id    = (int)dr["id"];
            }
            else
            {
                area = null;
            }

            return(area);
        }
示例#22
0
        public int Insert(Postagem postagem, DateTime dataHora, int post)// insere uma postagem na tablea postagem com autor e data hora
        {
            Usuario usuario = HttpContext.Current.Session["UsuarioAtual"] as Usuario;

            try
            {
                SqlConnection conn    = new SqlConnection();
                SqlCommand    comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "INSERT INTO postagem(usuario_fk,corpo,dataHora,titulo,etiqueta,rascunho) " +
                                      "values(@usuario_fk,@corpo,@dataHora,@titulo,@etiqueta,@rascunho) SELECT scope_identity();";

                comando.Parameters.AddWithValue("@usuario_fk", usuario.id);
                comando.Parameters.AddWithValue("@corpo", postagem.corpo);
                comando.Parameters.AddWithValue("@titulo", postagem.titulo);
                comando.Parameters.AddWithValue("@etiqueta", postagem.etiqueta);
                comando.Parameters.AddWithValue("@dataHora", dataHora);
                comando.Parameters.AddWithValue("@rascunho", post);

                conn = ConexaoBanco.Conectar();
                comando.Connection = conn;
                Int32 id = Convert.ToInt32(comando.ExecuteScalar());



                return(id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#23
0
        public Postagem ReadById(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT postagem.* from postagem where id=@rascunhoId ";

            comando.Parameters.AddWithValue("@rascunhoId", id);

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            Postagem postagem = new Postagem();

            if (dr.HasRows)
            {
                dr.Read();
                postagem.corpo    = (string)dr["corpo"];
                postagem.titulo   = (string)dr["titulo"];
                postagem.etiqueta = (string)dr["etiqueta"];
                postagem.autor.id = (int)dr["usuario_fk"];
                postagem.rascunho = (int)dr["rascunho"];
                postagem.id       = (int)dr["id"];
            }
            else
            {
                postagem = null;
            }

            return(postagem);
        }
示例#24
0
        public Usuario ReadById(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM usuario WHERE id=@id ";

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

            SqlDataReader dr = ConexaoBanco.Selecionar(comando);

            Usuario         usuario   = new Usuario();
            GrupoUsuarioDAO gpUserDao = new GrupoUsuarioDAO();

            if (dr.HasRows) //verifica se o dr tem alguma coisa
            {
                //preenche o objeto usuario
                dr.Read();
                usuario.nome         = (string)dr["nome"];
                usuario.cargo        = (string)dr["cargo"];
                usuario.usuarioLogin = (string)dr["titulo"];
                usuario.senha        = (string)dr["etiqueta"];
                usuario.centroCusto  = (string)dr["publicada"];
                usuario.email        = (string)dr["email"];
                usuario.bU           = (string)dr["bU"];
                usuario.setor        = (string)dr["setor"];
                usuario.situacao     = (Boolean)dr["situacao"];
            }
            else
            {
                usuario = null;
            }

            return(usuario);
        }
示例#25
0
        public Dictionary <int, CadastroMenu> ListarPorFiltroGrupo(List <GrupoUsuario> grupos) // retorna uma lista de links/itens de menu filtrado por 2 ou mais grupos de usuario
        {
            //  List<CadastroMenu> ListaDelinks = null;
            Dictionary <int, CadastroMenu> conjunto = new Dictionary <int, CadastroMenu>();

            try
            {
                foreach (var grupo in grupos)
                {
                    SqlCommand comando = new SqlCommand();
                    comando.CommandType = CommandType.Text;
                    comando.CommandText = "SELECT [ExtranetFenix].[dbo].menu.* FROM [ExtranetFenix].[dbo].[grupoXMenu] JOIN [ExtranetFenix].[dbo].menu on [ExtranetFenix].[dbo].grupoXMenu.Menu_fk = [ExtranetFenix].[dbo].menu.id where [ExtranetFenix].[dbo].[grupoXMenu].grupoUsuario_fk = @idGrupo";
                    comando.Parameters.AddWithValue("@idGrupo", grupo.id);
                    SqlDataReader dr = ConexaoBanco.Selecionar(comando);

                    if (dr.HasRows)
                    {
                        CadastroMenu link = new CadastroMenu();



                        while (dr.Read())
                        {
                            link.id = Convert.ToInt32(dr["id"]);

                            link.nome = Convert.ToString(dr["nome"]);

                            link.ordem = Convert.ToInt32(dr["ordem"]);

                            link.codigoPai = Convert.ToInt32(dr["codigoPai"]);

                            link.url = Convert.ToString(dr["URL"]);



                            if (!conjunto.ContainsKey(link.id))
                            {
                                conjunto.Add(link.id, link);
                            }



                            link = new CadastroMenu();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                conjunto = null;
                throw e;
            }


            return(conjunto);
        }
示例#26
0
        public void Ativar(int id) // responsavel por ativar um usuairo
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "  UPDATE [ExtranetFenix].[dbo].[usuario] SET [situacao] = 1 WHERE [ExtranetFenix].[dbo].[usuario].id =@id ";

            comando.Parameters.AddWithValue("@id", id);
            ConexaoBanco.CRUD(comando);
        }
示例#27
0
        public void Delete(Historico historico)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "DELETE * FROM historico WHERE id=@id ";

            comando.Parameters.AddWithValue("@id", historico.id);
            ConexaoBanco.CRUD(comando);
        }
示例#28
0
        public void Delete(int id)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "DELETE * FROM anexo WHERE id=@anexoId ";

            comando.Parameters.AddWithValue("@anexoId", id);
            ConexaoBanco.CRUD(comando);
        }
示例#29
0
        public void Delete(EstadoCivil estado)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "DELETE * FROM estadoCivil WHERE id=@estadoId ";

            comando.Parameters.AddWithValue("@estadoId", estado.id);
            ConexaoBanco.CRUD(comando);
        }
示例#30
0
        public List <Curriculo> ListarPorArea(string area) // lista curriculos  por área pretendida
        {
            List <Curriculo> curriculos = new List <Curriculo>();

            try {
                SqlCommand comando = new SqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "SELECT curriculo.*,estadoCivil.estado,areaPretendida.cargo,anexo.arquivo FROM ExtranetFenix.dbo.curriculo  LEFT JOIN ExtranetFenix.dbo.estadoCivil on estadoCivil.id=curriculo.estadoCivil_fk LEFT JOIN  ExtranetFenix.dbo.areaPretendida on areaPretendida.id=curriculo.areaPretendida_fk LEFT JOIN  ExtranetFenix.dbo.anexo on curriculo.anexo_fk=anexo.id  WHERE cargo like @cargo order by [ExtranetFenix].[dbo].curriculo.nome asc";


                comando.Parameters.AddWithValue("@cargo", "%" + area + "%");

                SqlDataReader dr = ConexaoBanco.Selecionar(comando);



                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Curriculo curriculo = new Curriculo();

                        curriculo.nome            = (string)dr["nome"];
                        curriculo.cpf             = (string)dr["cpf"];
                        curriculo.uf              = (string)dr["uf"];
                        curriculo.cep             = (string)dr["cep"];
                        curriculo.cidade          = (string)dr["cidade"];
                        curriculo.bairro          = (string)dr["bairro"];
                        curriculo.rua             = (string)dr["rua"];
                        curriculo.numero          = Convert.ToString(dr["numero"]);
                        curriculo.descricao       = (string)dr["descricao"];
                        curriculo.telefoneFixo    = (string)dr["telefoneFixo"];
                        curriculo.telefoneCelular = (string)dr["telefoneCelular"];
                        curriculo.email           = (string)dr["email"];
                        curriculo.siteBlog        = (string)dr["siteBlog"];
                        curriculo.skype           = (string)dr["skype"];
                        curriculo.remuneracao     = (double)dr["remuneracao"];
                        curriculo.genero          = (string)dr["genero"];
                        curriculo.estado.id       = Convert.ToInt32(dr["estadoCivil_fk"]);
                        curriculo.area.id         = Convert.ToInt32(dr["areaPretendida_fk"]);
                        curriculo.id              = Convert.ToInt32(dr["id"]);

                        curriculos.Add(curriculo);
                    }
                }
            }
            catch {
                curriculos = null;
                throw;
            }



            return(curriculos);
        }