From 225aa1499e37faf9d38257caabbadc68d78b427e Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 12:29:41 -0300 Subject: decompiler.com --- .../InfoViewModel.cs | 175 +++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs (limited to 'Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs') diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs new file mode 100644 index 0000000..20fb507 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Drawer; + +public class InfoViewModel : BaseViewModel +{ + private ObservableCollection _contatos = new ObservableCollection(); + + private ObservableCollection _itens = new ObservableCollection(); + + private ObservableCollection _parcelas = new ObservableCollection(); + + private Documento _documento; + + private Visibility _ocultarInfos; + + private bool _carregando; + + public ObservableCollection Contatos + { + get + { + return _contatos; + } + set + { + _contatos = value; + OnPropertyChanged("Contatos"); + } + } + + public ObservableCollection Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public ObservableCollection Parcelas + { + get + { + return _parcelas; + } + set + { + _parcelas = value; + OnPropertyChanged("Parcelas"); + } + } + + public Documento Documento + { + get + { + return _documento; + } + set + { + _documento = value; + OnPropertyChanged("Documento"); + } + } + + public Visibility OcultarInfos + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _ocultarInfos; + } + 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) + _ocultarInfos = value; + OnPropertyChanged("OcultarInfos"); + } + } + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + base.IsEnabled = !value; + base.EnableMenu = !value; + OnPropertyChanged("Carregando"); + } + } + + public InfoViewModel(Documento documento, bool ocultarInfos) + { + Documento = documento; + OcultarInfos = (Visibility)(ocultarInfos ? 2 : 0); + Seleciona(); + } + + public async void Seleciona() + { + Carregando = true; + if (Documento != null) + { + Documento = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)Documento).Id); + } + if ((int)OcultarInfos == 0 && Documento != null) + { + ObservableCollection observableCollection = await new ParcelaServico().BuscarParcelasAsync(((DomainBase)Documento).Id); + Parcelas = (((int)Documento.TipoRecebimento.GetValueOrDefault() == 2) ? new ObservableCollection(observableCollection.OrderByDescending((Parcela x) => x.VigenciaIncial)) : observableCollection); + } + Documento documento = Documento; + if (((documento != null) ? documento.Controle : null) != null) + { + Itens = await new ItemServico().BuscarItens(((DomainBase)Documento.Controle).Id, (StatusItem)0); + List contatos = new List(); + ClienteServico servico = new ClienteServico(); + if (Documento.Controle.Cliente != null) + { + ObservableCollection telefones = await servico.BuscarTelefonesAsync(((DomainBase)Documento.Controle.Cliente).Id); + ObservableCollection observableCollection2 = await servico.BuscarEmailsAsync(((DomainBase)Documento.Controle.Cliente).Id); + if (telefones != null) + { + contatos.AddRange(((IEnumerable)telefones).Select((Func)((ClienteTelefone x) => new Contato + { + Tipo = (TipoContato)0, + TipoTelefone = ((TelefoneBase)x).Tipo.GetValueOrDefault((TipoTelefone)1), + Numero = ((TelefoneBase)x).Prefixo + " " + ((TelefoneBase)x).Numero + })).Take(2).ToList()); + } + if (observableCollection2 != null) + { + contatos.AddRange(((IEnumerable)observableCollection2).Select((Func)((ClienteEmail x) => new Contato + { + Tipo = (TipoContato)1, + TipoTelefone = null, + Numero = ((EmailBase)x).Email + })).Take(1).ToList()); + } + } + Contatos = new ObservableCollection(contatos); + } + Carregando = false; + } + + public string GerarObs(Documento doc) + { + if (doc.Tipo != 0) + { + return $"CLIENTE: {doc.Controle.Cliente.Nome}{Environment.NewLine}CÓDIGO: {((DomainBase)doc).Id}{Environment.NewLine}PROPOSTA: {doc.Proposta}{Environment.NewLine}APÓLICE: {doc.Apolice}{Environment.NewLine}PROPOSTA DE ENDOSSO: {doc.PropostaEndosso}{Environment.NewLine}ENDOSSO: {doc.Endosso}"; + } + return $"CLIENTE: {doc.Controle.Cliente.Nome}{Environment.NewLine}CÓDIGO: {((DomainBase)doc).Id}{Environment.NewLine}PROPOSTA: {doc.Proposta}{Environment.NewLine}APÓLICE: {doc.Apolice}"; + } +} -- cgit v1.2.3