diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/Servicos/Ferramentas/AgendaServico.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Gestor.Application/Servicos/Ferramentas/AgendaServico.cs')
| -rw-r--r-- | Gestor.Application/Servicos/Ferramentas/AgendaServico.cs | 257 |
1 files changed, 0 insertions, 257 deletions
diff --git a/Gestor.Application/Servicos/Ferramentas/AgendaServico.cs b/Gestor.Application/Servicos/Ferramentas/AgendaServico.cs deleted file mode 100644 index d52af23..0000000 --- a/Gestor.Application/Servicos/Ferramentas/AgendaServico.cs +++ /dev/null @@ -1,257 +0,0 @@ -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 Gestor.Model.Domain.Seguros;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class AgendaServico : BaseServico
- {
- public AgendaServico()
- {
- }
-
- internal async Task<ObservableCollection<AgendaEmail>> BuscarEmailsAsync(long id)
- {
- int num = 3;
- ObservableCollection<AgendaEmail> observableCollection1 = await Task.Run<ObservableCollection<AgendaEmail>>(() => {
- ObservableCollection<AgendaEmail> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- observableCollection = new ObservableCollection<AgendaEmail>(read.get_AgendaEmailRepository().FindByAgendaId(id));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 108, num, id, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<AgendaEmail>();
- });
- return observableCollection1;
- }
-
- internal async Task<ObservableCollection<AgendaTelefone>> BuscarTelefonesAsync(long id)
- {
- int num = 3;
- ObservableCollection<AgendaTelefone> observableCollection1 = await Task.Run<ObservableCollection<AgendaTelefone>>(() => {
- ObservableCollection<AgendaTelefone> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- observableCollection = new ObservableCollection<AgendaTelefone>(read.get_AgendaTelefoneRepository().FindByAgendaId(id));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 107, num, id, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<AgendaTelefone>();
- });
- return observableCollection1;
- }
-
- public async Task<bool> Delete(Agenda agenda)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_AgendaRepository().Delete(agenda.get_Id());
- DateTime networkTime = Funcoes.GetNetworkTime();
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(2);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- registroLog.set_Descricao(string.Concat(new string[] { string.Format("O USUÁRIO {0} EXCLUIU, EM {1}, O CONTATO DE ", Recursos.Usuario.get_Nome(), networkTime), string.Format("ID: '{0}'", agenda.get_Id()), ", NOME: '", (string.IsNullOrWhiteSpace(agenda.get_Nome()) ? "" : agenda.get_Nome() ?? ""), "', ENDEREÇO: '", agenda.get_Endereco(), ", ", agenda.get_Numero(), ", ", (string.IsNullOrWhiteSpace(agenda.get_Complemento()) ? "-" : agenda.get_Complemento() ?? ""), ", ", agenda.get_Bairro(), ", ", agenda.get_Cidade(), "/", agenda.get_Estado(), " - ", agenda.get_Cep(), "', OBSERVAÇÃO: '", (string.IsNullOrWhiteSpace(agenda.get_Observacao()) ? "" : agenda.get_Observacao() ?? ""), "'." }));
- registroLog.set_EntidadeId(agenda.get_Id());
- registroLog.set_Tela(34);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- RegistroLog registroLog1 = registroLog;
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = AgendaServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- AgendaServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_11);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog1.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 216, num, agenda, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Agenda> Save(Agenda agenda)
- {
- int num = 3;
- base.Sucesso = true;
- Agenda agenda2 = agenda;
- Agenda agenda3 = await Task.Run<Agenda>(() => {
- Agenda agenda4;
- List<AgendaTelefone> list;
- List<AgendaEmail> agendaEmails;
- string str;
- while (num > 0)
- {
- agenda = agenda2;
- try
- {
- TipoAcao tipoAcao = (agenda.get_Id() == 0 ? 0 : 1);
- ObservableCollection<AgendaTelefone> telefones = agenda.get_Telefones();
- if (telefones != null)
- {
- list = telefones.ToList<AgendaTelefone>();
- }
- else
- {
- list = null;
- }
- List<AgendaTelefone> agendaTelefones = list;
- ObservableCollection<AgendaEmail> emails = agenda.get_Emails();
- if (emails != null)
- {
- agendaEmails = emails.ToList<AgendaEmail>();
- }
- else
- {
- agendaEmails = null;
- }
- List<AgendaEmail> agendaEmails1 = agendaEmails;
- agenda.set_Telefones(null);
- agenda.set_Emails(null);
- using (UnitOfWork commited = Instancia.Commited)
- {
- if (agenda.get_Id() != (long)0)
- {
- if (agendaTelefones != null)
- {
- agendaTelefones = commited.get_AgendaTelefoneRepository().Merge(agendaTelefones, agenda);
- }
- if (agendaEmails1 != null)
- {
- agendaEmails1 = commited.get_AgendaEmailRepository().Merge(agendaEmails1, agenda);
- }
- agenda = commited.get_AgendaRepository().Merge(agenda);
- }
- else
- {
- agenda = commited.get_AgendaRepository().SaveOrUpdate(agenda);
- if (agendaTelefones != null)
- {
- agendaTelefones = commited.get_AgendaTelefoneRepository().Inserir(agendaTelefones, agenda);
- }
- if (agendaEmails1 != null)
- {
- agendaEmails1 = commited.get_AgendaEmailRepository().Inserir(agendaEmails1, agenda);
- }
- }
- agenda.set_Telefones((agendaTelefones == null ? null : new ObservableCollection<AgendaTelefone>(agendaTelefones)));
- agenda.set_Emails((agendaEmails1 == null ? null : new ObservableCollection<AgendaEmail>(agendaEmails1)));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- Agenda agenda1 = agenda;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(agenda1, jsonSerializerSetting));
- registroLog.set_EntidadeId(agenda.get_Id());
- registroLog.set_Tela(34);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_01 = AgendaServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- AgendaServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_01);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- agenda4 = agenda;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 215, num, agenda, true);
- continue;
- }
- return agenda4;
- }
- return agenda2;
- });
- return agenda3;
- }
- }
-}
\ No newline at end of file |