summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Servicos.Ajuda/AjudaServico.cs
blob: 7805918bdd2e825df62e387ec31c68e14869befb (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using CsQuery.ExtensionMethods.Internal;
using Gestor.Application.Helpers;
using Gestor.Application.Model.Ajuda;
using Gestor.Application.Servicos.Generic;
using Gestor.Model.API;
using Gestor.Model.License;

namespace Gestor.Application.Servicos.Ajuda;

public class AjudaServico : BaseServico
{
	internal async Task<ObservableCollection<Atendimento>> BuscarAtendimentos(string status)
	{
		return await Task.Run(delegate
		{
			try
			{
				int num = ((status == "PENDENTES") ? 1 : 2);
				return Connection.Get<ObservableCollection<Atendimento>>($"Attendance/{num}").Result;
			}
			catch (Exception)
			{
				return (ObservableCollection<Atendimento>)null;
			}
		});
	}

	internal async Task<string> BuscarCorpoAtendimentos(long id)
	{
		return await Task.Run(delegate
		{
			try
			{
				return Connection.Get<string>($"Attendance/Body/{id}").Result;
			}
			catch (Exception)
			{
				return (string)null;
			}
		});
	}

	internal async Task<List<Boleto>> BuscarBoletosNotas(string status)
	{
		return await Task.Run(delegate
		{
			try
			{
				return Connection.Get<List<Boleto>>(string.Format("Billet/{0}", status == "BAIXADOS")).Result;
			}
			catch (Exception)
			{
				return (List<Boleto>)null;
			}
		});
	}

	internal async Task<Contrato> BuscarContrato(Produto produto)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		return await Task.Run(delegate
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return Connection.Get<Contrato>($"Contract/{ExtensionMethods.GetValue((Enum)(object)produto)}").Result;
			}
			catch (Exception)
			{
				return (Contrato)null;
			}
		});
	}

	internal async Task<ObservableCollection<Instalacao>> BuscarLicencas()
	{
		return await Task.Run(delegate
		{
			try
			{
				return Connection.Get<ObservableCollection<Instalacao>>($"License/{ApplicationHelper.IdFornecedor}").Result;
			}
			catch (Exception)
			{
				return (ObservableCollection<Instalacao>)null;
			}
		});
	}

	internal async Task<bool> ExcluirInstalacao(long id)
	{
		int tries = 3;
		return await Task.Run(delegate
		{
			while (tries > 0)
			{
				try
				{
					return Connection.Delete($"License/{id}").Result;
				}
				catch (Exception e)
				{
					tries = Registrar(e, (TipoErro)273, tries, id);
				}
			}
			return false;
		});
	}
}