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> BuscarAtendimentos(string status) { return await Task.Run(delegate { try { int num = ((status == "PENDENTES") ? 1 : 2); return Connection.Get>($"Attendance/{num}").Result; } catch (Exception) { return (ObservableCollection)null; } }); } internal async Task BuscarCorpoAtendimentos(long id) { return await Task.Run(delegate { try { return Connection.Get($"Attendance/Body/{id}").Result; } catch (Exception) { return (string)null; } }); } internal async Task> BuscarBoletosNotas(string status) { return await Task.Run(delegate { try { return Connection.Get>(string.Format("Billet/{0}", status == "BAIXADOS")).Result; } catch (Exception) { return (List)null; } }); } internal async Task 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($"Contract/{ExtensionMethods.GetValue((Enum)(object)produto)}").Result; } catch (Exception) { return (Contrato)null; } }); } internal async Task> BuscarLicencas() { return await Task.Run(delegate { try { return Connection.Get>($"License/{ApplicationHelper.IdFornecedor}").Result; } catch (Exception) { return (ObservableCollection)null; } }); } internal async Task 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; }); } }