-3
I have a service [file.svc.Cs] but it does not go up, I try to access it with ajax and da not found. Someone knows how to fix it, what could be wrong.?
namespace Bob.Servico
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Usuario" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Usuario.svc or Usuario.svc.cs at the Solution Explorer and start debugging.
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Usuario : IUsuario
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public GetUsuarioDAO GetUsuario(GetUsuarioRequestDAO usuario)
{
log.Info("Iniciando GetUsuario");
var retorno = new GetUsuarioDAO();
using (var db = new BobDataContext())
{
var result = db.sp_usuario_select(null, usuario.email, usuario.cpf, usuario.senha).Select(r => new GetUsuarioDAO()
{
email = r.email,
cpf = r.cpf,
nome = r.nome,
nome_usuario = r.nome_usuario,
sexo = r.sexo,
data_nascimento = Convert.ToString(r.data_nascimento),
id = r.id,
celular = r.celular,
}).FirstOrDefault();
if (result != null)
{
retorno = result;
log.Info("GetUsuario - OK");
retorno.mensagens.Add(new MensagemDAO() { Mensagem = "OK", Tipo = Models.Enum.TipoMensagemEnum.Sucesso });
}
else
{
if (string.IsNullOrEmpty (usuario.facebook_id) ){
log.Info("GetUsuario - nOK - Usuário ou senha inválidos.");
retorno.mensagens.Add(new MensagemDAO() { Mensagem = "Usuário ou senha inválidos!.", Tipo = Models.Enum.TipoMensagemEnum.Erro});
}
else
{
log.Info("GetUsuario - OK - Não encontrou nenhum usuário.");
retorno.mensagens.Add(new MensagemDAO() { Mensagem = "0", Tipo = Models.Enum.TipoMensagemEnum.Aviso });
}
}
}
return retorno;
}
}
}
function inicio() {
$("span.help-block").hide();
alert("2");
$(document).on("click", "#btn_esqueci_senha", function() {
window.location = "esqueci-senha.html";
});
$(document).on("click", "#btn_validar", function() {
$("#aviso").hide();
$("#aviso").find("p").html("");
if (validar()) {
alert("3");
var email = null;
var cpf = null;
if ($("[name=email]").val() == "" || $("[name=email]").length == 0) {
cpf = $("[name=cpf]").val();
} else {
email = $("[name=email]").val();
}
var usuario = {
email: email,
cpf: cpf,
senha: $("#txt_senha").val()
};
//var usuario = getFormData($("#usuario"));
alert(email);
$.ajax({
type: "POST",
url: "../sistema/Bob.Servico/Usuario.svc.cs/GetUsuario",
cache: false,
//crossdomain:true,
contentType: "application/json",
processData: false,
dataType: "json",
data: JSON.stringify(usuario),
success: function(data) {
alert("teste zombie 4 :( ");
console.log(data);
if (data.GetUsuarioResult.mensagens[0].Mensagem == "0") {
window.location = "dados-complementares.html";
} else if (data.GetUsuarioResult.mensagens[0].Mensagem == "OK") {
window.localStorage.setItem("usuario", JSON.stringify(data.GetUsuarioResult));
window.location = "home.html";
} else {
alert(data.GetUsuarioResult.mensagens[0].Mensagem);
}
},
error: function(error) {
alert(error)
}
});
}
});
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>site</title>
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<link rel="stylesheet" href="dist/css/custom.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/square/blue.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body onload="onDeviceReady()">
<div class="container-fluid">
<div class="wrapper">
<!-- Main Header -->
<header class="main-header">
<!-- Logo -->
<a href="home.html" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"></span>
</a>
<!-- Header Navbar -->
</header>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="row">
<div class="div-beta"></div>
<div class="col-xs-8 text-center painel" id="conteudo">
<h1 class="painel-content">
LOGIN
</h1>
</div>
<div class="row dnone" id="aviso">
<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4>
<i class="icon fa fa-warning"></i> Aviso!
</h4>
<p></p>
</div>
</div>
</div>
</section>
<!-- Main content -->
</div>
<!-- /.content-wrapper -->
<!-- Control Sidebar -->
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
</div>
<div class="login-box">
<div class="login-logo">
<a href="/">
<p>
<img src="images/logo.jpeg" width="140" height="100" />
</a>
</p>
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">Iniciar sessão</p>
<form role="form" name="dados" id="usuario" onsubmit="return false">
<div class="form-group has-feedback">
<input type="email" class="form-control" placeholder="Email" id="txt_email_cpf">
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
<span class="help-block help-block-email_cpf">Este campo é obrigatório!</span>
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password" id="txt_senha">
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
<span class="help-block help-block-esqueci-senha">Este campo é obrigatório!</span>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
<label>
<input type="checkbox" id="lembrarme"> Lembrar me
</label>
</div>
</div>
<!-- /.col -->
<div class="col-xs-8 form-group">
<button type="submit" id="btn_validar" class="btn btn-primary btn-block btn-flat">Logar</button>
</div>
<div class="col-xs-8 form-group">
<button type="button" id="btn_esqueci_senha" class="btn bg-purple marginbtn-esqueci-senha">Esqueci a senha</button>
</div>
<div class="col-xs-8 form-group">
<button type="button" class="btn btn-block btn-success btn-cadastro">CADASTRO
</button>
</div>
<!-- /.col -->
</div>
</form>
<!--
<div class="social-auth-links text-center">
<p>- OR -</p>
<a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-facebook"></i> Sign in using
Facebook</a>
<a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-google-plus"></i> Sign in using
Google+</a>
</div>
<!- - /.social-auth-links -->
</div>
<!-- /.login-box-body -->
</div>
<!-- /.login-box -->
<!-- Main Footer -->
<footer class="main-footer">
<!-- To the right -->
<div class="pull-right hidden-xs">
<a href="https://www.site.com.br" target="_blank"><img src="img/logo-min.jpg" height="30"></a>
</div>
<!-- Default to the left -->
<span>Copyright © 2018 <b> site</b>.</span> Todos os direitos reservados.
</footer>
<!--</div>-->
<!-- /.container -->
<!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="plugins/iCheck/icheck.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="js/scripts.js"></script>
<script type="text/javascript" src="scripts/index.js"></script>
<script>
$(function() {
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
});
</script>
</body>
</html>
If you expose your code and show how you are doing the publication and how you are accessing via javascript... we will know how to solve.
– Leandro Angelo
Dude, you’re making a mess here... I recommend you remove this question and make a new one in a more organized way. Take a look here: https://answall.com/tour
– Leandro Angelo
has character limit to answer very bad this, so I put new answer.
– hyperpixel
You have the option to edit the question without posting new replies @hyperpixel
– vinibrsl
all right, which correct way, I want to solve the app!!
– hyperpixel