Adicionar arquivos de projeto.
This commit is contained in:
parent
e93c2e5c2c
commit
f68431413b
14
Pipefy.csproj
Normal file
14
Pipefy.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Data.OleDb" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
25
Pipefy.sln
Normal file
25
Pipefy.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34221.43
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pipefy", "Pipefy.csproj", "{23715724-86C9-4C02-8A4A-E3A348A1135E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{23715724-86C9-4C02-8A4A-E3A348A1135E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{23715724-86C9-4C02-8A4A-E3A348A1135E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{23715724-86C9-4C02-8A4A-E3A348A1135E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{23715724-86C9-4C02-8A4A-E3A348A1135E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E7708A1F-F545-4539-979D-AC1EBCFFB1F2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
79
Program.cs
Normal file
79
Program.cs
Normal file
@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Data.OleDb;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
// URL da API que você deseja chamar
|
||||
string apiUrl = "https://api.pipefy.com/graphql";
|
||||
|
||||
// Crie uma instância HttpClient
|
||||
using (HttpClient httpClient = new HttpClient())
|
||||
{
|
||||
// Defina os headers da requisição (opcional)
|
||||
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJQaXBlZnkiLCJpYXQiOjE2OTg4NTYyMjcsImp0aSI6IjM2N2Y4M2NhLWZjODYtNGRhOC04ODEyLTkzODRkZGZkODc0MiIsInN1YiI6MzAyNTM0MzY2LCJ1c2VyIjp7ImlkIjozMDI1MzQzNjYsImVtYWlsIjoiYmFjazVAZW5lcmdpYXNtYXJ0LmNvbS5iciIsImFwcGxpY2F0aW9uIjozMDAyODkyNDgsInNjb3BlcyI6W119LCJpbnRlcmZhY2VfdXVpZCI6bnVsbH0.o13j9c_y3G3HX35qhX4PmkkibGsmlHsk5dL_Bxsr1CKV5Jlgj218kJdEmriS7aHiw0-P7sfs-bu4YcElfuyiqg");
|
||||
|
||||
// Crie a consulta GraphQL
|
||||
string query = /*lang=json,strict*/ @"
|
||||
{
|
||||
""query"":""{\r\n table_records(table_id: \""b9t-7uD5\"") {\r\n edges {\r\n node {\r\n id\r\n record_fields{\r\n value\r\n }\r\n }\r\n }\r\n }\r\n}"",""variables"":{}
|
||||
}";
|
||||
|
||||
// Defina o conteúdo do corpo da requisição
|
||||
var content = new StringContent(query, System.Text.Encoding.UTF8, "application/json");
|
||||
|
||||
// Envie a requisição POST com a consulta GraphQL
|
||||
var response = await httpClient.PostAsync(apiUrl, content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
Console.WriteLine("Resposta bem-sucedida:");
|
||||
Console.WriteLine(responseBody);
|
||||
|
||||
// Agora você pode comparar a resposta JSON com a tabela no banco de dados Access
|
||||
CompareResponseWithDatabase(responseBody);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Erro na requisição: {response.StatusCode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
static void CompareResponseWithDatabase(string jsonResponse)
|
||||
{
|
||||
// Defina a string de conexão para o banco de dados Access
|
||||
string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\contratos\Documents\Giuliano\Pipefy.accdb";
|
||||
|
||||
using (OleDbConnection connection = new OleDbConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
// Execute uma consulta SQL para recuperar dados da tabela no banco de dados Access
|
||||
string sqlQuery = "SELECT * FROM tblEmpresas";
|
||||
using (OleDbCommand command = new OleDbCommand(sqlQuery, connection))
|
||||
{
|
||||
using (OleDbDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
// Compare os dados da resposta JSON com os dados da tabela
|
||||
// Você pode usar a biblioteca Newtonsoft.Json para desserializar o JSON
|
||||
// e comparar os valores desejados com os valores do banco de dados
|
||||
// Por exemplo:
|
||||
// string valueFromDatabase = reader["NomeDaColuna"].ToString();
|
||||
// string valueFromJSON = JsonConvert.DeserializeObject<YourType>(jsonResponse).YourProperty;
|
||||
|
||||
// Realize as comparações aqui e tome as ações necessárias
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user