summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Helpers/ArquivoDigital.cs
blob: 492694488c07717a53c0c7ae6325ea8487271a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using ArquivoDigital.Infrastructure.UnitOfWork.Logic;
using Gestor.Application.Servicos.Generic;
using Gestor.Model.Domain.Common;

namespace Gestor.Application.Helpers;

public static class ArquivoDigital
{
	public static string ConexaoAd = null;

	public static UnitOfWork Commited => UnitOfWork();

	public static UnitOfWork Read => UnitOfWork(withTransaction: false);

	public static string Banco { get; set; }

	public static string Tabela { get; set; } = "arquivodigital";


	private static UnitOfWork UnitOfWork(bool withTransaction = true, bool reconect = false)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		if (ConexaoAd == null)
		{
			SetConnection();
		}
		return new UnitOfWork(ConexaoAd, Tabela, withTransaction);
	}

	public static void SetConnection(string banco = "")
	{
		ControleArquivoDigital val = (string.IsNullOrEmpty(banco) ? new BaseServico().ArquivoDigital().Result : new BaseServico().ArquivoDigital(banco).Result);
		Banco = val.Catalogo;
		Tabela = (string.IsNullOrWhiteSpace(val.Tabela) ? "arquivodigital" : val.Tabela);
		ConexaoAd = "Server=" + Connection.Server + ";initial catalog=" + val.Catalogo + ";user=" + Connection.User + ";password=" + Connection.Password + ";";
	}
}