From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- Gestor.Application/Servicos/TarefaServico.cs | 795 --------------------------- 1 file changed, 795 deletions(-) delete mode 100644 Gestor.Application/Servicos/TarefaServico.cs (limited to 'Gestor.Application/Servicos/TarefaServico.cs') diff --git a/Gestor.Application/Servicos/TarefaServico.cs b/Gestor.Application/Servicos/TarefaServico.cs deleted file mode 100644 index 792aea6..0000000 --- a/Gestor.Application/Servicos/TarefaServico.cs +++ /dev/null @@ -1,795 +0,0 @@ -using Gestor.Application.Actions; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos.Generic; -using Gestor.Application.ViewModels; -using Gestor.Infrastructure.Repository.Interface; -using Gestor.Infrastructure.UnitOfWork.Generic; -using Gestor.Infrastructure.UnitOfWork.Logic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Threading; - -namespace Gestor.Application.Servicos -{ - public class TarefaServico : BaseServico - { - public TarefaServico() - { - } - - public async Task AtualizarNotasTarefas() - { - int num = 3; - int[] numArray1 = await Task.Run(() => { - int[] numArray; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - numArray = read.get_TarefaRepository().ContarTarefas(Recursos.Usuario.get_Id()); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 100, num, Recursos.Usuario.get_Id(), true); - continue; - } - return numArray; - } - return new int[1]; - }); - return numArray1; - } - - public async Task> BuscarFases(long id) - { - int num = 3; - List fases1 = await Task.Run>(() => { - List fases; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - fases = read.get_TarefaRepository().BuscarFases(id); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 102, num, id, true); - continue; - } - return fases; - } - return new List(); - }); - return fases1; - } - - public async Task> BuscarNotas(long id) - { - int num = 3; - List tarefas1 = await Task.Run>(() => { - List tarefas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefaPorUsuario(id, 1); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 98, num, id, true); - continue; - } - return tarefas; - } - return new List(); - }); - return tarefas1; - } - - public async Task> BuscarNotasConcluidas(long id) - { - int num = 3; - List tarefas1 = await Task.Run>(() => { - List tarefas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefaConcluidaPorUsuario(id, 1); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 99, num, id, true); - continue; - } - return tarefas; - } - return new List(); - }); - return tarefas1; - } - - public async Task BuscarTarefa(long id) - { - int num = 3; - Tarefa tarefa1 = await Task.Run(() => { - Tarefa tarefa; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefa = read.get_TarefaRepository().BuscarTarefa(id); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 105, num, id, true); - continue; - } - return tarefa; - } - return new Tarefa(); - }); - return tarefa1; - } - - public async Task> BuscarTarefas(TipoTarefa entidade, long id, bool? concluido) - { - int num = 3; - List tarefas1 = await Task.Run>(() => { - List tarefas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefa(entidade, id, concluido); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 94, num, new { entidade = entidade, id = id, concluido = concluido }, true); - continue; - } - return tarefas; - } - return new List(); - }); - return tarefas1; - } - - public async Task> BuscarTarefas(long id, DateTime inicio, DateTime fim, bool? concluido) - { - int num = 3; - List tarefas1 = await Task.Run>(() => { - List tarefas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefaPorUsuario(id, inicio, fim, concluido); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 95, num, new { id = id, inicio = inicio, fim = fim, concluido = concluido }, true); - continue; - } - return tarefas; - } - return new List(); - }); - return tarefas1; - } - - public async Task> BuscarTarefas(long id) - { - int num = 3; - List tarefas1 = await Task.Run>(() => { - List tarefas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefaPorTrilha(id); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 101, num, id, true); - continue; - } - return tarefas; - } - return new List(); - }); - return tarefas1; - } - - public async Task> BuscarTarefasCliente(long id) - { - int num = 3; - List tarefas1 = await Task.Run>(() => { - List tarefas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefaPorCliente(id); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 96, num, id, true); - continue; - } - return tarefas; - } - return new List(); - }); - return tarefas1; - } - - public async Task> BuscarTarefasPorTipo(TipoDeTarefa tipoTarefa) - { - int num = 3; - List tarefas1 = await Task.Run>(() => { - List tarefas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefasPorTipo(tipoTarefa.get_Id()); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 309, num, new { tipoTarefa = tipoTarefa }, true); - continue; - } - return tarefas; - } - return new List(); - }); - return tarefas1; - } - - public async Task> BuscarTrilhas() - { - int num = 3; - List trilhas1 = await Task.Run>(() => { - List trilhas; - while (num > 0) - { - try - { - using (UnitOfWork read = Instancia.Read) - { - trilhas = read.get_TarefaRepository().BuscarTrilhas(true); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 104, num, null, true); - continue; - } - return trilhas; - } - return new List(); - }); - return trilhas1; - } - - private static void CleanWebEditor(Tarefa tarefa) - { - if (tarefa.get_Descricao() != null) - { - tarefa.set_Descricao(TarefaServico.RemoveXml(tarefa.get_Descricao())); - } - if (tarefa.get_DescricaoInterna() != null) - { - tarefa.set_DescricaoInterna(TarefaServico.RemoveXml(tarefa.get_DescricaoInterna())); - } - } - - public async Task Excluir(long id) - { - int num = 3; - bool flag1 = await Task.Run(() => { - bool flag; - while (num > 0) - { - try - { - using (UnitOfWork commited = Instancia.Commited) - { - commited.get_TarefaRepository().Excluir(id); - commited.Commit(); - } - Dispatcher dispatcher = System.Windows.Application.Current.Dispatcher; - Action u003cu003e9_51 = TarefaServico.u003cu003ec.u003cu003e9__5_1; - if (u003cu003e9_51 == null) - { - u003cu003e9_51 = () => Gestor.Application.Actions.Actions.AtualizaBadges(); - TarefaServico.u003cu003ec.u003cu003e9__5_1 = u003cu003e9_51; - } - dispatcher.Invoke(u003cu003e9_51); - flag = true; - } - catch (Exception exception) - { - num = base.Registrar(exception, 268, num, id, true); - continue; - } - return flag; - } - return false; - }); - return flag1; - } - - public async Task ExcluirTarefasDocumento(long id) - { - int num = 3; - bool flag1 = await Task.Run(() => { - bool flag; - string str; - while (num > 0) - { - try - { - List tarefas = new List(); - using (UnitOfWork read = Instancia.Read) - { - tarefas = read.get_TarefaRepository().BuscarTarefa(0, id, new bool?(false)); - } - foreach (Tarefa tarefa in tarefas) - { - using (UnitOfWork commited = Instancia.Commited) - { - commited.get_TarefaRepository().Excluir(tarefa.get_Id()); - commited.Commit(); - IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); - RegistroLog registroLog = new RegistroLog(); - registroLog.set_Acao(1); - registroLog.set_Usuario(Recursos.Usuario); - registroLog.set_DataHora(DateTime.Now); - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - registroLog.set_Descricao(JsonConvert.SerializeObject(tarefa, jsonSerializerSetting)); - registroLog.set_EntidadeId(tarefa.get_Id()); - registroLog.set_Tela(4); - registroLog.set_Versao(LoginViewModel.VersaoAtual); - registroLog.set_NomeMaquina(Environment.MachineName); - registroLog.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList = hostEntry.AddressList; - Func u003cu003e9_192 = TarefaServico.u003cu003ec.u003cu003e9__19_2; - if (u003cu003e9_192 == null) - { - u003cu003e9_192 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - TarefaServico.u003cu003ec.u003cu003e9__19_2 = u003cu003e9_192; - } - IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault(u003cu003e9_192); - if (pAddress != null) - { - str = pAddress.ToString(); - } - else - { - str = null; - } - registroLog.set_Ip(str); - base.SaveLog(registroLog, commited); - } - } - Dispatcher dispatcher = System.Windows.Application.Current.Dispatcher; - Action u003cu003e9_191 = TarefaServico.u003cu003ec.u003cu003e9__19_1; - if (u003cu003e9_191 == null) - { - u003cu003e9_191 = () => Gestor.Application.Actions.Actions.AtualizaBadges(); - TarefaServico.u003cu003ec.u003cu003e9__19_1 = u003cu003e9_191; - } - dispatcher.Invoke(u003cu003e9_191); - flag = true; - } - catch (Exception exception) - { - num = base.Registrar(exception, 268, num, id, true); - continue; - } - return flag; - } - return false; - }); - return flag1; - } - - public static string RemoveXml(string description) - { - try - { - List strs = new List(); - string[] strArrays = description.Split(new char[] { '<' }); - for (int i = 0; i < (int)strArrays.Length; i++) - { - string str = strArrays[i]; - if (str.Contains("?xml") || str.Contains("o:p")) - { - strs.Add(string.Concat("<", str)); - } - } - foreach (string str1 in strs) - { - description = description.Replace(str1, ""); - } - } - catch (Exception exception) - { - throw exception; - } - return description; - } - - public async Task Salvar(Tarefa tarefa) - { - int num = 3; - base.Sucesso = true; - DateTime networkTime = Funcoes.GetNetworkTime(); - Tarefa tarefa2 = tarefa; - Tarefa tarefa3 = await Task.Run(() => { - Tarefa tarefa4; - string str; - while (num > 0) - { - tarefa = tarefa2; - try - { - using (UnitOfWork commited = Instancia.Commited) - { - TarefaServico.CleanWebEditor(tarefa); - if (tarefa.get_Entidade() == 1) - { - tarefa.set_Descricao((!string.IsNullOrWhiteSpace(tarefa.get_Anotacoes()) ? tarefa.get_Anotacoes() : tarefa.get_Descricao())); - } - tarefa = (tarefa.get_Id() == (long)0 ? commited.get_TarefaRepository().Salvar(tarefa) : commited.get_TarefaRepository().Atualizar(tarefa)); - IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); - RegistroLog registroLog = new RegistroLog(); - registroLog.set_Acao(1); - registroLog.set_Usuario(Recursos.Usuario); - registroLog.set_DataHora(networkTime); - Tarefa tarefa1 = tarefa; - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - registroLog.set_Descricao(JsonConvert.SerializeObject(tarefa1, jsonSerializerSetting)); - registroLog.set_EntidadeId(tarefa.get_Id()); - registroLog.set_Tela(38); - registroLog.set_Versao(LoginViewModel.VersaoAtual); - registroLog.set_NomeMaquina(Environment.MachineName); - registroLog.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList = hostEntry.AddressList; - Func u003cu003e9_12 = TarefaServico.u003cu003ec.u003cu003e9__1_2; - if (u003cu003e9_12 == null) - { - u003cu003e9_12 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - TarefaServico.u003cu003ec.u003cu003e9__1_2 = u003cu003e9_12; - } - IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault(u003cu003e9_12); - if (pAddress != null) - { - str = pAddress.ToString(); - } - else - { - str = null; - } - registroLog.set_Ip(str); - base.SaveLog(registroLog, commited); - commited.Commit(); - Dispatcher dispatcher = System.Windows.Application.Current.Dispatcher; - Action u003cu003e9_11 = TarefaServico.u003cu003ec.u003cu003e9__1_1; - if (u003cu003e9_11 == null) - { - u003cu003e9_11 = () => Gestor.Application.Actions.Actions.AtualizaBadges(); - TarefaServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11; - } - dispatcher.Invoke(u003cu003e9_11); - tarefa4 = tarefa; - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 265, num, tarefa, true); - continue; - } - return tarefa4; - } - return tarefa2; - }); - return tarefa3; - } - - public async Task Salvar(Trilha trilha) - { - int num = 3; - base.Sucesso = true; - DateTime networkTime = Funcoes.GetNetworkTime(); - Trilha trilha2 = trilha; - Trilha trilha3 = await Task.Run(() => { - Trilha trilha4; - string str; - while (num > 0) - { - trilha = trilha2; - try - { - using (UnitOfWork commited = Instancia.Commited) - { - trilha = (trilha.get_Id() == (long)0 ? commited.get_TarefaRepository().Salvar(trilha) : commited.get_TarefaRepository().Atualizar(trilha)); - IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); - RegistroLog registroLog = new RegistroLog(); - registroLog.set_Acao(1); - registroLog.set_Usuario(Recursos.Usuario); - registroLog.set_DataHora(networkTime); - Trilha trilha1 = trilha; - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - registroLog.set_Descricao(JsonConvert.SerializeObject(trilha1, jsonSerializerSetting)); - registroLog.set_EntidadeId(trilha.get_Id()); - registroLog.set_Tela(4); - registroLog.set_Versao(LoginViewModel.VersaoAtual); - registroLog.set_NomeMaquina(Environment.MachineName); - registroLog.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList = hostEntry.AddressList; - Func u003cu003e9_42 = TarefaServico.u003cu003ec.u003cu003e9__4_2; - if (u003cu003e9_42 == null) - { - u003cu003e9_42 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - TarefaServico.u003cu003ec.u003cu003e9__4_2 = u003cu003e9_42; - } - IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault(u003cu003e9_42); - if (pAddress != null) - { - str = pAddress.ToString(); - } - else - { - str = null; - } - registroLog.set_Ip(str); - base.SaveLog(registroLog, commited); - commited.Commit(); - Dispatcher dispatcher = System.Windows.Application.Current.Dispatcher; - Action u003cu003e9_41 = TarefaServico.u003cu003ec.u003cu003e9__4_1; - if (u003cu003e9_41 == null) - { - u003cu003e9_41 = () => Gestor.Application.Actions.Actions.AtualizaBadges(); - TarefaServico.u003cu003ec.u003cu003e9__4_1 = u003cu003e9_41; - } - dispatcher.Invoke(u003cu003e9_41); - trilha4 = trilha; - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 267, num, trilha, true); - continue; - } - return trilha4; - } - return trilha2; - }); - return trilha3; - } - - public async Task> Salvar(List fases) - { - int num = 3; - base.Sucesso = true; - DateTime networkTime = Funcoes.GetNetworkTime(); - List fases1 = fases; - List fases2 = await Task.Run>(() => { - List fases3; - string str; - while (num > 0) - { - fases = fases1; - try - { - using (UnitOfWork commited = Instancia.Commited) - { - fases = commited.get_TarefaRepository().Salvar(fases); - IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); - foreach (Fase fase in fases) - { - RegistroLog registroLog = new RegistroLog(); - registroLog.set_Acao(1); - registroLog.set_Usuario(Recursos.Usuario); - registroLog.set_DataHora(networkTime); - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - registroLog.set_Descricao(JsonConvert.SerializeObject(fase, jsonSerializerSetting)); - registroLog.set_EntidadeId(fase.get_Id()); - registroLog.set_Tela(4); - registroLog.set_Versao(LoginViewModel.VersaoAtual); - registroLog.set_NomeMaquina(Environment.MachineName); - registroLog.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList = hostEntry.AddressList; - Func u003cu003e9_142 = TarefaServico.u003cu003ec.u003cu003e9__14_2; - if (u003cu003e9_142 == null) - { - u003cu003e9_142 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - TarefaServico.u003cu003ec.u003cu003e9__14_2 = u003cu003e9_142; - } - IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault(u003cu003e9_142); - if (pAddress != null) - { - str = pAddress.ToString(); - } - else - { - str = null; - } - registroLog.set_Ip(str); - base.SaveLog(registroLog, commited); - } - commited.Commit(); - Dispatcher dispatcher = System.Windows.Application.Current.Dispatcher; - Action u003cu003e9_141 = TarefaServico.u003cu003ec.u003cu003e9__14_1; - if (u003cu003e9_141 == null) - { - u003cu003e9_141 = () => Gestor.Application.Actions.Actions.AtualizaBadges(); - TarefaServico.u003cu003ec.u003cu003e9__14_1 = u003cu003e9_141; - } - dispatcher.Invoke(u003cu003e9_141); - fases3 = fases; - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 269, num, fases, true); - continue; - } - return fases3; - } - return fases1; - }); - return fases2; - } - - public async Task> Salvar(List tarefas) - { - int num = 3; - base.Sucesso = true; - DateTime networkTime = Funcoes.GetNetworkTime(); - List tarefas1 = tarefas; - List tarefas2 = await Task.Run>(() => { - List tarefas3; - string str; - while (num > 0) - { - tarefas = tarefas1; - try - { - using (UnitOfWork commited = Instancia.Commited) - { - tarefas = commited.get_TarefaRepository().Salvar(tarefas); - IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); - foreach (Tarefa tarefa in tarefas) - { - RegistroLog registroLog = new RegistroLog(); - registroLog.set_Acao(1); - registroLog.set_Usuario(Recursos.Usuario); - registroLog.set_DataHora(networkTime); - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - registroLog.set_Descricao(JsonConvert.SerializeObject(tarefa, jsonSerializerSetting)); - registroLog.set_EntidadeId(tarefa.get_Id()); - registroLog.set_Tela(4); - registroLog.set_Versao(LoginViewModel.VersaoAtual); - registroLog.set_NomeMaquina(Environment.MachineName); - registroLog.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList = hostEntry.AddressList; - Func u003cu003e9_152 = TarefaServico.u003cu003ec.u003cu003e9__15_2; - if (u003cu003e9_152 == null) - { - u003cu003e9_152 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - TarefaServico.u003cu003ec.u003cu003e9__15_2 = u003cu003e9_152; - } - IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault(u003cu003e9_152); - if (pAddress != null) - { - str = pAddress.ToString(); - } - else - { - str = null; - } - registroLog.set_Ip(str); - base.SaveLog(registroLog, commited); - } - commited.Commit(); - Dispatcher dispatcher = System.Windows.Application.Current.Dispatcher; - Action u003cu003e9_151 = TarefaServico.u003cu003ec.u003cu003e9__15_1; - if (u003cu003e9_151 == null) - { - u003cu003e9_151 = () => Gestor.Application.Actions.Actions.AtualizaBadges(); - TarefaServico.u003cu003ec.u003cu003e9__15_1 = u003cu003e9_151; - } - dispatcher.Invoke(u003cu003e9_151); - tarefas3 = tarefas; - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 265, num, tarefas, true); - continue; - } - return tarefas3; - } - return tarefas1; - }); - return tarefas2; - } - - public async Task> Validar(List ids, long trilhaId) - { - int num = 3; - List nums1 = await Task.Run>(() => { - List nums; - while (num > 0) - { - try - { - using (UnitOfWork commited = Instancia.Commited) - { - nums = commited.get_TarefaRepository().Validar(ids, trilhaId); - } - } - catch (Exception exception) - { - num = base.Registrar(exception, 266, num, new { ids = ids, trilhaId = trilhaId }, true); - continue; - } - return nums; - } - return null; - }); - return nums1; - } - } -} \ No newline at end of file -- cgit v1.2.3