public static List <EventoTemplate> GetAll()
        {
            List <EventoTemplate> eventos = new List <EventoTemplate>();

            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = "Select id_evento, nome, logo, data_evento, descricao, cidade, UF from tbl_evento where oculto = 0 and publico = 1";
            conexao.connection.Open();
            SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    EventoTemplate evento = new EventoTemplate();
                    evento.idEvento    = dr.GetInt32(0);
                    evento.Nome        = dr.GetString(1);
                    evento.Logo        = dr.GetString(2);
                    evento.Data_evento = Convert.ToString(dr.GetDateTime(3));
                    evento.Descricao   = dr.GetString(4);
                    evento.Cidade      = dr.GetString(5);
                    evento.UF          = dr.GetString(6);

                    //adiciona evento
                    eventos.Add(evento);
                }
            }

            return(eventos);
        }
Beispiel #2
0
        public static int TrocarSenha(int idUsuario, string senhaAtual, string SenhaNova)
        {
            try
            {
                string cryptoSenhaAtual = CoolEventsEncrypter.Encrypt(senhaAtual);
                string cryptoSenhaNova  = CoolEventsEncrypter.Encrypt(SenhaNova);

                BDConexao conexao = new BDConexao();
                conexao.connection.Open();
                conexao.command.CommandText = "SELECT COUNT(*) FROM TBL_USUARIO WHERE SENHA = @_SENHA AND ID_USUARIO = @IDUSUARIO";
                conexao.command.Parameters.Add("@_SENHA", SqlDbType.VarChar).Value = cryptoSenhaAtual;
                conexao.command.Parameters.Add("@IDUSUARIO", SqlDbType.Int).Value  = idUsuario;

                if ((int)conexao.command.ExecuteScalar() == 0)
                {
                    return(0);
                }

                conexao.command.Parameters.Clear();

                conexao.command.CommandText = "UPDATE TBL_USUARIO SET SENHA = @_NOVASENHA WHERE ID_USUARIO = @IDUSUARIO";
                conexao.command.Parameters.Add("@_NOVASENHA", SqlDbType.VarChar).Value = cryptoSenhaNova;
                conexao.command.Parameters.Add("@IDUSUARIO", SqlDbType.Int).Value      = idUsuario;

                conexao.command.ExecuteNonQuery();

                conexao.connection.Close();
                return(1);
            }
            catch (Exception)
            {
                return(2);
            }
        }
Beispiel #3
0
        public bool DoIt()
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.Parameters.Clear();
            conexao.command.CommandText = "SELECT id_usuario,nome FROM tbl_usuario WHERE EMAIL = @EMAIL AND SENHA = @SENHA";
            conexao.command.Parameters.Add("@EMAIL", SqlDbType.VarChar).Value = Email;
            conexao.command.Parameters.Add("@SENHA", SqlDbType.VarChar).Value = CoolEventsEncrypter.Encrypt(Senha);


            System.Data.SqlClient.SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                dr.Read();
                HttpContext.Current.Session["idUsuario"]   = dr.GetInt32(0);
                HttpContext.Current.Session["nomeUsuario"] = dr.GetString(1);
                conexao.connection.Close();
                return(true);
            }

            conexao.connection.Close();
            return(false);
        }
        public static List <EventoTemplate> GetEventsImIn()
        {
            List <EventoTemplate> eventos = new List <EventoTemplate>();

            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = @"Select id_evento, nome, logo, data_evento, descricao, cidade, UF 
                from tbl_evento WHERE id_evento in (SELECT ID_EVENTO FROM TBL_CONVIDADO WHERE ID_USUARIO = @IDUSUARIO AND CONFIRMADO = 1)";

            conexao.command.Parameters.Add("@IDUSUARIO", SqlDbType.Int).Value = HttpContext.Current.Session["idUsuario"];
            conexao.connection.Open();
            SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    EventoTemplate evento = new EventoTemplate();
                    evento.idEvento    = dr.GetInt32(0);
                    evento.Nome        = dr.GetString(1);
                    evento.Logo        = dr.GetString(2);
                    evento.Data_evento = Convert.ToString(dr.GetDateTime(3));
                    evento.Descricao   = dr.GetString(4);
                    evento.Cidade      = dr.GetString(5);
                    evento.UF          = dr.GetString(6);

                    //adiciona evento
                    eventos.Add(evento);
                }
            }

            return(eventos);
        }
