Compare commits

..

No commits in common. "0fb1a59d44b7dbc62f8f5f763f73df18614626af" and "8efd900bb533204b1bb429342f8e16bcc921c4ee" have entirely different histories.

24 changed files with 198 additions and 187 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework> <TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RootNamespace>Download_Faturas.Tests</RootNamespace> <RootNamespace>Download_Faturas.Tests</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@ -10,12 +10,12 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" /> <PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.3" /> <PackageReference Include="xunit" Version="2.9.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Faturas\Faturas.csproj" /> <ProjectReference Include="..\Download Faturas\Download Faturas.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,5 @@
using System.Data.OleDb; using System.Data.OleDb;
using Faturas; using System.Numerics;
using System.Text.Json; using System.Text.Json;
using Download_Faturas; using Download_Faturas;

View File

@ -5,6 +5,6 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Tests.FaturaIntegrationTests.DeleteTusdRecords(System.Data.OleDb.OleDbConnection,System.Double)")] [assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.Tests.FaturaIntegrationTests.DeleteTusdRecords(System.Data.OleDb.OleDbConnection,System.Double)")]
[assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Tests.FaturaIntegrationTests.GetDadosTusd(System.Data.OleDb.OleDbConnection,System.Double)~Faturas.RecordSet")] [assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.Tests.FaturaIntegrationTests.GetDadosTusd(System.Data.OleDb.OleDbConnection,System.Double)~Download_Faturas.RecordSet")]
[assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Tests.FaturaIntegrationTests.WriteCsv(System.String,System.Collections.Generic.List{System.String})")] [assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.Tests.FaturaIntegrationTests.WriteCsv(System.String,System.Collections.Generic.List{System.String})")]

View File

@ -1,9 +1,18 @@
// <copyright file="CustomPdfSplitter.cs" company="Smart Energia"> // <copyright file="CustomPdfSplitter.cs" company="Smart Energia">
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
using System.Data.OleDb;
using System.Globalization;
using System.Net.Http.Headers;
using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using iText.Kernel.Pdf; using iText.Kernel.Pdf;
using iText.Kernel.Utils; using iText.Kernel.Utils;

View File

@ -1,7 +1,7 @@
// <copyright file="DefaultDateTimeConverter.cs" company="Smart Energia"> // <copyright file="DefaultDateTimeConverter.cs" company="Smart Energia">
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
using System; using System;
using System.Text.Json; using System.Text.Json;

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework> <TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RootNamespace>Download_Faturas</RootNamespace> <RootNamespace>Download_Faturas</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@ -27,22 +27,21 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="itext7" Version="9.0.0" />
<PackageReference Include="itext7.bouncy-castle-adapter" Version="9.0.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118"> <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.Data.OleDb" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
<PackageReference Include="XUnit" Version="2.9.3" /> <PackageReference Include="XUnit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5"> <PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Faturas\Faturas.csproj" />
<ProjectReference Include="..\Faturas\Faturas.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>

View File

