Ejemplo n.º 1
0
        public void coo(object sender, EventArgs e)
        {
            double a = new ApiCoordenadas().pegarLng(txEndereco.Value);
            double b = new ApiCoordenadas().pegarLat(txEndereco.Value);

            mostrar = b.ToString() + "" + a.ToString();
        }
Ejemplo n.º 2
0
        public void cadastrar(object sender, EventArgs e)
        {
            postCnpj        = cnpj.Text;
            postRazaoSocial = razaoSocial.Text;
            postTel         = tel.Text;
            postCel         = cel.Text;
            postEnd         = endereco.Text;
            postComplemento = complemento.Text;
            postCep         = cep.Text;
            postDesc        = descricao.Value;

            postZonaAtend = zonaAtendimento.Text;

            int    idCidade = Int32.Parse(cidadesDD.Text);
            Cidade cid      = cidadeDAO.selectCidadePorId(idCidade);

            if (numero.Text != "")
            {
                postNum = Int32.Parse(numero.Text);
            }
            else
            {
                postNum = 0;
            }
            if (qtdFunc.Text != "")
            {
                postQtdFunc = Int32.Parse(qtdFunc.Text);
            }
            else
            {
                postQtdFunc = 0;
            }

            string busca = postEnd + ", " + postNum + " " + cid.Nome;
            double lat   = new ApiCoordenadas().pegarLat(busca);
            double lng   = new ApiCoordenadas().pegarLng(busca);

            MySqlDateTime mysqldt = new MySqlDateTime(DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"));
            Empresa       emp     = new Empresa(1, 1, 1, 1, postCnpj, postRazaoSocial, postTel, postCel, postEnd, postNum, postComplemento, postCep,
                                                lat, lng, cid, mysqldt, postDesc, postQtdFunc, 0, 0, 0, 0, 80, 0, postZonaAtend, mysqldt, 1);

            EmpresaCadastroValidator validator = new EmpresaCadastroValidator();
            ValidationResult         result    = validator.Validate(emp);

            if (result.IsValid)
            {
                new EmpresaDAO().insertEmpresa(emp);
                emp = new EmpresaDAO().selectEmpPorCNPJ(postCnpj);
                Session["sIdEmp"] = emp.Id;
                EmpresaSaldo saldo = new EmpresaSaldo(0, emp.Id, 0, 0, 0);
                new EmpresaSaldoDAO().insertEmpSaldo(saldo);
                Response.Redirect("userEmpCadastro.aspx?acao=primCad");
            }
            else
            {
                mensagem = result.ToString(" & ");
            }
        }
Ejemplo n.º 3
0
        public void espiarClick(object sender, EventArgs e)
        {
            string cepForm = cep.Value + " - Curitiba";

            if (cepForm.Length < 2)
            {
                cepForm = "80010020";
            }

            string lt = new ApiCoordenadas().pegarLat(cepForm).ToString();
            string lg = new ApiCoordenadas().pegarLng(cepForm).ToString();

            string latS = lt.Replace(",", ".");
            string lonS = lg.Replace(",", ".");


            Session["latCentro"] = latS;
            Session["lngCentro"] = lonS;

            Response.Redirect("mapao.aspx");
        }
Ejemplo n.º 4
0
        public void autenticar(object sender, EventArgs e)
        {
            string senhaPost = (senha.Value);
            string loginPost = (login.Value);

            //ANTI INJECTION
            int lenS = senhaPost.Length; if (lenS >= 10)
            {
                lenS = 10;
            }
            int lenL = loginPost.Length; if (lenL >= 12)

            {
                lenS = 12;
            }

            senhaPost = senhaPost.Substring(0, lenS);
            loginPost = loginPost.Substring(0, lenL);

            senhaPost = senhaPost.Replace("'", "0");
            loginPost = loginPost.Replace("'", "0");
            senhaPost = senhaPost.Replace('"', '0');
            loginPost = loginPost.Replace('"', '0');
            senhaPost = senhaPost.Replace("/", "0");
            loginPost = loginPost.Replace("/", "0");
            senhaPost = senhaPost.Replace("=", "0");
            loginPost = loginPost.Replace("=", "0");
            loginPost = loginPost.Replace(" OR ", "0");

            Usuario logando = new Usuario();

            logando.Login = loginPost;
            logando.Senha = senhaPost;
            LoginClienteValidator validator = new LoginClienteValidator();
            ValidationResult      result    = validator.Validate(logando);

            if (result.IsValid)
            {
                logando = new UsuarioDAO().selectUserLogin(loginPost);

                if (logando.Block != 1)
                {
                    String senha = logando.Senha;
                    if (senha == null)
                    {
                        senha = "-";
                    }
                    if (senha.Equals(senhaPost))
                    {
                        mensagem                = "Login e senha OK";
                        Session["sId"]          = logando.Id;
                        Session["sNome"]        = logando.Nome;
                        Session["sRep"]         = logando.Reputacao;
                        Session["sQtdServicos"] = logando.QtdServicos;
                        Session["sCliente"]     = 1;
                        Session["sFuncao"]      = Session["sRep"];
                        string endereco = logando.Endereco + " " + logando.Numero + " " + logando.Cidade.Nome;

                        string lt = new ApiCoordenadas().pegarLat(endereco).ToString();
                        string lg = new ApiCoordenadas().pegarLng(endereco).ToString();

                        string latS = lt.Replace(",", ".");
                        string lonS = lg.Replace(",", ".");


                        Session["latCentro"] = latS;
                        Session["lngCentro"] = lonS;

                        new LogDAO().logit("Login Cliente", (int)logando.Id);

                        Response.Redirect("mapao.aspx");
                    }
                    else
                    {
                        mensagem = "Dados Incorretos";
                        ++contaErros;
                        logando = null;
                        if (contaErros >= 5)
                        {
                        }
                    }
                }
                else
                {
                    mensagem = "Usuario Bloqueado";
                }
            }
            else
            {
                mensagem = result.ToString(" & ");
            }
        }