public string autenticar(string cpf, string senha) { cpf = UtilFormatar.retirarFormatacao(cpf); string validar = validarDadosLogin(cpf, senha); if (string.IsNullOrEmpty(validar)) { clnCliente objCliente = new clnCliente { Cpf = cpf, Hash = senha }.autenticarPorCPF(); if (objCliente != null) { HttpContext.Current.Session["clienteAutenticado"] = (clnCliente)objCliente; return("1Autenticado com sucesso!"); } else { return("0Os dados informados são inválidos."); } } else { return("0" + validar); } }
public static Endereco obterEndereco(String cep) { try { Endereco objEndereco = new Endereco { CEP = UtilFormatar.retirarFormatacao(cep) }.obterPorCep(); if (objEndereco != null) { return(objEndereco); } } catch (Exception) { } try { return(Endereco.Transform(ViaCEP.GetEndereco(cep))); } catch (Exception) { return(null); } }
public string cadastrar(string nome, string email, string senha, string cpf, string celular, string cartaoNumero, string cartaoValidade, string cartaoCVV) { if (!autenticado()) { cartaoNumero = UtilFormatar.retirarFormatacao(cartaoNumero); cpf = UtilFormatar.retirarFormatacao(cpf); string validar = validarDados(nome, email, senha, cpf, celular, cartaoNumero, cartaoValidade, cartaoCVV); if (string.IsNullOrEmpty(validar)) { clnCliente objClienteEmail = new clnCliente { Email = email }.obterPorEmail(); if (objClienteEmail != null) { validar += "E-mail já cadastrado."; } clnCliente objClienteCPF = new clnCliente { Cpf = cpf }.obterPorCPF(); if (objClienteCPF != null) { validar += "CPF já cadastrado."; } if (string.IsNullOrEmpty(validar)) { clnCliente objCliente = new clnCliente { Nome = nome, Email = email, Hash = senha, Ativo = true, TelCelular = UtilFormatar.retirarFormatacao(celular), Cpf = cpf, Cadastro = DateTime.Now, CartaoCVV = UtilFormatar.retirarFormatacao(cartaoCVV), CartaoNumero = UtilFormatar.retirarFormatacao(cartaoNumero), CartaoValidade = UtilFormatar.retirarFormatacao(cartaoValidade) }; objCliente.gravar(); HttpContext.Current.Session["clienteAutenticado"] = (clnCliente)objCliente; return("1Cadastrado com sucesso!"); } } return("0" + validar); } else { return("0Você já está autenticado"); } }
public string novaReserva(string cpf, string dataStr, string horaStr, string lugaresStr, string informacoes, string codCliente) { cpf = UtilFormatar.retirarFormatacao(cpf); clnCliente objCliente; if (clienteBLL.autenticado()) { objCliente = clienteBLL.obterCliente(); } else if (codCliente != null && UtilValidar.validarInt(codCliente)) { objCliente = new clnCliente { Cod = UtilConvert.ToInt(codCliente) }.obterPorCod(); } else { return("0Cliente não informado"); } string validar = validarDados(cpf, dataStr, horaStr, lugaresStr, informacoes, objCliente); if (string.IsNullOrEmpty(validar)) { if (string.IsNullOrEmpty(informacoes)) { informacoes = "Sem informações adicionais."; } clnReserva objReserva = new clnReserva { Informacoes = informacoes, Pessoas = UtilConvert.ToInt(lugaresStr), CodCliente = objCliente.Cod, Agendado = UtilConvert.ObterDataHora(dataStr, horaStr), Agendamento = DateTime.Now.Date, Situacao = clnReserva.reservaSituacao.MARCADA }; objReserva.gravar(); atribuirMesas(objReserva); return("1Reserva realizada com sucesso"); } else { return("0" + validar); } }
public bool call(DataGridView dgv, string pesquisa, bool ativo) { clnPagamento objPagamentos = new clnPagamento { Cpf = UtilFormatar.retirarFormatacao(pesquisa) }; foreach (clnPagamento objPagamento in objPagamentos.obterPagamentosPorCpf()) { //"Código", "Data", "Forma", "Valor", "Cpf" clnPagamentoForma objForma = new clnPagamentoForma { Cod = objPagamento.CodForma }.obterPorCod(); dgv.Rows.Add(new object[] { objPagamento.Cod, UtilFormatar.formatarData(objPagamento.Data), objForma.Nome, UtilFormatar.formatarValor(objPagamento.Valor), UtilFormatar.formatarCPF(objPagamento.Cpf) }); } return(false); }
public string alterar(string nome, string senha, string celular, string cartaoNumero, string cartaoValidade, string cartaoCVV) { if (autenticado()) { clnCliente objCliente = obterCliente(); cartaoNumero = UtilFormatar.retirarFormatacao(cartaoNumero); string validar = validarDados(nome, objCliente.Email, ((senha == "") ? null : senha), objCliente.Cpf, celular, cartaoNumero, cartaoValidade, cartaoCVV); if (string.IsNullOrEmpty(validar)) { objCliente = obterCliente(); objCliente.Nome = nome; objCliente.TelCelular = UtilFormatar.retirarFormatacao(celular); objCliente.CartaoNumero = UtilFormatar.retirarFormatacao(cartaoNumero); objCliente.CartaoValidade = UtilFormatar.retirarFormatacao(cartaoValidade); objCliente.CartaoCVV = UtilFormatar.retirarFormatacao(cartaoCVV); if (senha != "") { objCliente.Hash = senha; } objCliente.alterar(); return("1Seus dados foram atualizados com sucesso!"); } else { return("0" + validar); } } else { return("0Você não está autenticado"); } }
public string enviarRecuperacao(string cpf, string email) { string valido = validarCPFEmail(cpf, email); if (string.IsNullOrEmpty(valido)) { clnCliente objCliente = new clnCliente { Email = email }.obterPorEmail(); if (objCliente.Ativo && objCliente.Cpf.Equals(UtilFormatar.retirarFormatacao(cpf))) { enviarToken(objCliente); } return("1Se seus dados são validos, enviamos um link de recuperação para você"); } else { return("0" + valido); } }
public string recuperarSenha(string token, string email, string cpf, string senha) { string valido = validarRecuperacao(token, email, cpf, senha); if (string.IsNullOrEmpty(valido)) { clnCliente objCliente = new clnCliente { Email = email }.obterPorEmail(); if (objCliente != null) { if (objCliente.Cpf.Equals(UtilFormatar.retirarFormatacao(cpf))) { String tokenClienteValido = gerarTokenCliente(objCliente); String tokenCliente = UtilConvert.FromBase64(token).Split('&')[0]; if (tokenCliente.Equals(tokenClienteValido)) { objCliente.Hash = senha; objCliente.alterar(); return("1Senha alterada com sucesso!"); } else { return("0O token informado é inválido."); } } } return("0O cliente informado é inválido"); } else { return("0" + valido); } }