Beispiel #5
0
        public static List <Tipo> GetTipos()
        {
            List <Tipo> lista_de_tipos = new List <Tipo>();


            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.CommandText = "SELECT ID_TIPO,TIPO FROM TBL_TIPOEVENTO";

            SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Tipo tipo = new Tipo();
                    tipo.Id   = dr.GetInt32(0);
                    tipo.Nome = dr.GetString(1);
                    lista_de_tipos.Add(tipo);
                }
            }
            conexao.connection.Close();

            return(lista_de_tipos);
        }
Beispiel #6
0
        public void Cadastrar()
        {
            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = "INSERT INTO TBL_TAREFA(TAREFA, ID_EVENTO) VALUES (@TAREFA, @ID_EVENTO)";
            conexao.command.Parameters.Add("@TAREFA", SqlDbType.VarChar).Value = Tarefa;
            conexao.command.Parameters.Add("@ID_EVENTO", SqlDbType.Int).Value  = Id_evento;

            conexao.connection.Open();
            conexao.command.ExecuteNonQuery();
            conexao.connection.Close();
        }
Beispiel #7
0
        public void RedefinirSenhaPorkey(string key, string novaSenha)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.Parameters.Clear();
            conexao.command.CommandText = "UPDATE CLIENTE SET senha = @SENHA WHERE codSenha = @CODSENHA";
            conexao.command.Parameters.Add("@SENHA", SqlDbType.VarChar).Value    = CoolEventsEncrypter.Encrypt(novaSenha);
            conexao.command.Parameters.Add("@CODSENHA", SqlDbType.VarChar).Value = key;

            conexao.command.ExecuteNonQuery();
            conexao.connection.Close();
        }
Beispiel #8
0
        public void SetRestoreKeyOnUser(string email, string key)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.Parameters.Clear();
            conexao.command.CommandText = "UPDATE CLIENTE SET codSenha = @CODSENHA WHERE EMAIL = @EMAIL";
            conexao.command.Parameters.Add("@CODSENHA", SqlDbType.VarChar).Value = key;
            conexao.command.Parameters.Add("@EMAIL", SqlDbType.VarChar).Value    = email;

            conexao.command.ExecuteNonQuery();
            conexao.connection.Close();
        }
Beispiel #9
0
        public void AlterarSenha(string novaSenha)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.Parameters.Clear();
            conexao.command.CommandText = "UPDATE CLIENTE SET SENHA = @NOVASENHA WHERE IDCLIENTE = @IDCLIENTE";
            conexao.command.Parameters.Add("@IDCLIENTE", SqlDbType.Int).Value     = (int)HttpContext.Current.Session["idUsuario"];
            conexao.command.Parameters.Add("@NOVASENHA", SqlDbType.VarChar).Value = CoolEventsEncrypter.Encrypt(novaSenha);

            conexao.command.ExecuteNonQuery();
            conexao.connection.Close();
        }
