示例#1
0
        public void DetalhaUsuario(string Email, string Senha,
            out string Retorno)
        {
            try
            {

                String Qry;

                SQLServer SQL = new SQLServer();
                SQL.ConectaDB();

                Qry = "select * from tblUsuario where emailUsuario = '" + Email.Trim() + "' and senhaUsuario = '" + Senha.Trim() + "'";

                SqlDataReader Rs = SQL.DR(Qry);

                if (Rs.Read() == false)
                {

                    Retorno = "ERRO: O e-mail ou a senha inseridos estão incorretos.";

                }
                else
                {
                    //desloga caso já exista um logon feito.
                    Deslogar();

                    FormsAuthentication.SignOut();

                    //Guarda o usuário e senha encriptado em um cookie.
                    FormsAuthentication.SetAuthCookie(Email + ";" + Senha, false);
                    Retorno = "OK";
                }

            }

            catch (Exception Ex)
            {
                Retorno =  "ERRO: " + Ex.Message;
            }
        }
示例#2
0
        public void ValidaEmailRecSenha(string EmailID, out string Retorn)
        {
            string query;
            Retorn = "";
            SQLServer db = new SQLServer();
            db.ConectaDB();
            query = "select * from tblUsuario where emailUsuario = '" + EmailID.Trim() + "'";

            SqlDataReader Rs = db.DR(query);

            if (Rs.Read() == false)
            {

                Retorn = "ERRO: O e-mail inserido está incorreto ou não foi cadastrado.";

            }
            else
            {
                Retorn = "ok";

            }

            //throw new NotImplementedException();
        }