using CsQuery.ExtensionMethods.Internal; using Gestor.Application.Helpers; using Gestor.Application.Model.Ajuda; using Gestor.Application.Servicos.Generic; using Gestor.Model.License; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace Gestor.Application.Servicos.Ajuda { public class AjudaServico : BaseServico { public AjudaServico() { } internal async Task> BuscarAtendimentos(string status) { ObservableCollection observableCollection = await Task.Run>(() => { ObservableCollection result; try { result = Connection.Get>(string.Format("Attendance/{0}", (status == "PENDENTES" ? 1 : 2)), true, false).Result; } catch (Exception exception) { result = null; } return result; }); return observableCollection; } internal async Task> BuscarBoletosNotas(string status) { List boletos = await Task.Run>(() => { List result; try { result = Connection.Get>(string.Format("Billet/{0}", status == "BAIXADOS"), true, false).Result; } catch (Exception exception) { result = null; } return result; }); return boletos; } internal async Task BuscarContrato(Produto produto) { Contrato contrato = await Task.Run(() => { Contrato result; try { result = Connection.Get(string.Format("Contract/{0}", ExtensionMethods.GetValue(produto)), true, false).Result; } catch (Exception exception) { result = null; } return result; }); return contrato; } internal async Task BuscarCorpoAtendimentos(long id) { string str = await Task.Run(() => { string result; try { result = Connection.Get(string.Format("Attendance/Body/{0}", id), true, false).Result; } catch (Exception exception) { result = null; } return result; }); return str; } internal async Task> BuscarLicencas() { ObservableCollection observableCollection = await Task.Run>(() => { ObservableCollection result; try { result = Connection.Get>(string.Format("License/{0}", ApplicationHelper.IdFornecedor), true, false).Result; } catch (Exception exception) { result = null; } return result; }); return observableCollection; } internal async Task ExcluirInstalacao(long id) { int num = 3; bool flag = await Task.Run(() => { bool result; while (num > 0) { try { result = Connection.Delete(string.Format("License/{0}", id)).Result; } catch (Exception exception) { num = base.Registrar(exception, 273, num, id, true); continue; } return result; } return false; }); return flag; } } }