Beispiel #10
0
        public bool UpdateUser(Usuario usuario, int idUsuario)
        {
            try {
                BDConexao conexao = new BDConexao();

                string command = "exec updateUsuario " +
                                 "@IDUSUARIO = @_ID, " +
                                 "@NOME = @_NOME, " +
                                 "@SOBRENOME = @_SOBRENOME, " +
                                 "@EMAIL = @_EMAIL, " +
                                 "@NASC = @_NASC, " +
                                 "@GENERO = @_SEXO, " +
                                 "@APELIDO = @_APELIDO, " +
                                 "@CIVIL = @_CIVIL, " +
                                 "@UF = @_UF, " +
                                 "@CIDADE = @_CIDADE, " +
                                 "@CEP = @_CEP, " +
                                 "@BAIRRO = @_BAIRRO, " +
                                 "@LOGRADOURO = @_LOGRADOURO," +
                                 "@NUMERO = @_NUMERO, " +
                                 "@COMPLEMENTO = @_COMPLEMENTO," +
                                 "@DESCRICAO = @_DESCRICAO";

                conexao.command.CommandText = command;
                conexao.command.Parameters.Add("@_ID", SqlDbType.Int).Value              = idUsuario;
                conexao.command.Parameters.Add("@_NOME", SqlDbType.VarChar).Value        = usuario.Nome;
                conexao.command.Parameters.Add("@_SOBRENOME", SqlDbType.VarChar).Value   = usuario.Sobrenome;
                conexao.command.Parameters.Add("@_EMAIL", SqlDbType.VarChar).Value       = usuario.Email;
                conexao.command.Parameters.Add("@_NASC", SqlDbType.Date).Value           = usuario.DataNascimento;
                conexao.command.Parameters.Add("@_SEXO", SqlDbType.Char).Value           = usuario.Sexo;
                conexao.command.Parameters.Add("@_APELIDO", SqlDbType.VarChar).Value     = usuario.Apelido;
                conexao.command.Parameters.Add("@_CIVIL", SqlDbType.VarChar).Value       = usuario.Civil;
                conexao.command.Parameters.Add("@_UF", SqlDbType.Char).Value             = usuario.UF;
                conexao.command.Parameters.Add("@_CIDADE", SqlDbType.VarChar).Value      = usuario.Cidade;
                conexao.command.Parameters.Add("@_CEP", SqlDbType.VarChar).Value         = usuario.CEP;
                conexao.command.Parameters.Add("@_BAIRRO", SqlDbType.VarChar).Value      = usuario.Bairro;
                conexao.command.Parameters.Add("@_LOGRADOURO", SqlDbType.VarChar).Value  = usuario.Logradouro;
                conexao.command.Parameters.Add("@_NUMERO", SqlDbType.Int).Value          = usuario.Numero;
                conexao.command.Parameters.Add("@_COMPLEMENTO", SqlDbType.VarChar).Value = usuario.Complemento;
                conexao.command.Parameters.Add("@_DESCRICAO", SqlDbType.VarChar).Value   = usuario.Descricao;

                conexao.connection.Open();
                conexao.command.ExecuteNonQuery();
                conexao.connection.Close();

                return(true);
            }
            catch (Exception Ex) {
                return(false);
            }
        }
Beispiel #11
0
        public static void Cadastrar(string email, int idEvento)
        {
            BDConexao conexao = new BDConexao();


            conexao.command.CommandText = "INSERT INTO tbl_convidado(id_usuario, id_evento, CONFIRMADO)  VALUES ((SELECT ID_USUARIO FROM TBL_USUARIO WHERE EMAIL = @EMAIL), @ID_EVENTO, 0)";

            conexao.command.Parameters.Add("@EMAIL", SqlDbType.VarChar).Value = email;
            conexao.command.Parameters.Add("@ID_EVENTO", SqlDbType.Int).Value = idEvento;

            conexao.connection.Open();
            conexao.command.ExecuteNonQuery();
            conexao.connection.Close();
        }
Beispiel #12
0
        public Usuario GetUser(int id)
        {
            Usuario user = new Usuario();

            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = "SELECT * from tbl_USUARIO WHERE ID_USUARIO = @IDUSUARIO";
            conexao.command.Parameters.Add("@IDUSUARIO", SqlDbType.Int).Value = id;

            conexao.connection.Open();

            SqlDataReader dr = conexao.command.ExecuteReader();



            if (dr.HasRows)
            {
                dr.Read();

                user.Id        = dr.GetInt32(0).ToString();
                user.Nome      = dr.GetString(1);
                user.Sobrenome = dr.GetString(2);
                user.Email     = dr.GetString(3);
                //user.Senha = dr.GetString(4);
                user.DataNascimento = Convert.ToString(dr.GetDateTime(5));
                user.Sexo           = dr.GetString(6);
                user.Foto           = dr.GetString(7);
                user.Apelido        = dr.GetString(8);
                user.Civil          = dr.GetString(9);
                user.UF             = dr.GetString(10);
                user.Cidade         = dr.GetString(11);
                user.CEP            = dr.GetString(12);
                user.Bairro         = dr.GetString(13);
                user.Logradouro     = dr.GetString(14);
                user.Numero         = dr.GetString(15);
                user.Complemento    = dr.GetString(16);
                user.Descricao      = dr.GetString(17);
                user.Pontuacao      = dr.GetInt32(18);

                conexao.connection.Close();
                return(user);
            }
            else
            {
                conexao.connection.Close();
                return(null);
            }
        }
