Beispiel #1
0
        public string InsereCadastro(string Nome, string SobreNome,
            string Cpf, string Tel, string Cel,
            string Email, string Senha, string ConfirmSenha)
        {
            try
            {

                String Qry = "";

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

                Qry = "Insert into tblUsuario " +
                    "( emailUsuario, senhaUsuario, nomeUsuario, sobrenomeUsuario, telFixo, telCelular, cpf) " +
                    "values ('" + Email + "','"
                    + Senha + "','" + Nome + "','"
                    + SobreNome + "','" + Tel + "','" + Cel + "','" + Cpf + "')";

                SQL.ExecQry(Qry);

                SQL.Cnx.Close();
                return "CADASTRO REALIZADO COM SUCESSO.";

            }

            catch (Exception Ex)
            {
                return "ERRO: " + Ex.Message;
            }
        }
        public string InsereItemEncontrado(ParametrosEncontreiPerdi Parametros)
        {
            try
            {

                //Carrega variável com strings contidas no cookie criado, caso ele exista.
                string Login = HttpContext.Current.User.Identity.Name;

                string[] Usr = Login.Split(';');
                string usuario = Usr[0];
                string senha = Usr[1];

                String Qry;

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

                Qry = "select idUsuario from tblUsuario where emailUsuario = '" + usuario.Trim() + "' and senhaUsuario = '" + senha.Trim() + "'";

                SqlDataReader Rs = SQL.DR(Qry);

                string Id = "";

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

                    Id = Rs["idUsuario"].ToString();

                }

                SQL.Cnx.Close();
                SQL.ConectaDB();

                Qry = "Insert into tblItemEncontrado " +
                    "(idUsuario, codCategoria, codSubCategoria, codPais, "
                    + "dataCadastro, descricao, Latitude, Longitude) " +
                    "values (" + Id + ", " + Parametros.Categoria + ","
                    + Parametros.Subcategoria + ", 1, getdate(), 'null', '" +
                    Parametros.lttde + "','" + Parametros.lgttde + "')";

                SQL.ExecQry(Qry);

                SQL.Cnx.Close();
                return "OK";

            }

            catch (Exception Ex)
            {
                return "ERRO: " + Ex.Message;
            }
        }