This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Threading; | |
public static class WindowHelper | |
{ | |
[DllImport("user32.dll")] | |
private static extern bool SetForegroundWindow(IntPtr hWnd); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
mr.contrato, | |
mr.dt_inicio_vigencia_contrato AS dt_inicio_mf_receita, | |
mr.vl_receita_total AS receita_mf_receita, | |
mr.competencia AS competencia_mf_receita, | |
mr2.dt_inicio_vigencia_contrato AS dt_inicio_mf_receita_202501, | |
mr2.vl_receita_total AS receita_mf_receita_202501, | |
mr2.competencia AS competencia_mf_receita_202501, | |
CASE | |
WHEN mr.vl_receita_total = mr2.vl_receita_total THEN 'Iguais' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConfigReader | |
{ | |
private readonly string _configFilePath; | |
// Constructor that initializes the config file path | |
public ConfigReader(string configFilePath = "appsettings.json") | |
{ | |
_configFilePath = configFilePath; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using Newtonsoft.Json.Linq; | |
/// <summary> | |
/// Provides methods to retrieve connection strings and app settings from the appsettings.json file. | |
/// </summary> | |
public static class AppSettings | |
{ | |
private static readonly Lazy<JObject> _config = new Lazy<JObject>(LoadAppSettings); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ConfigurationHelper | |
{ | |
public static IConfigurationRoot GetConfiguration() | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(Directory.GetCurrentDirectory()) // Define o diretório base | |
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); // Carrega o arquivo JSON | |
return builder.Build(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); // Exibe erros detalhados em desenvolvimento | |
} | |
else | |
{ | |
// Em produção, você pode optar por exibir detalhes de erro | |
app.UseExceptionHandler(errorApp => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function IsSmartCardCertificate(pCertContext As LongPtr) As Boolean | |
Dim cbData As Long | |
Dim provInfo As String | |
Dim isSmartCard As Boolean | |
' Obtém o tamanho das informações do provedor de chaves | |
If CertGetCertificateContextProperty(pCertContext, CERT_KEY_PROV_INFO_PROP_ID, 0, cbData) = 0 Then | |
IsSmartCardCertificate = False | |
Exit Function | |
End If |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
' Windows API Declarations | |
Private Declare PtrSafe Function CertOpenSystemStore Lib "crypt32.dll" Alias "CertOpenSystemStoreA" (ByVal hProv As LongPtr, ByVal szSubsystemProtocol As String) As LongPtr | |
Private Declare PtrSafe Function CertFindCertificateInStore Lib "crypt32.dll" (ByVal hCertStore As LongPtr, ByVal dwCertEncodingType As Long, ByVal dwFindFlags As Long, ByVal dwFindType As Long, ByVal pvFindPara As LongPtr, ByVal pPrevCertContext As LongPtr) As LongPtr | |
Private Declare PtrSafe Function CertGetNameString Lib "crypt32.dll" Alias "CertGetNameStringA" (ByVal pCertContext As LongPtr, ByVal dwType As Long, ByVal dwFlags As Long, ByVal pvTypePara As LongPtr, ByVal pszNameString As String, ByVal cchNameString As Long) As Long | |
Private Declare PtrSafe Function CertGetCertificateContextProperty Lib "crypt32.dll" (ByVal pCertContext As LongPtr, ByVal dwPropId As Long, ByVal pvData As LongPtr, ByRef pcbData As Long) As Long | |
Private Declare PtrSafe Function CertCloseStore Lib "crypt32.dll" (ByV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Declare PtrSafe Function CertOpenStore Lib "Crypt32.dll" ( _ | |
ByVal lpszStoreProvider As String, _ | |
ByVal dwEncodingType As Long, _ | |
ByVal hCryptProv As LongPtr, _ | |
ByVal dwFlags As Long, _ | |
ByVal pvPara As LongPtr) As LongPtr | |
Private Declare PtrSafe Function CertCloseStore Lib "Crypt32.dll" ( _ | |
ByVal hCertStore As LongPtr, _ | |
ByVal dwFlags As Long) As Long |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digo VBA para Extrair o Conteúdo entre Parênteses | |
vba | |
Copiar | |
Editar | |
Function ExtrairConteudoParenteses(ByVal texto As String) As String | |
Dim regex As Object | |
Dim match As Object | |
Set regex = CreateObject("VBScript.RegExp") | |
NewerOlder