Beispiel #13
0
        public static EventoView GetEventoById(int idEvento)
        {
            EventoView evento = new EventoView();

            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = @"SELECT 
                NOME, DATA_EVENTO, INICIO, FIM, MAX_PESSOAS, 
                (SELECT COUNT(*) FROM tbl_convidado WHERE ID_EVENTO = @IDEVENTO) AS [PESSOAS CONFIRMADAS], 
                DESCRICAO, LOGO, BACKGROUND, UF, CIDADE, CEP, BAIRRO, LOGRADOURO, NUMERO,
                COMPLEMENTO, (SELECT TIPO FROM tbl_tipoevento WHERE ID_TIPO = (SELECT ID_TIPO FROM TBL_EVENTO WHERE ID_EVENTO = @IDEVENTO)) AS [TIPO EVENTO]
                FROM tbl_evento where id_evento = @IDEVENTO";

            conexao.command.Parameters.Add("@IDEVENTO", SqlDbType.VarChar).Value = idEvento;

            conexao.connection.Open();

            SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    evento.Id                 = idEvento;
                    evento.Nome               = dr.GetString(0);
                    evento.DataEvento         = dr.GetDateTime(1).ToString();
                    evento.Inicio             = dr.GetTimeSpan(2).ToString();
                    evento.Fim                = dr.GetTimeSpan(2).ToString();
                    evento.MaxPessoas         = dr.GetInt32(4);
                    evento.PessoasConfirmadas = dr.GetInt32(5);
                    evento.Descricao          = dr.GetString(6);
                    evento.Logo               = dr.GetString(7);
                    evento.Background         = dr.GetString(8);
                    evento.UF                 = dr.GetString(9);
                    evento.Cidade             = dr.GetString(10);
                    evento.CEP                = dr.GetString(11);
                    evento.Bairro             = dr.GetString(12);
                    evento.Logradouro         = dr.GetString(13);
                    evento.Numero             = Convert.ToInt32(dr.GetString(14));
                    evento.Complemento        = dr.GetString(15);
                    evento.TipoEvento         = dr.GetString(16);
                }
            }
            conexao.connection.Close();
            return(evento);
        }
