summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs')
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs537
1 files changed, 537 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs
new file mode 100644
index 0000000..81e4e8f
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/ReciboViewModel.cs
@@ -0,0 +1,537 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Ferramentas;
+
+public class ReciboViewModel : BaseSegurosViewModel
+{
+ private readonly ReciboServico _servico;
+
+ public Recibo CancelRecibo;
+
+ private Recibo _selectedRecibo = new Recibo();
+
+ private DateTime? _horaRecibo;
+
+ private ObservableCollection<Recibo> _recibosFiltrados = new ObservableCollection<Recibo>();
+
+ private bool _isExpanded;
+
+ private Cliente _pagante;
+
+ private Cliente _recebedor;
+
+ public List<Recibo> Recibos { get; set; }
+
+ public Recibo SelectedRecibo
+ {
+ get
+ {
+ return _selectedRecibo;
+ }
+ set
+ {
+ _selectedRecibo = value;
+ WorkOnSelectedRecibo(value);
+ VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null);
+ if (!value.DataRecibo.HasValue)
+ {
+ value.DataRecibo = DateTime.Now;
+ }
+ if (value != null)
+ {
+ HoraRecibo = value.DataRecibo;
+ }
+ OnPropertyChanged("SelectedRecibo");
+ }
+ }
+
+ public DateTime? HoraRecibo
+ {
+ get
+ {
+ return _horaRecibo;
+ }
+ set
+ {
+ _horaRecibo = value;
+ if (value.HasValue)
+ {
+ SelectedRecibo.DataRecibo = (SelectedRecibo.DataRecibo.HasValue ? new DateTime?(DateTime.Parse($"{SelectedRecibo.DataRecibo.Value:d} {value:T}")) : null);
+ OnPropertyChanged("HoraRecibo");
+ }
+ }
+ }
+
+ public ObservableCollection<Recibo> RecibosFiltrados
+ {
+ get
+ {
+ return _recibosFiltrados;
+ }
+ set
+ {
+ _recibosFiltrados = value;
+ IsExpanded = value != null && value.Count > 0;
+ OnPropertyChanged("RecibosFiltrados");
+ }
+ }
+
+ public bool IsExpanded
+ {
+ get
+ {
+ return _isExpanded;
+ }
+ set
+ {
+ _isExpanded = value;
+ OnPropertyChanged("IsExpanded");
+ }
+ }
+
+ public Cliente Pagante
+ {
+ get
+ {
+ return _pagante;
+ }
+ set
+ {
+ _pagante = value;
+ WorkOnSelectedPagante(value);
+ OnPropertyChanged("Pagante");
+ }
+ }
+
+ public Cliente Recebedor
+ {
+ get
+ {
+ return _recebedor;
+ }
+ set
+ {
+ _recebedor = value;
+ WorkOnSelectedRecebedor(value);
+ OnPropertyChanged("Recebedor");
+ }
+ }
+
+ public ReciboViewModel()
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000b: Expected O, but got Unknown
+ _servico = new ReciboServico();
+ base.EnableMenu = true;
+ Seleciona();
+ }
+
+ private void WorkOnSelectedPagante(Cliente value)
+ {
+ if (value != null)
+ {
+ SelectedRecibo.Pagante = Regex.Replace(value.NomeSocial, "\\-\\s\\d.*", "").Trim();
+ SelectedRecibo.DocumentoPagante = value.Documento;
+ SelectedRecibo = SelectedRecibo;
+ }
+ }
+
+ private void WorkOnSelectedRecebedor(Cliente value)
+ {
+ if (value != null)
+ {
+ SelectedRecibo.Recebedor = Regex.Replace(value.NomeSocial, "\\-\\s\\d.*", "").Trim();
+ SelectedRecibo.DocumentoRecebedor = value.Documento;
+ SelectedRecibo = SelectedRecibo;
+ }
+ }
+
+ private async void Seleciona()
+ {
+ Loading(isLoading: true);
+ await PermissaoTela((TipoTela)42);
+ await SelecionaRecibo();
+ Loading(isLoading: false);
+ }
+
+ private async Task SelecionaRecibo()
+ {
+ Loading(isLoading: true);
+ Recibos = (await _servico.BuscarRecibos()).ToList();
+ RecibosFiltrados = new ObservableCollection<Recibo>(Recibos);
+ if (RecibosFiltrados.Count > 0)
+ {
+ SelectedRecibo = RecibosFiltrados.First();
+ }
+ else
+ {
+ SelectedRecibo = new Recibo();
+ Alterar(alterar: false);
+ base.EnableMenu = false;
+ }
+ Loading(isLoading: false);
+ }
+
+ public void Incluir()
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000b: Expected O, but got Unknown
+ SelectedRecibo = new Recibo();
+ Alterar(alterar: true);
+ }
+
+ internal async Task<List<Recibo>> Filtrar(string value)
+ {
+ return await Task.Run(() => FiltrarRecibo(value));
+ }
+
+ public List<Recibo> FiltrarRecibo(string filter)
+ {
+ RecibosFiltrados = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Recibo>(Recibos) : new ObservableCollection<Recibo>(Recibos.Where((Recibo x) => ValidationHelper.RemoveDiacritics(x.Pagante.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.Recebedor).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)))));
+ return RecibosFiltrados.ToList();
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar()
+ {
+ List<KeyValuePair<string, string>> list = SelectedRecibo.Validate();
+ if (list.Count > 0)
+ {
+ return list;
+ }
+ string acao = ((((DomainBase)SelectedRecibo).Id == 0L) ? "INCLUIU" : "ALTEROU");
+ Recibo value = await _servico.Save(SelectedRecibo);
+ if (!_servico.Sucesso)
+ {
+ return null;
+ }
+ ReciboViewModel reciboViewModel = this;
+ string descricao = $"{acao} RECIBO DE NÚMERO \"{((DomainBase)value).Id}\"";
+ long id = ((DomainBase)value).Id;
+ TipoTela? tela = (TipoTela)42;
+ object[] obj = new object[9]
+ {
+ value.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)value.Tipo.Value) ?? "") : "-",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ TipoPagamento? pagamento = value.Pagamento;
+ obj[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null);
+ obj[2] = value.Valor;
+ obj[3] = value.DataRecibo;
+ obj[4] = value.Pagante;
+ obj[5] = value.DocumentoPagante;
+ obj[6] = value.Recebedor;
+ obj[7] = value.DocumentoRecebedor;
+ obj[8] = value.Referente;
+ reciboViewModel.RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj));
+ if (Recibos.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id))
+ {
+ DomainBase.Copy<Recibo, Recibo>(Recibos.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value);
+ }
+ else
+ {
+ Recibos.Add(value);
+ }
+ if (RecibosFiltrados.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id))
+ {
+ DomainBase.Copy<Recibo, Recibo>(RecibosFiltrados.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value);
+ }
+ else
+ {
+ RecibosFiltrados.Add(value);
+ }
+ RecibosFiltrados = new ObservableCollection<Recibo>(RecibosFiltrados);
+ WorkOnSelectedRecibo(value, registrar: false);
+ Alterar(alterar: false);
+ ToggleSnackBar("RECIBO SALVO COM SUCESSO");
+ return null;
+ }
+
+ public async void Excluir()
+ {
+ if (SelectedRecibo != null && ((DomainBase)SelectedRecibo).Id != 0L && await ShowMessage("DESEJA REALMENTE EXCLUIR O RECIBO PERMANENTEMENTE?", "SIM", "NÃO"))
+ {
+ Loading(isLoading: true);
+ if (!(await _servico.Delete(SelectedRecibo)))
+ {
+ Loading(isLoading: false);
+ return;
+ }
+ ReciboViewModel reciboViewModel = this;
+ string descricao = $"EXCLUIU RECIBO DE NÚMERO \"{((DomainBase)SelectedRecibo).Id}\"";
+ long id = ((DomainBase)SelectedRecibo).Id;
+ TipoTela? tela = (TipoTela)42;
+ object[] obj = new object[9]
+ {
+ SelectedRecibo.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Tipo.Value) ?? "") : "-",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ TipoPagamento? pagamento = SelectedRecibo.Pagamento;
+ obj[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null);
+ obj[2] = SelectedRecibo.Valor;
+ obj[3] = SelectedRecibo.DataRecibo;
+ obj[4] = SelectedRecibo.Pagante;
+ obj[5] = SelectedRecibo.DocumentoPagante;
+ obj[6] = SelectedRecibo.Recebedor;
+ obj[7] = SelectedRecibo.DocumentoRecebedor;
+ obj[8] = SelectedRecibo.Referente;
+ reciboViewModel.RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj));
+ await SelecionaRecibo();
+ Loading(isLoading: false);
+ ToggleSnackBar("RECIBO EXCLUÍDO COM SUCESSO");
+ }
+ }
+
+ public void CancelarAlteracao()
+ {
+ if (CancelRecibo != null && Recibos.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id))
+ {
+ DomainBase.Copy<Recibo, Recibo>(Recibos.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id), CancelRecibo);
+ if (RecibosFiltrados.Count > 0 && RecibosFiltrados.Any((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id))
+ {
+ DomainBase.Copy<Recibo, Recibo>(RecibosFiltrados.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id), CancelRecibo);
+ }
+ else
+ {
+ RecibosFiltrados.Add(CancelRecibo);
+ }
+ RecibosFiltrados = new ObservableCollection<Recibo>(RecibosFiltrados);
+ SelectedRecibo = RecibosFiltrados.First((Recibo x) => ((DomainBase)x).Id == ((DomainBase)CancelRecibo).Id);
+ }
+ else
+ {
+ Incluir();
+ }
+ Alterar(alterar: false);
+ }
+
+ private bool IsImage(string extensao)
+ {
+ if (extensao == null)
+ {
+ return false;
+ }
+ if (extensao.ToLower().Contains("jpg"))
+ {
+ return true;
+ }
+ if (extensao.ToLower().Contains("jpeg"))
+ {
+ return true;
+ }
+ if (extensao.ToLower().Contains("png"))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public async void Print()
+ {
+ Recibo selectedRecibo = SelectedRecibo;
+ if (((selectedRecibo != null) ? selectedRecibo.Referente : null) == null || SelectedRecibo.Recebedor == null)
+ {
+ return;
+ }
+ ArquivoDigital arquivo = null;
+ List<IndiceArquivoDigital> list = await ArquivoDigitalServico.BuscarPorTipo((TipoArquivoDigital)13, ((DomainBase)Recursos.Empresa).Id);
+ if (list != null && list.Any((IndiceArquivoDigital x) => x.Descricao == "LOGO"))
+ {
+ IndiceArquivoDigital? obj = ((IEnumerable<IndiceArquivoDigital>)list).FirstOrDefault((Func<IndiceArquivoDigital, bool>)((IndiceArquivoDigital x) => x.Descricao == "LOGO"));
+ long? num = ((obj != null) ? new long?(obj.IdArquivoDigital) : null);
+ IndiceArquivoDigital? obj2 = ((IEnumerable<IndiceArquivoDigital>)list).FirstOrDefault((Func<IndiceArquivoDigital, bool>)((IndiceArquivoDigital x) => x.Descricao == "LOGO"));
+ string banco = ((obj2 != null) ? obj2.Bd : null);
+ if (num.HasValue)
+ {
+ arquivo = await ArquivoDigitalServico.BuscarPorId(num.Value, banco);
+ }
+ }
+ ArquivoDigital obj3 = arquivo;
+ byte[] array = ((obj3 != null) ? obj3.Arquivo : null);
+ string image = "";
+ if (array != null && array.Length != 0)
+ {
+ ReciboViewModel reciboViewModel = this;
+ ArquivoDigital obj4 = arquivo;
+ if (reciboViewModel.IsImage((obj4 != null) ? obj4.Extensao : null))
+ {
+ ArquivoDigital obj5 = arquivo;
+ image = GetImage(array, (obj5 != null) ? obj5.Extensao : null);
+ }
+ }
+ string longDatePattern = new CultureInfo("pt-PT", useUserOverride: false).DateTimeFormat.LongDatePattern;
+ string data = SelectedRecibo.DataRecibo?.ToString(longDatePattern, new CultureInfo("pt-PT"));
+ int vias = ((!(await ShowMessage("DESEJA IMPRIMIR DUAS VIAS DO RECIBO?", "SIM", "NÃO"))) ? 1 : 2);
+ bool flag = !string.IsNullOrEmpty(image);
+ if (flag)
+ {
+ flag = await ShowMessage("DESEJA IMPRIMIR O LOGO DA CORRETORA NO RECIBO?\nPARA ADICIONAR UM LOGO, É NECESSÁRIO COLOCÁ-LO NO ARQUIVO\nDIGITAL NA TELA DE EMPRESA E FILIAIS COM DESCRIÇÃO \"LOGO\"", "SIM", "NÃO");
+ }
+ bool flag2 = flag;
+ string text = "<html><head><style type='text/css'>@page{size: A4; margin: 0cm}</style><title>RECIBO</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>";
+ for (int i = 0; i < vias; i++)
+ {
+ if (flag2)
+ {
+ text = text + "<div>" + image + "</div>";
+ text += "<div style='margin: 0px 100px 0px 100px; font-size: 20px;'>";
+ }
+ else
+ {
+ text += "<div style='margin: 50px 100px 50px 100px; font-size: 20px;'>";
+ }
+ text += $"<div style='text-align: right'><strong>N° {((DomainBase)SelectedRecibo).Id}</strong></div><br>";
+ text += "<strong>R E C I B O</strong><br><br>";
+ if ((int)SelectedRecibo.Tipo.GetValueOrDefault() == 1)
+ {
+ string text2 = ((SelectedRecibo.DocumentoRecebedor == null || SelectedRecibo.DocumentoRecebedor.Clear().Length < 12) ? "EU" : "A");
+ string text3 = ((SelectedRecibo.DocumentoRecebedor == null || SelectedRecibo.DocumentoRecebedor.Clear().Length < 12) ? "CPF" : "CNPJ");
+ string text4 = ((text2 == "EU") ? "O" : "A");
+ string text5 = ((text2 == "EU") ? "RECEBI" : "RECEBEU");
+ text += $"PELO PRESENTE, {text2}, <strong>{SelectedRecibo.Recebedor}</strong>, INSCRIT{text4} NO {text3} SOB Nº <strong>{SelectedRecibo.DocumentoRecebedor}</strong>, DECLAR{text4} QUE {text5}, NA DATA DE HOJE, <strong>{SelectedRecibo.DataRecibo:dd/MM/yyyy HH:mm}</strong>, O VALOR DE <strong>R$ {SelectedRecibo.Valor:0.00}</strong> POR MEIO DE <strong>{ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Pagamento)}</strong>, DE <strong>{SelectedRecibo.Pagante}</strong>, INSCRITO NO CPF/CNPJ SOB Nº <strong>{SelectedRecibo.DocumentoPagante}</strong>, REFERENTE À(AO) <strong>{SelectedRecibo.Referente.ToUpper()}</strong>. DANDO-LHE POR ESTE RECIBO A DEVIDA QUITAÇÃO.<br>";
+ text = text + "<strong>" + ((EnderecoBase)Recursos.Empresa).Cidade + ", " + data?.ToUpper() + ".</strong><br><br>";
+ text = text + "_________________________________<br><strong>ASSINATURA </strong>" + SelectedRecibo.Recebedor + "<br>" + SelectedRecibo.DocumentoRecebedor;
+ }
+ else
+ {
+ string text6 = ((SelectedRecibo.DocumentoPagante == null || SelectedRecibo.DocumentoPagante.Clear().Length < 12) ? "EU" : "A");
+ string text7 = ((SelectedRecibo.DocumentoPagante == null || SelectedRecibo.DocumentoPagante.Clear().Length < 12) ? "CPF" : "CNPJ");
+ string text8 = ((text6 == "EU") ? "O" : "A");
+ string text9 = ((text6 == "EU") ? "PAGUEI" : "PAGOU");
+ text += $"PELO PRESENTE, {text6}, <strong>{SelectedRecibo.Pagante}</strong>, INSCRIT{text8} NO {text7} SOB Nº <strong>{SelectedRecibo.DocumentoPagante}</strong>, DECLAR{text8} QUE {text9}, NA DATA DE HOJE, <strong>{SelectedRecibo.DataRecibo:dd/MM/yyyy HH:mm}</strong>, O VALOR DE <strong>R$ {SelectedRecibo.Valor:0.00}</strong> POR MEIO DE <strong>{ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Pagamento)}</strong>, PARA <strong>{SelectedRecibo.Recebedor}</strong>, INSCRITO NO CPF/CNPJ SOB Nº <strong>{SelectedRecibo.DocumentoRecebedor}</strong>, REFERENTE À(AO) <strong>{SelectedRecibo.Referente.ToUpper()}</strong>. DANDO-LHE POR ESTE RECIBO A DEVIDA QUITAÇÃO.<br>";
+ text = text + "<br><strong>" + ((EnderecoBase)Recursos.Empresa).Cidade + ", " + data?.ToUpper() + ".</strong><br><br>";
+ text = text + "_________________________________<br><strong>ASSINATURA </strong>" + SelectedRecibo.Recebedor + "<br>" + SelectedRecibo.DocumentoRecebedor;
+ }
+ text += "<hr /></div>";
+ }
+ text += "<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 text10 = $"{tempPath}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html";
+ StreamWriter streamWriter = new StreamWriter(text10, append: true, Encoding.UTF8);
+ streamWriter.Write(text);
+ streamWriter.Close();
+ Process.Start(text10);
+ ReciboViewModel reciboViewModel2 = this;
+ string descricao = $"IMPRIMIU O RECIBO DE NÚMERO \"{((DomainBase)SelectedRecibo).Id}\"";
+ long id = ((DomainBase)SelectedRecibo).Id;
+ TipoTela? tela = (TipoTela)42;
+ object[] obj6 = new object[9]
+ {
+ SelectedRecibo.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)SelectedRecibo.Tipo.Value) ?? "") : "-",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ TipoPagamento? pagamento = SelectedRecibo.Pagamento;
+ obj6[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null);
+ obj6[2] = SelectedRecibo.Valor;
+ obj6[3] = SelectedRecibo.DataRecibo;
+ obj6[4] = SelectedRecibo.Pagante;
+ obj6[5] = SelectedRecibo.DocumentoPagante;
+ obj6[6] = SelectedRecibo.Recebedor;
+ obj6[7] = SelectedRecibo.DocumentoRecebedor;
+ obj6[8] = SelectedRecibo.Referente;
+ reciboViewModel2.RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj6));
+ }
+
+ private static string GetImage(byte[] bytes, string extensao)
+ {
+ try
+ {
+ Image val = Image.FromStream((Stream)new MemoryStream(bytes));
+ string text = (extensao.ToUpper().Contains("JPG") ? ("data:image/jpeg;base64," + Convert.ToBase64String(bytes, Base64FormattingOptions.None)) : ("data:image/png;base64," + Convert.ToBase64String(bytes, Base64FormattingOptions.None)));
+ return "<img style=\"WIDTH=" + val.Width + "; HEIGHT=" + val.Height + "; max-height: 250px; max-width: 250px; margin-bottom: 0px; margin-left: 100px; margin-top: 0px;\" src=\"" + text + "\"/>";
+ }
+ catch (Exception)
+ {
+ return "";
+ }
+ }
+
+ private void WorkOnSelectedRecibo(Recibo value, bool registrar = true)
+ {
+ //IL_002e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0069: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0070: Invalid comparison between Unknown and I4
+ //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00de: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0113: Unknown result type (might be due to invalid IL or missing references)
+ CancelRecibo = (Recibo)((value == null || ((DomainBase)value).Id == 0L) ? ((object)CancelRecibo) : ((object)(Recibo)((DomainBase)value).Clone()));
+ if (value == null || ((DomainBase)value).Id == 0L || (LastAccessId == ((DomainBase)value).Id && (int)LastAccessTela == 42))
+ {
+ return;
+ }
+ if (registrar)
+ {
+ string descricao = $"ACESSOU RECIBO DE NÚMERO \"{((DomainBase)value).Id}\"";
+ long id = ((DomainBase)value).Id;
+ TipoTela? tela = (TipoTela)42;
+ object[] obj = new object[9]
+ {
+ value.Tipo.HasValue ? (ValidationHelper.GetDescription((Enum)(object)value.Tipo.Value) ?? "") : "-",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ TipoPagamento? pagamento = value.Pagamento;
+ obj[1] = (pagamento.HasValue ? ValidationHelper.GetDescription((Enum)(object)pagamento.GetValueOrDefault()) : null);
+ obj[2] = value.Valor;
+ obj[3] = value.DataRecibo;
+ obj[4] = value.Pagante;
+ obj[5] = value.DocumentoPagante;
+ obj[6] = value.Recebedor;
+ obj[7] = value.DocumentoRecebedor;
+ obj[8] = value.Referente;
+ RegistrarAcao(descricao, id, tela, string.Format("TIPO: {0}\nPAGAMENTO: {1}\nVALOR: {2:c}\nDATA RECIBO: {3:G}\nPAGANTE: {4}, {5}\nRECEBEDOR: {6}, {7}\nREFERENTE: \"{8}\"", obj));
+ }
+ LastAccessId = ((DomainBase)value).Id;
+ LastAccessTela = (TipoTela)42;
+ Recibo selectedRecibo = SelectedRecibo;
+ if (((selectedRecibo != null) ? new long?(((DomainBase)selectedRecibo).Id) : null) != ((DomainBase)value).Id)
+ {
+ SelectedRecibo = ((IEnumerable<Recibo>)RecibosFiltrados).FirstOrDefault((Func<Recibo, bool>)((Recibo x) => ((DomainBase)x).Id == ((DomainBase)value).Id));
+ }
+ }
+}