diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs new file mode 100644 index 0000000..5086554 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class LogEmailViewModel : BaseSegurosViewModel +{ + private readonly LogServico _servico; + + private Visibility _visibilityDetalhesLog = (Visibility)1; + + private bool _mostrarMensagem; + + private ObservableCollection<LogEmail> _logs = new ObservableCollection<LogEmail>(); + + private LogEmail _selectedLog; + + private List<TupleList> _lists = new List<TupleList>(); + + public Visibility VisiblityDetalhesLog + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityDetalhesLog; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityDetalhesLog = value; + OnPropertyChanged("VisiblityDetalhesLog"); + } + } + + public bool MostrarMensagem + { + get + { + return _mostrarMensagem; + } + set + { + _mostrarMensagem = value; + OnPropertyChanged("MostrarMensagem"); + } + } + + public ObservableCollection<LogEmail> Logs + { + get + { + return _logs; + } + set + { + _logs = value; + OnPropertyChanged("Logs"); + } + } + + public LogEmail SelectedLog + { + get + { + return _selectedLog; + } + set + { + _selectedLog = value; + List<TupleList> lists = SelectedLog.CriarLogEmail(); + Lists = lists; + OnPropertyChanged("SelectedLog"); + } + } + + public List<TupleList> Lists + { + get + { + return _lists; + } + set + { + _lists = value; + OnPropertyChanged("Lists"); + } + } + + public LogEmailViewModel(TipoTela tela, long id, bool singleMode) + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + _servico = new LogServico(); + VisiblityDetalhesLog = (Visibility)(!Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 55)); + Seleciona(tela, id, singleMode); + } + + private async void Seleciona(TipoTela tela, long id, bool singleMode) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + Loading(isLoading: true); + if (singleMode) + { + Logs = await _servico.FindById(id); + } + else + { + Logs = await _servico.FindByEntity(tela, id); + } + if (Logs.Count > 0) + { + SelectedLog = Logs[0]; + } + else + { + MostrarMensagem = true; + } + Loading(isLoading: false); + } + + public void Imprimir() + { + string text = "<html><head><style type='text/css'>@page{size: A4; margin: 0cm}</style><title>LOGS</title><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css' integrity='sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh' crossorigin='anonymous'></head><body><div align='center'><font size='5px' face='Arial' style='font-weight: 900;'>LOG ENVIO DE E-MAIL</font>"; + foreach (TupleList list in Lists) + { + foreach (Tuple<string, string, string> tuple in list.Tuples) + { + if (tuple == list.Tuples.First()) + { + text += "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: 240px; text-align:center;'><font size='3px' face='Arial' style='font-weight: 700'>E-MAIL ENVIADO</font></td>"; + text += "</tr></table>"; + } + bool flag = tuple.Item1.Contains("$"); + text = text + "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: " + (flag ? "900" : "700") + "; padding-left: 5px'>" + tuple.Item1.Replace(" ", " ").Replace("$", "") + "</font></td><td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>" + tuple.Item2 + "</font></td>"; + text += "</tr></table>"; + } + } + text += "</div><script src='https://code.jquery.com/jquery-3.4.1.slim.min.js' integrity='sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n' crossorigin='anonymous'></script><script src = 'https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js' integrity = 'sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo' crossorigin = 'anonymous' ></script ><script src = 'https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js' integrity = 'sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6' crossorigin = 'anonymous' ></script > </body></html>"; + string tempPath = Path.GetTempPath(); + string text2 = $"{tempPath}{(object)(TipoExtrato)0}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html"; + StreamWriter streamWriter = new StreamWriter(text2, append: true, Encoding.UTF8); + streamWriter.Write(text); + streamWriter.Close(); + Process.Start(text2); + } +} |