Beispiel #14
0
        public void Cadastrar()
        {
            string urlLogo = Guid.NewGuid().ToString().Replace("-", "") + Path.GetExtension(Logo.FileName);

            string urlBackground = Guid.NewGuid().ToString().Replace("-", "") + Path.GetExtension(Background.FileName);

            var path = (@"C:\ImageProvider\public\eventoLogo\" + urlLogo);

            Logo.SaveAs(path);

            path = (@"C:\ImageProvider\public\eventoBackground\" + urlBackground);
            Background.SaveAs(path);

            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = "INSERT INTO TBL_EVENTO OUTPUT INSERTED.ID_EVENTO values (@NOME, @DATA_EVENTO, @DATA_CRIACAO, @INICIO, @FIM, @PUBLICO, @OCULTO, @MAX_PESSOAS, @DESCRICAO, @LOGO, @BACKGROUND, " +
                                          "@UF, @CIDADE, @CEP, @BAIRRO, @LOGRADOURO, @NUMERO, @COMPLEMENTO, @ID_TIPO, @ID_USUARIO)";

            conexao.command.Parameters.Add("@NOME", SqlDbType.VarChar).Value          = Nome;
            conexao.command.Parameters.Add("@DATA_EVENTO", SqlDbType.DateTime).Value  = DataEvento;
            conexao.command.Parameters.Add("@DATA_CRIACAO", SqlDbType.DateTime).Value = DateTime.Now;
            conexao.command.Parameters.Add("@INICIO", SqlDbType.Time).Value           = Inicio;
            conexao.command.Parameters.Add("@FIM", SqlDbType.Time).Value            = Fim;
            conexao.command.Parameters.Add("@PUBLICO", SqlDbType.Bit).Value         = Publico;
            conexao.command.Parameters.Add("@OCULTO", SqlDbType.Bit).Value          = false;
            conexao.command.Parameters.Add("@MAX_PESSOAS", SqlDbType.Int).Value     = MaxPessoas;
            conexao.command.Parameters.Add("@DESCRICAO", SqlDbType.NVarChar).Value  = Descricao;
            conexao.command.Parameters.Add("@LOGO", SqlDbType.NVarChar).Value       = urlLogo;
            conexao.command.Parameters.Add("@BACKGROUND", SqlDbType.VarChar).Value  = urlBackground;
            conexao.command.Parameters.Add("@UF", SqlDbType.Char).Value             = UF;
            conexao.command.Parameters.Add("@CIDADE", SqlDbType.VarChar).Value      = Cidade;
            conexao.command.Parameters.Add("@CEP", SqlDbType.VarChar).Value         = CEP;
            conexao.command.Parameters.Add("@BAIRRO", SqlDbType.NVarChar).Value     = Bairro;
            conexao.command.Parameters.Add("@LOGRADOURO", SqlDbType.NVarChar).Value = Logradouro;
            conexao.command.Parameters.Add("@NUMERO", SqlDbType.Int).Value          = Numero;
            conexao.command.Parameters.Add("@COMPLEMENTO", SqlDbType.VarChar).Value = Complemento;
            conexao.command.Parameters.Add("@ID_TIPO", SqlDbType.Int).Value         = TipoEvento;
            conexao.command.Parameters.Add("@ID_USUARIO", SqlDbType.Int).Value      = HttpContext.Current.Session["idUsuario"];

            conexao.connection.Open();
            int idUsuario = (int)conexao.command.ExecuteScalar();

            conexao.connection.Close();
            Id = idUsuario;
        }
Beispiel #15
0
        public void CarCookietoUser(string cookie)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();

            conexao.command.CommandText = "DELETE FROM CARCLIENTE WHERE IDCLIENTE = @IDCLIENTE";
            conexao.command.Parameters.Clear();
            conexao.command.Parameters.Add("@IDCLIENTE", SqlDbType.Int).Value = (int)HttpContext.Current.Session["idUsuario"];
            conexao.command.ExecuteNonQuery();

            conexao.command.CommandText = "INSERT INTO CARCLIENTE (idProduto, quantidade, idCliente, idTamanho) " +
                                          "SELECT idProduto, quantidade,@IDCLIENTE,idTamanho FROM Detalhe_CarPublico WHERE IDCARPUBLICO = (SELECT IDCARPUBLICO FROM CARPUBLICO WHERE COOKIEVALUE = @COOKIE)";
            conexao.command.Parameters.Clear();
            conexao.command.Parameters.Add("@IDCLIENTE", SqlDbType.Int).Value  = (int)HttpContext.Current.Session["idUsuario"];
            conexao.command.Parameters.Add("@COOKIE", SqlDbType.VarChar).Value = cookie;

            conexao.command.ExecuteNonQuery();
        }
Beispiel #16
0
        public static bool SaveUserImageById(int idUsuario, string fileName)
        {
            try
            {
                BDConexao conexao = new BDConexao();
                conexao.command.CommandText = "UPDATE TBL_USUARIO SET foto = @FILENAME WHERE ID_USUARIO = @IDUSUARIO";
                conexao.command.Parameters.Add("@FILENAME", SqlDbType.VarChar).Value = fileName;
                conexao.command.Parameters.Add("@IDUSUARIO", SqlDbType.Int).Value    = idUsuario;

                conexao.connection.Open();
                conexao.command.ExecuteNonQuery();
                conexao.connection.Close();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #17
0
        public Enquete GetEnqueteById(int id)
        {
            Enquete enquete = new Enquete();

            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = @"SELECT * FROM TBL_ENQUETE WHERE ID_ENQUETE = @IDENQUETE";

            conexao.command.Parameters.Add("@IDENQUETE", SqlDbType.Int).Value = id;

            conexao.connection.Open();

            SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.Id             = dr.GetInt32(0);
                    this.Imagem         = dr.GetString(2);
                    this.Titulo         = dr.GetString(3);
                    this.Texto          = dr.GetString(4);
                    this.Prazo          = dr.GetDateTime(5).ToString().Substring(0, 10);
                    this.Valor          = dr.GetInt32(7);
                    this.QUESTAO_A      = dr.GetString(8);
                    this.ALTERNATIVA_AA = dr.GetString(9);
                    this.ALTERNATIVA_AB = dr.GetString(10);
                    this.ALTERNATIVA_AC = dr.GetString(11);
                    this.ALTERNATIVA_AD = dr.GetString(12);
                    this.QUESTAO_B      = dr.GetString(13);
                    this.ALTERNATIVA_BA = dr.GetString(14);
                    this.ALTERNATIVA_BB = dr.GetString(15);
                    this.ALTERNATIVA_BC = dr.GetString(16);
                    this.ALTERNATIVA_BD = dr.GetString(17);
                }
            }

            conexao.connection.Close();

            return(enquete);
        }
Beispiel #18
0
        public void Submit()
        {
            BDConexao conexao = new BDConexao();

            conexao.command.CommandText = @"INSERT INTO TBL_RESULTADO VALUES (@IDENQUETE, @IDUSUARIO, @REALIZADO, @QUESTAOA, @QUESTAOB, @PONTUACAO)";
            conexao.command.Parameters.Add("@IDENQUETE", SqlDbType.Int).Value      = Id_Enquete;
            conexao.command.Parameters.Add("@IDUSUARIO", SqlDbType.Int).Value      = HttpContext.Current.Session["idUsuario"];
            conexao.command.Parameters.Add("@REALIZADO", SqlDbType.DateTime).Value = DateTime.Today;
            conexao.command.Parameters.Add("@QUESTAOA", SqlDbType.Char).Value      = QUESTAO_A;
            conexao.command.Parameters.Add("@QUESTAOB", SqlDbType.Char).Value      = QUESTAO_B;
            conexao.command.Parameters.Add("@PONTUACAO", SqlDbType.Int).Value      = Pontuacao;

            conexao.connection.Open();
            conexao.command.ExecuteNonQuery();

            conexao.command.CommandText = @"update tbl_usuario set PONTUACAO = (select sum(pontuacao) from tbl_resultado) WHERE ID_USUARIO = @IDUSUARIO";


            conexao.command.ExecuteNonQuery();
            conexao.connection.Close();
        }
Beispiel #19
0
        //public bool Check() {

        //}

        public bool Cadastrar()
        {
            try {
                this.Pontuacao = 0;

                BDConexao conexao = new BDConexao();

                conexao.command.CommandText = "INSERT INTO tbl_USUARIO values (@NOME, @SOBRENOME, @EMAIL, @SENHA, @NASC, @GENERO, @FOTO, @APELIDO, @CIVIL, @UF, " +
                                              "@CIDADE, @CEP, @BAIRRO, @LOGRADOURO, @NUMERO, @COMPLEMENTO, @DESCRICAO, @PONTUACAO)";

                conexao.command.Parameters.Add("@NOME", SqlDbType.NVarChar).Value        = Nome;
                conexao.command.Parameters.Add("@SOBRENOME", SqlDbType.NVarChar).Value   = Sobrenome;
                conexao.command.Parameters.Add("@EMAIL", SqlDbType.NVarChar).Value       = Email;
                conexao.command.Parameters.Add("@SENHA", SqlDbType.NVarChar).Value       = CoolEventsEncrypter.Encrypt(Senha);
                conexao.command.Parameters.Add("@NASC", SqlDbType.Date).Value            = DataNascimento;
                conexao.command.Parameters.Add("@GENERO", SqlDbType.Char).Value          = Sexo;
                conexao.command.Parameters.Add("@FOTO", SqlDbType.NVarChar).Value        = "";
                conexao.command.Parameters.Add("@APELIDO", SqlDbType.NVarChar).Value     = Apelido;
                conexao.command.Parameters.Add("@CIVIL", SqlDbType.NVarChar).Value       = Civil;
                conexao.command.Parameters.Add("@UF", SqlDbType.NVarChar).Value          = UF;
                conexao.command.Parameters.Add("@CIDADE", SqlDbType.NVarChar).Value      = Cidade;
                conexao.command.Parameters.Add("@CEP", SqlDbType.NVarChar).Value         = CEP;
                conexao.command.Parameters.Add("@BAIRRO", SqlDbType.NVarChar).Value      = Bairro;
                conexao.command.Parameters.Add("@LOGRADOURO", SqlDbType.NVarChar).Value  = Logradouro;
                conexao.command.Parameters.Add("@NUMERO", SqlDbType.VarChar).Value       = Numero;
                conexao.command.Parameters.Add("@COMPLEMENTO", SqlDbType.NVarChar).Value = Complemento;
                conexao.command.Parameters.Add("@DESCRICAO", SqlDbType.NVarChar).Value   = Descricao;
                conexao.command.Parameters.Add("@PONTUACAO", SqlDbType.Int).Value        = Pontuacao;

                conexao.connection.Open();
                conexao.command.ExecuteNonQuery();
                conexao.connection.Close();

                return(true);
            }
            catch (Exception Ex)
            {
                return(false);
            }
        }
Beispiel #20
0
        public string verificaEmail(string email)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.Parameters.Clear();
            conexao.command.CommandText = "SELECT NOME FROM CLIENTE WHERE email = @EMAIL";
            conexao.command.Parameters.Add("@EMAIL", SqlDbType.VarChar).Value = email;

            var nome = conexao.command.ExecuteScalar();

            conexao.connection.Close();

            if (nome == null)
            {
                return("");
            }
            else
            {
                return((string)nome);
            }
        }