@ -2,14 +2,19 @@
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
using System.Data.OleDb; using System.Data.OleDb;
using System.Globalization;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Reflection; using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.Intrinsics.X86;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
/// <summary> /// <summary>
/// Representa uma fatura eletrônica e fornece métodos para processá-la e movê-la. /// Representa uma fatura eletrônica e fornece métodos para processá-la e movê-la.
@ -41,20 +46,20 @@ namespace Faturas
HttpResponseMessage fatura_response = GetStatus(httpClient, Token, id); HttpResponseMessage fatura_response = GetStatus(httpClient, Token, id);
if (fatura_response.IsSuccessStatusCode) if (fatura_response.IsSuccessStatusCode)
{ {
faturaParsed = JsonDocument.Parse(fatura_response.Content.ReadAsStringAsync().Result).RootElement; this.faturaParsed = JsonDocument.Parse(fatura_response.Content.ReadAsStringAsync().Result).RootElement;
Agrupada = faturaParsed.TryGetProperty("multiple", out var _); this.Agrupada = this.faturaParsed.TryGetProperty("multiple", out var _);
Status = faturaParsed.GetProperty("status").GetString(); this.Status = this.faturaParsed.GetProperty("status").GetString();
Arquivo = new FileInfo(fatura_path); this.Arquivo = new FileInfo(fatura_path);
this.id = id; this.id = id;
if (faturaParsed.GetProperty("external").GetString() is not null) if (this.faturaParsed.GetProperty("external").GetString() is not null)
{ {
pagina = JsonDocument.Parse(faturaParsed.GetProperty("external").GetString() !).RootElement.GetProperty("origin")[0].GetProperty("page").GetInt32(); this.pagina = JsonDocument.Parse(this.faturaParsed.GetProperty("external").GetString() !).RootElement.GetProperty("origin")[0].GetProperty("page").GetInt32();
} }
if (Agrupada) if (this.Agrupada)
{ {
Agrupada_children = faturaParsed.GetProperty("children").EnumerateArray(); this.Agrupada_children = this.faturaParsed.GetProperty("children").EnumerateArray();
} }
} }
} }
@ -69,8 +74,8 @@ namespace Faturas
{ {
// Utilizado para gerar novo token // Utilizado para gerar novo token
// this.token = Req_token(HttpClient).ToString(); // this.token = Req_token(HttpClient).ToString();
faturaParsed = fatura_Parsed; this.faturaParsed = fatura_Parsed;
Agrupada = false; this.Agrupada = false;
this.id = id; this.id = id;
} }
@ -131,18 +136,18 @@ namespace Faturas
public void Processar(OleDbConnection conn) public void Processar(OleDbConnection conn)
{ {
// Resultado da fatura processada // Resultado da fatura processada
if (!faturaParsed.TryGetProperty("result", out JsonElement a)) if (!this.faturaParsed.TryGetProperty("result", out JsonElement a))
{ {
faturaParsed.TryGetProperty("json", out a); this.faturaParsed.TryGetProperty("json", out a);
} }
Rootobject parsedResult = a.Deserialize<Rootobject>() !; Rootobject parsedResult = JsonSerializer.Deserialize<Rootobject>(a) !;
if (parsedResult == null || parsedResult.dates == null || parsedResult.dates.reading == null || parsedResult.locationNumber == null || parsedResult.customer == null || parsedResult.items == null || parsedResult.dates.reading.periodUntil == DateTime.MinValue) if (parsedResult == null || parsedResult.dates == null || parsedResult.dates.reading == null || parsedResult.locationNumber == null || parsedResult.customer == null || parsedResult.items == null || parsedResult.dates.reading.periodUntil == DateTime.MinValue)
{ {
return; return;
} }
dadosTusd.Mes = int.Parse(parsedResult.dates.reading.periodUntil.AddDays(-15).ToString("yMM")); this.dadosTusd.Mes = int.Parse(parsedResult.dates.reading.periodUntil.AddDays(-15).ToString("yMM"));
string uc = new Regex("^0+").Replace(parsedResult.locationNumber, string.Empty).Replace("/", string.Empty).Replace("-", string.Empty).Replace(".", string.Empty); string uc = new Regex("^0+").Replace(parsedResult.locationNumber, string.Empty).Replace("/", string.Empty).Replace("-", string.Empty).Replace(".", string.Empty);
@ -183,29 +188,29 @@ namespace Faturas
while (reader.Read()) while (reader.Read())
{ {
// Dados cadastrais // Dados cadastrais
dadosTusd.Cod_Smart_unidade = long.Parse(reader["Cod_Smart_unidade"].ToString() !); this.dadosTusd.Cod_Smart_unidade = long.Parse(reader["Cod_Smart_unidade"].ToString() !);
dadosTusd.Perfil_CliqCCEE = reader["PerfilCCEE"].ToString(); this.dadosTusd.Perfil_CliqCCEE = reader["PerfilCCEE"].ToString();
dadosTusd.Submercado = reader["Submercado"].ToString(); this.dadosTusd.Submercado = reader["Submercado"].ToString();
DateTime dataMigração = DateTime.Parse(reader["Data_de_Migracao"].ToString() !); DateTime dataMigração = DateTime.Parse(reader["Data_de_Migracao"].ToString() !);
if (int.Parse(dataMigração.ToString("yMM")) <= dadosTusd.Mes) if (int.Parse(dataMigração.ToString("yMM")) <= this.dadosTusd.Mes)
{ {
dadosTusd.Ambiente = reader["Status_unidade"].ToString(); this.dadosTusd.Ambiente = reader["Status_unidade"].ToString();
} }
else else
{ {
dadosTusd.Ambiente = "Cativo"; this.dadosTusd.Ambiente = "Cativo";
} }
dadosTusd.Grupo = reader["Grupo"].ToString(); this.dadosTusd.Grupo = reader["Grupo"].ToString();
dadosTusd.Distribuidora = reader["Distribuidora"].ToString(); this.dadosTusd.Distribuidora = reader["Distribuidora"].ToString();
dadosTusd.ICMS = float.Parse(reader["ICMS_TUSD"].ToString() !); this.dadosTusd.ICMS = float.Parse(reader["ICMS_TUSD"].ToString() !);
dadosTusd.Dem_Cont_P = float.Parse(reader["Demanda_P"].ToString() !); this.dadosTusd.Dem_Cont_P = float.Parse(reader["Demanda_P"].ToString() !);
dadosTusd.Dem_Cont_FP = float.Parse(reader["Demanda_FP"].ToString() !); this.dadosTusd.Dem_Cont_FP = float.Parse(reader["Demanda_FP"].ToString() !);
dadosTusd.Perfil = reader["Perfil"].ToString(); this.dadosTusd.Perfil = reader["Perfil"].ToString();
PastaTUSD = new DirectoryInfo(reader["Caminho_NFs"].ToString() !.Replace("\\NFe", string.Empty, StringComparison.OrdinalIgnoreCase) + "\\TUSD"); this.PastaTUSD = new DirectoryInfo(reader["Caminho_NFs"].ToString() !.Replace("\\NFe", string.Empty, StringComparison.OrdinalIgnoreCase) + "\\TUSD");
Gestao = reader["Gestao"].ToString(); this.Gestao = reader["Gestao"].ToString();
Empresa = reader["Cliente"].ToString(); this.Empresa = reader["Cliente"].ToString();
Unidade = reader["Unidade"].ToString(); this.Unidade = reader["Unidade"].ToString();
} }
} }
} }
@ -216,8 +221,8 @@ namespace Faturas
sqlQuery = $"SELECT Cod_TUSD FROM Dados_TUSD WHERE Cod_TUSD = ?"; sqlQuery = $"SELECT Cod_TUSD FROM Dados_TUSD WHERE Cod_TUSD = ?";
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
CodTusd = double.Parse(dadosTusd.Cod_Smart_unidade.ToString() + dadosTusd.Mes.ToString()); this.CodTusd = double.Parse(this.dadosTusd.Cod_Smart_unidade.ToString() + this.dadosTusd.Mes.ToString());
cmd.Parameters.AddWithValue("?", CodTusd); cmd.Parameters.AddWithValue("?", this.CodTusd);
using (OleDbDataReader reader = cmd.ExecuteReader()) using (OleDbDataReader reader = cmd.ExecuteReader())
{ {
@ -225,18 +230,18 @@ namespace Faturas
} }
} }
if (dadosTusd.Cod_Smart_unidade == 0) if (this.dadosTusd.Cod_Smart_unidade == 0)
{ {
Status = "UNIDADE CONSUMIDORA NÃO LOCALIZADA NO BD"; this.Status = "UNIDADE CONSUMIDORA NÃO LOCALIZADA NO BD";
this.uc = uc; this.uc = uc;
Mes = dadosTusd.Mes; this.Mes = this.dadosTusd.Mes;
return; return;
} }
else if (tusdLanc) else if (tusdLanc)
{ {
Status = "FATURA DUPLICADA NO BD"; this.Status = "FATURA DUPLICADA NO BD";
this.uc = uc; this.uc = uc;
Mes = dadosTusd.Mes; this.Mes = this.dadosTusd.Mes;
return; return;
} }
@ -245,62 +250,62 @@ namespace Faturas
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
cmd.Parameters.AddWithValue("?", dadosTusd.Mes.ToString()); cmd.Parameters.AddWithValue("?", this.dadosTusd.Mes.ToString());
cmd.Parameters.AddWithValue("?", dadosTusd.Distribuidora); cmd.Parameters.AddWithValue("?", this.dadosTusd.Distribuidora);
using (OleDbDataReader reader = cmd.ExecuteReader()) using (OleDbDataReader reader = cmd.ExecuteReader())
{ {
while (reader.Read()) while (reader.Read())
{ {
// PIS e Cofins // PIS e Cofins
dadosTusd.PIS = float.Parse(reader["PIS"].ToString() !); this.dadosTusd.PIS = float.Parse(reader["PIS"].ToString() !);
dadosTusd.COFINS = float.Parse(reader["COFINS"].ToString() !); this.dadosTusd.COFINS = float.Parse(reader["COFINS"].ToString() !);
} }
} }
} }
// Dados da fatura processada // Dados da fatura processada
dadosTusd.Cod_TUSD = long.Parse(dadosTusd.Cod_Smart_unidade.ToString() + dadosTusd.Mes.ToString()); this.dadosTusd.Cod_TUSD = long.Parse(this.dadosTusd.Cod_Smart_unidade.ToString() + this.dadosTusd.Mes.ToString());
switch (parsedResult.tariffModality, parsedResult.subgroup) switch (parsedResult.tariffModality, parsedResult.subgroup)
{ {
case ("blue", _): case ("blue", _):
dadosTusd.Perfil = "AZUL"; this.dadosTusd.Perfil = "AZUL";
break; break;
case ("green", _): case ("green", _):
dadosTusd.Perfil = "VERDE"; this.dadosTusd.Perfil = "VERDE";
break; break;
case ("standart", _): case ("standart", _):
dadosTusd.Perfil = "CONVENCIONAL"; this.dadosTusd.Perfil = "CONVENCIONAL";
break; break;
case (_, "B3"): case (_, "B3"):
dadosTusd.Perfil = "CONVENCIONAL"; this.dadosTusd.Perfil = "CONVENCIONAL";
break; break;
default: default:
break; break;
} }
dadosTusd.Valor = parsedResult.totalCharges; this.dadosTusd.Valor = parsedResult.totalCharges;
dadosTusd.Inicio_Leitura = parsedResult.dates.reading.periodFrom; this.dadosTusd.Inicio_Leitura = parsedResult.dates.reading.periodFrom;
dadosTusd.Fim_leitura = parsedResult.dates.reading.periodUntil; this.dadosTusd.Fim_leitura = parsedResult.dates.reading.periodUntil;
DateTime d = DateTime.Now; DateTime d = DateTime.Now;
dadosTusd.Hora_TUSD = new DateTime(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second); this.dadosTusd.Hora_TUSD = new DateTime(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second);
dadosTusd.Dem_Reativa_kvar = 0; this.dadosTusd.Dem_Reativa_kvar = 0;
dadosTusd.Multa = 0; this.dadosTusd.Multa = 0;
dadosTusd.Credito = 0; this.dadosTusd.Credito = 0;
dadosTusd.Bandeira_RS_MWh = 0; this.dadosTusd.Bandeira_RS_MWh = 0;
dadosTusd.FIC_DIC = 0; this.dadosTusd.FIC_DIC = 0;
dadosTusd.Enc_conexao = 0; this.dadosTusd.Enc_conexao = 0;
dadosTusd.Liminar_ICMS = 0; this.dadosTusd.Liminar_ICMS = 0;
dadosTusd.Outros = 0; this.dadosTusd.Outros = 0;
dadosTusd.Cred_livre = 0; this.dadosTusd.Cred_livre = 0;
dadosTusd.Tempo_TUSD = 0; this.dadosTusd.Tempo_TUSD = 0;
dadosTusd.Lanc_aut = true; this.dadosTusd.Lanc_aut = true;
dadosTusd.Rev_atual = true; this.dadosTusd.Rev_atual = true;
dadosTusd.Revisao = 0; this.dadosTusd.Revisao = 0;
// Loop entre os dados faturados na fatura // Loop entre os dados faturados na fatura
int j = 0; int j = 0;
@ -324,9 +329,9 @@ namespace Faturas
if (item.kind == kind_P || item.kind == "TUSD") if (item.kind == kind_P || item.kind == "TUSD")
{ {
if (item.billed / 1000 != dadosTusd.Consumo_P) if ((item.billed / 1000) != this.dadosTusd.Consumo_P)
{ {
dadosTusd.Consumo_P += item.billed / 1000; this.dadosTusd.Consumo_P += item.billed / 1000;
} }
} }
@ -343,9 +348,9 @@ namespace Faturas
if (item.kind == kind_FP) if (item.kind == kind_FP)
{ {
if (item.billed / 1000 != dadosTusd.Consumo_FP) if ((item.billed / 1000) != this.dadosTusd.Consumo_FP)
{ {
dadosTusd.Consumo_FP += item.billed / 1000; this.dadosTusd.Consumo_FP += item.billed / 1000;
} }
} }
} }
@ -363,16 +368,16 @@ namespace Faturas
{ {
if (item.period == "peak") if (item.period == "peak")
{ {
dadosTusd.Dem_Reg_P = item.billed; this.dadosTusd.Dem_Reg_P = item.billed;
dadosTusd.Dem_Cont_P = item.contract; this.dadosTusd.Dem_Cont_P = item.contract;
} }
else if (item.period == "off-peak") else if (item.period == "off-peak")
{ {
dadosTusd.Dem_Reg_FP = item.billed; this.dadosTusd.Dem_Reg_FP = item.billed;
dadosTusd.Dem_Cont_FP = item.contract; this.dadosTusd.Dem_Cont_FP = item.contract;
} }
if (dadosTusd.Perfil == "AZUL") if (this.dadosTusd.Perfil == "AZUL")
{ {
if (item.period == "peak") if (item.period == "peak")
{ {
@ -380,7 +385,7 @@ namespace Faturas
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
cmd.Parameters.AddWithValue("@demanda", item.contract); cmd.Parameters.AddWithValue("@demanda", item.contract);
cmd.Parameters.AddWithValue("@cod_smart_unidade", dadosTusd.Cod_Smart_unidade); cmd.Parameters.AddWithValue("@cod_smart_unidade", this.dadosTusd.Cod_Smart_unidade);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -390,18 +395,18 @@ namespace Faturas
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
cmd.Parameters.AddWithValue("@demanda", item.contract); cmd.Parameters.AddWithValue("@demanda", item.contract);
cmd.Parameters.AddWithValue("@cod_smart_unidade", dadosTusd.Cod_Smart_unidade); cmd.Parameters.AddWithValue("@cod_smart_unidade", this.dadosTusd.Cod_Smart_unidade);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
} }
else if (dadosTusd.Perfil == "VERDE") else if (this.dadosTusd.Perfil == "VERDE")
{ {
sqlQuery = $"UPDATE Dados_cadastrais SET Demanda_P = @demanda, Demanda_FP = @demanda WHERE Cod_Smart_unidade = @cod_smart_unidade"; sqlQuery = $"UPDATE Dados_cadastrais SET Demanda_P = @demanda, Demanda_FP = @demanda WHERE Cod_Smart_unidade = @cod_smart_unidade";
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
cmd.Parameters.AddWithValue("@demanda", item.contract); cmd.Parameters.AddWithValue("@demanda", item.contract);
cmd.Parameters.AddWithValue("@cod_smart_unidade", dadosTusd.Cod_Smart_unidade); cmd.Parameters.AddWithValue("@cod_smart_unidade", this.dadosTusd.Cod_Smart_unidade);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -411,22 +416,22 @@ namespace Faturas
// Ilum. publica // Ilum. publica
case ("publicLighting", _): case ("publicLighting", _):
dadosTusd.Ilum_Publica = item.charge; this.dadosTusd.Ilum_Publica = item.charge;
break; break;
// Energia Reativa // Energia Reativa
case ("excessReactiveEnergy", _): case ("excessReactiveEnergy", _):
dadosTusd.En_Reativa_Mvarh += item.billed / 1000; this.dadosTusd.En_Reativa_Mvarh += item.billed / 1000;
break; break;
// Demanda Reativa // Demanda Reativa
case ("excessReactiveDemand", _): case ("excessReactiveDemand", _):
dadosTusd.Dem_Reativa_kvar += item.billed; this.dadosTusd.Dem_Reativa_kvar += item.billed;
break; break;
// Bandeira Tarifaria // Bandeira Tarifaria
case ("flagSurcharge", _): case ("flagSurcharge", _):
dadosTusd.Bandeira_RS_MWh = item.charge; this.dadosTusd.Bandeira_RS_MWh = item.charge;
break; break;
// Items não classificados // Items não classificados
@ -439,7 +444,7 @@ namespace Faturas
sqlQuery = $"DELETE FROM Dados_TUSD_aux WHERE Cod_TUSD = @cod_tusd"; sqlQuery = $"DELETE FROM Dados_TUSD_aux WHERE Cod_TUSD = @cod_tusd";
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
cmd.Parameters.AddWithValue("@cod_tusd", dadosTusd.Cod_TUSD); cmd.Parameters.AddWithValue("@cod_tusd", this.dadosTusd.Cod_TUSD);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -481,22 +486,22 @@ namespace Faturas
} }
} }
if (dem_Reg_P != null && Math.Round((decimal)dadosTusd.Consumo_FP, 2) == Math.Round((decimal)(consumo_Reg_FP * 1.025 / 1000) !, 2)) if (dem_Reg_P != null && (Math.Round((decimal)this.dadosTusd.Consumo_FP, 2) == Math.Round((decimal)(consumo_Reg_FP * 1.025 / 1000) !, 2)))
{ {
dadosTusd.Dem_Reg_P = (float)(dem_Reg_P * 1.025); this.dadosTusd.Dem_Reg_P = (float)(dem_Reg_P * 1.025);
} }
else if (dem_Reg_P != null) else if (dem_Reg_P != null)
{ {
dadosTusd.Dem_Reg_P = (float)dem_Reg_P; this.dadosTusd.Dem_Reg_P = (float)dem_Reg_P;
} }
if (dem_Reg_FP != null && Math.Round((decimal)dadosTusd.Consumo_FP, 2) == Math.Round((decimal)(consumo_Reg_FP * 1.025 / 1000) !, 2)) if (dem_Reg_FP != null && (Math.Round((decimal)this.dadosTusd.Consumo_FP, 2) == Math.Round((decimal)(consumo_Reg_FP * 1.025 / 1000) !, 2)))
{ {
dadosTusd.Dem_Reg_FP = (float)(dem_Reg_FP * 1.025); this.dadosTusd.Dem_Reg_FP = (float)(dem_Reg_FP * 1.025);
} }
else if (dem_Reg_FP != null) else if (dem_Reg_FP != null)
{ {
dadosTusd.Dem_Reg_FP = dem_Reg_FP ?? 0; this.dadosTusd.Dem_Reg_FP = dem_Reg_FP ?? 0;
} }
// var dados = this.dadosTusd.GetType().GetProperties(); // var dados = this.dadosTusd.GetType().GetProperties();
@ -527,12 +532,12 @@ namespace Faturas
foreach (PropertyInfo propriedade in propriedades) foreach (PropertyInfo propriedade in propriedades)
{ {
string nomeColuna = propriedade.Name; string nomeColuna = propriedade.Name;
object valorColuna = propriedade.GetValue(dadosTusd) ?? string.Empty; object valorColuna = propriedade.GetValue(this.dadosTusd) ?? string.Empty;
cmd.Parameters.AddWithValue($"@{nomeColuna}", valorColuna); cmd.Parameters.AddWithValue($"@{nomeColuna}", valorColuna);
} }
// Valor do código TUSD na cláusula WHERE // Valor do código TUSD na cláusula WHERE
cmd.Parameters.AddWithValue("@cod_tusd", dadosTusd.Cod_TUSD); cmd.Parameters.AddWithValue("@cod_tusd", this.dadosTusd.Cod_TUSD);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
@ -544,7 +549,7 @@ namespace Faturas
sqlQuery = "INSERT INTO Dados_TUSD_aux (Cod_TUSD,Id,Nome,Valor,Cod_lanc) VALUES (@cod_tusd, @j, @name, @valor,0)"; sqlQuery = "INSERT INTO Dados_TUSD_aux (Cod_TUSD,Id,Nome,Valor,Cod_lanc) VALUES (@cod_tusd, @j, @name, @valor,0)";
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
cmd.Parameters.AddWithValue("@cod_tusd", dadosTusd.Cod_TUSD); cmd.Parameters.AddWithValue("@cod_tusd", this.dadosTusd.Cod_TUSD);
cmd.Parameters.AddWithValue("@j", j); cmd.Parameters.AddWithValue("@j", j);
cmd.Parameters.AddWithValue("@name", name); cmd.Parameters.AddWithValue("@name", name);
cmd.Parameters.AddWithValue("@valor", valor); cmd.Parameters.AddWithValue("@valor", valor);
@ -585,7 +590,7 @@ namespace Faturas
foreach (PropertyInfo propriedade in propriedades) foreach (PropertyInfo propriedade in propriedades)
{ {
string nomeColuna = propriedade.Name; string nomeColuna = propriedade.Name;
object valorColuna = propriedade.GetValue(dadosTusd) ?? string.Empty; object valorColuna = propriedade.GetValue(this.dadosTusd) ?? string.Empty;
cmd.Parameters.AddWithValue($"@{nomeColuna}", valorColuna); cmd.Parameters.AddWithValue($"@{nomeColuna}", valorColuna);
} }
@ -600,7 +605,7 @@ namespace Faturas
sqlQuery = "INSERT INTO Dados_TUSD_aux (Cod_TUSD,Id,Nome,Valor,Cod_lanc) VALUES (@cod_tusd, @j, @name, @valor, 0)"; sqlQuery = "INSERT INTO Dados_TUSD_aux (Cod_TUSD,Id,Nome,Valor,Cod_lanc) VALUES (@cod_tusd, @j, @name, @valor, 0)";
using (OleDbCommand cmd = new (sqlQuery, conn)) using (OleDbCommand cmd = new (sqlQuery, conn))
{ {
cmd.Parameters.AddWithValue("@cod_tusd", dadosTusd.Cod_TUSD); cmd.Parameters.AddWithValue("@cod_tusd", this.dadosTusd.Cod_TUSD);
cmd.Parameters.AddWithValue("@j", j); cmd.Parameters.AddWithValue("@j", j);
cmd.Parameters.AddWithValue("@name", name); cmd.Parameters.AddWithValue("@name", name);
cmd.Parameters.AddWithValue("@valor", valor); cmd.Parameters.AddWithValue("@valor", valor);
@ -609,9 +614,9 @@ namespace Faturas
} }
} }
Status = "FATURA INCLUIDA NO BD"; this.Status = "FATURA INCLUIDA NO BD";
this.uc = uc; this.uc = uc;
Mes = dadosTusd.Mes; this.Mes = this.dadosTusd.Mes;
} }
/// <summary> /// <summary>
@ -622,22 +627,22 @@ namespace Faturas
{ {
string destino; string destino;
switch (Status, separar) switch (this.Status, separar)
{ {
case ("UNIDADE CONSUMIDORA NÃO LOCALIZADA NO BD", _): case ("UNIDADE CONSUMIDORA NÃO LOCALIZADA NO BD", _):
destino = Arquivo?.Directory?.Parent?.FullName + $@"\5 - {Status}\ID {id!} - Mês {Mes} - UC {uc}.pdf"; destino = this.Arquivo?.Directory?.Parent?.FullName + $@"\5 - {this.Status}\ID {this.id!} - Mês {this.Mes} - UC {this.uc}.pdf";
if (separar) if (separar)
{ {
_ = new PDFSplitter(pagina, Arquivo!.ToString(), destino); _ = new PDFSplitter(this.pagina, this.Arquivo!.ToString(), destino);
Arquivo = new FileInfo(destino); this.Arquivo = new FileInfo(destino);
} }
else else
{ {
try try
{ {
Arquivo!.MoveTo(destino); this.Arquivo!.MoveTo(destino);
} }
catch catch
{ {
@ -648,18 +653,18 @@ namespace Faturas
case ("FATURA DUPLICADA NO BD", _): case ("FATURA DUPLICADA NO BD", _):
destino = Arquivo?.Directory?.Parent?.FullName + $@"\4 - {Status}\ID {id!} - Mês {Mes} - Empresa {Empresa} - Unidade {Unidade}.pdf"; destino = this.Arquivo?.Directory?.Parent?.FullName + $@"\4 - {this.Status}\ID {this.id!} - Mês {this.Mes} - Empresa {this.Empresa} - Unidade {this.Unidade}.pdf";
if (separar) if (separar)
{ {
_ = new PDFSplitter(pagina, Arquivo!.ToString(), destino); _ = new PDFSplitter(this.pagina, this.Arquivo!.ToString(), destino);
Arquivo = new FileInfo(destino); this.Arquivo = new FileInfo(destino);
} }
else else
{ {
try try
{ {
Arquivo!.MoveTo(destino); this.Arquivo!.MoveTo(destino);
} }
catch catch
{ {
@ -670,25 +675,25 @@ namespace Faturas
case ("FATURA INCLUIDA NO BD", _): case ("FATURA INCLUIDA NO BD", _):
if (PastaTUSD!.Exists) if (this.PastaTUSD!.Exists)
{ {
destino = PastaTUSD!.FullName + $@"\ID {id!} - Mês {Mes} - Empresa {Empresa} - Unidade {Unidade}.pdf"; destino = this.PastaTUSD!.FullName + $@"\ID {this.id!} - Mês {this.Mes} - Empresa {this.Empresa} - Unidade {this.Unidade}.pdf";
} }
else else
{ {
destino = Arquivo?.Directory?.Parent?.FullName + $@"\6 - {Status}\ID {id!} - Mês {Mes} - Empresa {Empresa} - Unidade {Unidade}.pdf"; destino = this.Arquivo?.Directory?.Parent?.FullName + $@"\6 - {this.Status}\ID {this.id!} - Mês {this.Mes} - Empresa {this.Empresa} - Unidade {this.Unidade}.pdf";
} }
if (separar) if (separar)
{ {
_ = new PDFSplitter(pagina, Arquivo!.ToString(), destino); _ = new PDFSplitter(this.pagina, this.Arquivo!.ToString(), destino);
Arquivo = new FileInfo(destino); this.Arquivo = new FileInfo(destino);
} }
else else
{ {
try try
{ {
Arquivo!.MoveTo(destino); this.Arquivo!.MoveTo(destino);
} }
catch catch
{ {
@ -699,18 +704,18 @@ namespace Faturas
case ("INVALID", _): case ("INVALID", _):
destino = Arquivo?.Directory?.Parent?.FullName + $@"\7 - ERRO\ID {id!} - {Arquivo?.Name}"; destino = this.Arquivo?.Directory?.Parent?.FullName + $@"\7 - ERRO\ID {this.id!} - {this.Arquivo?.Name}";
if (separar) if (separar)
{ {
_ = new PDFSplitter(pagina, Arquivo!.ToString(), destino); _ = new PDFSplitter(this.pagina, this.Arquivo!.ToString(), destino);
Arquivo = new FileInfo(destino); this.Arquivo = new FileInfo(destino);
} }
else else
{ {
try try
{ {
Arquivo!.MoveTo(destino); this.Arquivo!.MoveTo(destino);
} }
catch catch
{ {
@ -722,10 +727,10 @@ namespace Faturas
case (_, true): case (_, true):
destino = Arquivo?.Directory?.Parent?.FullName + $@"\3 - PROCESSANDO\ID {id!} - {Arquivo?.Name}"; destino = this.Arquivo?.Directory?.Parent?.FullName + $@"\3 - PROCESSANDO\ID {this.id!} - {this.Arquivo?.Name}";
_ = new PDFSplitter(pagina, Arquivo!.ToString(), destino); _ = new PDFSplitter(this.pagina, this.Arquivo!.ToString(), destino);
Arquivo = new FileInfo(destino); this.Arquivo = new FileInfo(destino);
break; break;
} }
} }

View File

@ -2,14 +2,19 @@
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
using System.Data.OleDb; using System.Data.OleDb;
using System.Globalization;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Reflection; using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.Intrinsics.X86;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
/// <summary> /// <summary>
/// Class representing the old invoice processing logic. /// Class representing the old invoice processing logic.

View File

@ -2,7 +2,7 @@
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
using System; using System;
using System.Text.Json; using System.Text.Json;

View File

@ -4,13 +4,13 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")] [assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1011:Closing square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.FloatArrayOrSingleConverter.Read(System.Text.Json.Utf8JsonReader@,System.Type,System.Text.Json.JsonSerializerOptions)~System.Single[]")] [assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1011:Closing square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.FloatArrayOrSingleConverter.Read(System.Text.Json.Utf8JsonReader@,System.Type,System.Text.Json.JsonSerializerOptions)~System.Single[]")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:Closing parenthesis should be spaced correctly", Justification = "<Pendente>", Scope = "type", Target = "~T:Faturas.CustomPdfSplitter")] [assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:Closing parenthesis should be spaced correctly", Justification = "<Pendente>", Scope = "type", Target = "~T:Download_Faturas.CustomPdfSplitter")]
[assembly: SuppressMessage("Performance", "SYSLIB1045:Converter em 'GeneratedRegexAttribute'.", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")] [assembly: SuppressMessage("Performance", "SYSLIB1045:Converter em 'GeneratedRegexAttribute'.", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")]
[assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")] [assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")]
[assembly: SuppressMessage("Performance", "SYSLIB1045:Converter em 'GeneratedRegexAttribute'.", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.FaturaOld.Processar(System.Data.OleDb.OleDbConnection)")] [assembly: SuppressMessage("Performance", "SYSLIB1045:Converter em 'GeneratedRegexAttribute'.", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.FaturaOld.Processar(System.Data.OleDb.OleDbConnection)")]
[assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.FaturaOld.Processar(System.Data.OleDb.OleDbConnection)")] [assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.FaturaOld.Processar(System.Data.OleDb.OleDbConnection)")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.FaturaOld.Processar(System.Data.OleDb.OleDbConnection)")] [assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.FaturaOld.Processar(System.Data.OleDb.OleDbConnection)")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.FloatArrayOrSingleConverter.Read(System.Text.Json.Utf8JsonReader@,System.Type,System.Text.Json.JsonSerializerOptions)~System.Single[]")] [assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.FloatArrayOrSingleConverter.Read(System.Text.Json.Utf8JsonReader@,System.Type,System.Text.Json.JsonSerializerOptions)~System.Single[]")]
[assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Program.Main")] [assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Download_Faturas.Program.Main")]

View File

@ -1,9 +1,18 @@
// <copyright file="PDFSplitter.cs" company="Smart Energia"> // <copyright file="PDFSplitter.cs" company="Smart Energia">
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
using System.Data.OleDb;
using System.Globalization;
using System.Net.Http.Headers;
using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using iText.Kernel.Pdf; using iText.Kernel.Pdf;
using iText.Kernel.Utils; using iText.Kernel.Utils;

View File

@ -5,8 +5,11 @@
namespace Download_Faturas namespace Download_Faturas
{ {
using System.Data.OleDb; using System.Data.OleDb;
using System.Globalization;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json; using System.Text.Json;
using Faturas; using System.Text.RegularExpressions;
/// <summary> /// <summary>
/// Main program class for processing invoices. /// Main program class for processing invoices.

View File

@ -2,7 +2,7 @@
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
/// <summary> /// <summary>
/// Record set class representing invoice data. /// Record set class representing invoice data.

View File

@ -2,7 +2,7 @@
// Copyright (c) Smart Energia. All rights reserved. // Copyright (c) Smart Energia. All rights reserved.
// </copyright> // </copyright>
namespace Faturas namespace Download_Faturas
{ {
using System.Text.Json.Serialization; using System.Text.Json.Serialization;

View File

@ -14,9 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig .editorconfig = .editorconfig
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Faturas.Tests", "Faturas.Tests\Faturas.Tests.csproj", "{67A025C1-B7A4-48D0-8157-C0BBA550469F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Download Faturas.Tests", "Download Faturas.Tests\Download Faturas.Tests.csproj", "{67A025C1-B7A4-48D0-8157-C0BBA550469F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Faturas", "Faturas\Faturas.csproj", "{E0184772-C161-441B-8872-4BCBA20E4B47}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -40,10 +38,6 @@ Global
{67A025C1-B7A4-48D0-8157-C0BBA550469F}.Debug|Any CPU.Build.0 = Debug|Any CPU {67A025C1-B7A4-48D0-8157-C0BBA550469F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67A025C1-B7A4-48D0-8157-C0BBA550469F}.Release|Any CPU.ActiveCfg = Release|Any CPU {67A025C1-B7A4-48D0-8157-C0BBA550469F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67A025C1-B7A4-48D0-8157-C0BBA550469F}.Release|Any CPU.Build.0 = Release|Any CPU {67A025C1-B7A4-48D0-8157-C0BBA550469F}.Release|Any CPU.Build.0 = Release|Any CPU
{E0184772-C161-441B-8872-4BCBA20E4B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0184772-C161-441B-8872-4BCBA20E4B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0184772-C161-441B-8872-4BCBA20E4B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0184772-C161-441B-8872-4BCBA20E4B47}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="itext7" Version="9.0.0" />
<PackageReference Include="System.Data.OleDb" Version="10.0.0" />
</ItemGroup>
</Project>

View File

@ -1,9 +0,0 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Interoperability", "CA1416:Validar a compatibilidade da plataforma", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")]
[assembly: SuppressMessage("Style", "IDE0063:Usar a instrução 'using' simples", Justification = "<Pendente>", Scope = "member", Target = "~M:Faturas.Fatura.Processar(System.Data.OleDb.OleDbConnection)")]

View File

@ -4,6 +4,7 @@
namespace Download_Faturas namespace Download_Faturas
{ {
using System.Net;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RootNamespace>Download_Faturas</RootNamespace> <RootNamespace>Download_Faturas</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@ -14,6 +14,8 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.Data.OleDb" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Webhook_4docs namespace Webhook_4docs
{ {

View File

@ -1,9 +1,13 @@
using System.Data.OleDb; using System.Data.OleDb;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading.RateLimiting; using System.Threading.RateLimiting;
using Faturas; using Download_Faturas;
using iText.Layout.Splitting;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
namespace Webhook_4docs namespace Webhook_4docs
{ {

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework> <TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>Webhook_4docs</RootNamespace> <RootNamespace>Webhook_4docs</RootNamespace>
@ -18,11 +18,12 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
<PackageReference Include="System.Data.OleDb" Version="10.0.0" /> <PackageReference Include="System.Data.OleDb" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Faturas\Faturas.csproj" /> <ProjectReference Include="..\Download Faturas\Download Faturas.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>