Beispiel #21
0
        public bool VerificarCodigo(string key)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.Parameters.Clear();
            conexao.command.CommandText = "SELECT COUNT(*) FROM CLIENTE WHERE CODSENHA = @CODSENHA";
            conexao.command.Parameters.Add("@CODSENHA", SqlDbType.VarChar).Value = key;

            int cont = (int)conexao.command.ExecuteScalar();

            conexao.connection.Close();

            if (cont == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #22
0
        public static bool Verificar(string email)
        {
            BDConexao conexao = new BDConexao();


            conexao.command.CommandText = "SELECT COUNT(*) FROM TBL_USUARIO WHERE EMAIL = @EMAIL";

            conexao.command.Parameters.Add("@EMAIL", SqlDbType.VarChar).Value = email;

            conexao.connection.Open();
            int possui = (int)conexao.command.ExecuteScalar();

            conexao.connection.Close();

            if (possui == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #23
0
        public bool verificaSenha(string senha)
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.Parameters.Clear();
            conexao.command.CommandText = "SELECT COUNT(*) FROM CLIENTE WHERE IDCLIENTE = @IDCLIENTE AND SENHA = @SENHA";
            conexao.command.Parameters.Add("@IDCLIENTE", SqlDbType.Int).Value = (int)HttpContext.Current.Session["idUsuario"];;
            conexao.command.Parameters.Add("@SENHA", SqlDbType.VarChar).Value = CoolEventsEncrypter.Encrypt(senha);

            int ok = (int)conexao.command.ExecuteScalar();

            conexao.connection.Close();

            if (ok == 0)
            {
                return(false);
            }

            else
            {
                return(true);
            }
        }
Beispiel #24
0
        public static List <Enquetes> GetAll()
        {
            List <Enquetes> enquetes = new List <Enquetes>();

            BDConexao conexao = new BDConexao( );

            conexao.command.CommandText = @"
                select ID_ENQUETE, tbl_tipoevento.TIPO, IMAGEM, TITULO, TEXTO, PRAZO FROM tbl_enquete LEFT JOIN tbl_tipoevento ON tbl_enquete.ID_TIPO = tbl_tipoevento.ID_TIPO
                where ID_ENQUETE not in (select id_enquete from tbl_resultado where id_usuario = @IDUSUARIO) AND OCULTO = 0";

            conexao.command.Parameters.Add("@IDUSUARIO", SqlDbType.VarChar).Value = HttpContext.Current.Session["idUsuario"];

            conexao.connection.Open();

            SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Enquetes enquete = new Enquetes();
                    enquete.Id            = dr.GetInt32(0);
                    enquete.TipoEnquete   = dr.GetString(1);
                    enquete.Imagem        = dr.GetString(2);
                    enquete.Titulo        = dr.GetString(3);
                    enquete.Texto         = dr.GetString(4);
                    enquete.PrazoResposta = dr.GetDateTime(5).ToString();

                    enquetes.Add(enquete);
                }
            }

            conexao.connection.Close();

            return(enquetes);
        }