summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.ViewModels.Drawer
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Drawer')
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs248
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs406
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs1229
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs164
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs2773
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs314
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/InfoViewModel.cs175
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs97
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/LogEmailViewModel.cs161
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs36
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs1458
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs212
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs209
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs1704
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs1064
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs306
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs490
-rw-r--r--Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs258
18 files changed, 11304 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs
new file mode 100644
index 0000000..06cd656
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/AdiantamentoViewModel.cs
@@ -0,0 +1,248 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Assinador.Infrastructure.Helpers;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class AdiantamentoViewModel : BaseSegurosViewModel
+{
+ private readonly AdiantamentoServico _servico;
+
+ private readonly Vendedor _selectedVendedor;
+
+ private bool _carregando;
+
+ private ObservableCollection<Adiantamento> _adiantamento = new ObservableCollection<Adiantamento>();
+
+ private Adiantamento _selectedAdiantamento = new Adiantamento();
+
+ private bool _logEnabled;
+
+ public Adiantamento CancelAdiantamento;
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public ObservableCollection<Adiantamento> Adiantamento
+ {
+ get
+ {
+ return _adiantamento;
+ }
+ set
+ {
+ _adiantamento = value;
+ OnPropertyChanged("Adiantamento");
+ }
+ }
+
+ public Adiantamento SelectedAdiantamento
+ {
+ get
+ {
+ return _selectedAdiantamento;
+ }
+ set
+ {
+ _selectedAdiantamento = value;
+ CancelAdiantamento = ((value != null && ((DomainBase)value).Id > 0) ? value : CancelAdiantamento);
+ VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null);
+ OnPropertyChanged("SelectedAdiantamento");
+ }
+ }
+
+ public bool LogEnabled
+ {
+ get
+ {
+ return _logEnabled;
+ }
+ set
+ {
+ _logEnabled = value;
+ OnPropertyChanged("LogEnabled");
+ }
+ }
+
+ public AdiantamentoViewModel(Vendedor vendedor)
+ {
+ //IL_000c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0016: Expected O, but got Unknown
+ _servico = new AdiantamentoServico();
+ Seleciona(vendedor);
+ _selectedVendedor = vendedor;
+ }
+
+ private async void Seleciona(Vendedor vendedor)
+ {
+ Loading(isLoading: true);
+ await PermissaoTela((TipoTela)15);
+ await SelecionaAdiantamento(vendedor);
+ Loading(isLoading: false);
+ }
+
+ public void SelecionaAdiantamento(Adiantamento adiantamento)
+ {
+ SelectedAdiantamento = adiantamento;
+ }
+
+ private async Task SelecionaAdiantamento(Vendedor vendedor)
+ {
+ Carregando = true;
+ List<Adiantamento> list = (from x in await new BaseServico().BuscarAdiantamentoAsync(vendedor)
+ orderby x.Pago, x.Valor
+ select x).ToList();
+ Adiantamento = new ObservableCollection<Adiantamento>(list);
+ if (Adiantamento.Count > 0)
+ {
+ SelecionaAdiantamento(Adiantamento.First());
+ LogEnabled = true;
+ }
+ else
+ {
+ SelectedAdiantamento = new Adiantamento();
+ LogEnabled = false;
+ Alterar(alterar: false);
+ VerificarEnables(((DomainBase)SelectedAdiantamento).Id);
+ base.EnableMenu = false;
+ }
+ Carregando = false;
+ }
+
+ public void Incluir()
+ {
+ //IL_0000: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0006: Expected O, but got Unknown
+ Adiantamento selectedAdiantamento = new Adiantamento();
+ SelectedAdiantamento = selectedAdiantamento;
+ Alterar(alterar: true);
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar()
+ {
+ if (string.IsNullOrWhiteSpace(SelectedAdiantamento.Historico))
+ {
+ return new List<KeyValuePair<string, string>>
+ {
+ new KeyValuePair<string, string>("Historico|HISTÓRICO", "OBRIGATÓRIO")
+ };
+ }
+ SelectedAdiantamento.Vendedor = _selectedVendedor;
+ string acao = ((((DomainBase)SelectedAdiantamento).Id == 0L) ? "INCLUIU" : "ALTEROU");
+ Adiantamento value = await _servico.Save(SelectedAdiantamento);
+ if (!_servico.Sucesso)
+ {
+ return null;
+ }
+ RegistrarAcao(acao + " ADIANTAMENTO DO VENDEDOR \"" + value.Vendedor.Nome + "\"", ((DomainBase)value).Id, (TipoTela)36, string.Format("ID: {0}\nDATA: {1}\nVALOR: {2:c}\nTIPO PAGAMENTO: {3}\nPAGO: {4}", ((DomainBase)value).Id, (!value.Data.HasValue) ? "-" : $"{value.Data:d}", value.Valor, Functions.GetDescription((Enum)(object)value.TipoPagamento), value.Pago ? "SIM" : "NÃO"));
+ if (Adiantamento.Any((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)value).Id))
+ {
+ DomainBase.Copy<Adiantamento, Adiantamento>(Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value);
+ }
+ else
+ {
+ Adiantamento.Add(value);
+ }
+ Adiantamento = new ObservableCollection<Adiantamento>(Adiantamento);
+ SelectedAdiantamento = Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)value).Id);
+ LogEnabled = true;
+ Alterar(alterar: false);
+ return null;
+ }
+
+ public void CancelarAlteracao()
+ {
+ Carregando = true;
+ if (CancelAdiantamento != null && Adiantamento.Any((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)CancelAdiantamento).Id))
+ {
+ DomainBase.Copy<Adiantamento, Adiantamento>(Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)CancelAdiantamento).Id), CancelAdiantamento);
+ SelectedAdiantamento = Adiantamento.First((Adiantamento x) => ((DomainBase)x).Id == ((DomainBase)CancelAdiantamento).Id);
+ }
+ Alterar(alterar: false);
+ Carregando = false;
+ }
+
+ public async Task<bool> Excluir()
+ {
+ if (SelectedAdiantamento == null || ((DomainBase)SelectedAdiantamento).Id == 0L)
+ {
+ return false;
+ }
+ if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO")))
+ {
+ return false;
+ }
+ Carregando = true;
+ if (!(await _servico.Delete(SelectedAdiantamento)))
+ {
+ return false;
+ }
+ RegistrarAcao("EXCLUIU O ADIANTAMENTO DO VENDEDOR \"" + SelectedAdiantamento.Vendedor.Nome + "\"", ((DomainBase)SelectedAdiantamento).Id, (TipoTela)36, string.Format("ID: {0}\nDATA: {1}\nVALOR: {2:c}\nTIPO PAGAMENTO: {3}\nPAGO: {4}", ((DomainBase)SelectedAdiantamento).Id, (!SelectedAdiantamento.Data.HasValue) ? "-" : $"{SelectedAdiantamento.Data:d}", SelectedAdiantamento.Valor, Functions.GetDescription((Enum)(object)SelectedAdiantamento.TipoPagamento), SelectedAdiantamento.Pago ? "SIM" : "NÃO"));
+ int num = Adiantamento.IndexOf(SelectedAdiantamento);
+ Adiantamento.Remove(SelectedAdiantamento);
+ Adiantamento.Remove(SelectedAdiantamento);
+ Adiantamento = new ObservableCollection<Adiantamento>(Adiantamento);
+ if (Adiantamento.Count > 0)
+ {
+ SelectedAdiantamento = ((num < Adiantamento.Count) ? Adiantamento.ElementAt(num) : Adiantamento.Last());
+ LogEnabled = true;
+ }
+ else
+ {
+ SelectedAdiantamento = new Adiantamento();
+ Alterar(alterar: false);
+ base.EnableMenu = false;
+ LogEnabled = false;
+ }
+ if (Adiantamento.Count > 0)
+ {
+ SelecionaAdiantamento((num < Adiantamento.Count) ? Adiantamento.ElementAt(num) : Adiantamento.Last());
+ LogEnabled = true;
+ }
+ else
+ {
+ SelectedAdiantamento = new Adiantamento();
+ LogEnabled = false;
+ Alterar(alterar: false);
+ }
+ Carregando = false;
+ return true;
+ }
+
+ public async Task CarregarAdiantamento(int index)
+ {
+ Carregando = true;
+ Adiantamento = new ObservableCollection<Adiantamento>(await _servico.BuscarAdiantamentos(((DomainBase)_selectedVendedor).Id, index != 0));
+ if (Adiantamento != null && Adiantamento.Count > 0)
+ {
+ SelectedAdiantamento = Adiantamento.First();
+ LogEnabled = true;
+ }
+ else
+ {
+ LogEnabled = false;
+ }
+ Carregando = false;
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs
new file mode 100644
index 0000000..57aebe2
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/AgendaViewModel.cs
@@ -0,0 +1,406 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class AgendaViewModel : BaseSegurosViewModel
+{
+ private readonly AgendaServico _servico;
+
+ private Agenda _selectedAgenda;
+
+ private ObservableCollection<AgendaTelefone> _telefones = new ObservableCollection<AgendaTelefone>();
+
+ private ObservableCollection<AgendaEmail> _emails = new ObservableCollection<AgendaEmail>();
+
+ private long _ultimoId;
+
+ public Agenda CancelAgenda;
+
+ private ObservableCollection<Agenda> _agendasFiltradas = new ObservableCollection<Agenda>();
+
+ private bool _carregando;
+
+ public Agenda SelectedAgenda
+ {
+ get
+ {
+ return _selectedAgenda;
+ }
+ set
+ {
+ _selectedAgenda = value;
+ VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null);
+ OnPropertyChanged("SelectedAgenda");
+ }
+ }
+
+ public ObservableCollection<AgendaTelefone> Telefones
+ {
+ get
+ {
+ return _telefones;
+ }
+ set
+ {
+ _telefones = value;
+ OnPropertyChanged("Telefones");
+ }
+ }
+
+ public ObservableCollection<AgendaEmail> Emails
+ {
+ get
+ {
+ return _emails;
+ }
+ set
+ {
+ _emails = value;
+ OnPropertyChanged("Emails");
+ }
+ }
+
+ public ObservableCollection<Agenda> AgendasFiltradas
+ {
+ get
+ {
+ return _agendasFiltradas;
+ }
+ set
+ {
+ _agendasFiltradas = value;
+ OnPropertyChanged("AgendasFiltradas");
+ }
+ }
+
+ public List<Agenda> Agendas { get; set; }
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public AgendaViewModel()
+ {
+ _servico = new AgendaServico();
+ Seleciona();
+ }
+
+ private async void Seleciona()
+ {
+ Loading(isLoading: true);
+ await PermissaoTela((TipoTela)34);
+ await SelecionaAgendas();
+ Loading(isLoading: false);
+ }
+
+ private async Task SelecionaAgendas()
+ {
+ Carregando = true;
+ Agendas = (await new BaseServico().BuscarAgendasAsync()).OrderBy((Agenda x) => x.Nome).ToList();
+ AgendasFiltradas = new ObservableCollection<Agenda>(Agendas);
+ SelectedAgenda = (Agenda)((AgendasFiltradas.Count > 0) ? ((object)AgendasFiltradas.First()) : ((object)new Agenda()));
+ Carregando = false;
+ }
+
+ public void IncluirTelefone()
+ {
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0021: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003a: Expected O, but got Unknown
+ if (SelectedAgenda != null)
+ {
+ if (Telefones == null)
+ {
+ Telefones = new ObservableCollection<AgendaTelefone>();
+ }
+ AgendaTelefone item = new AgendaTelefone
+ {
+ Agenda = SelectedAgenda,
+ Tipo = (TipoTelefone)1
+ };
+ Telefones.Add(item);
+ OnPropertyChanged("IncluirTelefone");
+ }
+ }
+
+ public void ExcluirEmail(AgendaEmail email)
+ {
+ Emails.Remove(email);
+ }
+
+ public void IncluirEmail()
+ {
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0021: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002e: Expected O, but got Unknown
+ if (SelectedAgenda != null)
+ {
+ if (Emails == null)
+ {
+ Emails = new ObservableCollection<AgendaEmail>();
+ }
+ AgendaEmail item = new AgendaEmail
+ {
+ Agenda = SelectedAgenda
+ };
+ Emails.Add(item);
+ OnPropertyChanged("IncluirEmail");
+ }
+ }
+
+ public void ExcluirTelefone(AgendaTelefone telefone)
+ {
+ Telefones.Remove(telefone);
+ }
+
+ public void Incluir()
+ {
+ //IL_001a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0024: Expected O, but got Unknown
+ //IL_002b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0030: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_004d: Expected O, but got Unknown
+ //IL_0059: Unknown result type (might be due to invalid IL or missing references)
+ //IL_005e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_006f: Expected O, but got Unknown
+ if (SelectedAgenda != null)
+ {
+ _ultimoId = ((DomainBase)SelectedAgenda).Id;
+ }
+ SelectedAgenda = new Agenda();
+ Telefones = new ObservableCollection<AgendaTelefone>
+ {
+ new AgendaTelefone
+ {
+ Agenda = SelectedAgenda,
+ Tipo = (TipoTelefone)1
+ }
+ };
+ Emails = new ObservableCollection<AgendaEmail>
+ {
+ new AgendaEmail
+ {
+ Agenda = SelectedAgenda
+ }
+ };
+ Alterar(alterar: true);
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar()
+ {
+ List<KeyValuePair<string, string>> list = SelectedAgenda.Validate();
+ List<AgendaTelefone> list2 = Telefones.Where((AgendaTelefone x) => !string.IsNullOrEmpty(((TelefoneBase)x).Numero)).ToList();
+ List<AgendaEmail> list3 = Emails.Where((AgendaEmail x) => !string.IsNullOrEmpty(((EmailBase)x).Email)).ToList();
+ foreach (AgendaTelefone item in list2)
+ {
+ list.AddRange(item.Validate());
+ }
+ foreach (AgendaEmail item2 in list3)
+ {
+ list.AddRange(item2.Validate());
+ }
+ if (list.Count > 0)
+ {
+ return list;
+ }
+ SelectedAgenda.Telefones = new ObservableCollection<AgendaTelefone>(list2);
+ SelectedAgenda.Emails = new ObservableCollection<AgendaEmail>(list3);
+ if (((DomainBase)SelectedAgenda).Id == 0L)
+ {
+ SelectedAgenda = await _servico.Save(SelectedAgenda);
+ if (!_servico.Sucesso)
+ {
+ return null;
+ }
+ Telefones = new ObservableCollection<AgendaTelefone>(SelectedAgenda.Telefones);
+ Emails = new ObservableCollection<AgendaEmail>(SelectedAgenda.Emails);
+ Agendas.Add(SelectedAgenda);
+ AgendasFiltradas.Insert((_ultimoId != 0L) ? AgendasFiltradas.IndexOf(AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId)) : 0, SelectedAgenda);
+ }
+ else
+ {
+ SelectedAgenda = await _servico.Save(SelectedAgenda);
+ if (!_servico.Sucesso)
+ {
+ return null;
+ }
+ Telefones = new ObservableCollection<AgendaTelefone>(SelectedAgenda.Telefones);
+ Emails = new ObservableCollection<AgendaEmail>(SelectedAgenda.Emails);
+ DomainBase.Copy<Agenda, Agenda>(Agendas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id), SelectedAgenda);
+ if (AgendasFiltradas.Count > 0 && AgendasFiltradas.Any((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id))
+ {
+ DomainBase.Copy<Agenda, Agenda>(AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id), SelectedAgenda);
+ }
+ else
+ {
+ AgendasFiltradas.Add(SelectedAgenda);
+ }
+ }
+ AgendasFiltradas = new ObservableCollection<Agenda>(AgendasFiltradas);
+ SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)SelectedAgenda).Id);
+ Alterar(alterar: false);
+ return null;
+ }
+
+ public void CancelarAlteracao()
+ {
+ //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d6: Expected O, but got Unknown
+ //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ee: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ff: Expected O, but got Unknown
+ //IL_010b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0110: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0121: Expected O, but got Unknown
+ Carregando = true;
+ if (((DomainBase)SelectedAgenda).Id == 0L)
+ {
+ if (AgendasFiltradas.Count > 0 && AgendasFiltradas.Any((Agenda x) => ((DomainBase)x).Id == _ultimoId))
+ {
+ SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId);
+ }
+ else
+ {
+ if (Agendas.Count <= 0 || !Agendas.Any((Agenda x) => ((DomainBase)x).Id == _ultimoId))
+ {
+ SelectedAgenda = new Agenda();
+ Telefones = new ObservableCollection<AgendaTelefone>
+ {
+ new AgendaTelefone
+ {
+ Agenda = SelectedAgenda,
+ Tipo = (TipoTelefone)1
+ }
+ };
+ Emails = new ObservableCollection<AgendaEmail>
+ {
+ new AgendaEmail
+ {
+ Agenda = SelectedAgenda
+ }
+ };
+ Alterar(alterar: false);
+ Carregando = false;
+ return;
+ }
+ AgendasFiltradas.Add(Agendas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId));
+ SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == _ultimoId);
+ }
+ }
+ else
+ {
+ DomainBase.Copy<Agenda, Agenda>(Agendas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id), CancelAgenda);
+ if (AgendasFiltradas.Count > 0 && AgendasFiltradas.Any((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id))
+ {
+ DomainBase.Copy<Agenda, Agenda>(AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id), CancelAgenda);
+ }
+ else
+ {
+ AgendasFiltradas.Add(CancelAgenda);
+ }
+ AgendasFiltradas = new ObservableCollection<Agenda>(AgendasFiltradas);
+ SelectedAgenda = AgendasFiltradas.First((Agenda x) => ((DomainBase)x).Id == ((DomainBase)CancelAgenda).Id);
+ }
+ Alterar(alterar: false);
+ Carregando = false;
+ }
+
+ public async Task<bool> Excluir()
+ {
+ if (SelectedAgenda == null || ((DomainBase)SelectedAgenda).Id == 0L)
+ {
+ return false;
+ }
+ if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO")))
+ {
+ return false;
+ }
+ Carregando = true;
+ if (!(await _servico.Delete(SelectedAgenda)))
+ {
+ Alterar(alterar: false);
+ Carregando = false;
+ return false;
+ }
+ int num = AgendasFiltradas.IndexOf(SelectedAgenda);
+ Agendas.Remove(SelectedAgenda);
+ AgendasFiltradas.Remove(SelectedAgenda);
+ AgendasFiltradas = new ObservableCollection<Agenda>(AgendasFiltradas);
+ if (AgendasFiltradas.Count > 0)
+ {
+ if (num >= AgendasFiltradas.Count)
+ {
+ await SelecionaAgenda(AgendasFiltradas.Last());
+ }
+ else
+ {
+ await SelecionaAgenda(AgendasFiltradas.ElementAt(num));
+ }
+ }
+ else
+ {
+ SelectedAgenda = new Agenda();
+ Telefones = new ObservableCollection<AgendaTelefone>();
+ Emails = new ObservableCollection<AgendaEmail>();
+ Alterar(alterar: false);
+ }
+ Carregando = false;
+ return true;
+ }
+
+ internal async Task<List<Agenda>> Filtrar(string value)
+ {
+ return await Task.Run(() => FiltrarAgenda(value));
+ }
+
+ public List<Agenda> FiltrarAgenda(string filter)
+ {
+ AgendasFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Agenda>(Agendas) : new ObservableCollection<Agenda>(from x in Agendas
+ where ValidationHelper.RemoveDiacritics(x.Nome.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))
+ orderby x.Nome
+ select x));
+ return AgendasFiltradas.ToList();
+ }
+
+ public async Task SelecionaAgenda(Agenda agenda = null)
+ {
+ Carregando = true;
+ SelectedAgenda = ((agenda == null) ? AgendasFiltradas.FirstOrDefault() : ((IEnumerable<Agenda>)AgendasFiltradas).FirstOrDefault((Func<Agenda, bool>)((Agenda x) => ((DomainBase)x).Id == ((DomainBase)agenda).Id)));
+ if (SelectedAgenda != null)
+ {
+ Emails = await _servico.BuscarEmailsAsync(((DomainBase)SelectedAgenda).Id);
+ Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)SelectedAgenda).Id);
+ }
+ else
+ {
+ Emails = null;
+ Telefones = null;
+ }
+ Carregando = false;
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs
new file mode 100644
index 0000000..a25f375
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ArquivoDigitalViewModel.cs
@@ -0,0 +1,1229 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using Assinador.Model.Domain;
+using CsQuery.ExtensionMethods.Internal;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Application.Views.Ferramentas;
+using Gestor.Common.Security;
+using Gestor.Common.Validation;
+using Gestor.Model.API;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Financeiro;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.MalaDireta;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.Helper;
+using Gestor.Model.License;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class ArquivoDigitalViewModel : BaseSegurosViewModel
+{
+ private readonly ClienteServico _servico;
+
+ private Visibility _assinarVisibility = (Visibility)2;
+
+ private Visibility _visibilityWhatsApp = (Visibility)2;
+
+ private bool _carregando;
+
+ private bool _activated = true;
+
+ private bool _adDocumento;
+
+ private Visibility _adDocumentoVisibility;
+
+ private bool _isVisibleSalvar;
+
+ private Visibility _enviarSelecionadosVisibility;
+
+ private Cliente _selectedCliente = new Cliente();
+
+ private ObservableCollection<ClienteTelefone> _telefones = new ObservableCollection<ClienteTelefone>();
+
+ private ObservableCollection<IndiceArquivoDigital> _arquivos = new ObservableCollection<IndiceArquivoDigital>();
+
+ private ObservableCollection<IndiceArquivoDigital> _arquivosTela = new ObservableCollection<IndiceArquivoDigital>();
+
+ private IndiceArquivoDigital _selectedArquivo = new IndiceArquivoDigital();
+
+ private ObservableCollection<ArquivoDigital> _arquivosAnexados = new ObservableCollection<ArquivoDigital>();
+
+ private ArquivoDigital _selectedAnexado = new ArquivoDigital();
+
+ private string _titulo = "";
+
+ private ObservableCollection<ClienteEmail> _emails = new ObservableCollection<ClienteEmail>();
+
+ private string _assunto;
+
+ private string _corpo;
+
+ private string _nome;
+
+ private string _documento;
+
+ private string _email;
+
+ private string _licencas;
+
+ private string _assinadorKey;
+
+ private FiltroArquivoDigital Filtro { get; }
+
+ public Visibility AssinarVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _assinarVisibility;
+ }
+ 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)
+ _assinarVisibility = value;
+ OnPropertyChanged("AssinarVisibility");
+ }
+ }
+
+ public Visibility VisibilityWhatsApp
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _visibilityWhatsApp;
+ }
+ 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)
+ _visibilityWhatsApp = value;
+ OnPropertyChanged("VisibilityWhatsApp");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public bool Activated
+ {
+ get
+ {
+ return _activated;
+ }
+ set
+ {
+ _activated = value;
+ OnPropertyChanged("Activated");
+ }
+ }
+
+ public bool AdDocumento
+ {
+ get
+ {
+ return _adDocumento;
+ }
+ set
+ {
+ _adDocumento = value;
+ CarregarArquivos();
+ OnPropertyChanged("AdDocumento");
+ }
+ }
+
+ public Visibility AdDocumentoVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _adDocumentoVisibility;
+ }
+ 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)
+ _adDocumentoVisibility = value;
+ OnPropertyChanged("AdDocumentoVisibility");
+ }
+ }
+
+ public bool IsVisibleSalvar
+ {
+ get
+ {
+ return _isVisibleSalvar;
+ }
+ set
+ {
+ _isVisibleSalvar = value;
+ OnPropertyChanged("IsVisibleSalvar");
+ }
+ }
+
+ public Visibility EnviarSelecionadosVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _enviarSelecionadosVisibility;
+ }
+ set
+ {
+ //IL_000e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000f: Unknown result type (might be due to invalid IL or missing references)
+ _enviarSelecionadosVisibility = (Visibility)(Restricao((TipoRestricao)20) ? 2 : ((int)value));
+ OnPropertyChanged("EnviarSelecionadosVisibility");
+ }
+ }
+
+ public Cliente SelectedCliente
+ {
+ get
+ {
+ return _selectedCliente;
+ }
+ set
+ {
+ _selectedCliente = value;
+ OnPropertyChanged("SelectedCliente");
+ }
+ }
+
+ public ObservableCollection<ClienteTelefone> Telefones
+ {
+ get
+ {
+ return _telefones;
+ }
+ set
+ {
+ _telefones = value;
+ OnPropertyChanged("Telefones");
+ }
+ }
+
+ public ObservableCollection<IndiceArquivoDigital> Arquivos
+ {
+ get
+ {
+ return _arquivos;
+ }
+ set
+ {
+ _arquivos = value;
+ ArquivosTela = value;
+ OnPropertyChanged("Arquivos");
+ }
+ }
+
+ public ObservableCollection<IndiceArquivoDigital> ArquivosTela
+ {
+ get
+ {
+ return _arquivosTela;
+ }
+ set
+ {
+ _arquivosTela = value;
+ OnPropertyChanged("ArquivosTela");
+ }
+ }
+
+ public IndiceArquivoDigital SelectedArquivo
+ {
+ get
+ {
+ return _selectedArquivo;
+ }
+ set
+ {
+ _selectedArquivo = value;
+ OnPropertyChanged("SelectedArquivo");
+ }
+ }
+
+ public ObservableCollection<ArquivoDigital> ArquivosAnexados
+ {
+ get
+ {
+ return _arquivosAnexados;
+ }
+ set
+ {
+ _arquivosAnexados = value;
+ IsVisibleSalvar = value != null && value.Count > 0;
+ OnPropertyChanged("ArquivosAnexados");
+ }
+ }
+
+ public ArquivoDigital SelectedAnexado
+ {
+ get
+ {
+ return _selectedAnexado;
+ }
+ set
+ {
+ _selectedAnexado = value;
+ OnPropertyChanged("SelectedAnexado");
+ }
+ }
+
+ public string Titulo
+ {
+ get
+ {
+ return _titulo;
+ }
+ set
+ {
+ _titulo = value;
+ OnPropertyChanged("Titulo");
+ }
+ }
+
+ public ObservableCollection<ClienteEmail> Emails
+ {
+ get
+ {
+ return _emails;
+ }
+ set
+ {
+ _emails = value;
+ OnPropertyChanged("Emails");
+ }
+ }
+
+ public string Assunto
+ {
+ get
+ {
+ return _assunto;
+ }
+ set
+ {
+ _assunto = value;
+ OnPropertyChanged("Assunto");
+ }
+ }
+
+ public string Corpo
+ {
+ get
+ {
+ return _corpo;
+ }
+ set
+ {
+ _corpo = value;
+ OnPropertyChanged("Corpo");
+ }
+ }
+
+ public string Nome
+ {
+ get
+ {
+ return _nome;
+ }
+ set
+ {
+ _nome = value;
+ OnPropertyChanged("Nome");
+ }
+ }
+
+ public string Documento
+ {
+ get
+ {
+ return _documento;
+ }
+ set
+ {
+ _documento = value;
+ OnPropertyChanged("Documento");
+ }
+ }
+
+ public string Email
+ {
+ get
+ {
+ return _email;
+ }
+ set
+ {
+ _email = value?.Trim();
+ OnPropertyChanged("Email");
+ }
+ }
+
+ public string Licencas
+ {
+ get
+ {
+ return _licencas;
+ }
+ set
+ {
+ _licencas = value;
+ OnPropertyChanged("Licencas");
+ }
+ }
+
+ public ArquivoDigitalViewModel(FiltroArquivoDigital filtro)
+ {
+ //IL_0002: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0009: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0016: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0020: Expected O, but got Unknown
+ //IL_0042: Unknown result type (might be due to invalid IL or missing references)
+ //IL_004c: Expected O, but got Unknown
+ //IL_0058: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0062: Expected O, but got Unknown
+ //IL_0098: Unknown result type (might be due to invalid IL or missing references)
+ //IL_009e: Invalid comparison between Unknown and I4
+ //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a7: Invalid comparison between Unknown and I4
+ //IL_00c6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00cc: Invalid comparison between Unknown and I4
+ //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b0: Invalid comparison between Unknown and I4
+ //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d5: Invalid comparison between Unknown and I4
+ //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b9: Invalid comparison between Unknown and I4
+ //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00de: Invalid comparison between Unknown and I4
+ //IL_0108: Unknown result type (might be due to invalid IL or missing references)
+ //IL_010d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_010e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_015c: Expected I4, but got Unknown
+ Filtro = filtro;
+ _servico = new ClienteServico();
+ CarregarArquivos();
+ VisibilityWhatsApp = (Visibility)(((int)filtro.Tipo != 2 && (int)filtro.Tipo != 3 && (int)filtro.Tipo != 4 && (int)filtro.Tipo != 5) ? 2 : 0);
+ AdDocumentoVisibility = (Visibility)((((int)filtro.Tipo != 4 && (int)filtro.Tipo != 3 && (int)filtro.Tipo != 5) || !new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) ? 2 : 0);
+ base.EnableMenu = true;
+ TipoArquivoDigital tipo = filtro.Tipo;
+ switch ((int)tipo)
+ {
+ default:
+ EnviarSelecionadosVisibility = (Visibility)0;
+ break;
+ case 0:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 17:
+ EnviarSelecionadosVisibility = (Visibility)2;
+ break;
+ }
+ }
+
+ public async void CarregarArquivos()
+ {
+ await PermissaoTela((TipoTela)6);
+ await PermissaoArquivoDigital(Filtro.Tipo);
+ await CarregaArquivos();
+ string licencas = "PRODUTO NÃO CONTRATADO";
+ if (LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86))
+ {
+ _assinadorKey = await AssinadorHelper.Key();
+ licencas = $"{await AssinadorHelper.Licencas(_assinadorKey)} LICENÇAS DISPONÍVEIS";
+ }
+ Licencas = licencas;
+ VerificarEnables(0L);
+ }
+
+ private void AtualizaEmpresa()
+ {
+ Recursos.Empresa = new BaseServico().BuscarEmpresa(Recursos.Usuario.IdEmpresa);
+ }
+
+ public string CarregarMensagem()
+ {
+ //IL_000b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0012: Invalid comparison between Unknown and I4
+ //IL_0019: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0020: Invalid comparison between Unknown and I4
+ //IL_0076: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0080: Unknown result type (might be due to invalid IL or missing references)
+ //IL_009a: Expected I4, but got Unknown
+ //IL_016a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0170: Expected O, but got Unknown
+ //IL_0287: Unknown result type (might be due to invalid IL or missing references)
+ //IL_028e: Expected O, but got Unknown
+ //IL_0403: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0409: Expected O, but got Unknown
+ //IL_0549: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0550: Expected O, but got Unknown
+ //IL_009a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_009e: Invalid comparison between Unknown and I4
+ AtualizaEmpresa();
+ string text = (((int)Recursos.Empresa.TipoTelefone1 == 11) ? "0300" : (((int)Recursos.Empresa.TipoTelefone1 == 10) ? "0800" : ""));
+ text = text + " " + Recursos.Empresa.PrimeiroPrefixo + " " + Recursos.Empresa.PrimeiroTelefone;
+ TipoArquivoDigital tipo = Filtro.Tipo;
+ switch (tipo - 1)
+ {
+ default:
+ if ((int)tipo == 13)
+ {
+ return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + ", segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s). " + Environment.NewLine + Environment.NewLine + "[*LINK*]" + Environment.NewLine + Environment.NewLine + "<|LINKASSINATURA|>" + Environment.NewLine + Environment.NewLine + "Para mais informações entre contato conosco pelo " + text + "." + Environment.NewLine + "Atenciosamente " + ValidationHelper.Captalize(Recursos.Empresa.Nome) + ".";
+ }
+ return "Prezado(a), segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s)." + Environment.NewLine + Environment.NewLine + "[*LINK*]" + Environment.NewLine + Environment.NewLine + " Para mais informações entre contato conosco pelo " + text + "." + Environment.NewLine + "Atenciosamente " + ValidationHelper.Captalize(Recursos.Empresa.Nome) + ".";
+ case 0:
+ return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + ", segue o(s) link(s) para download referente ao(s) seu(s) arquivo(s). " + Environment.NewLine + Environment.NewLine + "[*LINK*]" + Environment.NewLine + Environment.NewLine + "<|LINKASSINATURA|>" + Environment.NewLine + Environment.NewLine + "Para mais informações entre contato conosco pelo " + text + "." + Environment.NewLine + "Atenciosamente " + ValidationHelper.Captalize(Recursos.Empresa.Nome) + ".";
+ case 1:
+ {
+ Documento documento = (Documento)Filtro.Parente;
+ string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice));
+ return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. " + Environment.NewLine + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}.";
+ }
+ case 2:
+ {
+ Parcela val2 = (Parcela)Filtro.Parente;
+ Documento documento = val2.Documento;
+ string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice));
+ return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente a sua parcela. " + Environment.NewLine + $"Parcela {val2.NumeroParcela} de {documento.NumeroParcelas}, valor {val2.Valor:C2} de vencimento {val2.Vencimento:d}. {Environment.NewLine}" + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}.";
+ }
+ case 3:
+ {
+ Item item = (Item)Filtro.Parente;
+ Documento documento = item.Documento;
+ string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice));
+ return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. " + Environment.NewLine + "Item " + item.Descricao + ". " + Environment.NewLine + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}.";
+ }
+ case 4:
+ {
+ Sinistro val = (Sinistro)Filtro.Parente;
+ Item item = val.ControleSinistro.Item;
+ Documento documento = item.Documento;
+ string text2 = (string.IsNullOrWhiteSpace(documento.Apolice) ? ("Proposta Número " + documento.Proposta) : ("Apólice Número " + documento.Apolice));
+ return "Prezado(a) " + ValidationHelper.Captalize(SelectedCliente.Nome) + " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu sinistro. " + Environment.NewLine + "Sinistro de número " + val.Numero + " Item sinistrado " + val.ItemSinistrado + ". " + Environment.NewLine + $"{ValidationHelper.Captalize(documento.Controle.Seguradora.Nome)}, {ValidationHelper.Captalize(documento.Controle.Ramo.Nome)}, {text2} de Vigências entre {documento.Vigencia1:d} e {documento.Vigencia2:d}. {Environment.NewLine}{Environment.NewLine}[*LINK*]{Environment.NewLine}{Environment.NewLine}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {text}.{Environment.NewLine}Atenciosamente {ValidationHelper.Captalize(Recursos.Empresa.Nome)}.";
+ }
+ }
+ }
+
+ public async Task CarregaArquivos()
+ {
+ FiltroArquivoDigital filtro = Filtro;
+ if (filtro != null && filtro.Id == 0)
+ {
+ return;
+ }
+ Carregando = true;
+ base.IsVisible = (Visibility)2;
+ AssinarVisibility = (Visibility)2;
+ if (Filtro != null)
+ {
+ List<IndiceArquivoDigital> arquivos = await ArquivoDigitalServico.BuscarPorTipo(Filtro.Tipo, Filtro.Id);
+ if (AdDocumento)
+ {
+ List<IndiceArquivoDigital> list = arquivos;
+ list.AddRange(await ArquivoDigitalServico.BuscarPorTipo((TipoArquivoDigital)2, Filtro.IdApolice));
+ }
+ Arquivos = new ObservableCollection<IndiceArquivoDigital>(arquivos.OrderBy((IndiceArquivoDigital x) => x.Descricao));
+ TipoArquivoDigital tipo = Filtro.Tipo;
+ switch (tipo - 2)
+ {
+ default:
+ SelectedCliente = (Cliente)Filtro.Parente;
+ Titulo = "ARQUIVO DIGITAL DO CLIENTE \"" + SelectedCliente.Nome + "\"";
+ break;
+ case 0:
+ {
+ AssinarVisibility = (Visibility)0;
+ Documento val13 = (Documento)Filtro.Parente;
+ SelectedCliente = val13.Controle.Cliente;
+ Titulo = ((val13.Apolice != string.Empty) ? ("ARQUIVO DIGITAL DA APÓLICE \"" + val13.Apolice + "\"") : ("ARQUIVO DIGITAL DA PROPOSTA \"" + val13.Proposta + "\""));
+ break;
+ }
+ case 1:
+ {
+ AssinarVisibility = (Visibility)0;
+ Parcela val16 = (Parcela)Filtro.Parente;
+ SelectedCliente = val16.Documento.Controle.Cliente;
+ Titulo = ((val16.Documento.Apolice != string.Empty) ? $"ARQUIVO DIGITAL DA PARCELA \"{val16.NumeroParcela}\" DA APÓLICE \"{val16.Documento.Apolice}\"" : $"ARQUIVO DIGITAL DA PARCELA \"{val16.NumeroParcela}\" DA PROPOSTA \"{val16.Documento.Proposta}\"");
+ DetalheExtrato val17 = await new ServicoExtrato().FindByParcelaId(((DomainBase)val16).Id);
+ if (val17 != null)
+ {
+ arquivos = await ArquivoDigitalServico.BuscarPorTipo((TipoArquivoDigital)7, ((DomainBase)val17.Extrato).Id);
+ arquivos.ForEach(delegate(IndiceArquivoDigital x)
+ {
+ x.NaoExcluir = true;
+ });
+ ExtensionMethods.AddRange<IndiceArquivoDigital>((ICollection<IndiceArquivoDigital>)Arquivos, (IEnumerable<IndiceArquivoDigital>)new ObservableCollection<IndiceArquivoDigital>(arquivos.OrderBy((IndiceArquivoDigital x) => x.Descricao)));
+ }
+ break;
+ }
+ case 2:
+ {
+ AssinarVisibility = (Visibility)0;
+ Item val15 = (Item)Filtro.Parente;
+ SelectedCliente = val15.Documento.Controle.Cliente;
+ Titulo = "ARQUIVO DIGITAL DO ITEM \"" + val15.Descricao + "\"";
+ break;
+ }
+ case 3:
+ {
+ AssinarVisibility = (Visibility)0;
+ Sinistro val14 = (Sinistro)Filtro.Parente;
+ SelectedCliente = val14.ControleSinistro.Item.Documento.Controle.Cliente;
+ Titulo = "ARQUIVO DIGITAL DO SINITRO \"" + val14.Numero + "\" DO ITEM \"" + val14.ControleSinistro.Item.Descricao + "\"";
+ break;
+ }
+ case 7:
+ {
+ Lancamento val12 = (Lancamento)Filtro.Parente;
+ if (val12.Historico.Equals("TRANSFERÊNCIA ENTRE CONTAS"))
+ {
+ await ShowMessage("NÃO É POSSIVEL INCLUIR ARQUIVOS EM TRANSFERÊNCIA ENTRE CONTAS");
+ CloseDrawer();
+ return;
+ }
+ SelectedCliente = new Cliente
+ {
+ Id = val12.Controle.Fornecedor.Id,
+ Nome = val12.Controle.Fornecedor.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DO LANCAMENTO {((DomainBase)val12).Id}, PLANO {val12.Controle.Plano.Nome}, CENTRO {val12.Controle.Centro.Descricao}";
+ break;
+ }
+ case 8:
+ {
+ Fornecedor val11 = (Fornecedor)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = val11.Id,
+ Nome = val11.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DO FORNECEDOR {val11.Nome} {val11.Id}";
+ break;
+ }
+ case 9:
+ {
+ Prospeccao val10 = (Prospeccao)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val10).Id,
+ Nome = val10.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DA PROSPECÇÃO {val10.Nome} {((DomainBase)val10).Id} {val10.Item}";
+ break;
+ }
+ case 5:
+ {
+ Extrato val9 = (Extrato)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Nome = "EXTRATO " + val9.Numero
+ };
+ Titulo = $"ARQUIVO DIGITAL DO EXTRATO {val9.Numero} ID:{((DomainBase)val9).Id}";
+ break;
+ }
+ case 6:
+ {
+ Seguradora val8 = (Seguradora)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val8).Id,
+ Nome = val8.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DA SEGURADORA {val8.Nome} {((DomainBase)val8).Id}";
+ break;
+ }
+ case 4:
+ {
+ Vendedor val7 = (Vendedor)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val7).Id,
+ Nome = val7.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DO VENDEDOR {val7.Nome} {((DomainBase)val7).Id}";
+ break;
+ }
+ case 10:
+ {
+ Usuario val6 = (Usuario)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val6).Id,
+ Nome = val6.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DO USUÁRIO {val6.Nome} {((DomainBase)val6).Id}";
+ break;
+ }
+ case 11:
+ {
+ Empresa val5 = (Empresa)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val5).Id,
+ Nome = val5.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DA EMPRESA {val5.Nome} {((DomainBase)val5).Id}";
+ break;
+ }
+ case 12:
+ {
+ Socio val4 = (Socio)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val4).Id,
+ Nome = val4.Nome
+ };
+ Titulo = $"ARQUIVO DIGITAL DO SÓCIO {val4.Nome} {((DomainBase)val4).Id}";
+ break;
+ }
+ case 13:
+ {
+ Tarefa val3 = (Tarefa)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val3).Id,
+ Nome = "TAREFA - " + val3.Titulo
+ };
+ Titulo = $"ANEXO DA TAREFA {val3.Titulo} {((DomainBase)val3).Id}";
+ break;
+ }
+ case 14:
+ {
+ NotaFiscal val2 = (NotaFiscal)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val2).Id,
+ Nome = $"NOTA FISCAL - {val2.Seguradora.NomeSocial} {val2.Data:d}"
+ };
+ Titulo = $"ANEXO DA NOTA FISCAL {val2.Seguradora.NomeSocial} {val2.Data:d}";
+ break;
+ }
+ case 15:
+ {
+ Estipulante val = (Estipulante)Filtro.Parente;
+ SelectedCliente = new Cliente
+ {
+ Id = ((DomainBase)val).Id,
+ Nome = "ESTIPULANTE - " + val.Nome
+ };
+ Titulo = "ANEXO DO ESTIPULANTE " + val.Nome;
+ break;
+ }
+ }
+ }
+ if (Filtro != null)
+ {
+ TipoArquivoDigital tipo = Filtro.Tipo;
+ switch (tipo - 1)
+ {
+ default:
+ if ((int)tipo == 17)
+ {
+ Estipulante val20 = (Estipulante)Filtro.Parente;
+ Telefones = new ObservableCollection<ClienteTelefone>
+ {
+ new ClienteTelefone
+ {
+ Prefixo = val20.PrimeiroPrefixo,
+ Numero = val20.PrimeiroTelefone
+ },
+ new ClienteTelefone
+ {
+ Prefixo = val20.SegundoPrefixo,
+ Numero = val20.SegundoTelefone
+ }
+ };
+ }
+ break;
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ {
+ Cliente cliente = await _servico.BuscarClienteAsync(((DomainBase)SelectedCliente).Id);
+ Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)SelectedCliente).Id);
+ ObservableCollection<ClienteEmail> source = await new ClienteServico().BuscarEmailsAsync(((DomainBase)SelectedCliente).Id);
+ if (SelectedCliente.Documento == null || ValidationHelper.OnlyNumber(SelectedCliente.Documento).Length <= 11)
+ {
+ ArquivoDigitalViewModel arquivoDigitalViewModel = this;
+ ClienteEmail? obj = source.FirstOrDefault();
+ arquivoDigitalViewModel.Email = ((obj != null) ? ((EmailBase)obj).Email : null);
+ Nome = SelectedCliente.Nome;
+ Documento = SelectedCliente.Documento;
+ break;
+ }
+ ArquivoDigitalViewModel arquivoDigitalViewModel2 = this;
+ object obj2;
+ if (cliente == null)
+ {
+ obj2 = null;
+ }
+ else
+ {
+ ResponsavelAssinatura responsavelAssinatura = cliente.ResponsavelAssinatura;
+ obj2 = ((responsavelAssinatura != null) ? responsavelAssinatura.EmailResponsavel : null);
+ }
+ if (obj2 == null)
+ {
+ ClienteEmail? obj3 = source.FirstOrDefault();
+ obj2 = ((obj3 != null) ? ((EmailBase)obj3).Email : null);
+ }
+ arquivoDigitalViewModel2.Email = (string)obj2;
+ ArquivoDigitalViewModel arquivoDigitalViewModel3 = this;
+ object obj4;
+ if (cliente == null)
+ {
+ obj4 = null;
+ }
+ else
+ {
+ ResponsavelAssinatura responsavelAssinatura2 = cliente.ResponsavelAssinatura;
+ obj4 = ((responsavelAssinatura2 != null) ? responsavelAssinatura2.NomeResponsavel : null);
+ }
+ if (obj4 == null)
+ {
+ obj4 = SelectedCliente.Nome;
+ }
+ arquivoDigitalViewModel3.Nome = (string)obj4;
+ ArquivoDigitalViewModel arquivoDigitalViewModel4 = this;
+ object obj5;
+ if (cliente == null)
+ {
+ obj5 = null;
+ }
+ else
+ {
+ ResponsavelAssinatura responsavelAssinatura3 = cliente.ResponsavelAssinatura;
+ obj5 = ((responsavelAssinatura3 != null) ? responsavelAssinatura3.DocumentoResponsavel : null);
+ }
+ if (obj5 == null)
+ {
+ obj5 = SelectedCliente.Documento;
+ }
+ arquivoDigitalViewModel4.Documento = (string)obj5;
+ break;
+ }
+ case 9:
+ {
+ Fornecedor val19 = (Fornecedor)Filtro.Parente;
+ Telefones = new ObservableCollection<ClienteTelefone>
+ {
+ new ClienteTelefone
+ {
+ Prefixo = val19.Prefixo1,
+ Numero = val19.Telefone1
+ },
+ new ClienteTelefone
+ {
+ Prefixo = val19.Prefixo2,
+ Numero = val19.Telefone2
+ }
+ };
+ break;
+ }
+ case 8:
+ {
+ Lancamento val18 = (Lancamento)Filtro.Parente;
+ Telefones = new ObservableCollection<ClienteTelefone>
+ {
+ new ClienteTelefone
+ {
+ Prefixo = val18.Controle.Fornecedor.Prefixo1,
+ Numero = val18.Controle.Fornecedor.Telefone1
+ },
+ new ClienteTelefone
+ {
+ Prefixo = val18.Controle.Fornecedor.Prefixo2,
+ Numero = val18.Controle.Fornecedor.Telefone2
+ }
+ };
+ break;
+ }
+ case 5:
+ case 6:
+ case 7:
+ break;
+ }
+ }
+ base.IsVisible = (Visibility)0;
+ Carregando = false;
+ }
+
+ public void Baixar(IndiceArquivoDigital arquivo, bool abrir = false)
+ {
+ if (arquivo != null && arquivo.IdArquivoDigital != 0L)
+ {
+ Download(arquivo, abrir);
+ }
+ }
+
+ public async Task Excluir(IndiceArquivoDigital arquivo)
+ {
+ if (arquivo != null && arquivo.IdArquivoDigital != 0L && await ArquivoDigitalServico.DeleteAttachment(arquivo))
+ {
+ await CarregaArquivos();
+ }
+ }
+
+ public async void Editar(IndiceArquivoDigital arquivo)
+ {
+ if (arquivo != null && arquivo.IdArquivoDigital != 0L)
+ {
+ await ArquivoDigitalServico.Save(arquivo);
+ }
+ }
+
+ public async Task<bool> BaixarTodos()
+ {
+ if (Arquivos == null || Arquivos.Count == 0)
+ {
+ return false;
+ }
+ return await DownloadAll(Arquivos.ToList(), Filtro.Id);
+ }
+
+ public async void Anexar()
+ {
+ List<ArquivoDigital> attacheds = ((IEnumerable<IndiceArquivoDigital>)Arquivos).Select((Func<IndiceArquivoDigital, ArquivoDigital>)((IndiceArquivoDigital x) => new ArquivoDigital
+ {
+ Descricao = x.Descricao,
+ Extensao = x.Extensao
+ })).ToList();
+ List<ArquivoDigital> list = await AddAttachments(ArquivosAnexados.ToList(), attacheds);
+ if (list == null)
+ {
+ return;
+ }
+ if (!Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 47))
+ {
+ list = await ShowDialogAnexar(list);
+ if (list == null)
+ {
+ return;
+ }
+ }
+ list.AddRange(ArquivosAnexados);
+ ArquivosAnexados = new ObservableCollection<ArquivoDigital>(list);
+ }
+
+ public void Delete(ArquivoDigital arquivo)
+ {
+ if (SelectedAnexado != null)
+ {
+ ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao);
+ ArquivosAnexados.Remove(item);
+ ArquivosAnexados = new ObservableCollection<ArquivoDigital>(ArquivosAnexados);
+ }
+ }
+
+ public async Task SalvarAnexos()
+ {
+ if (ArquivosAnexados != null && ArquivosAnexados.Count != 0)
+ {
+ Carregando = true;
+ List<ArquivoDigital> arquivos = ArquivosAnexados.ToList();
+ if (!(await SalvarAttachments(arquivos, Filtro.Tipo, Filtro.Id)))
+ {
+ Carregando = false;
+ return;
+ }
+ await CarregaArquivos();
+ ArquivosAnexados = new ObservableCollection<ArquivoDigital>();
+ Carregando = false;
+ }
+ }
+
+ public void LimparAnexos()
+ {
+ ArquivosAnexados = new ObservableCollection<ArquivoDigital>();
+ }
+
+ public async Task<MalaDireta> PrepararEnvio()
+ {
+ if (!Arquivos.Any((IndiceArquivoDigital x) => x.Selecionado))
+ {
+ await ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIO.");
+ return null;
+ }
+ MalaDireta maladireta = new MalaDireta
+ {
+ Cliente = SelectedCliente,
+ ArquivoDigital = Arquivos.Where((IndiceArquivoDigital x) => x.Selecionado).ToList()
+ };
+ TipoArquivoDigital tipo = Filtro.Tipo;
+ switch (tipo - 2)
+ {
+ default:
+ {
+ if ((int)tipo != 11)
+ {
+ SelectedCliente = (Cliente)Filtro.Parente;
+ Titulo = "ARQUIVO DIGITAL DO CLIENTE \"" + SelectedCliente.Nome + "\"";
+ break;
+ }
+ Prospeccao val5 = (maladireta.Prospeccao = (Prospeccao)Filtro.Parente);
+ ((DomainBase)maladireta.Cliente).Id = 0L;
+ Assunto = "DOCUMENTOS REFERENTES PROSPECÇÃO " + val5.Nome;
+ Corpo = "";
+ maladireta.Tela = (TipoTela)33;
+ break;
+ }
+ case 0:
+ {
+ Documento apolice = (Documento)Filtro.Parente;
+ List<Item> list2 = await CarregarItem(((DomainBase)apolice.Controle).Id, (StatusItem)0);
+ maladireta.Item = (Item)((list2.Count <= 1) ? ((object)list2.FirstOrDefault()) : ((object)new Item
+ {
+ Id = 0L,
+ Descricao = "APÓLICE COLETIVA"
+ }));
+ maladireta.Apolice = apolice;
+ Assunto = ((apolice.Apolice != string.Empty) ? ("DOCUMENTOS REFERENTES A APÓLICE " + apolice.Apolice) : ("DOCUMENTOS REFERENTES A PROPOSTA " + apolice.Proposta));
+ Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU SEGURO.";
+ maladireta.Tela = (TipoTela)2;
+ break;
+ }
+ case 1:
+ {
+ Parcela parcela = (Parcela)Filtro.Parente;
+ maladireta.Apolice = parcela.Documento;
+ maladireta.Parcela = parcela;
+ List<Item> list = await CarregarItem(((DomainBase)parcela.Documento.Controle).Id, (StatusItem)0);
+ maladireta.Item = (Item)((list.Count <= 1) ? ((object)list.FirstOrDefault()) : ((object)new Item
+ {
+ Id = 0L,
+ Descricao = "APÓLICE COLETIVA"
+ }));
+ Assunto = ((parcela.Documento.Apolice != string.Empty) ? $"DOCUMENTOS REFERENTE A PARCELA {parcela.NumeroParcela} DA APÓLICE {parcela.Documento.Apolice}" : $"DOCUMENTOS REFERENTE A PARCELA {parcela.NumeroParcela} DA PROPOSTA {parcela.Documento.Proposta}");
+ Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES AS PARCELAS DE SEU SEGURO.";
+ maladireta.Tela = (TipoTela)5;
+ break;
+ }
+ case 2:
+ {
+ Item val3 = (Item)Filtro.Parente;
+ maladireta.Apolice = val3.Documento;
+ maladireta.Item = val3;
+ Assunto = "DOCUMENTOS REFERENTES AO ITEM " + val3.Descricao;
+ Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU BEM.";
+ maladireta.Tela = (TipoTela)3;
+ break;
+ }
+ case 3:
+ {
+ Sinistro val2 = (maladireta.Sinistro = (Sinistro)Filtro.Parente);
+ maladireta.Item = val2.ControleSinistro.Item;
+ maladireta.Apolice = val2.ControleSinistro.Item.Documento;
+ Titulo = "DOCUMENTOS REFERENTES AO SINITRO " + val2.Numero;
+ Corpo = "PREZADO CLIENTE " + SelectedCliente.Nome + ", EM ANEXO OS DOCUMENTOS REFERENTES SINISTRO DO ITEM " + val2.ControleSinistro.Item.Descricao + ".";
+ maladireta.Tela = (TipoTela)7;
+ break;
+ }
+ }
+ return maladireta;
+ }
+
+ public async Task<Uri> CreateLink(IndiceArquivoDigital indice)
+ {
+ string value = $"{Funcoes.GetNetworkTime().Ticks}:{ApplicationHelper.IdFornecedor}:F:{((DomainBase)indice).Id}".Base64Encode();
+ return Recursos.ApiArquivo.AddQuery("search", value);
+ }
+
+ public async Task<bool> EnviarParaAssinatura()
+ {
+ if (!ArquivosTela.Any((IndiceArquivoDigital x) => x.Assinar))
+ {
+ await ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIAR PARA ASSINATURA.");
+ return false;
+ }
+ if (!(await ShowMessage("DESEJA ENVIAR OS ARQUIVOS SELECIONADOS PARA ASSINATURA ELETRÔNICA DO SEGURADO?", "SIM", "NÃO")))
+ {
+ return false;
+ }
+ if (Email.EndsWith(";"))
+ {
+ await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO");
+ return false;
+ }
+ Loading(isLoading: true);
+ _assinadorKey = await AssinadorHelper.Key();
+ int licencasDisponiveis = await AssinadorHelper.Licencas(_assinadorKey);
+ if (licencasDisponiveis < Arquivos.Count((IndiceArquivoDigital x) => x.Assinar && !x.EnviadoAssinatura))
+ {
+ if (Restricao((TipoRestricao)113))
+ {
+ await ShowMessage("VOCÊ NÃO POSSUI MAIS LICENÇAS DISPONÍVEIS E O USUÁRIO NÃO PODE CONTRATAR, ENTRE EM CONTATO COM O ADMINISTRADOR DO SISTEMA.");
+ Loading(isLoading: false);
+ return false;
+ }
+ if (!(await ShowMessage("VOCÊ NÃO POSSUI MAIS LICENÇAS DISPONÍVEIS, DESEJA CONTRATAR MAIS?", "SIM", "NÃO")))
+ {
+ Loading(isLoading: false);
+ return false;
+ }
+ string arguments = new Token().Encrypt(string.Format("{0}:{1}:{2}:{3}", ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, ((DomainBase)Recursos.Usuario).Id, ApplicationHelper.Beta ? "1" : "0"));
+ ((Window)new DownloadWindow(new Parameters
+ {
+ Beta = ApplicationHelper.Beta,
+ Type = 8,
+ Application = "Assinador.Application.exe",
+ Directory = "Assinador.Application",
+ Arguments = arguments,
+ Run = true
+ })).Show();
+ Loading(isLoading: false);
+ return false;
+ }
+ AssinadorHelper.Parametros = await AssinaturaServico.BuscarParametrosAssinatura(Recursos.Usuario.IdEmpresa);
+ int arquivosEnviados = 0;
+ int arquivosSelecionados = ArquivosTela.Where((IndiceArquivoDigital x) => x.Assinar).Count();
+ foreach (IndiceArquivoDigital indice in ArquivosTela.Where((IndiceArquivoDigital x) => x.Assinar))
+ {
+ if (indice.Assinado)
+ {
+ continue;
+ }
+ if (indice.EnviadoAssinatura)
+ {
+ await new AssinaturaServico().Reenviar(((DomainBase)indice).Id);
+ continue;
+ }
+ ArquivoParaAssinaturaAssinador val = await Assinar(indice);
+ if (val != null)
+ {
+ licencasDisponiveis--;
+ indice.EnviadoAssinatura = true;
+ indice.UrlAssinatura = val.UrlAssinatura;
+ arquivosEnviados++;
+ }
+ }
+ Loading(isLoading: false);
+ Arquivos = new ObservableCollection<IndiceArquivoDigital>(Arquivos);
+ await ShowMessage($"{arquivosEnviados} DE {arquivosSelecionados} ARQUIVOS FORAM ENVIADOS PARA ASSINATURA. VOCÊ SERÁ NOTIFICADO QUANDO OS DOCUMENTOS FOREM ASSINADOS");
+ return true;
+ }
+
+ public async Task<ArquivoParaAssinaturaAssinador> Assinar(IndiceArquivoDigital indice, bool lote = false)
+ {
+ try
+ {
+ AssinaturaServico servico = new AssinaturaServico();
+ ArquivoDigitalServico servicoArquivo = new ArquivoDigitalServico();
+ if (await servico.VerificarAssinado(((DomainBase)indice).Id))
+ {
+ if (!lote)
+ {
+ await ShowMessage("ARQUIVO JÁ ASSINADO");
+ }
+ return null;
+ }
+ if (await servico.VerificarEnviado(((DomainBase)indice).Id))
+ {
+ return await servico.Reenviar(((DomainBase)indice).Id);
+ }
+ if (Nome == null || string.IsNullOrWhiteSpace(Nome))
+ {
+ if (!lote)
+ {
+ await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM NOME VÁLIDO");
+ }
+ return null;
+ }
+ if (Documento == null || !ValidationHelper.ValidateDocument(Documento))
+ {
+ if (!lote)
+ {
+ await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM DOCUMENTO VÁLIDO");
+ }
+ return null;
+ }
+ if (Documento.Length > 14)
+ {
+ if (!lote)
+ {
+ await ShowMessage("O DOCUMENTO DO ASSINANTE DEVE SER CPF E NÃO CNPJ");
+ }
+ return null;
+ }
+ if (Email == null || !ValidationHelper.ValidacaoEmail(Email))
+ {
+ if (!lote)
+ {
+ await ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO");
+ }
+ return null;
+ }
+ ArquivoDigital arquivoDigital = await servicoArquivo.BuscarPorId(indice.IdArquivoDigital, indice.Bd);
+ new Documento();
+ TipoArquivoDigital tipo = Filtro.Tipo;
+ long id;
+ switch (tipo - 2)
+ {
+ default:
+ return null;
+ case 3:
+ id = ((DomainBase)((Sinistro)Filtro.Parente).ControleSinistro.Item.Documento).Id;
+ break;
+ case 1:
+ id = ((DomainBase)((Parcela)Filtro.Parente).Documento).Id;
+ break;
+ case 2:
+ id = ((DomainBase)((Item)Filtro.Parente).Documento).Id;
+ break;
+ case 0:
+ id = ((DomainBase)(Documento)Filtro.Parente).Id;
+ break;
+ }
+ return await servico.Save(await servico.Assinar(arquivoDigital, new ApoliceAssinador
+ {
+ ArquivoId = ((DomainBase)indice).Id,
+ ClienteId = ((DomainBase)SelectedCliente).Id,
+ Cliente = Nome,
+ Email = Email,
+ Documento = Documento,
+ Id = id
+ }));
+ }
+ catch (Exception ex)
+ {
+ await ShowMessage("ERRO AO ENVIAR PARA ASSINATURA" + Environment.NewLine + ex.Message + Environment.NewLine + "POR FAVOR CONTATE A AGGER ATRAVÉS DO PAINEL DE ATENDIMENTOS");
+ return null;
+ }
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs
new file mode 100644
index 0000000..d4633e7
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ExpedicaoViewModel.cs
@@ -0,0 +1,164 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class ExpedicaoViewModel : BaseSegurosViewModel
+{
+ private readonly ExpedicaoServico _servico;
+
+ private readonly Documento _documento;
+
+ private bool _carregando;
+
+ private Expedicao _selectedExpedicao = new Expedicao();
+
+ private ObservableCollection<Expedicao> _expedicoes = new ObservableCollection<Expedicao>();
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.EnableMenu = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public Expedicao SelectedExpedicao
+ {
+ get
+ {
+ return _selectedExpedicao;
+ }
+ set
+ {
+ _selectedExpedicao = value;
+ VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null);
+ OnPropertyChanged("SelectedExpedicao");
+ }
+ }
+
+ public ObservableCollection<Expedicao> Expedicoes
+ {
+ get
+ {
+ return _expedicoes;
+ }
+ set
+ {
+ _expedicoes = value;
+ OnPropertyChanged("Expedicoes");
+ }
+ }
+
+ public ExpedicaoViewModel(Documento documento)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000b: Expected O, but got Unknown
+ _servico = new ExpedicaoServico();
+ _documento = documento;
+ Seleciona(documento);
+ }
+
+ private async void Seleciona(Documento documento)
+ {
+ Carregando = true;
+ await PermissaoTela((TipoTela)46);
+ await Carregar(documento);
+ if (Expedicoes.Count > 0)
+ {
+ SelectedExpedicao = Expedicoes.First();
+ }
+ else
+ {
+ SelectedExpedicao = new Expedicao();
+ Alterar(alterar: false);
+ base.EnableMenu = false;
+ }
+ Carregando = false;
+ }
+
+ private async Task Carregar(Documento documento)
+ {
+ Expedicoes = new ObservableCollection<Expedicao>(await _servico.BuscarExpedicoes(documento));
+ }
+
+ public void Incluir()
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0017: Expected O, but got Unknown
+ SelectedExpedicao = new Expedicao
+ {
+ Apolice = _documento
+ };
+ Alterar(alterar: true);
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar()
+ {
+ SelectedExpedicao = await _servico.Save(SelectedExpedicao);
+ if (!_servico.Sucesso)
+ {
+ return null;
+ }
+ long id = ((DomainBase)SelectedExpedicao).Id;
+ await Carregar(SelectedExpedicao.Apolice);
+ SelectedExpedicao = ((IEnumerable<Expedicao>)Expedicoes).FirstOrDefault((Func<Expedicao, bool>)((Expedicao x) => ((DomainBase)x).Id == id));
+ Alterar(alterar: false);
+ return null;
+ }
+
+ public async void CancelarAlteracao()
+ {
+ Carregando = true;
+ long id = ((DomainBase)SelectedExpedicao).Id;
+ await Carregar(SelectedExpedicao.Apolice);
+ SelectedExpedicao = (Expedicao)((Expedicoes.Count > 0 && id > 0) ? ((IEnumerable<Expedicao>)Expedicoes).FirstOrDefault((Func<Expedicao, bool>)((Expedicao x) => ((DomainBase)x).Id == id)) : ((Expedicoes.Count > 0 && id == 0L) ? ((object)Expedicoes.First()) : ((object)new Expedicao())));
+ Alterar(alterar: false);
+ Carregando = false;
+ }
+
+ public async Task<bool> Excluir()
+ {
+ if (SelectedExpedicao == null || ((DomainBase)SelectedExpedicao).Id == 0L)
+ {
+ return false;
+ }
+ if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO")))
+ {
+ return false;
+ }
+ Carregando = true;
+ if (!(await _servico.Delete(SelectedExpedicao)))
+ {
+ Carregando = false;
+ return false;
+ }
+ int num = Expedicoes.IndexOf(SelectedExpedicao);
+ Expedicoes.Remove(SelectedExpedicao);
+ if (Expedicoes.Count > 0)
+ {
+ SelectedExpedicao = ((num < Expedicoes.Count) ? Expedicoes.ElementAt(num) : Expedicoes.Last());
+ }
+ else
+ {
+ SelectedExpedicao = new Expedicao();
+ }
+ Carregando = false;
+ return true;
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs
new file mode 100644
index 0000000..c04d349
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ExtratosViewModel.cs
@@ -0,0 +1,2773 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using Gestor.Application.Componentes;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.Servicos.Seguros.Itens;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos;
+using Gestor.Model.Domain.Seguros;
+using NReco.PdfGenerator;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class ExtratosViewModel : BaseSegurosViewModel
+{
+ private readonly ClienteServico _clienteServico = new ClienteServico();
+
+ private List<Documento> _documentos;
+
+ private List<Prospeccao> _prospeccoes;
+
+ private List<Cliente> _clientes;
+
+ private bool _tipoExtratoEnabled = true;
+
+ private bool _extratoResumido;
+
+ private bool _segurosVigentes;
+
+ private Visibility _clientePorPaginaVisibility;
+
+ private bool _clientePorPagina;
+
+ private bool _extratoPorPagina;
+
+ private bool _clientePorPaginaEnabled = true;
+
+ private bool _obsCliente;
+
+ private bool _comissaoDocumento;
+
+ private bool _premioParcela;
+
+ private bool _obsApolice;
+
+ private bool _beneficiariosItens;
+
+ private bool _selecionarItens;
+
+ private bool _endossos;
+
+ private bool _somenteEndosso;
+
+ private Visibility _selecionarItensVisibility;
+
+ private Visibility _endossoVisibility;
+
+ private Visibility _obsDocVisibility;
+
+ private Visibility _segurosVigentesVisibility;
+
+ private bool _obsItem;
+
+ private bool _separarPagina;
+
+ private bool _perfilCondutor;
+
+ private bool _obsClienteEnabled = true;
+
+ private bool _comissaoDocumentoEnabled;
+
+ private bool _obsApoliceEnabled;
+
+ private bool _beneficiariosItensEnabled;
+
+ private bool _obsItemEnabled;
+
+ private bool _separarPaginaEnabled;
+
+ private bool _coberturasEnabled;
+
+ private bool _coberturas;
+
+ private bool _perfilCondutorEnabled;
+
+ private bool _endossoEnabled;
+
+ private bool _esconderResumido;
+
+ private bool _clienteVisibility;
+
+ private bool _documentoVisibility;
+
+ private bool _itemVisibility;
+
+ private bool _perfilVisibility;
+
+ private TipoExtrato _selectedTipoExtrato;
+
+ private bool _carregando;
+
+ private List<Item> _itensSelecionados;
+
+ internal Relatorio? TipoDeRelatorio;
+
+ public List<Documento> Documentos
+ {
+ get
+ {
+ return _documentos;
+ }
+ set
+ {
+ _documentos = value;
+ OnPropertyChanged("Documentos");
+ }
+ }
+
+ public List<Prospeccao> Prospeccoes
+ {
+ get
+ {
+ return _prospeccoes;
+ }
+ set
+ {
+ _prospeccoes = value;
+ OnPropertyChanged("Prospeccoes");
+ }
+ }
+
+ public List<Cliente> Clientes
+ {
+ get
+ {
+ return _clientes;
+ }
+ set
+ {
+ _clientes = value;
+ OnPropertyChanged("Clientes");
+ }
+ }
+
+ public bool TipoExtratoEnabled
+ {
+ get
+ {
+ return _tipoExtratoEnabled;
+ }
+ set
+ {
+ _tipoExtratoEnabled = value;
+ OnPropertyChanged("TipoExtratoEnabled");
+ }
+ }
+
+ public bool ExtratoResumido
+ {
+ get
+ {
+ return _extratoResumido;
+ }
+ set
+ {
+ //IL_0059: Unknown result type (might be due to invalid IL or missing references)
+ _extratoResumido = value;
+ if (value)
+ {
+ ClienteVisibility = false;
+ DocumentoVisibility = false;
+ ItemVisibility = CoberturasEnabled;
+ SelecionarItensVisibility = (Visibility)2;
+ BeneficiariosItensEnabled = false;
+ ObsItemEnabled = false;
+ SepararPaginaEnabled = false;
+ }
+ else
+ {
+ ClienteVisibility = true;
+ DocumentoVisibility = true;
+ ItemVisibility = true;
+ AjustaTipoSelecionado(SelectedTipoExtrato);
+ }
+ OnPropertyChanged("ExtratoResumido");
+ }
+ }
+
+ public bool SegurosVigentes
+ {
+ get
+ {
+ return _segurosVigentes;
+ }
+ set
+ {
+ _segurosVigentes = value;
+ OnPropertyChanged("SegurosVigentes");
+ }
+ }
+
+ public Visibility ClientePorPaginaVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _clientePorPaginaVisibility;
+ }
+ 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)
+ _clientePorPaginaVisibility = value;
+ OnPropertyChanged("ClientePorPaginaVisibility");
+ }
+ }
+
+ public bool ClientePorPagina
+ {
+ get
+ {
+ return _clientePorPagina;
+ }
+ set
+ {
+ _clientePorPagina = value;
+ OnPropertyChanged("ClientePorPagina");
+ }
+ }
+
+ public bool ExtratoPorPagina
+ {
+ get
+ {
+ return _extratoPorPagina;
+ }
+ set
+ {
+ _extratoPorPagina = value;
+ OnPropertyChanged("ExtratoPorPagina");
+ }
+ }
+
+ public bool ClientePorPaginaEnabled
+ {
+ get
+ {
+ return _clientePorPaginaEnabled;
+ }
+ set
+ {
+ _clientePorPaginaEnabled = value;
+ OnPropertyChanged("ClientePorPaginaEnabled");
+ }
+ }
+
+ public bool ObsCliente
+ {
+ get
+ {
+ return _obsCliente;
+ }
+ set
+ {
+ _obsCliente = value;
+ OnPropertyChanged("ObsCliente");
+ }
+ }
+
+ public bool ComissaoDocumento
+ {
+ get
+ {
+ return _comissaoDocumento;
+ }
+ set
+ {
+ _comissaoDocumento = value;
+ OnPropertyChanged("ComissaoDocumento");
+ }
+ }
+
+ public bool PremioParcela
+ {
+ get
+ {
+ return _premioParcela;
+ }
+ set
+ {
+ _premioParcela = value;
+ OnPropertyChanged("PremioParcela");
+ }
+ }
+
+ public bool ObsApolice
+ {
+ get
+ {
+ return _obsApolice;
+ }
+ set
+ {
+ _obsApolice = value;
+ OnPropertyChanged("ObsApolice");
+ }
+ }
+
+ public bool BeneficiariosItens
+ {
+ get
+ {
+ return _beneficiariosItens;
+ }
+ set
+ {
+ _beneficiariosItens = value;
+ OnPropertyChanged("BeneficiariosItens");
+ }
+ }
+
+ public bool SelecionarItens
+ {
+ get
+ {
+ return _selecionarItens;
+ }
+ set
+ {
+ _selecionarItens = value;
+ if (!value)
+ {
+ _itensSelecionados = new List<Item>();
+ }
+ OnPropertyChanged("SelecionarItens");
+ }
+ }
+
+ public bool Endossos
+ {
+ get
+ {
+ return _endossos;
+ }
+ set
+ {
+ _endossos = value;
+ if (SomenteEndossos != !value)
+ {
+ SomenteEndossos = !value;
+ }
+ OnPropertyChanged("Endossos");
+ }
+ }
+
+ public bool SomenteEndossos
+ {
+ get
+ {
+ return _somenteEndosso;
+ }
+ set
+ {
+ _somenteEndosso = value;
+ if (Endossos != !value)
+ {
+ Endossos = !value;
+ }
+ OnPropertyChanged("SomenteEndossos");
+ }
+ }
+
+ public Visibility SelecionarItensVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _selecionarItensVisibility;
+ }
+ 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)
+ _selecionarItensVisibility = value;
+ OnPropertyChanged("SelecionarItensVisibility");
+ }
+ }
+
+ public Visibility EndossoVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _endossoVisibility;
+ }
+ 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)
+ _endossoVisibility = value;
+ OnPropertyChanged("EndossoVisibility");
+ }
+ }
+
+ public Visibility ObsDocVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _obsDocVisibility;
+ }
+ 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)
+ _obsDocVisibility = value;
+ OnPropertyChanged("ObsDocVisibility");
+ }
+ }
+
+ public Visibility SegurosVigentesVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _segurosVigentesVisibility;
+ }
+ 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)
+ _segurosVigentesVisibility = value;
+ OnPropertyChanged("SegurosVigentesVisibility");
+ }
+ }
+
+ public bool ObsItem
+ {
+ get
+ {
+ return _obsItem;
+ }
+ set
+ {
+ _obsItem = value;
+ OnPropertyChanged("ObsItem");
+ }
+ }
+
+ public bool SepararPagina
+ {
+ get
+ {
+ return _separarPagina;
+ }
+ set
+ {
+ _separarPagina = value;
+ OnPropertyChanged("SepararPagina");
+ }
+ }
+
+ public bool PerfilCondutor
+ {
+ get
+ {
+ return _perfilCondutor;
+ }
+ set
+ {
+ _perfilCondutor = value;
+ OnPropertyChanged("PerfilCondutor");
+ }
+ }
+
+ public bool ObsClienteEnabled
+ {
+ get
+ {
+ return _obsClienteEnabled;
+ }
+ set
+ {
+ _obsClienteEnabled = value;
+ OnPropertyChanged("ObsClienteEnabled");
+ }
+ }
+
+ public bool ComissaoDocumentoEnabled
+ {
+ get
+ {
+ return _comissaoDocumentoEnabled;
+ }
+ set
+ {
+ _comissaoDocumentoEnabled = value;
+ OnPropertyChanged("ComissaoDocumentoEnabled");
+ }
+ }
+
+ public bool ObsApoliceEnabled
+ {
+ get
+ {
+ return _obsApoliceEnabled;
+ }
+ set
+ {
+ _obsApoliceEnabled = value;
+ OnPropertyChanged("ObsApoliceEnabled");
+ }
+ }
+
+ public bool BeneficiariosItensEnabled
+ {
+ get
+ {
+ return _beneficiariosItensEnabled;
+ }
+ set
+ {
+ _beneficiariosItensEnabled = value;
+ OnPropertyChanged("BeneficiariosItensEnabled");
+ }
+ }
+
+ public bool ObsItemEnabled
+ {
+ get
+ {
+ return _obsItemEnabled;
+ }
+ set
+ {
+ _obsItemEnabled = value;
+ OnPropertyChanged("ObsItemEnabled");
+ }
+ }
+
+ public bool SepararPaginaEnabled
+ {
+ get
+ {
+ return _separarPaginaEnabled;
+ }
+ set
+ {
+ _separarPaginaEnabled = value;
+ OnPropertyChanged("SepararPaginaEnabled");
+ }
+ }
+
+ public bool CoberturasEnabled
+ {
+ get
+ {
+ return _coberturasEnabled;
+ }
+ set
+ {
+ _coberturasEnabled = value;
+ OnPropertyChanged("CoberturasEnabled");
+ }
+ }
+
+ public bool Coberturas
+ {
+ get
+ {
+ return _coberturas;
+ }
+ set
+ {
+ _coberturas = value;
+ OnPropertyChanged("Coberturas");
+ }
+ }
+
+ public bool PerfilCondutorEnabled
+ {
+ get
+ {
+ return _perfilCondutorEnabled;
+ }
+ set
+ {
+ _perfilCondutorEnabled = value;
+ OnPropertyChanged("PerfilCondutorEnabled");
+ }
+ }
+
+ public bool EndossoEnabled
+ {
+ get
+ {
+ return _endossoEnabled;
+ }
+ set
+ {
+ _endossoEnabled = value;
+ OnPropertyChanged("EndossoEnabled");
+ }
+ }
+
+ public bool EsconderResumido
+ {
+ get
+ {
+ return _esconderResumido;
+ }
+ set
+ {
+ _esconderResumido = value;
+ OnPropertyChanged("EsconderResumido");
+ }
+ }
+
+ public bool ClienteVisibility
+ {
+ get
+ {
+ return _clienteVisibility;
+ }
+ set
+ {
+ _clienteVisibility = value;
+ OnPropertyChanged("ClienteVisibility");
+ }
+ }
+
+ public bool DocumentoVisibility
+ {
+ get
+ {
+ return _documentoVisibility;
+ }
+ set
+ {
+ _documentoVisibility = value;
+ OnPropertyChanged("DocumentoVisibility");
+ }
+ }
+
+ public bool ItemVisibility
+ {
+ get
+ {
+ return _itemVisibility;
+ }
+ set
+ {
+ _itemVisibility = value;
+ OnPropertyChanged("ItemVisibility");
+ }
+ }
+
+ public bool PerfilVisibility
+ {
+ get
+ {
+ return _perfilVisibility;
+ }
+ set
+ {
+ _perfilVisibility = value;
+ OnPropertyChanged("PerfilVisibility");
+ }
+ }
+
+ public TipoExtrato SelectedTipoExtrato
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _selectedTipoExtrato;
+ }
+ 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)
+ //IL_0008: Unknown result type (might be due to invalid IL or missing references)
+ _selectedTipoExtrato = value;
+ AjustaTipoSelecionado(value);
+ OnPropertyChanged("SelectedTipoExtrato");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public void AjustaTipoSelecionado(TipoExtrato tipoExtrato)
+ {
+ //IL_0000: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0012: Expected I4, but got Unknown
+ switch ((int)tipoExtrato)
+ {
+ case 0:
+ ClienteVisibility = true;
+ ClientePorPaginaVisibility = (Visibility)1;
+ DocumentoVisibility = false;
+ ItemVisibility = false;
+ PerfilVisibility = false;
+ EsconderResumido = true;
+ SelecionarItensVisibility = (Visibility)2;
+ SegurosVigentesVisibility = (Visibility)2;
+ SegurosVigentes = false;
+ EndossoVisibility = (Visibility)2;
+ ObsDocVisibility = (Visibility)2;
+ ExtratoCliente();
+ break;
+ case 1:
+ ClienteVisibility = true;
+ ClientePorPaginaVisibility = (Visibility)0;
+ DocumentoVisibility = true;
+ ItemVisibility = true;
+ PerfilVisibility = true;
+ EsconderResumido = false;
+ SelecionarItensVisibility = (Visibility)(TipoDeRelatorio.HasValue ? 2 : 0);
+ SegurosVigentesVisibility = (Visibility)2;
+ SegurosVigentes = false;
+ EndossoVisibility = (Visibility)0;
+ ObsDocVisibility = (Visibility)0;
+ ApoliceSelecionada();
+ break;
+ case 2:
+ ClienteVisibility = false;
+ ClientePorPaginaVisibility = (Visibility)2;
+ DocumentoVisibility = true;
+ ItemVisibility = false;
+ PerfilVisibility = true;
+ EsconderResumido = false;
+ SelecionarItensVisibility = (Visibility)2;
+ SegurosVigentesVisibility = (Visibility)0;
+ EndossoVisibility = (Visibility)2;
+ ObsDocVisibility = (Visibility)2;
+ RelacaoApolices();
+ break;
+ }
+ }
+
+ private void SetAllFalse()
+ {
+ ObsClienteEnabled = false;
+ ClientePorPaginaEnabled = false;
+ ComissaoDocumentoEnabled = false;
+ ObsApoliceEnabled = false;
+ BeneficiariosItensEnabled = false;
+ ObsItemEnabled = false;
+ SepararPaginaEnabled = false;
+ CoberturasEnabled = false;
+ PerfilCondutorEnabled = false;
+ EndossoEnabled = false;
+ }
+
+ private void ExtratoCliente()
+ {
+ SetAllFalse();
+ ObsClienteEnabled = true;
+ }
+
+ private void ApoliceSelecionada()
+ {
+ SetAllFalse();
+ ObsClienteEnabled = true;
+ ClientePorPaginaEnabled = true;
+ ComissaoDocumentoEnabled = true;
+ ObsApoliceEnabled = true;
+ BeneficiariosItensEnabled = true;
+ ObsItemEnabled = true;
+ SepararPaginaEnabled = true;
+ PerfilCondutorEnabled = true;
+ EndossoEnabled = true;
+ CoberturasEnabled = true;
+ }
+
+ private void RelacaoApolices()
+ {
+ SetAllFalse();
+ ComissaoDocumentoEnabled = true;
+ PerfilCondutorEnabled = true;
+ }
+
+ public async Task Gerar(Relatorio? tipoRelatorio = null, bool pdf = false)
+ {
+ string html = "";
+ string title;
+ if (Clientes != null && Documentos == null)
+ {
+ html += "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title>";
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE";
+ html += title;
+ html += "</title></head><body bgcolor='#FFFFFF'><div align='center'>";
+ html += "<style> td > p { margin: 2px; }</style>";
+ long idCli = 0L;
+ Clientes.ForEach(delegate(Cliente x)
+ {
+ //IL_0353: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0359: Invalid comparison between Unknown and I4
+ //IL_080c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0812: Invalid comparison between Unknown and I4
+ //IL_0988: Unknown result type (might be due to invalid IL or missing references)
+ //IL_098e: Invalid comparison between Unknown and I4
+ //IL_0bb7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0bbd: Invalid comparison between Unknown and I4
+ //IL_0d17: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0d1d: Invalid comparison between Unknown and I4
+ //IL_0d97: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0d9d: Invalid comparison between Unknown and I4
+ //IL_1351: Unknown result type (might be due to invalid IL or missing references)
+ //IL_12a2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_12a8: Invalid comparison between Unknown and I4
+ //IL_0a09: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0a0e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_11e8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_11ee: Invalid comparison between Unknown and I4
+ //IL_0ea0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_1030: Unknown result type (might be due to invalid IL or missing references)
+ //IL_1035: Unknown result type (might be due to invalid IL or missing references)
+ int num6 = 0;
+ if (idCli != ((DomainBase)x).Id)
+ {
+ idCli = ((DomainBase)x).Id;
+ html += ((ClientePorPagina && ClientePorPaginaEnabled) ? "<div style='page-break-before:always;'>" : "");
+ html += "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>";
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE: " + x.Nome;
+ html = html + title + "</h4></td></table><br>";
+ string text25 = ((x.Atividade == null) ? "NASCIMENTO" : "ABERTURA");
+ bool pessoaFisica3 = x.PessoaFisica;
+ html = html + "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica3 ? "" : "colspan='1'") + "><p align='left'><b>CLIENTE: </b>" + x.Nome + "</p></td><td width='222' bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica3 ? "" : "colspan='2'") + "><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>" + x.Documento + "</p></td><td width='222' bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica3 ? "" : "colspan='3'") + "><p align='left'><b>" + text25 + ": </b>" + x.Nascimento?.ToShortDateString() + "</p></td>";
+ if (pessoaFisica3)
+ {
+ html = html + "<td width='222' bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>FALECIDO: </b>" + (x.Falecido ? "SIM" : "NÃO") + "</p></td>";
+ }
+ else
+ {
+ num6++;
+ }
+ html += "</tr>";
+ if (x.Atividade != null)
+ {
+ html = html + "<tr><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>RAMO DE ATIVIDADE: </b>" + x.Atividade.Nome + "</p></td></tr>";
+ if (!pessoaFisica3)
+ {
+ num6++;
+ }
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html += "<tr>";
+ if (pessoaFisica3)
+ {
+ html = html + "<td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ESTADO CIVIL: </b>" + (x.EstadoCivil.HasValue ? x.EstadoCivil.ToString().ToUpper() : "-") + "</p></td><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>SEXO: </b>" + (x.Sexo.HasValue ? x.Sexo.ToString().ToUpper() : "-") + "</p></td>";
+ }
+ html = html + "<td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica3 ? "colspan='2'" : "colspan='4'") + "><p align='left'><b>CLIENTE DESDE: </b>" + ((!x.ClienteDesde.HasValue) ? "-" : x.ClienteDesde?.ToShortDateString()) + "</p></td></tr>";
+ }
+ if (pessoaFisica3)
+ {
+ html = html + "<tr><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>HABILITAÇÃO: </b>" + ((!string.IsNullOrWhiteSpace(x.Habilitacao)) ? x.Habilitacao : "-") + "</p></td><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CATEGORIA: </b>" + ((!string.IsNullOrWhiteSpace(x.CategoriaHabilitacao)) ? x.CategoriaHabilitacao : "-") + "</p></td><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>1ª HAB.: </b>" + ((!x.PrimeiraHabilitacao.HasValue) ? "-" : x.PrimeiraHabilitacao?.ToShortDateString()) + "</p></td><td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>VENCIMENTO: </b>" + ((!x.VencimentoHabilitacao.HasValue) ? "-" : x.VencimentoHabilitacao?.ToShortDateString()) + "</p></td></tr>";
+ }
+ if (!string.IsNullOrWhiteSpace(x.Identidade))
+ {
+ html = html + "<tr><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>RG: </b>" + ((!string.IsNullOrWhiteSpace(x.Identidade)) ? x.Identidade : "-") + "</p></td><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ORGÃO EMISSOR: </b>" + ((!string.IsNullOrWhiteSpace(x.Emissor)) ? x.Emissor : "-") + "</p></td><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ESTADO EMISSOR: </b>" + ((!string.IsNullOrWhiteSpace(x.EstadoEmissor)) ? x.EstadoEmissor : "-") + "</p></td><td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>EXPEDIÇÃO: </b>" + ((!x.Expedicao.HasValue) ? "-" : x.Expedicao?.ToShortDateString()) + "</p></td></tr>";
+ }
+ if ((int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ html = html + "<tr><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>BANCO: </b>" + ((x.Banco != null) ? x.Banco.Nome : "-") + "</p></td><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>" + ((!string.IsNullOrWhiteSpace(x.Agencia)) ? x.Agencia : "-") + "</p></td><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CONTA: </b>" + ((!string.IsNullOrWhiteSpace(x.Conta)) ? x.Conta : "-") + "</p></td><td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>TIPO: </b>" + ((!string.IsNullOrWhiteSpace(x.TipoConta)) ? x.TipoConta : "-") + "</p></td></tr>";
+ }
+ TipoTelefone valueOrDefault3;
+ if ((x.Telefones != null || x.Emails != null) && (int)SelectedTipoExtrato != 2)
+ {
+ html += "<tr>";
+ if (x.Telefones != null)
+ {
+ string text26 = "";
+ foreach (ClienteTelefone telefone in x.Telefones)
+ {
+ string[] obj32 = new string[7] { text26, "<br>", null, null, null, null, null };
+ TipoTelefone? tipo2 = ((TelefoneBase)telefone).Tipo;
+ object obj33;
+ if (!tipo2.HasValue)
+ {
+ obj33 = null;
+ }
+ else
+ {
+ valueOrDefault3 = tipo2.GetValueOrDefault();
+ obj33 = ((object)(TipoTelefone)(ref valueOrDefault3)).ToString().ToUpper();
+ }
+ obj32[2] = (string)obj33;
+ obj32[3] = " (";
+ obj32[4] = ((TelefoneBase)telefone).Prefixo;
+ obj32[5] = ") ";
+ obj32[6] = ((TelefoneBase)telefone).Numero;
+ text26 = string.Concat(obj32);
+ }
+ html = html + "<td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>CONTATOS: </b>" + text26 + "</p></td>";
+ }
+ if (x.Emails != null && !ExtratoResumido)
+ {
+ string text27 = "";
+ foreach (ClienteEmail email in x.Emails)
+ {
+ text27 = text27 + "<br>" + ((EmailBase)email).Email;
+ }
+ html = html + "<td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>EMAILS: </b>" + text27 + "</p></td>";
+ }
+ num6++;
+ html += "</tr>";
+ }
+ if (x.Enderecos != null && (int)SelectedTipoExtrato != 2)
+ {
+ string text28 = "";
+ foreach (ClienteEndereco endereco in x.Enderecos)
+ {
+ text28 = text28 + "<br>" + ((EnderecoBase)endereco).Endereco + ", " + ((EnderecoBase)endereco).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco).Complemento) ? "" : (((EnderecoBase)endereco).Complemento + ", ")) + ((EnderecoBase)endereco).Bairro + " - " + ((EnderecoBase)endereco).Cidade + " - " + ((EnderecoBase)endereco).Estado + " - " + ((EnderecoBase)endereco).Cep;
+ }
+ html = html + "<tr><td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>" + text28 + "</p></td></tr>";
+ }
+ if (x.Profissao != null && (int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<tr><td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>PROFISSÃO: </b>" + x.Profissao.Nome + "</p></td></tr>";
+ }
+ if (x.Contatos != null && (int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ string text29 = "";
+ foreach (MaisContato contato in x.Contatos)
+ {
+ string[] obj34 = new string[15]
+ {
+ text29,
+ "<br>NOME: ",
+ contato.Nome,
+ (!string.IsNullOrWhiteSpace(contato.Documento)) ? (", DOCUMENTO: " + contato.Documento) : "",
+ contato.Nascimento.HasValue ? (", NASCIMENTO: " + contato.Nascimento?.ToShortDateString()) : "",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ object obj35;
+ if (!contato.Parentesco.HasValue)
+ {
+ obj35 = "";
+ }
+ else
+ {
+ Parentesco? parentesco2 = contato.Parentesco;
+ object obj36;
+ if (!parentesco2.HasValue)
+ {
+ obj36 = null;
+ }
+ else
+ {
+ Parentesco valueOrDefault4 = parentesco2.GetValueOrDefault();
+ obj36 = ((object)(Parentesco)(ref valueOrDefault4)).ToString().ToUpper();
+ }
+ obj35 = ", PARENTESCO: " + (string?)obj36;
+ }
+ obj34[5] = (string)obj35;
+ obj34[6] = ((!string.IsNullOrWhiteSpace(contato.Banco) || !string.IsNullOrWhiteSpace(contato.Agencia) || !string.IsNullOrWhiteSpace(contato.Conta)) ? "<br>" : "");
+ obj34[7] = ((!string.IsNullOrWhiteSpace(contato.Banco)) ? ("BANCO: " + contato.Banco) : "");
+ obj34[8] = ((!string.IsNullOrWhiteSpace(contato.Agencia)) ? (((!string.IsNullOrWhiteSpace(contato.Banco)) ? ", AGÊNCIA: " : "AGÊNCIA: ") + contato.Agencia) : "");
+ obj34[9] = ((!string.IsNullOrWhiteSpace(contato.Conta)) ? (((!string.IsNullOrWhiteSpace(contato.Banco) || !string.IsNullOrWhiteSpace(contato.Agencia)) ? ", CONTA: " : "CONTA: ") + contato.Conta) : "");
+ obj34[10] = ((contato.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato.Prefixo) && !string.IsNullOrWhiteSpace(contato.Telefone)) || !string.IsNullOrWhiteSpace(contato.Email)) ? "<br>" : "");
+ object obj37;
+ if (!contato.Tipo.HasValue)
+ {
+ obj37 = "";
+ }
+ else
+ {
+ TipoTelefone? tipo2 = contato.Tipo;
+ object obj38;
+ if (!tipo2.HasValue)
+ {
+ obj38 = null;
+ }
+ else
+ {
+ valueOrDefault3 = tipo2.GetValueOrDefault();
+ obj38 = ((object)(TipoTelefone)(ref valueOrDefault3)).ToString().ToUpper();
+ }
+ obj37 = "TIPO DO TELEFONE: " + (string?)obj38;
+ }
+ obj34[11] = (string)obj37;
+ obj34[12] = ((!string.IsNullOrWhiteSpace(contato.Prefixo) && !string.IsNullOrWhiteSpace(contato.Telefone)) ? ((contato.Tipo.HasValue ? ", TELEFONE: (" : "TELEFONE: (") + contato.Prefixo + ") " + contato.Telefone) : "");
+ obj34[13] = ((!string.IsNullOrWhiteSpace(contato.Email)) ? (((contato.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato.Prefixo) && !string.IsNullOrWhiteSpace(contato.Telefone))) ? ", EMAIL: " : "EMAIL: ") + contato.Email) : "");
+ obj34[14] = "<br>";
+ text29 = string.Concat(obj34);
+ }
+ html = html + "<tr><td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>MAIS CONTATOS: </b>" + text29 + "</p></td></tr>";
+ }
+ if (ObsCliente && ClienteVisibility && ObsClienteEnabled && !string.IsNullOrWhiteSpace(x.Observacao) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ x.Observacao = "<br>" + x.Observacao.Replace("\r\n", "<br>");
+ html = html + "<tr><td bgcolor='" + ((num6++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left' x-ms-format-detection='none'><b>OBSERVAÇÕES: </b>" + x.Observacao + "</p></td></tr>";
+ }
+ if (!string.IsNullOrWhiteSpace(x.Pasta) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ html = html + "<tr><td bgcolor='" + ((num6 % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left' x-ms-format-detection='none'><b>PASTA: </b>" + x.Pasta + "</p></td></tr>";
+ }
+ html += "</font></table>";
+ html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "</div>" : "");
+ }
+ });
+ DateTime networkTime = Funcoes.GetNetworkTime();
+ html = html + "<br><font face='Verdana' size='1'><br>" + Recursos.Usuario.Nome + " - " + networkTime.Date.ToShortDateString() + "</font></div><script src='https://code.jquery.com/jquery-3.3.1.slim.min.js' integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo' crossorigin='anonymous'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js' integrity='sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1' crossorigin='anonymous'></script><script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous'></script></body></html>";
+ string tempPath = Path.GetTempPath();
+ string text = $"{tempPath}{(object)(TipoExtrato)0}_{networkTime:ddMMyyyyhhmmss}.html";
+ if (pdf)
+ {
+ text = $"{tempPath}{(object)(TipoExtrato)0}_{networkTime:ddMMyyyyhhmmss}.pdf";
+ byte[] bytes = ((HtmlToPdfConverter)new NRecoHtmlToPdfConverter()).GeneratePdf(html);
+ File.WriteAllBytes(text, bytes);
+ }
+ else
+ {
+ StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8);
+ streamWriter.Write(html);
+ streamWriter.Close();
+ }
+ Process.Start(text);
+ RegistrarAcao("GEROU O EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " " + ((Clientes == null) ? "" : ((Clientes.Count > 1) ? $"DE {Clientes.Count} CLIENTES" : ("DO CLIENTE " + Clientes[0].Nome))), 0L, (TipoTela)23, "NOMES DOS CLIENTES:\n" + string.Join("\n", Clientes.Select((Cliente x) => x.Nome)) + GerarOpcoes());
+ Documentos = null;
+ Clientes = null;
+ }
+ else
+ {
+ if ((Documentos == null && Prospeccoes == null) || Clientes != null)
+ {
+ return;
+ }
+ html = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title>";
+ title = "";
+ TipoExtrato selectedTipoExtrato = SelectedTipoExtrato;
+ switch ((int)selectedTipoExtrato)
+ {
+ case 0:
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE";
+ break;
+ case 1:
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DA APÓLICE SELECIONADA";
+ if (tipoRelatorio.HasValue && (int)tipoRelatorio.GetValueOrDefault() == 4)
+ {
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO RELATÓRIO DE RENOVAÇÕES";
+ }
+ break;
+ case 2:
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DE RELAÇÃO DE APÓLICES";
+ break;
+ }
+ html += title;
+ html += "</title></head><body bgcolor='#FFFFFF'><div align='center'>";
+ List<long> sDocumento = new List<long>();
+ if (Documentos != null && Documentos.Count > 0)
+ {
+ bool configEndosso = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 42);
+ foreach (Documento documento2 in Documentos)
+ {
+ Documento val = documento2;
+ val.Parcelas = await new ParcelaServico().BuscarParcelasAsync(((DomainBase)documento2).Id);
+ Controle controle = documento2.Controle;
+ controle.Cliente = await _clienteServico.BuscarCliente(((DomainBase)documento2.Controle.Cliente).Id);
+ Cliente cliente = documento2.Controle.Cliente;
+ cliente.Enderecos = await _clienteServico.BuscarEnderecosAsync(((DomainBase)documento2.Controle.Cliente).Id);
+ cliente = documento2.Controle.Cliente;
+ cliente.Emails = await _clienteServico.BuscarEmailsAsync(((DomainBase)documento2.Controle.Cliente).Id);
+ cliente = documento2.Controle.Cliente;
+ cliente.Telefones = await _clienteServico.BuscarTelefonesAsync(((DomainBase)documento2.Controle.Cliente).Id);
+ cliente = documento2.Controle.Cliente;
+ cliente.Contatos = await _clienteServico.BuscarContatosAsync(((DomainBase)documento2.Controle.Cliente).Id);
+ }
+ bool primeiro = true;
+ foreach (Documento documento in Documentos)
+ {
+ List<Item> itensDocumentos = new List<Item>();
+ List<Item> list = ((!Endossos) ? (await new ItemServico().BuscarItens(((DomainBase)documento.Controle).Id, (StatusItem)0)).ToList() : (await new ItemServico().BuscarItens(((DomainBase)documento).Id, (StatusItem)2)).ToList());
+ List<Item> list2 = list;
+ if (_itensSelecionados != null && _itensSelecionados.Count > 0)
+ {
+ list2.ForEach(delegate(Item x)
+ {
+ if (_itensSelecionados.Any((Item y) => ((DomainBase)y).Id == ((DomainBase)x).Id))
+ {
+ itensDocumentos.Add(x);
+ }
+ });
+ }
+ else
+ {
+ itensDocumentos.AddRange(list2);
+ }
+ List<Perfil> source = await new PerfilServico().BuscarPerfis(((DomainBase)documento.Controle).Id);
+ long num = 0L;
+ int color = 0;
+ if (!primeiro)
+ {
+ html += (ExtratoPorPagina ? "<div style='page-break-before:always;'>" : "");
+ }
+ if (num != ((DomainBase)documento.Controle.Cliente).Id)
+ {
+ html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled && !ExtratoPorPagina) ? "<div style='page-break-before:always;'>" : "");
+ html += "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>";
+ selectedTipoExtrato = SelectedTipoExtrato;
+ switch ((int)selectedTipoExtrato)
+ {
+ case 0:
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE: " + documento.Controle.Cliente.Nome;
+ break;
+ case 1:
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DA APÓLICE SELECIONADA: " + documento.Apolice;
+ if (tipoRelatorio.HasValue && (int)tipoRelatorio.GetValueOrDefault() == 4)
+ {
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DA APÓLICE: " + documento.Apolice;
+ }
+ if (!string.IsNullOrEmpty(documento.Endosso) && !documento.Endosso.Equals("0"))
+ {
+ title = title + " E DO ENDOSSO: " + documento.Endosso;
+ }
+ if (SomenteEndossos)
+ {
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO ENDOSSO: " + documento.Endosso;
+ }
+ break;
+ case 2:
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DE RELAÇÃO DE APÓLICES";
+ break;
+ }
+ html = html + title + "</h4></td></table><br>";
+ html += "<style>td > p {margin: 2px;}</style>";
+ TipoTelefone valueOrDefault;
+ if (ExtratoResumido)
+ {
+ bool pessoaFisica = documento.Controle.Cliente.PessoaFisica;
+ if ((!Endossos || !SomenteEndossos) && !sDocumento.Any((long x) => x == ((DomainBase)documento.Controle).Id))
+ {
+ html = html + "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica ? "" : "colspan='2'") + "><p align='left'><b>CLIENTE: </b>" + documento.Controle.Cliente.Nome + "</p></td>";
+ if (pessoaFisica)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>RG: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "</p></td>";
+ }
+ html = html + "<td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>" + documento.Controle.Cliente.Documento + "</p></td></tr>";
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ string text2 = ((documento.Controle.Cliente.Atividade == null) ? "NASCIMENTO" : "ABERTURA");
+ html = html + "<tr><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica ? "" : "colspan='2'") + "><p align='left'><b>" + text2 + ": " + documento.Controle.Cliente.Nascimento?.ToShortDateString() + "</b></p>";
+ if (pessoaFisica)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'colspan='2'><p align='left'><b>ESTADO CIVIL: </b>" + (documento.Controle.Cliente.EstadoCivil.HasValue ? documento.Controle.Cliente.EstadoCivil.ToString().ToUpper() : "-") + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>SEXO: </b>" + (documento.Controle.Cliente.Sexo.HasValue ? documento.Controle.Cliente.Sexo.ToString().ToUpper() : "-") + "</p></td></td></tr>";
+ }
+ else
+ {
+ color++;
+ }
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>BANCO: </b>" + ((documento.Controle.Cliente.Banco != null) ? documento.Controle.Cliente.Banco.Nome : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Agencia)) ? documento.Controle.Cliente.Agencia : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CONTA: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Conta)) ? documento.Controle.Cliente.Conta : "-") + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>TIPO: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.TipoConta)) ? documento.Controle.Cliente.TipoConta : "-") + "</p></td></tr>";
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html += "<tr>";
+ string text3 = "";
+ if (documento.Controle.Cliente.Telefones != null)
+ {
+ foreach (ClienteTelefone telefone2 in documento.Controle.Cliente.Telefones)
+ {
+ string[] obj = new string[7] { text3, "<br>", null, null, null, null, null };
+ TipoTelefone? tipo = ((TelefoneBase)telefone2).Tipo;
+ object obj2;
+ if (!tipo.HasValue)
+ {
+ obj2 = null;
+ }
+ else
+ {
+ valueOrDefault = tipo.GetValueOrDefault();
+ obj2 = ((object)(TipoTelefone)(ref valueOrDefault)).ToString().ToUpper();
+ }
+ obj[2] = (string)obj2;
+ obj[3] = " (";
+ obj[4] = ((TelefoneBase)telefone2).Prefixo;
+ obj[5] = ") ";
+ obj[6] = ((TelefoneBase)telefone2).Numero;
+ text3 = string.Concat(obj);
+ }
+ }
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' ><p align='left'><b>CONTATOS: </b>" + (string.IsNullOrEmpty(text3) ? "-" : text3) + "</p></td>";
+ string text4 = "";
+ if (documento.Controle.Cliente.Emails != null)
+ {
+ foreach (ClienteEmail email2 in documento.Controle.Cliente.Emails)
+ {
+ text4 = text4 + "<br>" + ((EmailBase)email2).Email;
+ }
+ }
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>EMAILS: </b>" + (string.IsNullOrEmpty(text4) ? "-" : text4) + "</p></td>";
+ string text5 = "";
+ if (documento.Controle.Cliente.Enderecos != null)
+ {
+ foreach (ClienteEndereco endereco2 in documento.Controle.Cliente.Enderecos)
+ {
+ text5 = text5 + "<br>" + ((EnderecoBase)endereco2).Endereco + ", " + ((EnderecoBase)endereco2).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco2).Complemento) ? "" : (((EnderecoBase)endereco2).Complemento + ", ")) + ((EnderecoBase)endereco2).Bairro + " - " + ((EnderecoBase)endereco2).Cidade + " - " + ((EnderecoBase)endereco2).Estado + " - " + ((EnderecoBase)endereco2).Cep;
+ }
+ }
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>ENDEREÇOS: </b>" + (string.IsNullOrEmpty(text5) ? "-" : text5) + "</p></td>";
+ html += "</tr>";
+ }
+ html += "</font></table>";
+ html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "</div>" : "");
+ }
+ else
+ {
+ html = html + "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CLIENTE: </b>" + documento.Controle.Cliente.Nome + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>RG: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>" + documento.Controle.Cliente.Documento + "</p></td></tr></font></table>";
+ }
+ if ((int)SelectedTipoExtrato == 0)
+ {
+ return;
+ }
+ color = 0;
+ Documento val2 = documento.Controle.Documentos?.LastOrDefault((Func<Documento, bool>)((Documento x) => !x.Excluido && x.Ordem != 0));
+ html = html + "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>RAMO: </b>" + documento.Controle.Ramo.Nome + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>VIGÊNCIA INICIAL: </b>" + documento.Vigencia1.ToShortDateString() + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>VIGÊNCIA FINAL: </b>" + ((!documento.Vigencia2.HasValue) ? "-" : documento.Vigencia2?.ToShortDateString()) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CONTRATO: </b>" + (string.IsNullOrWhiteSpace(documento.Apolice) ? "-" : documento.Apolice) + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>POSSUI ENDOSSO? </b>" + (documento.TemEndosso ? "SIM" : "NÃO") + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>ADITAMENTO: </b>" + ((!string.IsNullOrWhiteSpace(documento.Endosso)) ? documento.Endosso : ((configEndosso && val2 != null) ? val2.Endosso : "-")) + "</p></td></tr><tr>";
+ if (!documento.NegocioCorretora.HasValue)
+ {
+ documento.NegocioCorretora = (NegocioCorretora)(((int)documento.Situacao == 2 && documento.Negocio.HasValue && (int)documento.Negocio.GetValueOrDefault() == 1) ? 1 : 0);
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>NEGÓCIO CORRETORA: </b>" + ValidationHelper.GetDescription((Enum)(object)documento.NegocioCorretora) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>STATUS DO SEGURO: </b>" + ValidationHelper.GetDescription((Enum)(object)documento.Situacao) + "</p></td>";
+ }
+ html = html + "</tr><tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>VENDEDOR: </b>" + ((documento.VendedorPrincipal == null) ? "-" : documento.VendedorPrincipal.Nome) + "</p></td></tr>";
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html += "<tr>";
+ string text6 = "";
+ if (documento.Estipulante1 != null)
+ {
+ text6 = text6 + documento.Estipulante1.Nome + ", ";
+ }
+ if (documento.Estipulante2 != null)
+ {
+ text6 = text6 + documento.Estipulante2.Nome + ", ";
+ }
+ if (documento.Estipulante3 != null)
+ {
+ text6 = text6 + documento.Estipulante3.Nome + ", ";
+ }
+ if (documento.Estipulante4 != null)
+ {
+ text6 = text6 + documento.Estipulante4.Nome + ", ";
+ }
+ if (documento.Estipulante5 != null)
+ {
+ text6 = text6 + documento.Estipulante5.Nome + ", ";
+ }
+ if (!string.IsNullOrWhiteSpace(text6))
+ {
+ int startIndex = text6.LastIndexOf(", ", StringComparison.Ordinal);
+ text6 = text6.Remove(startIndex, 2).Insert(startIndex, ".");
+ }
+ html = html + "<td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>ESTIPULANTE(S): </b>" + (string.IsNullOrWhiteSpace(text6) ? "-" : text6) + "</p></td></tr>";
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>SEGURADORA: </b>" + documento.Controle.Seguradora.Nome + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>APÓLICE SINISTRADA: </b>" + (documento.Sinistro ? "SIM" : "NÃO") + "</p></td></tr>";
+ }
+ else
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>SEGURADORA: </b>" + documento.Controle.Seguradora.Nome + "</p></td></tr>";
+ }
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>FORMA PAGAMENTO: </b>" + ValidationHelper.GetDescription((Enum)(object)documento.FormaPagamento) + "</p></td></tr>";
+ html += "</font></table>";
+ if (PremioParcela || ExtratoResumido)
+ {
+ html += "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr>";
+ if ((ComissaoDocumento && ComissaoDocumentoEnabled) || ExtratoResumido)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>COMISSÃO: </b>" + $"{Math.Round(documento.Comissao, 2):n2}%" + "</p></td>";
+ }
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>PRÊMIO LÍQUIDO: </b>" + $"{Math.Round(documento.PremioLiquido, 2):c}" + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ADICIONAL: </b>" + $"{Math.Round(documento.PremioAdicional, 2):c}" + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CUSTO APÓLICE: </b>" + $"{Math.Round(documento.Custo, 2):c}" + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>I.O.F.: </b>" + $"{Math.Round(documento.Iof, 2):c}" + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>PRÊMIO TOTAL: </b>" + $"{Math.Round(documento.PremioTotal, 2):c}" + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>Nº PARCELAS: </b>" + documento.NumeroParcelas + "</p></td></tr>";
+ html += "</font></table>";
+ }
+ if (PerfilCondutor && PerfilVisibility && ((DomainBase)documento.Controle.Ramo).Id == 5 && PerfilCondutorEnabled)
+ {
+ List<Perfil> list3 = source.ToList();
+ foreach (Perfil item3 in list3)
+ {
+ color = 0;
+ if (!string.IsNullOrEmpty(item3.Nome))
+ {
+ html = html + "<hr style='width:999; border-top: 2px solid #ccc'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>" + $"CONDUTOR {list3.IndexOf(item3) + 1}: " + "</b>" + item3.Nome + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CPF: </b>" + (string.IsNullOrWhiteSpace(item3.Cpf) ? "-" : item3.Cpf) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>NASCIMENTO: </b>" + ((!item3.Nascimento.HasValue) ? "-" : item3.Nascimento?.ToShortDateString()) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ESTADO CIVIL: </b>" + ((!item3.EstadoCivil.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.EstadoCivil)) + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>SEXO: </b>" + ((!item3.Sexo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.Sexo)) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>RELAÇÃO SEGURADO/CONDUTOR: </b>" + ValidationHelper.GetDescription((Enum)(object)item3.Relacao) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>GARAGEM NA RESIDÊNCIA: </b>" + ((!item3.GaragemResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.GaragemResidencia)) + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>GARAGEM NO TRABALHO: </b>" + ((!item3.GaragemTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.GaragemTrabalho)) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>GARAGEM NO ESTUDO: </b>" + ((!item3.GaragemEstudo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.GaragemEstudo)) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>TIPO DE RESIDÊNCIA: </b>" + ((!item3.TipoResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.TipoResidencia)) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>DISTÂNCIA ATÉ O TRABALHO: </b>" + ((!item3.DistanciaResidenciaTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.DistanciaResidenciaTrabalho)) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>USO PROFISSIONAL: </b>" + ((item3.UsoProfissional.HasValue && item3.UsoProfissional.Value) ? "SIM" : "NÃO") + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>USO POR DEPENDENTES: </b>" + ((!item3.UsoDependentes.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item3.UsoDependentes)) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>ISENÇÃO DE IMPOSTOS: </b>" + ((item3.Isencao.HasValue && item3.Isencao.Value) ? "SIM" : "NÃO") + "</p></td></tr></font></table>";
+ }
+ }
+ }
+ List<Item> itens2 = itensDocumentos.ToList();
+ if (itens2.Count == 0)
+ {
+ html += "<br><p align='center'><b>ESTA APÓLICE NÃO POSSUI ITENS</b></p>";
+ }
+ else
+ {
+ color = 0;
+ foreach (Item item2 in itens2)
+ {
+ if (item2.Sinistros.Count > 0)
+ {
+ Item val3 = item2;
+ val3.Sinistros = await new SinistroServico().BuscarControles(((DomainBase)item2).Id);
+ }
+ html += ((SepararPagina && SepararPaginaEnabled) ? "<div style='page-break-before:always;'>" : "");
+ html += (((int)SelectedTipoExtrato != 2 || itens2.IndexOf(item2) == 0) ? "<br>" : "");
+ html += "<table border='1' bordercolor='#ededed' width='999'>";
+ html += "<style> td > p { margin: 2px; }</style>";
+ html += "<font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr>";
+ if ((int)SelectedTipoExtrato == 2)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>" + $"ITEM {item2.Ordem}: " + "</b>" + item2.Descricao + "</p></td>";
+ }
+ else
+ {
+ switch (((DomainBase)documento.Controle.Ramo).Id)
+ {
+ case 1L:
+ case 2L:
+ case 3L:
+ case 15L:
+ case 18L:
+ {
+ Item val3 = item2;
+ val3.Patrimonial = await new ItemServico().BuscaPatrimonial(((DomainBase)item2).Id);
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='4'><p align='left'><b>" + $"ITEM {item2.Ordem}: " + "</b>" + ((EnderecoBase)item2.Patrimonial).Endereco + ", " + ((EnderecoBase)item2.Patrimonial).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)item2.Patrimonial).Complemento) ? "" : (((EnderecoBase)item2.Patrimonial).Complemento + ", ")) + ((EnderecoBase)item2.Patrimonial).Bairro + " - " + ((EnderecoBase)item2.Patrimonial).Cidade + " - " + ((EnderecoBase)item2.Patrimonial).Estado + " - " + ((EnderecoBase)item2.Patrimonial).Cep + "</p></td>";
+ break;
+ }
+ case 5L:
+ case 37L:
+ {
+ Item val3 = item2;
+ val3.Auto = await new ItemServico().BuscaAuto(((DomainBase)item2).Id);
+ string[] obj3 = new string[26]
+ {
+ html,
+ "<td bgcolor='",
+ (color % 2 == 0) ? "WhiteSmoke" : "White",
+ "' colspan='4'><p align='left'><b>",
+ $"ITEM {item2.Ordem}: ",
+ "</b><br>",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ Fabricante fabricante = item2.Auto.Fabricante;
+ obj3[6] = ((fabricante != null) ? fabricante.Descricao : null);
+ obj3[7] = " ";
+ obj3[8] = item2.Auto.Modelo;
+ obj3[9] = " (";
+ obj3[10] = item2.Auto.AnoFabricacao;
+ obj3[11] = "/";
+ obj3[12] = item2.Auto.AnoModelo;
+ obj3[13] = ")<br>PLACA: ";
+ obj3[14] = item2.Auto.Placa;
+ obj3[15] = ", CHASSI: ";
+ obj3[16] = item2.Auto.Chassi;
+ obj3[17] = "<br>C.I.: ";
+ obj3[18] = item2.Auto.Ci;
+ obj3[19] = ", RENAVAM: ";
+ obj3[20] = item2.Auto.Renavam;
+ obj3[21] = ", CEP PERNOITE: ";
+ obj3[22] = item2.Auto.CepPernoite;
+ obj3[23] = "<br>FINANCIADO: ";
+ obj3[24] = (item2.Auto.Financiado.GetValueOrDefault() ? "SIM" : "NÃO");
+ obj3[25] = "</p></td>";
+ html = string.Concat(obj3);
+ break;
+ }
+ default:
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='4'><p align='left'><b>" + $"ITEM {item2.Ordem}: " + "</b>" + item2.Descricao + "</p></td>";
+ break;
+ }
+ }
+ if (item2.Sinistros.Count > 0)
+ {
+ Item obj4 = item2;
+ DateTime? obj5;
+ if (obj4 == null)
+ {
+ obj5 = null;
+ }
+ else
+ {
+ IList<ControleSinistro> sinistros = obj4.Sinistros;
+ if (sinistros == null)
+ {
+ obj5 = null;
+ }
+ else
+ {
+ ControleSinistro? obj6 = sinistros.LastOrDefault();
+ if (obj6 == null)
+ {
+ obj5 = null;
+ }
+ else
+ {
+ List<Sinistro> sinistros2 = obj6.Sinistros;
+ if (sinistros2 == null)
+ {
+ obj5 = null;
+ }
+ else
+ {
+ Sinistro? obj7 = sinistros2.LastOrDefault();
+ obj5 = ((obj7 != null) ? obj7.DataReclamacao : null);
+ }
+ }
+ }
+ }
+ DateTime? dateTime = obj5;
+ string text7 = (dateTime.HasValue ? dateTime.Value.ToShortDateString() : "-");
+ string[] obj8 = new string[14]
+ {
+ html, "</tr><td bgcolor='", null, null, null, null, null, null, null, null,
+ null, null, null, null
+ };
+ int num2 = color + 1;
+ color = num2;
+ obj8[2] = ((num2 % 2 == 0) ? "WhiteSmoke" : "White");
+ obj8[3] = "' colspan='2'><p align='left'><b>SINISTRO STATUS: </b>";
+ obj8[4] = ValidationHelper.GetDescription((Enum)(object)item2.Sinistros.LastOrDefault().Sinistros.LastOrDefault().StatusSinistro);
+ obj8[5] = "</p></td><td bgcolor='";
+ obj8[6] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ obj8[7] = "'><p align='left'><b>DATA: </b>";
+ obj8[8] = text7;
+ obj8[9] = "</p></td><td bgcolor='";
+ obj8[10] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ obj8[11] = "'><p align='left'><b>VALOR: </b>";
+ obj8[12] = ValidationHelper.ToCurrency<decimal>(item2.Sinistros.LastOrDefault().Sinistros.LastOrDefault().Valor, "pt-BR");
+ obj8[13] = "</p></td>";
+ html = string.Concat(obj8);
+ }
+ html += "</tr>";
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ string[] obj9 = new string[6] { html, "<tr><td bgcolor='", null, null, null, null };
+ int num2 = color + 1;
+ color = num2;
+ obj9[2] = ((num2 % 2 == 0) ? "WhiteSmoke" : "White");
+ obj9[3] = "' colspan='4'><p align='left'><b>ATIVO: </b>";
+ obj9[4] = ((!item2.Substituido.HasValue) ? "SIM" : "NÃO");
+ obj9[5] = "</p></td></tr>";
+ html = string.Concat(obj9);
+ long id = ((DomainBase)documento.Controle.Ramo).Id;
+ long num3 = id - 1;
+ if ((ulong)num3 <= 58uL)
+ {
+ switch (num3)
+ {
+ case 0L:
+ case 1L:
+ case 2L:
+ case 14L:
+ case 17L:
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Patrimonial.Bens) ? "-" : item2.Patrimonial.Bens) + "</p></td></tr>";
+ }
+ break;
+ case 4L:
+ case 36L:
+ {
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Auto.Observacao) ? "-" : item2.Auto.Observacao) + "</p></td></tr>";
+ }
+ string[] array = new string[26];
+ array[0] = html;
+ array[1] = "<tr><td bgcolor='";
+ num2 = color + 1;
+ color = num2;
+ array[2] = ((num2 % 2 == 0) ? "WhiteSmoke" : "White");
+ array[3] = "' colspan='2'><p align='left'><b>COBERTURA PADRÃO: </b>";
+ TipoCobertura? tipoCobertura = item2.Auto.TipoCobertura;
+ array[4] = (tipoCobertura.HasValue ? ValidationHelper.GetDescription((Enum)(object)tipoCobertura.GetValueOrDefault()) : null);
+ array[5] = "</p></td><td bgcolor='";
+ array[6] = ((color++ % 2 == 0) ? "WhiteSmoke" : "White");
+ array[7] = "' colspan='2'><p align='left'><b>BÔNUS: </b>";
+ array[8] = item2.Auto.Bonus.ToString();
+ array[9] = "</p></td></tr><tr><td bgcolor='";
+ array[10] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array[11] = "'><p align='left'><b>REGIÃO DE CIRCULAÇÃO: </b>";
+ array[12] = (string.IsNullOrWhiteSpace(item2.Auto.RegiaoCirculacao) ? "-" : item2.Auto.RegiaoCirculacao);
+ array[13] = "</p></td><td bgcolor='";
+ array[14] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array[15] = "'><p align='left'><b>TABELA DE REFERÊNCIA: </b>";
+ TabelaReferencia? tabelaReferencia = item2.Auto.TabelaReferencia;
+ array[16] = (tabelaReferencia.HasValue ? ValidationHelper.GetDescription((Enum)(object)tabelaReferencia.GetValueOrDefault()) : null);
+ array[17] = "</p></td><td bgcolor='";
+ array[18] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array[19] = "'><p align='left'><b>FIPE: </b>";
+ array[20] = (string.IsNullOrWhiteSpace(item2.Auto.Fipe) ? "-" : item2.Auto.Fipe);
+ array[21] = "</p></td><td bgcolor='";
+ array[22] = ((color++ % 2 == 0) ? "WhiteSmoke" : "White");
+ array[23] = "'><p align='left'><b>% DE REFERÊNCIA: </b>";
+ array[24] = $"{item2.Auto.PorcentagemReferencia}%";
+ array[25] = "</p></td></tr></tr>";
+ html = string.Concat(array);
+ break;
+ }
+ case 5L:
+ case 6L:
+ case 8L:
+ case 9L:
+ case 52L:
+ {
+ Item val3 = item2;
+ val3.Vida = await new ItemServico().BuscaVida(((DomainBase)item2).Id);
+ if (!item2.Sinistrado || !BeneficiariosItens || !BeneficiariosItensEnabled)
+ {
+ break;
+ }
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>BENEFICIÁRIOS: </b>";
+ string text8 = "";
+ foreach (ControleSinistro sinistro in item2.Sinistros)
+ {
+ if (sinistro.Sinistros == null)
+ {
+ continue;
+ }
+ foreach (Sinistro sinistro2 in sinistro.Sinistros)
+ {
+ if (!string.IsNullOrWhiteSpace(sinistro2.SinistroVida.Beneficiario))
+ {
+ text8 = text8 + sinistro2.SinistroVida.Beneficiario + ", ";
+ }
+ }
+ }
+ if (!string.IsNullOrWhiteSpace(text8))
+ {
+ int startIndex2 = text8.LastIndexOf(", ", StringComparison.Ordinal);
+ text8 = text8.Remove(startIndex2, 2).Insert(startIndex2, ".");
+ }
+ html = html + text8 + "</p></td></tr>";
+ break;
+ }
+ case 3L:
+ case 7L:
+ case 15L:
+ case 16L:
+ case 18L:
+ case 22L:
+ case 23L:
+ case 25L:
+ case 27L:
+ case 30L:
+ case 32L:
+ case 38L:
+ case 40L:
+ case 43L:
+ case 48L:
+ case 58L:
+ {
+ Item val3 = item2;
+ val3.RiscosDiversos = await new ItemServico().BuscaRiscosDiversos(((DomainBase)item2).Id);
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.RiscosDiversos.Observacao) ? "-" : item2.RiscosDiversos.Observacao) + "</p></td></tr>";
+ }
+ break;
+ }
+ case 12L:
+ {
+ Item val3 = item2;
+ val3.Aeronautico = await new ItemServico().BuscaAeronautico(((DomainBase)item2).Id);
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Aeronautico.Observacao) ? "-" : item2.Aeronautico.Observacao) + "</p></td></tr>";
+ }
+ break;
+ }
+ case 19L:
+ {
+ Item val3 = item2;
+ val3.Granizo = await new ItemServico().BuscaGranizo(((DomainBase)item2).Id);
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Granizo.Observacao) ? "-" : item2.Granizo.Observacao) + "</p></td></tr>";
+ }
+ break;
+ }
+ }
+ }
+ }
+ html += "</font></table>";
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ ObservableCollection<Cobertura> observableCollection = await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item2).Id);
+ if (observableCollection.Count > 0 && Coberturas)
+ {
+ html += "<br><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>COBERTURA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>FRANQUIA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>LMI</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>PRÊMIO</div></b></p></td></tr>";
+ foreach (Cobertura item4 in observableCollection)
+ {
+ color++;
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><div align='left'>" + item4.Observacao + "</div></p></td><td style='white-space:nowrap; bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><div align='left'>" + $"{item4.Franquia:c}" + "</div></p></td><td style='white-space:nowrap; bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><div align='left'>" + $"{item4.Lmi:c}" + "</div></p></td><td style='white-space:nowrap; bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><div align='left'>" + $"{item4.Premio:c}" + "</div></p></td></tr>";
+ }
+ html += "</font></table>";
+ }
+ html += ((SepararPagina && SepararPaginaEnabled) ? "</div>" : "");
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ color = 0;
+ }
+ }
+ }
+ }
+ else
+ {
+ if ((!Endossos || !SomenteEndossos) && !sDocumento.Any((long x) => x == ((DomainBase)documento.Controle).Id))
+ {
+ string text9 = ((documento.Controle.Cliente.Atividade == null) ? "NASCIMENTO" : "ABERTURA");
+ bool pessoaFisica2 = documento.Controle.Cliente.PessoaFisica;
+ html = html + "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='" + (pessoaFisica2 ? "222" : "2500") + "' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica2 ? "" : "colspan='2'") + "><p align='left'><b>CLIENTE: </b>" + documento.Controle.Cliente.Nome + "</p></td><td width='" + (pessoaFisica2 ? "222" : "200") + "' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>" + documento.Controle.Cliente.Documento + "</p></td><td width='" + (pessoaFisica2 ? "222" : "300") + "' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>" + text9 + ": </b>" + documento.Controle.Cliente.Nascimento?.ToShortDateString() + "</p></td>";
+ if (pessoaFisica2)
+ {
+ html = html + "<td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>FALECIDO: </b>" + (documento.Controle.Cliente.Falecido ? "SIM" : "NÃO") + "</p></td>";
+ }
+ else
+ {
+ color++;
+ }
+ html += "</tr>";
+ if (documento.Controle.Cliente.Atividade != null)
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica2 ? "" : "colspan='4'") + "><p align='left'><b>RAMO DE ATIVIDADE: </b>" + documento.Controle.Cliente.Atividade.Nome + "</p></td></tr>";
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' " + (pessoaFisica2 ? "" : "colspan='4'") + ">";
+ if (pessoaFisica2)
+ {
+ html = html + "<b>ESTADO CIVIL: </b>" + (documento.Controle.Cliente.EstadoCivil.HasValue ? documento.Controle.Cliente.EstadoCivil.ToString().ToUpper() : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>SEXO: </b>" + (documento.Controle.Cliente.Sexo.HasValue ? documento.Controle.Cliente.Sexo.ToString().ToUpper() : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'>";
+ }
+ html = html + "<p align='left'><b>CLIENTE DESDE: </b>" + ((!documento.Controle.Cliente.ClienteDesde.HasValue) ? "-" : documento.Controle.Cliente.ClienteDesde?.ToShortDateString()) + "</p></td>";
+ if (documento.Controle.Cliente.Profissao != null && (int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' > <p align='left'><b>PROFISSÃO: </b>" + documento.Controle.Cliente.Profissao.Nome + "</p></td>";
+ }
+ else
+ {
+ color++;
+ }
+ html += "</tr>";
+ }
+ if (pessoaFisica2)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>HABILITAÇÃO: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Habilitacao)) ? documento.Controle.Cliente.Habilitacao : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CATEGORIA: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.CategoriaHabilitacao)) ? documento.Controle.Cliente.CategoriaHabilitacao : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>1ª HAB.: </b>" + ((!documento.Controle.Cliente.PrimeiraHabilitacao.HasValue) ? "-" : documento.Controle.Cliente.PrimeiraHabilitacao?.ToShortDateString()) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>VENCIMENTO: </b>" + ((!documento.Controle.Cliente.VencimentoHabilitacao.HasValue) ? "-" : documento.Controle.Cliente.VencimentoHabilitacao?.ToShortDateString()) + "</p></td></tr>";
+ }
+ if (!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade))
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>RG: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ORGÃO EMISSOR: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Emissor)) ? documento.Controle.Cliente.Emissor : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ESTADO EMISSOR: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.EstadoEmissor)) ? documento.Controle.Cliente.EstadoEmissor : "-") + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>EXPEDIÇÃO: </b>" + ((!documento.Controle.Cliente.Expedicao.HasValue) ? "-" : documento.Controle.Cliente.Expedicao?.ToShortDateString()) + "</p></td></tr>";
+ }
+ if ((int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>BANCO: </b>" + ((documento.Controle.Cliente.Banco != null) ? documento.Controle.Cliente.Banco.Nome : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Agencia)) ? documento.Controle.Cliente.Agencia : "-") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CONTA: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Conta)) ? documento.Controle.Cliente.Conta : "-") + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>TIPO: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.TipoConta)) ? documento.Controle.Cliente.TipoConta : "-") + "</p></td></tr>";
+ }
+ if ((documento.Controle.Cliente.Telefones != null || documento.Controle.Cliente.Emails != null) && (int)SelectedTipoExtrato != 2)
+ {
+ html += "<tr>";
+ if (documento.Controle.Cliente.Telefones != null)
+ {
+ string text10 = "";
+ foreach (ClienteTelefone telefone3 in documento.Controle.Cliente.Telefones)
+ {
+ string[] obj10 = new string[10] { text10, "<br>", null, null, null, null, null, null, null, null };
+ TipoTelefone? tipo = ((TelefoneBase)telefone3).Tipo;
+ object obj11;
+ if (!tipo.HasValue)
+ {
+ obj11 = null;
+ }
+ else
+ {
+ valueOrDefault = tipo.GetValueOrDefault();
+ obj11 = ((object)(TipoTelefone)(ref valueOrDefault)).ToString().ToUpper();
+ }
+ obj10[2] = (string)obj11;
+ obj10[3] = " (";
+ obj10[4] = ((TelefoneBase)telefone3).Prefixo;
+ obj10[5] = ") ";
+ obj10[6] = ((TelefoneBase)telefone3).Numero;
+ obj10[7] = " (";
+ obj10[8] = telefone3.Observacao;
+ obj10[9] = ") ";
+ text10 = string.Concat(obj10);
+ }
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>CONTATOS: </b>" + text10 + "</p></td>";
+ }
+ if (documento.Controle.Cliente.Emails != null && !ExtratoResumido)
+ {
+ string text11 = "";
+ foreach (ClienteEmail email3 in documento.Controle.Cliente.Emails)
+ {
+ text11 = text11 + "<br>" + ((EmailBase)email3).Email;
+ }
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>EMAILS: </b>" + text11 + "</p></td>";
+ }
+ else if (documento.Controle.Cliente.Enderecos != null && (int)SelectedTipoExtrato != 2)
+ {
+ string text12 = "";
+ foreach (ClienteEndereco endereco3 in documento.Controle.Cliente.Enderecos)
+ {
+ text12 = text12 + "<br>" + ((EnderecoBase)endereco3).Endereco + ", " + ((EnderecoBase)endereco3).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco3).Complemento) ? "" : (((EnderecoBase)endereco3).Complemento + ", ")) + ((EnderecoBase)endereco3).Bairro + " - " + ((EnderecoBase)endereco3).Cidade + " - " + ((EnderecoBase)endereco3).Estado + " - " + ((EnderecoBase)endereco3).Cep;
+ }
+ html = html + "<td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>" + text12 + "</p></td>";
+ }
+ color++;
+ html += "</tr>";
+ }
+ if (documento.Controle.Cliente.Enderecos != null && (int)SelectedTipoExtrato != 2 && documento.Controle.Cliente.Emails == null && ExtratoResumido)
+ {
+ string text13 = "";
+ foreach (ClienteEndereco endereco4 in documento.Controle.Cliente.Enderecos)
+ {
+ text13 = text13 + "<br>" + ((EnderecoBase)endereco4).Endereco + ", " + ((EnderecoBase)endereco4).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco4).Complemento) ? "" : (((EnderecoBase)endereco4).Complemento + ", ")) + ((EnderecoBase)endereco4).Bairro + " - " + ((EnderecoBase)endereco4).Cidade + " - " + ((EnderecoBase)endereco4).Estado + " - " + ((EnderecoBase)endereco4).Cep;
+ }
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>" + text13 + "</p></td></tr>";
+ }
+ if (documento.Controle.Cliente.Contatos != null && (int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ string text14 = "";
+ foreach (MaisContato contato2 in documento.Controle.Cliente.Contatos)
+ {
+ string[] obj12 = new string[15]
+ {
+ text14,
+ "<br>NOME: ",
+ contato2.Nome,
+ (!string.IsNullOrWhiteSpace(contato2.Documento)) ? (", DOCUMENTO: " + contato2.Documento) : "",
+ contato2.Nascimento.HasValue ? (", NASCIMENTO: " + contato2.Nascimento?.ToShortDateString()) : "",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ object obj13;
+ if (!contato2.Parentesco.HasValue)
+ {
+ obj13 = "";
+ }
+ else
+ {
+ Parentesco? parentesco = contato2.Parentesco;
+ object obj14;
+ if (!parentesco.HasValue)
+ {
+ obj14 = null;
+ }
+ else
+ {
+ Parentesco valueOrDefault2 = parentesco.GetValueOrDefault();
+ obj14 = ((object)(Parentesco)(ref valueOrDefault2)).ToString().ToUpper();
+ }
+ obj13 = ", PARENTESCO: " + (string?)obj14;
+ }
+ obj12[5] = (string)obj13;
+ obj12[6] = ((!string.IsNullOrWhiteSpace(contato2.Banco) || !string.IsNullOrWhiteSpace(contato2.Agencia) || !string.IsNullOrWhiteSpace(contato2.Conta)) ? "<br>" : "");
+ obj12[7] = ((!string.IsNullOrWhiteSpace(contato2.Banco)) ? ("BANCO: " + contato2.Banco) : "");
+ obj12[8] = ((!string.IsNullOrWhiteSpace(contato2.Agencia)) ? (((!string.IsNullOrWhiteSpace(contato2.Banco)) ? ", AGÊNCIA: " : "AGÊNCIA: ") + contato2.Agencia) : "");
+ obj12[9] = ((!string.IsNullOrWhiteSpace(contato2.Conta)) ? (((!string.IsNullOrWhiteSpace(contato2.Banco) || !string.IsNullOrWhiteSpace(contato2.Agencia)) ? ", CONTA: " : "CONTA: ") + contato2.Conta) : "");
+ obj12[10] = ((contato2.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato2.Prefixo) && !string.IsNullOrWhiteSpace(contato2.Telefone)) || !string.IsNullOrWhiteSpace(contato2.Email)) ? "<br>" : "");
+ object obj15;
+ if (!contato2.Tipo.HasValue)
+ {
+ obj15 = "";
+ }
+ else
+ {
+ TipoTelefone? tipo = contato2.Tipo;
+ object obj16;
+ if (!tipo.HasValue)
+ {
+ obj16 = null;
+ }
+ else
+ {
+ valueOrDefault = tipo.GetValueOrDefault();
+ obj16 = ((object)(TipoTelefone)(ref valueOrDefault)).ToString().ToUpper();
+ }
+ obj15 = "TIPO DO TELEFONE: " + (string?)obj16;
+ }
+ obj12[11] = (string)obj15;
+ obj12[12] = ((!string.IsNullOrWhiteSpace(contato2.Prefixo) && !string.IsNullOrWhiteSpace(contato2.Telefone)) ? ((contato2.Tipo.HasValue ? ", TELEFONE: (" : "TELEFONE: (") + contato2.Prefixo + ") " + contato2.Telefone) : "");
+ obj12[13] = ((!string.IsNullOrWhiteSpace(contato2.Email)) ? (((contato2.Tipo.HasValue || (!string.IsNullOrWhiteSpace(contato2.Prefixo) && !string.IsNullOrWhiteSpace(contato2.Telefone))) ? ", EMAIL: " : "EMAIL: ") + contato2.Email) : "");
+ obj12[14] = "<br>";
+ text14 = string.Concat(obj12);
+ }
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>MAIS CONTATOS: </b>" + text14 + "</p></td></tr>";
+ }
+ if (documento.Controle.Cliente.Enderecos != null && !ExtratoResumido)
+ {
+ string text15 = "";
+ foreach (ClienteEndereco endereco5 in documento.Controle.Cliente.Enderecos)
+ {
+ text15 = text15 + "<br>" + ((EnderecoBase)endereco5).Endereco + ", " + ((EnderecoBase)endereco5).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)endereco5).Complemento) ? "" : (((EnderecoBase)endereco5).Complemento + ", ")) + ((EnderecoBase)endereco5).Bairro + " - " + ((EnderecoBase)endereco5).Cidade + " - " + ((EnderecoBase)endereco5).Estado + " - " + ((EnderecoBase)endereco5).Cep;
+ }
+ html = html + "<td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>" + text15 + "</p></td>";
+ }
+ if (ObsCliente && ClienteVisibility && ObsClienteEnabled && !string.IsNullOrWhiteSpace(documento.Controle.Cliente.Observacao) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ documento.Controle.Cliente.Observacao = "<br>" + documento.Controle.Cliente.Observacao.Replace("\r\n", "<br>");
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left' x-ms-format-detection='none'><b>OBSERVAÇÕES: </b>" + documento.Controle.Cliente.Observacao + "</p></td></tr>";
+ }
+ if (!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Pasta) && (int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left' x-ms-format-detection='none'><b>PASTA: </b>" + documento.Controle.Cliente.Pasta + "</p></td></tr>";
+ }
+ html += "</font></table>";
+ if (!primeiro)
+ {
+ html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "</div>" : "");
+ }
+ }
+ else
+ {
+ html = html + "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CLIENTE: </b>" + documento.Controle.Cliente.Nome + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>RG: </b>" + ((!string.IsNullOrWhiteSpace(documento.Controle.Cliente.Identidade)) ? documento.Controle.Cliente.Identidade : "-") + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>" + documento.Controle.Cliente.Documento + "</p></td></tr></font></table>";
+ }
+ if ((int)SelectedTipoExtrato == 0)
+ {
+ return;
+ }
+ color = 0;
+ html = html + "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>RAMO: </b>" + documento.Controle.Ramo.Nome + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>VIGÊNCIA INICIAL: </b>" + documento.Vigencia1.ToShortDateString() + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>VIGÊNCIA FINAL: </b>" + ((!documento.Vigencia2.HasValue) ? "-" : documento.Vigencia2?.ToShortDateString()) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>CONTRATO: </b>" + (string.IsNullOrWhiteSpace(documento.Apolice) ? "-" : documento.Apolice) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>POSSUI ENDOSSO? </b>" + (documento.TemEndosso ? "SIM" : "NÃO") + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left' x-ms-format-detection='none'><b>ADITAMENTO: </b>" + ((!string.IsNullOrWhiteSpace(documento.Endosso)) ? documento.Endosso : ((configEndosso && documento.Controle.Documentos.Where((Documento x) => !x.Excluido && x.Ordem != 0).ToList().Count > 0) ? documento.Controle.Documentos.Last((Documento x) => !x.Excluido && x.Ordem != 0).Endosso : "-")) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>APÓLICE ANTERIOR: </b>" + (string.IsNullOrWhiteSpace(documento.ApoliceAnterior) ? "-" : documento.ApoliceAnterior) + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>BANCO: </b>" + ((documento.Banco == null) ? "-" : documento.Banco.Nome) + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>" + (string.IsNullOrWhiteSpace(documento.Agencia) ? "-" : documento.Agencia) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CONTA: </b>" + (string.IsNullOrWhiteSpace(documento.Conta) ? "-" : documento.Conta) + "</p></td></tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>NUMERO CARTÃO: </b>" + (string.IsNullOrWhiteSpace(documento.NumeroCartao) ? "-" : documento.NumeroCartao) + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>VENCIMENTO: </b>" + (string.IsNullOrWhiteSpace(documento.VencimentoCartao) ? "-" : documento.VencimentoCartao) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>BANDEIRA: </b>" + ((!documento.Bandeira.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)documento.Bandeira)) + "</p></td></tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left' x-ms-format-detection='none'><b>TITULAR/PROPONENTE: </b>" + (string.IsNullOrWhiteSpace(documento.NomeProponente) ? "-" : documento.NomeProponente) + "</p></td></tr>";
+ if (!documento.NegocioCorretora.HasValue)
+ {
+ documento.NegocioCorretora = (NegocioCorretora)(((int)documento.Situacao == 2 && documento.Negocio.HasValue && (int)documento.Negocio.GetValueOrDefault() == 1) ? 1 : 0);
+ }
+ if (ComissaoDocumento && ComissaoDocumentoEnabled)
+ {
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>NEGÓCIO CORRETORA: </b>" + ValidationHelper.GetDescription((Enum)(object)documento.NegocioCorretora) + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>STATUS DO SEGURO: </b>" + ValidationHelper.GetDescription((Enum)(object)documento.Situacao) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>COMISSÃO: </b>" + $"{documento.Comissao}%" + "</p></td>";
+ }
+ else
+ {
+ html = html + "<td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>COMISSÃO: </b>" + $"{documento.Comissao}%" + "</p></td>";
+ }
+ }
+ else if ((int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>NEGÓCIO CORRETORA: </b>" + ValidationHelper.GetDescription((Enum)(object)documento.NegocioCorretora) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>STATUS DO SEGURO: </b>" + ValidationHelper.GetDescription((Enum)(object)documento.Situacao) + "</p></td>";
+ }
+ html = html + "</tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>VENDEDOR: </b>" + ((documento.VendedorPrincipal == null) ? "-" : documento.VendedorPrincipal.Nome) + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>REMESSA: </b>" + ((!documento.Remessa.HasValue) ? "-" : documento.Remessa?.ToShortDateString()) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>EMISSÃO: </b>" + ((!documento.Emissao.HasValue) ? "-" : documento.Emissao?.ToShortDateString()) + "</p></td></tr>";
+ if ((int)SelectedTipoExtrato != 2 && !ExtratoResumido)
+ {
+ html += "<tr>";
+ string text16 = "";
+ if (documento.Estipulante1 != null)
+ {
+ text16 = text16 + documento.Estipulante1.Nome + ", ";
+ }
+ if (documento.Estipulante2 != null)
+ {
+ text16 = text16 + documento.Estipulante2.Nome + ", ";
+ }
+ if (documento.Estipulante3 != null)
+ {
+ text16 = text16 + documento.Estipulante3.Nome + ", ";
+ }
+ if (documento.Estipulante4 != null)
+ {
+ text16 = text16 + documento.Estipulante4.Nome + ", ";
+ }
+ if (documento.Estipulante5 != null)
+ {
+ text16 = text16 + documento.Estipulante5.Nome + ", ";
+ }
+ if (!string.IsNullOrWhiteSpace(text16))
+ {
+ int startIndex3 = text16.LastIndexOf(", ", StringComparison.Ordinal);
+ text16 = text16.Remove(startIndex3, 2).Insert(startIndex3, ".");
+ }
+ html = html + "<td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>ESTIPULANTE(S): </b>" + (string.IsNullOrWhiteSpace(text16) ? "-" : text16) + "</p></td></tr>";
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>SEGURADORA: </b>" + documento.Controle.Seguradora.Nome + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>APÓLICE SINISTRADA: </b>" + (documento.Sinistro ? "SIM" : "NÃO") + "</p></td></tr>";
+ if (documento.Controle.SeguradoraAnterior != null && !ExtratoResumido)
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>SEGURADORA ANTERIOR: </b>" + documento.Controle.SeguradoraAnterior.Nome + "</p></td></tr>";
+ }
+ }
+ else
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>SEGURADORA: </b>" + documento.Controle.Seguradora.Nome + "</p></td></tr>";
+ }
+ html += "</font></table>";
+ if (!ExtratoResumido && (PremioParcela || ObsApoliceEnabled))
+ {
+ html += "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>";
+ if (PremioParcela)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>PRÊMIO LÍQUIDO: </b><br/>" + documento.PremioLiquido.ToString("c") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ADICIONAL: </b><br/>" + documento.PremioAdicional.ToString("c") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CUSTO APÓLICE: </b><br/>" + documento.Custo.ToString("c") + "</p></td><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>I.O.F.: </b><br/>" + documento.Iof.ToString("c") + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'" + ((ComissaoDocumento && ComissaoDocumentoEnabled) ? "" : " colspan='2'") + "><p align='left'><b>PRÊMIO TOTAL: </b><br/>" + documento.PremioTotal.ToString("c") + "</p></td>";
+ html += "</tr>";
+ html += "</font></table><br>";
+ ObservableCollection<Parcela> parcelas = documento.Parcelas;
+ if (parcelas != null && parcelas.Count > 0)
+ {
+ html += "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>PARCELA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>VENCIMENTO</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>VALOR</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>FORMA DE PAGAMENTO</div></b></p></td></tr>";
+ foreach (Parcela parcela in documento.Parcelas)
+ {
+ html = html + "<tr><td bgcolor='White'><p align='left'><div align='center'>" + parcela.NumeroParcela + "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>" + parcela.Vencimento.ToShortDateString() + "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>" + $"{parcela.Valor:c}" + "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>" + ValidationHelper.GetDescription((Enum)(object)documento.FormaPagamento) + "</div></p></td></tr>";
+ }
+ }
+ }
+ if (ObsApolice && ObsApoliceEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='6'><p align='left' x-ms-format-detection='none'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(documento.Observacao) ? "-" : documento.Observacao) + "</p></td></tr>";
+ }
+ html += "</font></table>";
+ }
+ if (PerfilCondutor && PerfilVisibility && ((DomainBase)documento.Controle.Ramo).Id == 5 && PerfilCondutorEnabled)
+ {
+ List<Perfil> list4 = source.ToList();
+ foreach (Perfil item5 in list4)
+ {
+ color = 0;
+ if (!string.IsNullOrEmpty(item5.Nome))
+ {
+ html = html + "<hr style='width:999; border-top: 2px solid #ccc'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>" + $"CONDUTOR {list4.IndexOf(item5) + 1}: " + "</b>" + item5.Nome + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CPF: </b>" + (string.IsNullOrWhiteSpace(item5.Cpf) ? "-" : item5.Cpf) + "</p></td><td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>NASCIMENTO: </b>" + ((!item5.Nascimento.HasValue) ? "-" : item5.Nascimento?.ToShortDateString()) + "</p></td></tr><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ESTADO CIVIL: </b>" + ((!item5.EstadoCivil.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.EstadoCivil)) + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>SEXO: </b>" + ((!item5.Sexo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.Sexo)) + "</p></td><td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>RELAÇÃO SEGURADO/CONDUTOR: </b>" + ValidationHelper.GetDescription((Enum)(object)item5.Relacao) + "</p></td></tr><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>HABILITAÇÃO: </b>" + (string.IsNullOrWhiteSpace(item5.Habilitacao) ? "-" : item5.Habilitacao) + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>TEMPO DE HABILITAÇÃO: </b>" + ((!item5.TempoHabilitacao.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.TempoHabilitacao)) + "</p></td><td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>QUATIDADE DE VEÍCULOS: </b>" + ((!item5.VeiculoResidencia.HasValue) ? "-" : item5.VeiculoResidencia.Value.ToString()) + "</p></td></tr><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>GARAGEM NA RESIDÊNCIA: </b>" + ((!item5.GaragemResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.GaragemResidencia)) + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>GARAGEM NO TRABALHO: </b>" + ((!item5.GaragemTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.GaragemTrabalho)) + "</p></td><td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>GARAGEM NO ESTUDO: </b>" + ((!item5.GaragemEstudo.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.GaragemEstudo)) + "</p></td></tr><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>TIPO DE RESIDÊNCIA: </b>" + ((!item5.TipoResidencia.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.TipoResidencia)) + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>QUILOMETRAGEM MENSAL: </b>" + (string.IsNullOrWhiteSpace(item5.KmMensal) ? "-" : item5.KmMensal) + "</p></td><td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>DISTÂNCIA ATÉ O TRABALHO: </b>" + ((!item5.DistanciaResidenciaTrabalho.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.DistanciaResidenciaTrabalho)) + "</p></td></tr><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>USO PROFISSIONAL: </b>" + ((item5.UsoProfissional.HasValue && item5.UsoProfissional.Value) ? "SIM" : "NÃO") + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>USO POR DEPENDENTES: </b>" + ((!item5.UsoDependentes.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.UsoDependentes)) + "</p></td><td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>OCUPAÇÃO: </b>" + ((!item5.Ocupacao.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item5.Ocupacao)) + "</p></td></tr><tr><td width='333' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>SEGURO VIDA: </b>" + ((item5.SeguroVida.HasValue && item5.SeguroVida.Value) ? "SIM" : "NÃO") + "</p></td><td width='222' bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ISENÇÃO DE IMPOSTOS: </b>" + ((item5.Isencao.HasValue && item5.Isencao.Value) ? "SIM" : "NÃO") + "</p></td><td width='222' bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>ANTIFURTO: </b>" + (item5.AntiFurto.HasValue ? ValidationHelper.GetDescription((Enum)(object)item5.AntiFurto) : "") + "</p></td></tr><tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>COBERTURA ESTENDIDA PARA RESIDENTES HABILITADOS: </b>" + ((item5.EstenderCobertura.HasValue && item5.EstenderCobertura.Value) ? "SIM" : "NÃO") + "</p></td></tr></font></table>";
+ }
+ }
+ }
+ List<Item> itens2 = itensDocumentos.ToList();
+ if (itens2.Count == 0)
+ {
+ html += "<br><p align='center'><b>ESTA APÓLICE NÃO POSSUI ITENS</b></p>";
+ }
+ else
+ {
+ color = 0;
+ foreach (Item item2 in itens2)
+ {
+ if (item2.Sinistros.Count > 0)
+ {
+ Item val3 = item2;
+ val3.Sinistros = await new SinistroServico().BuscarControles(((DomainBase)item2).Id);
+ }
+ html += ((SepararPagina && SepararPaginaEnabled) ? "<div style='page-break-before:always;'>" : "");
+ html += (((int)SelectedTipoExtrato != 2 || itens2.IndexOf(item2) == 0) ? "<br>" : "");
+ html += "<table border='1' bordercolor='#ededed' width='999'>";
+ html += "<style> td > p { margin: 2px; }</style>";
+ html += "<font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr>";
+ if ((int)SelectedTipoExtrato == 2)
+ {
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>" + $"ITEM {item2.Ordem}: " + "</b>" + item2.Descricao + "</p></td>";
+ }
+ else
+ {
+ switch (((DomainBase)documento.Controle.Ramo).Id)
+ {
+ case 1L:
+ case 2L:
+ case 3L:
+ case 15L:
+ case 18L:
+ {
+ Item val3 = item2;
+ val3.Patrimonial = await new ItemServico().BuscaPatrimonial(((DomainBase)item2).Id);
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='4'><p align='left'><b>" + $"ITEM {item2.Ordem}: " + "</b>" + ((EnderecoBase)item2.Patrimonial).Endereco + ", " + ((EnderecoBase)item2.Patrimonial).Numero + ", " + (string.IsNullOrWhiteSpace(((EnderecoBase)item2.Patrimonial).Complemento) ? "" : (((EnderecoBase)item2.Patrimonial).Complemento + ", ")) + ((EnderecoBase)item2.Patrimonial).Bairro + " - " + ((EnderecoBase)item2.Patrimonial).Cidade + " - " + ((EnderecoBase)item2.Patrimonial).Estado + " - " + ((EnderecoBase)item2.Patrimonial).Cep + "</p></td>";
+ break;
+ }
+ case 5L:
+ case 37L:
+ {
+ Item val3 = item2;
+ val3.Auto = await new ItemServico().BuscaAuto(((DomainBase)item2).Id);
+ string[] obj17 = new string[26]
+ {
+ html,
+ "<td bgcolor='",
+ (color % 2 == 0) ? "WhiteSmoke" : "White",
+ "' colspan='4'><p align='left'><b>",
+ $"ITEM {item2.Ordem}: ",
+ "</b><br>",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ };
+ Fabricante fabricante2 = item2.Auto.Fabricante;
+ obj17[6] = ((fabricante2 != null) ? fabricante2.Descricao : null);
+ obj17[7] = " ";
+ obj17[8] = item2.Auto.Modelo;
+ obj17[9] = " (";
+ obj17[10] = item2.Auto.AnoFabricacao;
+ obj17[11] = "/";
+ obj17[12] = item2.Auto.AnoModelo;
+ obj17[13] = ")<br>PLACA: ";
+ obj17[14] = item2.Auto.Placa;
+ obj17[15] = ", CHASSI: ";
+ obj17[16] = item2.Auto.Chassi;
+ obj17[17] = "<br>C.I.: ";
+ obj17[18] = item2.Auto.Ci;
+ obj17[19] = ", RENAVAM: ";
+ obj17[20] = item2.Auto.Renavam;
+ obj17[21] = ", CEP PERNOITE: ";
+ obj17[22] = item2.Auto.CepPernoite;
+ obj17[23] = "<br>FINANCIADO: ";
+ obj17[24] = (item2.Auto.Financiado.GetValueOrDefault() ? "SIM" : "NÃO");
+ obj17[25] = "</p></td>";
+ html = string.Concat(obj17);
+ break;
+ }
+ default:
+ html = html + "<td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='4'><p align='left'><b>" + $"ITEM {item2.Ordem}: " + "</b>" + item2.Descricao + "</p>QTDE SINISTRO(S): </b>" + item2.Sinistros.Count + "</p></td>";
+ break;
+ }
+ }
+ if (item2.Sinistros.Count > 0)
+ {
+ Item obj18 = item2;
+ DateTime? obj19;
+ if (obj18 == null)
+ {
+ obj19 = null;
+ }
+ else
+ {
+ IList<ControleSinistro> sinistros3 = obj18.Sinistros;
+ if (sinistros3 == null)
+ {
+ obj19 = null;
+ }
+ else
+ {
+ ControleSinistro? obj20 = sinistros3.LastOrDefault();
+ if (obj20 == null)
+ {
+ obj19 = null;
+ }
+ else
+ {
+ List<Sinistro> sinistros4 = obj20.Sinistros;
+ if (sinistros4 == null)
+ {
+ obj19 = null;
+ }
+ else
+ {
+ Sinistro? obj21 = sinistros4.LastOrDefault();
+ obj19 = ((obj21 != null) ? obj21.DataReclamacao : null);
+ }
+ }
+ }
+ }
+ DateTime? dateTime2 = obj19;
+ string text17 = (dateTime2.HasValue ? dateTime2.Value.ToShortDateString() : "-");
+ string[] obj22 = new string[18]
+ {
+ html, "</tr><td bgcolor='", null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null
+ };
+ int num2 = color + 1;
+ color = num2;
+ obj22[2] = ((num2 % 2 == 0) ? "WhiteSmoke" : "White");
+ obj22[3] = "'><p align='left'><b>SINISTRO STATUS: </b>";
+ Item obj23 = item2;
+ object obj24;
+ if (obj23 == null)
+ {
+ obj24 = null;
+ }
+ else
+ {
+ IList<ControleSinistro> sinistros5 = obj23.Sinistros;
+ if (sinistros5 == null)
+ {
+ obj24 = null;
+ }
+ else
+ {
+ ControleSinistro? obj25 = sinistros5.LastOrDefault();
+ if (obj25 == null)
+ {
+ obj24 = null;
+ }
+ else
+ {
+ List<Sinistro> sinistros6 = obj25.Sinistros;
+ if (sinistros6 == null)
+ {
+ obj24 = null;
+ }
+ else
+ {
+ Sinistro? obj26 = sinistros6.LastOrDefault();
+ obj24 = ((obj26 != null) ? ValidationHelper.GetDescription((Enum)(object)obj26.StatusSinistro) : null);
+ }
+ }
+ }
+ }
+ obj22[4] = (string)obj24;
+ obj22[5] = "</p></td><td bgcolor='";
+ obj22[6] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ obj22[7] = "'><p align='left'><b>DATA: </b>";
+ obj22[8] = text17;
+ obj22[9] = "</p></td><td bgcolor='";
+ obj22[10] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ obj22[11] = "'><p align='left'><b>VALOR: </b>";
+ Item obj27 = item2;
+ object obj28;
+ if (obj27 == null)
+ {
+ obj28 = null;
+ }
+ else
+ {
+ IList<ControleSinistro> sinistros7 = obj27.Sinistros;
+ if (sinistros7 == null)
+ {
+ obj28 = null;
+ }
+ else
+ {
+ ControleSinistro? obj29 = sinistros7.LastOrDefault();
+ if (obj29 == null)
+ {
+ obj28 = null;
+ }
+ else
+ {
+ List<Sinistro> sinistros8 = obj29.Sinistros;
+ if (sinistros8 == null)
+ {
+ obj28 = null;
+ }
+ else
+ {
+ Sinistro? obj30 = sinistros8.LastOrDefault();
+ obj28 = ((obj30 != null) ? ValidationHelper.ToCurrency<decimal>(obj30.Valor, "pt-BR") : null);
+ }
+ }
+ }
+ }
+ obj22[12] = (string)obj28;
+ obj22[13] = "</p></td><td bgcolor='";
+ obj22[14] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ obj22[15] = "' colspan='3'><p align='left'><b>QTDE SINISTRO(S): </b>";
+ obj22[16] = item2.Sinistros.Count.ToString();
+ obj22[17] = "</p></td>";
+ html = string.Concat(obj22);
+ }
+ html += "</tr>";
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ string[] obj31 = new string[10] { html, "<tr><td bgcolor='", null, null, null, null, null, null, null, null };
+ int num2 = color + 1;
+ color = num2;
+ obj31[2] = ((num2 % 2 == 0) ? "WhiteSmoke" : "White");
+ obj31[3] = "' colspan='3'><p align='left'><b>STATUS: </b>";
+ obj31[4] = (string.IsNullOrWhiteSpace(item2.Status) ? item2.StatusInclusao : item2.Status);
+ obj31[5] = "</p></td><td bgcolor='";
+ obj31[6] = ((color++ % 2 == 0) ? "WhiteSmoke" : "White");
+ obj31[7] = "'><p align='left'><b>ATIVO: </b>";
+ obj31[8] = ((!item2.Substituido.HasValue) ? "SIM" : "NÃO");
+ obj31[9] = "</p></td></tr>";
+ html = string.Concat(obj31);
+ long id = ((DomainBase)documento.Controle.Ramo).Id;
+ long num4 = id - 1;
+ if ((ulong)num4 <= 58uL)
+ {
+ switch (num4)
+ {
+ case 0L:
+ case 1L:
+ case 2L:
+ case 14L:
+ case 17L:
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Patrimonial.Item.Observacao) ? "-" : item2.Patrimonial.Item.Observacao) + "</p></td><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>BENS E INFORMAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Patrimonial.Bens) ? "-" : item2.Patrimonial.Bens) + "</p></td></tr>";
+ }
+ break;
+ case 4L:
+ case 36L:
+ {
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Auto.Observacao) ? "-" : item2.Auto.Observacao) + "</p></td></tr>";
+ }
+ string[] array2 = new string[30];
+ array2[0] = html;
+ array2[1] = "<tr><td bgcolor='";
+ array2[2] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array2[3] = "' colspan='3'><p align='left'><b>COBERTURA PADRÃO: </b>";
+ TipoCobertura? tipoCobertura = item2.Auto.TipoCobertura;
+ array2[4] = (tipoCobertura.HasValue ? ValidationHelper.GetDescription((Enum)(object)tipoCobertura.GetValueOrDefault()) : null);
+ array2[5] = "</p></td><td bgcolor='";
+ array2[6] = ((color++ % 2 == 0) ? "WhiteSmoke" : "White");
+ array2[7] = "'><p align='left'><b>BÔNUS: </b>";
+ array2[8] = item2.Auto.Bonus.ToString();
+ array2[9] = "</p></td></tr><tr><td bgcolor='";
+ array2[10] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array2[11] = "'colspan='2'><p align='left'><b>REGIÃO DE CIRCULAÇÃO: </b>";
+ array2[12] = (string.IsNullOrWhiteSpace(item2.Auto.RegiaoCirculacao) ? "-" : item2.Auto.RegiaoCirculacao);
+ array2[13] = "</p></td><td bgcolor='";
+ array2[14] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array2[15] = "'><p align='left'><b>TABELA DE REFERÊNCIA: </b>";
+ TabelaReferencia? tabelaReferencia = item2.Auto.TabelaReferencia;
+ array2[16] = (tabelaReferencia.HasValue ? ValidationHelper.GetDescription((Enum)(object)tabelaReferencia.GetValueOrDefault()) : null);
+ array2[17] = "</p></td><td bgcolor='";
+ array2[18] = ((color++ % 2 == 0) ? "WhiteSmoke" : "White");
+ array2[19] = "'><p align='left'><b>% DE REFERÊNCIA: </b>";
+ array2[20] = $"{item2.Auto.PorcentagemReferencia}%";
+ array2[21] = "</p></td></tr><tr><td bgcolor='";
+ array2[22] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array2[23] = "' colspan='3'><p align='left'><b>CÓDIGO FIPE: </b>";
+ array2[24] = (string.IsNullOrWhiteSpace(item2.Auto.Fipe) ? "-" : item2.Auto.Fipe);
+ array2[25] = "</p></td><td bgcolor='";
+ array2[26] = ((color % 2 == 0) ? "WhiteSmoke" : "White");
+ array2[27] = "'><p align='left'><b>COR DO VEÍCULO: </b>";
+ array2[28] = ((!item2.Auto.Cor.HasValue) ? "-" : ValidationHelper.GetDescription((Enum)(object)item2.Auto.Cor));
+ array2[29] = "</p></td></tr>";
+ html = string.Concat(array2);
+ break;
+ }
+ case 5L:
+ case 6L:
+ case 8L:
+ case 9L:
+ case 52L:
+ {
+ Item val3 = item2;
+ val3.Vida = await new ItemServico().BuscaVida(((DomainBase)item2).Id);
+ if (!item2.Sinistrado || !BeneficiariosItens || !BeneficiariosItensEnabled)
+ {
+ break;
+ }
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>BENEFICIÁRIOS: </b>";
+ string text18 = "";
+ foreach (ControleSinistro sinistro3 in item2.Sinistros)
+ {
+ if (sinistro3.Sinistros == null)
+ {
+ continue;
+ }
+ foreach (Sinistro sinistro4 in sinistro3.Sinistros)
+ {
+ if (!string.IsNullOrWhiteSpace(sinistro4.SinistroVida.Beneficiario))
+ {
+ text18 = text18 + sinistro4.SinistroVida.Beneficiario + ", ";
+ }
+ }
+ }
+ if (!string.IsNullOrWhiteSpace(text18))
+ {
+ int startIndex4 = text18.LastIndexOf(", ", StringComparison.Ordinal);
+ text18 = text18.Remove(startIndex4, 2).Insert(startIndex4, ".");
+ }
+ html = html + text18 + "</p></td></tr>";
+ break;
+ }
+ case 3L:
+ case 7L:
+ case 15L:
+ case 16L:
+ case 18L:
+ case 22L:
+ case 23L:
+ case 25L:
+ case 27L:
+ case 30L:
+ case 32L:
+ case 38L:
+ case 40L:
+ case 43L:
+ case 48L:
+ case 58L:
+ {
+ Item val3 = item2;
+ val3.RiscosDiversos = await new ItemServico().BuscaRiscosDiversos(((DomainBase)item2).Id);
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.RiscosDiversos.Observacao) ? "-" : item2.RiscosDiversos.Observacao) + "</p></td></tr>";
+ }
+ break;
+ }
+ case 12L:
+ {
+ Item val3 = item2;
+ val3.Aeronautico = await new ItemServico().BuscaAeronautico(((DomainBase)item2).Id);
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Aeronautico.Observacao) ? "-" : item2.Aeronautico.Observacao) + "</p></td></tr>";
+ }
+ break;
+ }
+ case 19L:
+ {
+ Item val3 = item2;
+ val3.Granizo = await new ItemServico().BuscaGranizo(((DomainBase)item2).Id);
+ if (ObsItem && ObsItemEnabled)
+ {
+ html = html + "<tr><td bgcolor='" + ((color % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>" + (string.IsNullOrWhiteSpace(item2.Granizo.Observacao) ? "-" : item2.Granizo.Observacao) + "</p></td></tr>";
+ }
+ break;
+ }
+ }
+ }
+ }
+ html += "</font></table>";
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ ObservableCollection<Cobertura> observableCollection2 = await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item2).Id);
+ if (observableCollection2.Count > 0 && Coberturas)
+ {
+ html += "<br><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>COBERTURA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>FRANQUIA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>L.M.I.</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>PRÊMIO</div></b></p></td></tr>";
+ foreach (Cobertura item6 in observableCollection2)
+ {
+ html = html + "<tr><td bgcolor='White'><p align='left'><div align='center'>" + item6.Observacao + "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>" + $"{item6.Franquia:c}" + "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>" + $"{item6.Lmi:c}" + "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>" + $"{item6.Premio:c}" + "</div></p></td></tr>";
+ }
+ html += "</font></table>";
+ }
+ html += ((SepararPagina && SepararPaginaEnabled) ? "</div>" : "");
+ }
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ color = 0;
+ }
+ }
+ }
+ }
+ }
+ sDocumento.Add(((DomainBase)documento.Controle).Id);
+ primeiro = false;
+ }
+ }
+ if (Prospeccoes != null && Prospeccoes.Count > 0)
+ {
+ foreach (Prospeccao prospecco in Prospeccoes)
+ {
+ int num5 = 0;
+ html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "<div style='page-break-before:always;'>" : "");
+ html += "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>";
+ if ((int)SelectedTipoExtrato == 0)
+ {
+ title = "EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " DO CLIENTE: " + prospecco.Nome;
+ }
+ html = html + title + "</h4></td></table><br>";
+ html += "<style>td > p {margin: 2px;}</style>";
+ if (ExtratoResumido)
+ {
+ html = html + "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CLIENTE: </b>" + prospecco.Nome + "</p></td><td width='222' bgcolor='" + ((num5++ % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>" + prospecco.Documento + "</p></td></tr>";
+ if ((int)SelectedTipoExtrato != 2)
+ {
+ html += "<tr>";
+ string text19 = "";
+ if (prospecco.Telefone1 != null)
+ {
+ text19 = text19 + "<br> (" + prospecco.Prefixo1 + ") " + prospecco.Telefone1;
+ }
+ if (prospecco.Telefone2 != null)
+ {
+ text19 = text19 + "<br> (" + prospecco.Prefixo2 + ") " + prospecco.Telefone2;
+ }
+ html = html + "<td bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CONTATOS: </b>" + (string.IsNullOrEmpty(text19) ? "-" : text19) + "</p></td>";
+ string text20 = "";
+ if (prospecco.Email != null)
+ {
+ text20 = "<br>" + prospecco.Email;
+ }
+ html = html + "<td bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>EMAILS: </b>" + (string.IsNullOrEmpty(text20) ? "-" : text20) + "</p></td>";
+ }
+ html += "</font></table>";
+ html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "</div>" : "");
+ if ((int)SelectedTipoExtrato == 0)
+ {
+ return;
+ }
+ num5 = 0;
+ html = html + "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='222' bgcolor='" + ((num5++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>VIGÊNCIA FINAL: </b>" + ((!prospecco.VigenciaFinal.HasValue) ? "-" : prospecco.VigenciaFinal?.ToShortDateString()) + "</p></td></tr>";
+ html = html + "</tr><tr><td bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='3'><p align='left'><b>VENDEDOR: </b>" + ((prospecco.Vendedor == null) ? "-" : prospecco.Vendedor.Nome) + "</p></td></tr>";
+ html += "</font></table>";
+ continue;
+ }
+ string text21 = "NASCIMENTO";
+ html = html + "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CLIENTE: </b>" + prospecco.Nome + "</p></td><td width='222' bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>" + prospecco.Documento + "</p></td><td width='222' bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>" + text21 + ": </b>" + prospecco.Nascimento?.ToShortDateString() + "</p></td></tr>";
+ if ((prospecco.Telefone1 != null || prospecco.Email != null) && (int)SelectedTipoExtrato != 2)
+ {
+ html += "<tr>";
+ if (prospecco.Telefone1 != null)
+ {
+ string text22 = "";
+ text22 = text22 + "<br> (" + prospecco.Prefixo1 + ") " + prospecco.Telefone1;
+ if (prospecco.Telefone2 != null)
+ {
+ text22 = text22 + "<br> (" + prospecco.Prefixo2 + ") " + prospecco.Telefone2;
+ }
+ html = html + "<td bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>CONTATOS: </b>" + text22 + "</p></td>";
+ }
+ if (prospecco.Email != null && !ExtratoResumido)
+ {
+ string text23 = "";
+ text23 = text23 + "<br>" + prospecco.Email;
+ html = html + "<td bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "' colspan='2'><p align='left'><b>EMAILS: </b>" + text23 + "</p></td>";
+ }
+ html += "</font></tr>";
+ }
+ html += (((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled) ? "</div>" : "");
+ if ((int)SelectedTipoExtrato == 0)
+ {
+ return;
+ }
+ num5 = 0;
+ html = html + "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='222' bgcolor='" + ((num5++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>VIGÊNCIA FINAL: </b>" + ((!prospecco.VigenciaFinal.HasValue) ? "-" : prospecco.VigenciaFinal?.ToShortDateString()) + "</p></td></tr>";
+ html = html + "</tr><tr><td bgcolor='" + ((num5 % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>VENDEDOR: </b>" + ((prospecco.Vendedor == null) ? "-" : prospecco.Vendedor.Nome) + "</p></td></tr>";
+ html += "</font></table>";
+ }
+ }
+ DateTime networkTime2 = Funcoes.GetNetworkTime();
+ html = html + "<br><font face='Verdana' size='1'><br>" + Recursos.Usuario.Nome + " - " + networkTime2.Date.ToShortDateString() + "</font></div><script src='https://code.jquery.com/jquery-3.3.1.slim.min.js' integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo' crossorigin='anonymous'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js' integrity='sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1' crossorigin='anonymous'></script><script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous'></script></body></html>";
+ string tempPath2 = Path.GetTempPath();
+ string text24 = $"{tempPath2}{(object)(TipoExtrato)0}_{networkTime2:ddMMyyyyhhmmss}.html";
+ if (pdf)
+ {
+ text24 = $"{tempPath2}{(object)(TipoExtrato)0}_{networkTime2:ddMMyyyyhhmmss}.pdf";
+ byte[] bytes2 = ((HtmlToPdfConverter)new NRecoHtmlToPdfConverter()).GeneratePdf(html);
+ File.WriteAllBytes(text24, bytes2);
+ }
+ else
+ {
+ StreamWriter streamWriter2 = new StreamWriter(text24, append: true, Encoding.UTF8);
+ streamWriter2.Write(html);
+ streamWriter2.Close();
+ }
+ Process.Start(text24);
+ if (Documentos != null && Documentos.Count > 1)
+ {
+ RegistrarAcao("GEROU O EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " " + ((Documentos == null) ? "" : ((Documentos.Count > 1) ? $"DE {Documentos.Count} DOCUMENTOS" : $"DO DOCUMENTO {((DomainBase)Documentos[0]).Id}")), 0L, (TipoTela)23, "IDS DOS DOCUMENTOS:\n" + string.Join("\n", Documentos.Select((Documento x) => ((DomainBase)x).Id)) + GerarOpcoes());
+ }
+ if (Prospeccoes != null && Prospeccoes.Count > 1)
+ {
+ RegistrarAcao("GEROU O EXTRATO" + (ExtratoResumido ? " RESUMIDO" : "") + " " + ((Prospeccoes == null) ? "" : ((Prospeccoes.Count > 1) ? $"DE {Prospeccoes.Count} PROSPECÇÕES" : $"DA PROSPÇÃO{((DomainBase)Prospeccoes[0]).Id}")), 0L, (TipoTela)23, "IDS DOS DOCUMENTOS:\n" + string.Join("\n", Prospeccoes.Select((Prospeccao x) => ((DomainBase)x).Id)) + GerarOpcoes());
+ }
+ Documentos = null;
+ Clientes = null;
+ Prospeccoes = null;
+ }
+ }
+
+ public string GerarOpcoes()
+ {
+ //IL_002b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_008f: Unknown result type (might be due to invalid IL or missing references)
+ string text = "";
+ if (ClienteVisibility && ObsCliente && ObsClienteEnabled)
+ {
+ text += "\nOBSERVAÇÕES DO CLIENTE";
+ }
+ if ((int)ClientePorPaginaVisibility == 0 && ClientePorPagina && ClientePorPaginaEnabled)
+ {
+ text += "\nSEPARAR CLIENTES POR PÁGINA";
+ }
+ if (DocumentoVisibility)
+ {
+ if (ComissaoDocumentoEnabled && ComissaoDocumento)
+ {
+ text += "\nCOMISSÕES DO DOCUMENTO";
+ }
+ if (ObsApoliceEnabled && ObsApolice)
+ {
+ text += "\nOBSERVAÇÕES DA APÓLICE";
+ }
+ if ((int)SegurosVigentesVisibility == 0 && SegurosVigentes)
+ {
+ text += "\nAPENAS SEGUROS VIGENTES";
+ }
+ }
+ if (ItemVisibility)
+ {
+ if ((int)SelecionarItensVisibility == 0 && SelecionarItens)
+ {
+ text += "\nSELECIONAR ITENS";
+ }
+ if (BeneficiariosItensEnabled && BeneficiariosItens)
+ {
+ text += "\nBENEFICIÁRIOS DOS ITENS";
+ }
+ if (ObsItemEnabled && ObsItem)
+ {
+ text += "\nOBSERVAÇÕES DO ITEM";
+ }
+ if (SepararPaginaEnabled && SepararPagina)
+ {
+ text += "\nSEPARAR ITENS POR PÁGINA";
+ }
+ }
+ if (PerfilCondutor && PerfilVisibility && PerfilCondutorEnabled)
+ {
+ text += "\nPERFIL DO CONDUTOR";
+ }
+ if (string.IsNullOrWhiteSpace(text))
+ {
+ return "";
+ }
+ return "\n\nOPÇÕES:" + text;
+ }
+
+ public async Task PrepararExtrato(List<ClientesAtivosInativos> clientes, List<Documento> documentos, List<Prospeccao> prospeccoes, Relatorio? tipoRelatorio = null, List<long> selecionadosDoc = null, List<long> selecionadosPros = null, bool pdf = false)
+ {
+ Carregando = true;
+ if (tipoRelatorio == (Relatorio?)0 || (int)tipoRelatorio.GetValueOrDefault() == 1)
+ {
+ if (clientes == null || clientes.Count == 0)
+ {
+ await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM CLIENTE");
+ Carregando = false;
+ return;
+ }
+ if (clientes.Count > 200 && !(await ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO")))
+ {
+ Carregando = false;
+ return;
+ }
+ List<Cliente> listaCli = new List<Cliente>();
+ foreach (ClientesAtivosInativos item2 in clientes.Where((ClientesAtivosInativos x) => x.Selecionado))
+ {
+ Cliente cli = await new ClienteServico().BuscarCliente(item2.Id);
+ Cliente val = cli;
+ val.Enderecos = await _clienteServico.BuscarEnderecosAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Emails = await _clienteServico.BuscarEmailsAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Telefones = await _clienteServico.BuscarTelefonesAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Contatos = await _clienteServico.BuscarContatosAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Vinculos = await _clienteServico.BuscarVinculosAsync(((DomainBase)cli).Id);
+ listaCli.Add(cli);
+ }
+ Clientes = listaCli;
+ goto IL_16a4;
+ }
+ if ((documentos == null || documentos.Count == 0) && (prospeccoes == null || prospeccoes.Count == 0))
+ {
+ await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO");
+ Carregando = false;
+ return;
+ }
+ if (documentos == null || documentos.Count <= 200)
+ {
+ if (prospeccoes == null || prospeccoes.Count <= 200)
+ {
+ goto IL_0741;
+ }
+ }
+ if (!(await ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO")))
+ {
+ Carregando = false;
+ return;
+ }
+ goto IL_0741;
+ IL_16a4:
+ if ((int)SegurosVigentesVisibility == 0 && SegurosVigentes)
+ {
+ Documentos = Documentos.Where((Documento x) => (x.Vigencia2 > Funcoes.GetNetworkTime().Date.AddDays(-5.0) || !x.Vigencia2.HasValue) && (int)x.Situacao != 7).ToList();
+ }
+ await Gerar(tipoRelatorio, pdf);
+ Carregando = false;
+ return;
+ IL_0741:
+ TipoExtrato selectedTipoExtrato = SelectedTipoExtrato;
+ switch ((int)selectedTipoExtrato)
+ {
+ case 2:
+ {
+ List<Documento> listaEndossos = new List<Documento>();
+ ApoliceServico apoliceServico = new ApoliceServico();
+ long id = ((DomainBase)documentos.First().Controle.Cliente).Id;
+ FiltroStatusDocumento statusSelecionado = MainViewModel.StatusSelecionado;
+ Documentos = new List<Documento>(await apoliceServico.BuscarApolicesAsync(id, statusSelecionado, await VerificaVinculoVendedor(Recursos.Usuario)));
+ foreach (Documento documento in Documentos)
+ {
+ foreach (Documento documento2 in documento.Controle.Documentos)
+ {
+ if (documento2.Tipo == 1)
+ {
+ listaEndossos.Add(documento2);
+ documento.TemEndosso = true;
+ }
+ }
+ }
+ Documentos.AddRange(listaEndossos);
+ break;
+ }
+ case 1:
+ if ((selecionadosDoc == null || selecionadosDoc.Count == 0) && (selecionadosPros == null || selecionadosPros.Count == 0))
+ {
+ await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO");
+ Carregando = false;
+ return;
+ }
+ Documentos = new List<Documento>();
+ Prospeccoes = new List<Prospeccao>();
+ if (selecionadosDoc != null)
+ {
+ foreach (long item3 in selecionadosDoc)
+ {
+ Documento doc = await new ApoliceServico().BuscarApoliceAsync(item3, itens: false, sinistrosPorControle: true);
+ List<Documento> listDoc = ((SomenteEndossos && doc.Ordem != 1) ? new List<Documento>() : new List<Documento> { doc });
+ if (SomenteEndossos)
+ {
+ IEnumerable<Documento> enumerable = doc.Controle.Documentos.Where((Documento x) => !x.Excluido && x.Ordem != 0 && !listDoc.Any((Documento y) => ((DomainBase)y).Id == ((DomainBase)x).Id));
+ foreach (Documento item4 in enumerable)
+ {
+ item4.Sinistro = doc.Sinistro;
+ }
+ listDoc.AddRange(enumerable);
+ }
+ else if (Endossos)
+ {
+ IEnumerable<Documento> enumerable2 = doc.Controle.Documentos.Where((Documento x) => ((DomainBase)x).Id != ((DomainBase)doc).Id && !x.Excluido);
+ foreach (Documento item5 in enumerable2)
+ {
+ item5.Sinistro = doc.Sinistro;
+ }
+ listDoc.AddRange(enumerable2);
+ }
+ if (doc.Controle.Documentos.Any((Documento x) => ((DomainBase)x).Id != ((DomainBase)doc).Id && !x.Excluido && x.Ordem > doc.Ordem))
+ {
+ doc.TemEndosso = true;
+ }
+ if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 31) && doc.TemEndosso)
+ {
+ doc.PremioTotal = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.PremioTotal);
+ doc.Iof = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.Iof);
+ doc.Custo = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.Custo);
+ doc.PremioLiquido = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.PremioLiquido);
+ doc.PremioAdicional = doc.Controle.Documentos.Where((Documento x) => !x.Excluido).Sum((Documento x) => x.PremioAdicional);
+ }
+ Documentos.AddRange(listDoc.OrderBy((Documento x) => x.Ordem).ToList());
+ }
+ }
+ if (selecionadosPros != null)
+ {
+ foreach (long selecionadosPro in selecionadosPros)
+ {
+ Prospeccao item = await new ProspeccaoServico().BuscarProspeccao(selecionadosPro);
+ Prospeccoes.Add(item);
+ }
+ }
+ if ((int)SelecionarItensVisibility == 0 && SelecionarItens && Documentos != null && Documentos.Count > 0)
+ {
+ _itensSelecionados = (await ShowSelecionarItensDialog(((DomainBase)Documentos.First().Controle).Id)).Where((Item x) => x.Selecionado).ToList();
+ }
+ if ((Documentos == null || Documentos.Count == 0) && (Prospeccoes == null || Prospeccoes.Count == 0))
+ {
+ if (!SomenteEndossos)
+ {
+ await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO SELECIONADO");
+ }
+ else
+ {
+ await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM ENDOSSO OU PROSPECÇÃO SELECIONADO");
+ }
+ Carregando = false;
+ return;
+ }
+ break;
+ case 0:
+ {
+ if (selecionadosDoc == null || selecionadosDoc.Count == 0)
+ {
+ await ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO");
+ Carregando = false;
+ return;
+ }
+ List<Cliente> listaCli = new List<Cliente>();
+ foreach (Documento documento3 in documentos)
+ {
+ Cliente cli = await new ClienteServico().BuscarCliente(((DomainBase)documento3.Controle.Cliente).Id);
+ Cliente val = cli;
+ val.Enderecos = await _clienteServico.BuscarEnderecosAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Emails = await _clienteServico.BuscarEmailsAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Telefones = await _clienteServico.BuscarTelefonesAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Contatos = await _clienteServico.BuscarContatosAsync(((DomainBase)cli).Id);
+ val = cli;
+ val.Vinculos = await _clienteServico.BuscarVinculosAsync(((DomainBase)cli).Id);
+ listaCli.Add(cli);
+ }
+ Clientes = listaCli;
+ Prospeccoes = prospeccoes;
+ break;
+ }
+ }
+ goto IL_16a4;
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs
new file mode 100644
index 0000000..a00c4be
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ImpostoViewModel.cs
@@ -0,0 +1,314 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class ImpostoViewModel : BaseViewModel
+{
+ private bool _carregando;
+
+ private bool _apelido;
+
+ public int Tipo;
+
+ private List<Seguradora> _seguradoras;
+
+ private List<Ramo> _ramos;
+
+ private ObservableCollection<Imposto> _impostos = new ObservableCollection<Imposto>();
+
+ private Imposto _selectedImposto = new Imposto();
+
+ private Ramo _selectedRamo = new Ramo();
+
+ private Seguradora _selectedSeguradora = new Seguradora();
+
+ private ImpostoServico Servico { get; }
+
+ public bool? Ativo { get; set; } = true;
+
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public bool Apelido
+ {
+ get
+ {
+ return _apelido;
+ }
+ set
+ {
+ _apelido = value;
+ OnPropertyChanged("Apelido");
+ }
+ }
+
+ public List<Seguradora> Seguradoras
+ {
+ get
+ {
+ return _seguradoras;
+ }
+ set
+ {
+ _seguradoras = value;
+ OnPropertyChanged("Seguradoras");
+ }
+ }
+
+ public List<Ramo> Ramos
+ {
+ get
+ {
+ return _ramos;
+ }
+ set
+ {
+ _ramos = value;
+ OnPropertyChanged("Ramos");
+ }
+ }
+
+ public ObservableCollection<Imposto> Impostos
+ {
+ get
+ {
+ return _impostos;
+ }
+ set
+ {
+ _impostos = value;
+ OnPropertyChanged("Impostos");
+ }
+ }
+
+ public Imposto SelectedImposto
+ {
+ get
+ {
+ return _selectedImposto;
+ }
+ set
+ {
+ _selectedImposto = value;
+ VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null);
+ OnPropertyChanged("SelectedImposto");
+ }
+ }
+
+ public Ramo SelectedRamo
+ {
+ get
+ {
+ return _selectedRamo;
+ }
+ set
+ {
+ _selectedRamo = value;
+ OnPropertyChanged("SelectedRamo");
+ }
+ }
+
+ public Seguradora SelectedSeguradora
+ {
+ get
+ {
+ return _selectedSeguradora;
+ }
+ set
+ {
+ _selectedSeguradora = value;
+ OnPropertyChanged("SelectedSeguradora");
+ }
+ }
+
+ public ImpostoViewModel()
+ {
+ //IL_0018: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0022: Expected O, but got Unknown
+ //IL_0023: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002d: Expected O, but got Unknown
+ //IL_002e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0038: Expected O, but got Unknown
+ Servico = new ImpostoServico();
+ Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 6);
+ }
+
+ public async Task Carregar(int tipo, long id)
+ {
+ Tipo = tipo;
+ await PermissaoTela((TipoTela)56);
+ List<Seguradora> list = (from x in Recursos.Seguradoras
+ where x.Ativo || (tipo == 0 && ((DomainBase)x).Id == id)
+ orderby (!Apelido) ? x.Nome : x.NomeSocial
+ select x).ToList();
+ list.Insert(0, new Seguradora
+ {
+ Nome = "TODAS SEGURADORAS",
+ NomeSocial = "TODAS SEGURADORAS",
+ Id = 0L
+ });
+ Seguradoras = list;
+ SelectedSeguradora = Seguradoras.First();
+ List<Ramo> list2 = (from x in Recursos.Ramos
+ where x.Ativo || (tipo == 1 && ((DomainBase)x).Id == id)
+ orderby x.Nome
+ select x).ToList();
+ list2.Insert(0, new Ramo
+ {
+ Nome = "TODOS OS RAMOS",
+ Id = 0L
+ });
+ Ramos = list2;
+ SelectedRamo = Ramos.First();
+ string text = ((tipo == 1) ? ("O RAMO \"" + Ramos.First((Ramo x) => ((DomainBase)x).Id == id).Nome + "\"") : ("A SEGURADORA \"" + Seguradoras.First((Seguradora x) => ((DomainBase)x).Id == id).Nome + "\""));
+ RegistrarAcao("ACESSOU IMPOSTOS D" + text, id, (TipoTela)56, $"ID: {id}");
+ List<Imposto> source = await Servico.Buscar(true);
+ if (tipo != 1)
+ {
+ source = source.Where((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == id && x.Ramo == null).ToList();
+ SelectedSeguradora = Seguradoras.Find((Seguradora x) => ((DomainBase)x).Id == id);
+ }
+ else
+ {
+ source = source.Where((Imposto x) => x.Ramo != null && ((DomainBase)x.Ramo).Id == id && x.Seguradora == null).ToList();
+ SelectedRamo = Ramos.Find((Ramo x) => ((DomainBase)x).Id == id);
+ }
+ Impostos = new ObservableCollection<Imposto>(source.OrderByDescending((Imposto x) => x.Ativo));
+ SelectedImposto = Impostos.FirstOrDefault();
+ }
+
+ public async Task Carregar(long id = 0L)
+ {
+ List<Imposto> source = await Servico.Buscar(Ativo);
+ if (((DomainBase)SelectedSeguradora).Id == 0L)
+ {
+ source = source.Where((Imposto x) => x.Seguradora == null).ToList();
+ }
+ if (((DomainBase)SelectedSeguradora).Id > 0)
+ {
+ source = source.Where((Imposto x) => x.Seguradora != null && ((DomainBase)x.Seguradora).Id == ((DomainBase)SelectedSeguradora).Id).ToList();
+ }
+ if (((DomainBase)SelectedRamo).Id == 0L)
+ {
+ source = source.Where((Imposto x) => x.Ramo == null).ToList();
+ }
+ if (((DomainBase)SelectedRamo).Id > 0)
+ {
+ source = source.Where((Imposto x) => x.Ramo != null && ((DomainBase)x.Ramo).Id == ((DomainBase)SelectedRamo).Id).ToList();
+ }
+ Impostos = new ObservableCollection<Imposto>(source.Where((Imposto x) => !Ativo.HasValue || x.Ativo == Ativo.Value).ToList());
+ SelectedImposto = ((id == 0L) ? Impostos.FirstOrDefault() : ((IEnumerable<Imposto>)Impostos).FirstOrDefault((Func<Imposto, bool>)((Imposto x) => ((DomainBase)x).Id == id)));
+ }
+
+ public void Incluir()
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0024: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0042: Unknown result type (might be due to invalid IL or missing references)
+ //IL_004e: Expected O, but got Unknown
+ SelectedImposto = new Imposto
+ {
+ Seguradora = ((((DomainBase)SelectedSeguradora).Id > 0) ? SelectedSeguradora : null),
+ Ramo = ((((DomainBase)SelectedRamo).Id > 0) ? SelectedRamo : null),
+ Ativo = true
+ };
+ Alterar(alterar: true);
+ }
+
+ public void AlterarImposto()
+ {
+ Alterar(alterar: true);
+ }
+
+ public async Task Cancelar()
+ {
+ Imposto selectedImposto = SelectedImposto;
+ long id = ((selectedImposto != null) ? ((DomainBase)selectedImposto).Id : 0);
+ Alterar(alterar: false);
+ await Carregar(id);
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar()
+ {
+ List<KeyValuePair<string, string>> list = SelectedImposto.Validate();
+ list.AddRange(Validate(SelectedImposto));
+ if (list.Count > 0)
+ {
+ return list;
+ }
+ string acao = ((((DomainBase)SelectedImposto).Id == 0L) ? "INCLUIU" : "ALTEROU");
+ Imposto val = await Servico.Salvar(SelectedImposto);
+ if (!Servico.Sucesso)
+ {
+ return new List<KeyValuePair<string, string>>
+ {
+ new KeyValuePair<string, string>("GRAVAR", "HOUVE UM ERRO AO SALVAR O IMPOSTO SELECIONADO.")
+ };
+ }
+ string text = ((val.Seguradora == null) ? "TODAS AS SEGURADORAS" : (" SEGURADORA " + val.Seguradora.Nome));
+ string text2 = ((val.Ramo == null) ? "TODOS OS RAMOS" : (" RAMO " + val.Ramo.Nome));
+ string text3 = " " + text + " E " + text2;
+ RegistrarAcao(acao + " IMPOSTO PARA " + text3, ((DomainBase)val).Id, (TipoTela)31, string.Format("ID: {0}{1}{2}\nSTATUS: {3}\nIR: {4:p2}\nISS: {5:p2}\nOUTROS: {6:p2}\nDESCONTO: {7:p2}", ((DomainBase)val).Id, text, text2, val.Ativo ? "ATIVO" : "INATIVO", val.Ir, val.Iss, val.Outros, val.Desconto));
+ Alterar(alterar: false);
+ await Carregar(((DomainBase)val).Id);
+ return null;
+ }
+
+ public List<KeyValuePair<string, string>> Validate(Imposto imposto)
+ {
+ List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>();
+ if (imposto == null)
+ {
+ return list;
+ }
+ if (imposto.Ativo && Impostos.Any(delegate(Imposto x)
+ {
+ if (((DomainBase)x).Id != ((DomainBase)imposto).Id)
+ {
+ Seguradora seguradora = x.Seguradora;
+ long? num = ((seguradora != null) ? new long?(((DomainBase)seguradora).Id) : null);
+ Seguradora seguradora2 = imposto.Seguradora;
+ if (num == ((seguradora2 != null) ? new long?(((DomainBase)seguradora2).Id) : null))
+ {
+ Ramo ramo = x.Ramo;
+ long? num2 = ((ramo != null) ? new long?(((DomainBase)ramo).Id) : null);
+ Ramo ramo2 = imposto.Ramo;
+ if (num2 == ((ramo2 != null) ? new long?(((DomainBase)ramo2).Id) : null))
+ {
+ return x.Ativo;
+ }
+ }
+ }
+ return false;
+ }))
+ {
+ list.Add(new KeyValuePair<string, string>("IMPOSTO DUPLICADO", "NÃO É POSSIVEL INSERIR UM NOVO PARAMETRO DE IMPOSTO, POIS JÁ EXISTEM PARAMETROS PARA A MESMA SEGURADORA E RAMO"));
+ }
+ return list.Distinct().ToList();
+ }
+}
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<Contato> _contatos = new ObservableCollection<Contato>();
+
+ private ObservableCollection<Item> _itens = new ObservableCollection<Item>();
+
+ private ObservableCollection<Parcela> _parcelas = new ObservableCollection<Parcela>();
+
+ private Documento _documento;
+
+ private Visibility _ocultarInfos;
+
+ private bool _carregando;
+
+ public ObservableCollection<Contato> Contatos
+ {
+ get
+ {
+ return _contatos;
+ }
+ set
+ {
+ _contatos = value;
+ OnPropertyChanged("Contatos");
+ }
+ }
+
+ public ObservableCollection<Item> Itens
+ {
+ get
+ {
+ return _itens;
+ }
+ set
+ {
+ _itens = value;
+ OnPropertyChanged("Itens");
+ }
+ }
+
+ public ObservableCollection<Parcela> 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<Parcela> observableCollection = await new ParcelaServico().BuscarParcelasAsync(((DomainBase)Documento).Id);
+ Parcelas = (((int)Documento.TipoRecebimento.GetValueOrDefault() == 2) ? new ObservableCollection<Parcela>(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<Contato> contatos = new List<Contato>();
+ ClienteServico servico = new ClienteServico();
+ if (Documento.Controle.Cliente != null)
+ {
+ ObservableCollection<ClienteTelefone> telefones = await servico.BuscarTelefonesAsync(((DomainBase)Documento.Controle.Cliente).Id);
+ ObservableCollection<ClienteEmail> observableCollection2 = await servico.BuscarEmailsAsync(((DomainBase)Documento.Controle.Cliente).Id);
+ if (telefones != null)
+ {
+ contatos.AddRange(((IEnumerable<ClienteTelefone>)telefones).Select((Func<ClienteTelefone, Contato>)((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<ClienteEmail>)observableCollection2).Select((Func<ClienteEmail, Contato>)((ClienteEmail x) => new Contato
+ {
+ Tipo = (TipoContato)1,
+ TipoTelefone = null,
+ Numero = ((EmailBase)x).Email
+ })).Take(1).ToList());
+ }
+ }
+ Contatos = new ObservableCollection<Contato>(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}";
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs
new file mode 100644
index 0000000..b69bec0
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogAcaoViewModel.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Linq;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Relatorios;
+using Gestor.Model.Domain.Seguros;
+using Newtonsoft.Json;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class LogAcaoViewModel : BaseViewModel
+{
+ private RegistroAcao _log;
+
+ private string _obs;
+
+ private Relatorio Relatorio { get; set; }
+
+ public RegistroAcao Log
+ {
+ get
+ {
+ return _log;
+ }
+ set
+ {
+ _log = value;
+ OnPropertyChanged("Log");
+ }
+ }
+
+ public string Obs
+ {
+ get
+ {
+ return _obs;
+ }
+ set
+ {
+ _obs = value;
+ OnPropertyChanged("Obs");
+ }
+ }
+
+ public LogAcaoViewModel(RegistroAcao registro, Relatorio relatorio)
+ {
+ //IL_0007: Unknown result type (might be due to invalid IL or missing references)
+ Relatorio = relatorio;
+ CarregarLog(registro);
+ }
+
+ private void CarregarLog(RegistroAcao registro)
+ {
+ //IL_0024: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002b: Invalid comparison between Unknown and I4
+ if (!registro.Tela.HasValue && !string.IsNullOrEmpty(registro.Observacao) && (int)Relatorio != 25)
+ {
+ Log = registro;
+ Filtros filtros = JsonConvert.DeserializeObject<Filtros>(registro.Observacao);
+ string text = ((filtros.Seguradoras == null || filtros.Seguradoras.Count == 0) ? "" : ("SEGURADORAS FILTRADAS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Seguradoras
+ where filtros.Seguradoras.Contains(((DomainBase)x).Id)
+ select x.NomeSocial) + Environment.NewLine + Environment.NewLine));
+ string text2 = ((filtros.Status == null || filtros.Status.Count == 0) ? "" : ("STATUS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Status.Select((long x) => (TipoSeguro)x)) + Environment.NewLine + Environment.NewLine));
+ string text3 = ((filtros.Ramos == null || filtros.Ramos.Count == 0) ? "" : ("RAMOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Ramos
+ where filtros.Ramos.Contains(((DomainBase)x).Id)
+ select x.Nome) + Environment.NewLine + Environment.NewLine));
+ string text4 = ((filtros.Vendedores == null || filtros.Vendedores.Count == 0) ? "" : ("VENDEDORES FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Vendedores
+ where filtros.Vendedores.Contains(((DomainBase)x).Id)
+ select x.Nome) + Environment.NewLine + Environment.NewLine));
+ string text5 = ((filtros.Estipulantes == null || filtros.Estipulantes.Count == 0) ? "" : ("ESTIPULANTES FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Estipulantes
+ where filtros.Estipulantes.Contains(((DomainBase)x).Id)
+ select x.Nome) + Environment.NewLine + Environment.NewLine));
+ string text6 = ((filtros.Produtos == null || filtros.Produtos.Count == 0) ? "" : ("PRODUTOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Produtos
+ where filtros.Produtos.Contains(((DomainBase)x).Id)
+ select x.Nome) + Environment.NewLine + Environment.NewLine));
+ string text7 = ((filtros.Negocio == null || filtros.Negocio.Count == 0) ? "" : ("TIPOS DE NEGÓCIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Negocio.Select((long x) => (NegocioCorretora)x)) + Environment.NewLine + Environment.NewLine));
+ string text8 = ((filtros.Usuarios == null || filtros.Usuarios.Count == 0) ? "" : ("USUÁRIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, from x in Recursos.Usuarios
+ where filtros.Usuarios.Contains(((DomainBase)x).Id)
+ select x.Nome) + Environment.NewLine + Environment.NewLine));
+ string text9 = ((filtros.Telas == null || filtros.Telas.Count == 0) ? "" : ("TELAS FILTRADAS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Telas.Select((long x) => (TipoTela)x)) + Environment.NewLine + Environment.NewLine));
+ string text10 = ((filtros.Relatorios == null || filtros.Relatorios.Count == 0) ? "" : ("RELATÓRIOS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.Relatorios.Select((long x) => (Relatorio)x)) + Environment.NewLine + Environment.NewLine));
+ string text11 = ((filtros.ParcelasEspeciais == null || !filtros.ParcelasEspeciais.Any((FiltroTipoParcela x) => x.Selecionado)) ? "" : ("TIPOS DE PARCELAS FILTRADOS: " + Environment.NewLine + string.Join(Environment.NewLine, filtros.ParcelasEspeciais.Select((FiltroTipoParcela x) => x.Tipo)) + Environment.NewLine + Environment.NewLine));
+ string text12 = ((filtros.IdEmpresa == 0L) ? "" : ("EMPRESA: " + Environment.NewLine + Recursos.Empresas.Find((Empresa x) => ((DomainBase)x).Id == filtros.IdEmpresa).Nome + Environment.NewLine + Environment.NewLine));
+ _ = $"PERÍODO DE {filtros.Inicio:d} ATÉ {filtros.Fim:d}";
+ Obs = ValidationHelper.GetDescription((Enum)(object)registro.Relatorio) + Environment.NewLine + Environment.NewLine + text12 + text + text3 + text6 + text4 + text5 + text2 + text7 + text11 + text8 + text9 + text10;
+ }
+ else
+ {
+ Log = registro;
+ Obs = registro.Observacao;
+ }
+ }
+}
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(" ", "&nbsp;").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);
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs
new file mode 100644
index 0000000..3e52eea
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogSistemaAntigoViewModel.cs
@@ -0,0 +1,36 @@
+using Gestor.Application.ViewModels.Generic;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class LogSistemaAntigoViewModel : BaseViewModel
+{
+ private string _descricao;
+
+ private string _log;
+
+ public string Descricao
+ {
+ get
+ {
+ return _descricao;
+ }
+ set
+ {
+ _descricao = value;
+ OnPropertyChanged("Descricao");
+ }
+ }
+
+ public string Log
+ {
+ get
+ {
+ return _log;
+ }
+ set
+ {
+ _log = value;
+ OnPropertyChanged("Log");
+ }
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs
new file mode 100644
index 0000000..bc49853
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/LogViewModel.cs
@@ -0,0 +1,1458 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Windows;
+using ControlzEx;
+using CsQuery.ExtensionMethods.Internal;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Financeiro;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.Validation;
+using MaterialDesignThemes.Wpf;
+using Newtonsoft.Json;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class LogViewModel : BaseSegurosViewModel
+{
+ private readonly LogServico _servico;
+
+ private readonly TipoTela _tipoTela;
+
+ private readonly long _id;
+
+ private Visibility _visibilityDetalhesLog = (Visibility)1;
+
+ private bool _mostrar;
+
+ private bool _mostrarMensagem;
+
+ private string _mostrarToolTip = "MOSTRAR TODAS OS CAMPOS";
+
+ private long _mostrarColuna = 120L;
+
+ private PackIcon _mostrarIcone;
+
+ private ObservableCollection<RegistroLog> _logs;
+
+ private string _currentDescription;
+
+ private RegistroLog _selectedLog;
+
+ private List<TupleList> _lists;
+
+ private ObservableCollection<TupleList> _listsAlterados;
+
+ private ObservableCollection<TupleList> _listsAdicionados;
+
+ private ObservableCollection<TupleList> _listsRemovidos;
+
+ private string _textAdicoes;
+
+ 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 Mostrar
+ {
+ get
+ {
+ return _mostrar;
+ }
+ set
+ {
+ //IL_0051: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0056: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0061: Expected O, but got Unknown
+ //IL_0066: Expected O, but got Unknown
+ //IL_0022: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0027: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0032: Expected O, but got Unknown
+ //IL_0037: Expected O, but got Unknown
+ _mostrar = value;
+ if (value)
+ {
+ MostrarColuna = 240L;
+ MostrarToolTip = "ESCONDER CAMPOS INALTERADOS";
+ PackIcon val = new PackIcon();
+ ((PackIconBase<PackIconKind>)val).Kind = (PackIconKind)1492;
+ MostrarIcone = val;
+ }
+ else
+ {
+ MostrarColuna = 240L;
+ MostrarToolTip = "MOSTRAR TODOS OS CAMPOS";
+ PackIcon val2 = new PackIcon();
+ ((PackIconBase<PackIconKind>)val2).Kind = (PackIconKind)1497;
+ MostrarIcone = val2;
+ }
+ OnPropertyChanged("Mostrar");
+ }
+ }
+
+ public bool MostrarMensagem
+ {
+ get
+ {
+ return _mostrarMensagem;
+ }
+ set
+ {
+ _mostrarMensagem = value;
+ OnPropertyChanged("MostrarMensagem");
+ }
+ }
+
+ public string MostrarToolTip
+ {
+ get
+ {
+ return _mostrarToolTip;
+ }
+ set
+ {
+ _mostrarToolTip = value;
+ OnPropertyChanged("MostrarToolTip");
+ }
+ }
+
+ public long MostrarColuna
+ {
+ get
+ {
+ return _mostrarColuna;
+ }
+ set
+ {
+ _mostrarColuna = value;
+ OnPropertyChanged("MostrarColuna");
+ }
+ }
+
+ public PackIcon MostrarIcone
+ {
+ get
+ {
+ return _mostrarIcone;
+ }
+ set
+ {
+ _mostrarIcone = value;
+ OnPropertyChanged("MostrarIcone");
+ }
+ }
+
+ public ObservableCollection<RegistroLog> Logs
+ {
+ get
+ {
+ return _logs;
+ }
+ set
+ {
+ _logs = value;
+ OnPropertyChanged("Logs");
+ }
+ }
+
+ public string CurrentDescription
+ {
+ get
+ {
+ return _currentDescription;
+ }
+ set
+ {
+ _currentDescription = value;
+ OnPropertyChanged("CurrentDescription");
+ }
+ }
+
+ public RegistroLog SelectedLog
+ {
+ get
+ {
+ return _selectedLog;
+ }
+ set
+ {
+ //IL_01d7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0081: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0086: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0088: Unknown result type (might be due to invalid IL or missing references)
+ //IL_008b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0171: Expected I4, but got Unknown
+ //IL_0016: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002e: Expected I4, but got Unknown
+ //IL_090b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_08b5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_08ba: Unknown result type (might be due to invalid IL or missing references)
+ //IL_08c6: Expected O, but got Unknown
+ //IL_0733: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0738: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0744: Expected O, but got Unknown
+ _selectedLog = value;
+ List<TupleList> list = new List<TupleList>();
+ try
+ {
+ if (value.ModeloNovo)
+ {
+ TipoAcao acao = value.Acao;
+ switch ((int)acao)
+ {
+ case 0:
+ case 2:
+ list = JsonConvert.DeserializeObject<List<ValorOriginal>>(SelectedLog.Descricao).LogList(Restricao((TipoRestricao)14));
+ break;
+ case 1:
+ list = JsonConvert.DeserializeObject<List<Diferenca>>(SelectedLog.Descricao).LogList(Restricao((TipoRestricao)14));
+ break;
+ }
+ }
+ else
+ {
+ TipoTela tipoTela = _tipoTela;
+ switch (tipoTela - 1)
+ {
+ case 1:
+ list = JsonConvert.DeserializeObject<Documento>(SelectedLog.Descricao).Log(Restricao((TipoRestricao)14));
+ break;
+ case 4:
+ try
+ {
+ list = JsonConvert.DeserializeObject<Parcelas>(SelectedLog.Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95));
+ }
+ catch
+ {
+ list = DefaultLog(SelectedLog.Descricao, SelectedLog.Acao);
+ }
+ break;
+ case 36:
+ list = JsonConvert.DeserializeObject<VendedorParcelas>(SelectedLog.Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95));
+ break;
+ case 0:
+ list = JsonConvert.DeserializeObject<Cliente>(SelectedLog.Descricao).Log();
+ break;
+ case 2:
+ {
+ Item val = JsonConvert.DeserializeObject<Item>(SelectedLog.Descricao);
+ if (val.Aeronautico != null)
+ {
+ list = Aeronautico.Log(val);
+ }
+ else if (val.Auto != null)
+ {
+ list = Auto.Log(val);
+ }
+ else if (val.Granizo != null)
+ {
+ list = Granizo.Log(val);
+ }
+ else if (val.Patrimonial != null)
+ {
+ list = Patrimonial.Log(val);
+ }
+ else if (val.RiscosDiversos != null)
+ {
+ list = RiscosDiversos.Log(val);
+ }
+ else if (val.Vida != null)
+ {
+ list = Vida.Log(val);
+ }
+ break;
+ }
+ case 12:
+ list = JsonConvert.DeserializeObject<Seguradora>(SelectedLog.Descricao).Log();
+ break;
+ case 11:
+ {
+ Ramo ramo = JsonConvert.DeserializeObject<Ramo>(SelectedLog.Descricao);
+ List<CoberturaPadrao> list5 = (from x in Recursos.Coberturas
+ where x.IdRamo == ((DomainBase)ramo).Id
+ orderby x.Padrao descending, x.Descricao
+ select x).ToList();
+ list = JsonConvert.DeserializeObject<Ramo>(SelectedLog.Descricao).Log(list5);
+ break;
+ }
+ case 9:
+ list = JsonConvert.DeserializeObject<Produto>(SelectedLog.Descricao).Log();
+ break;
+ case 8:
+ list = JsonConvert.DeserializeObject<Estipulante>(SelectedLog.Descricao).Log();
+ break;
+ case 14:
+ list = JsonConvert.DeserializeObject<Vendedor>(SelectedLog.Descricao).Log();
+ break;
+ case 13:
+ list = JsonConvert.DeserializeObject<TipoVendedor>(SelectedLog.Descricao).Log();
+ break;
+ case 15:
+ list = JsonConvert.DeserializeObject<Usuario>(SelectedLog.Descricao).Log();
+ break;
+ case 16:
+ list = JsonConvert.DeserializeObject<Credencial>(SelectedLog.Descricao).Log();
+ break;
+ case 17:
+ list = JsonConvert.DeserializeObject<Empresa>(SelectedLog.Descricao).Log();
+ break;
+ case 21:
+ list = JsonConvert.DeserializeObject<Parceiro>(SelectedLog.Descricao).Log();
+ break;
+ case 23:
+ list = JsonConvert.DeserializeObject<Fornecedor>(SelectedLog.Descricao).Log();
+ break;
+ case 25:
+ list = JsonConvert.DeserializeObject<BancosContas>(SelectedLog.Descricao).Log();
+ break;
+ case 27:
+ list = JsonConvert.DeserializeObject<Planos>(SelectedLog.Descricao).Log();
+ break;
+ case 28:
+ list = JsonConvert.DeserializeObject<Centro>(SelectedLog.Descricao).Log();
+ break;
+ case 3:
+ list = JsonConvert.DeserializeObject<Trilha>(SelectedLog.Descricao).Log();
+ break;
+ case 32:
+ list = JsonConvert.DeserializeObject<Prospeccao>(SelectedLog.Descricao).Log();
+ break;
+ case 37:
+ list = JsonConvert.DeserializeObject<Tarefa>(SelectedLog.Descricao).Log();
+ break;
+ case 33:
+ list = JsonConvert.DeserializeObject<Agenda>(SelectedLog.Descricao).Log();
+ break;
+ case 18:
+ list = JsonConvert.DeserializeObject<Socio>(SelectedLog.Descricao).Log();
+ break;
+ case 40:
+ list = JsonConvert.DeserializeObject<TrocaCliente>(SelectedLog.Descricao).Log();
+ break;
+ case 41:
+ list = JsonConvert.DeserializeObject<Recibo>(SelectedLog.Descricao).Log();
+ break;
+ case 35:
+ list = JsonConvert.DeserializeObject<Adiantamento>(SelectedLog.Descricao).Log();
+ break;
+ case 29:
+ list = JsonConvert.DeserializeObject<MetaVendedor>(SelectedLog.Descricao).Log();
+ break;
+ case 10:
+ list = JsonConvert.DeserializeObject<Status>(SelectedLog.Descricao).Log();
+ break;
+ case 30:
+ list = JsonConvert.DeserializeObject<MetaSeguradora>(SelectedLog.Descricao).Log();
+ break;
+ case 45:
+ list = JsonConvert.DeserializeObject<Expedicao>(SelectedLog.Descricao).Log();
+ break;
+ case 6:
+ list = JsonConvert.DeserializeObject<Sinistro>(SelectedLog.Descricao).Log();
+ break;
+ case 42:
+ {
+ List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>> list4 = JsonConvert.DeserializeObject<List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>>>(SelectedLog.Descricao);
+ List<TupleList> list3 = new List<TupleList>();
+ foreach (Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>> item in list4)
+ {
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>(item.Item1 + "$", "", "")
+ };
+ foreach (Tuple<string, List<Tuple<string, string>>> item2 in item.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" " + item2.Item1 + "$", "", ""));
+ foreach (Tuple<string, string> item3 in item2.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" " + item3.Item1, item3.Item2, ""));
+ }
+ }
+ list3.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ }
+ foreach (TupleList item4 in list3)
+ {
+ list.Add(item4);
+ }
+ break;
+ }
+ case 47:
+ list = JsonConvert.DeserializeObject<Qualificacao>(SelectedLog.Descricao).Log();
+ break;
+ case 51:
+ list = JsonConvert.DeserializeObject<TipoDeTarefa>(SelectedLog.Descricao).Log();
+ break;
+ case 53:
+ list = JsonConvert.DeserializeObject<Repasse>(SelectedLog.Descricao).Log();
+ break;
+ case 54:
+ list = JsonConvert.DeserializeObject<NotaFiscal>(SelectedLog.Descricao).Log();
+ break;
+ case 55:
+ list = JsonConvert.DeserializeObject<Imposto>(SelectedLog.Descricao).Log();
+ break;
+ case 44:
+ {
+ List<Vendedor> list2 = JsonConvert.DeserializeObject<List<Vendedor>>(SelectedLog.Descricao);
+ List<TupleList> list3 = new List<TupleList>();
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("VENDEDORES VINCULADOS$", "", "")
+ };
+ foreach (Vendedor item5 in list2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" VENDEDOR {list2.IndexOf(item5) + 1}", item5.Nome, ""));
+ }
+ list3.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ foreach (TupleList item6 in list3)
+ {
+ list.Add(item6);
+ }
+ break;
+ }
+ default:
+ list = DefaultLog(SelectedLog.Descricao, SelectedLog.Acao);
+ break;
+ }
+ }
+ }
+ catch (Exception)
+ {
+ }
+ Lists = list;
+ OnPropertyChanged("SelectedLog");
+ }
+ }
+
+ public List<TupleList> Lists
+ {
+ get
+ {
+ return _lists;
+ }
+ set
+ {
+ _lists = value;
+ SetListaFiltrada(value);
+ OnPropertyChanged("Lists");
+ }
+ }
+
+ public ObservableCollection<TupleList> ListsAlterados
+ {
+ get
+ {
+ return _listsAlterados;
+ }
+ set
+ {
+ _listsAlterados = value;
+ OnPropertyChanged("ListsAlterados");
+ }
+ }
+
+ public ObservableCollection<TupleList> ListsAdicionados
+ {
+ get
+ {
+ return _listsAdicionados;
+ }
+ set
+ {
+ _listsAdicionados = value;
+ OnPropertyChanged("ListsAdicionados");
+ }
+ }
+
+ public ObservableCollection<TupleList> ListsRemovidos
+ {
+ get
+ {
+ return _listsRemovidos;
+ }
+ set
+ {
+ _listsRemovidos = value;
+ if (ListsAlterados == null && ListsAdicionados == null && value == null)
+ {
+ MostrarMensagem = true;
+ }
+ else
+ {
+ MostrarMensagem = false;
+ }
+ OnPropertyChanged("ListsRemovidos");
+ }
+ }
+
+ public string TextAdicoes
+ {
+ get
+ {
+ return _textAdicoes;
+ }
+ set
+ {
+ _textAdicoes = value;
+ OnPropertyChanged("TextAdicoes");
+ }
+ }
+
+ public LogViewModel(TipoTela tela, long id, List<long> parcelas = null, int numparcela = 0)
+ {
+ //IL_0002: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0021: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002c: Expected O, but got Unknown
+ //IL_0031: Expected O, but got Unknown
+ //IL_0090: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0091: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
+ PackIcon val = new PackIcon();
+ ((PackIconBase<PackIconKind>)val).Kind = (PackIconKind)1497;
+ _mostrarIcone = val;
+ _logs = new ObservableCollection<RegistroLog>();
+ _currentDescription = "";
+ _lists = new List<TupleList>();
+ _listsAlterados = new ObservableCollection<TupleList>();
+ _listsAdicionados = new ObservableCollection<TupleList>();
+ _listsRemovidos = new ObservableCollection<TupleList>();
+ _textAdicoes = "INCLUSÃO";
+ base._002Ector();
+ _servico = new LogServico();
+ _tipoTela = tela;
+ _id = id;
+ VisiblityDetalhesLog = (Visibility)(!Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 55));
+ base.EnableMenu = true;
+ if (parcelas != null)
+ {
+ LogParcelas(id, parcelas, numparcela);
+ }
+ else
+ {
+ Seleciona(tela, id);
+ }
+ }
+
+ private static List<TupleList> DefaultLog(string log, TipoAcao acao)
+ {
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0012: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0037: Expected O, but got Unknown
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>(Funcoes.GetDescription((Enum)(object)acao), log, "")
+ }
+ }
+ };
+ }
+
+ public int BuscaNumeroParcela(string json)
+ {
+ try
+ {
+ if (!int.TryParse(json.Split(new char[1] { '}' }).FirstOrDefault((string x) => x.Contains("NumeroParcela")).Split(new char[1] { ':' })[^1].Replace("\"", ""), out var result))
+ {
+ return 0;
+ }
+ return result;
+ }
+ catch
+ {
+ return 0;
+ }
+ }
+
+ private async void LogParcelas(long documento, List<long> parcelas, int numparcela)
+ {
+ Loading(isLoading: true);
+ List<long> list = new List<long>();
+ list.AddRange(parcelas);
+ list.Add(documento);
+ Logs = new ObservableCollection<RegistroLog>(await _servico.BuscaLogParcelas(list));
+ ObservableCollection<RegistroLog> observableCollection = new ObservableCollection<RegistroLog>();
+ List<RegistroLog> list2 = Logs.Where((RegistroLog x) => !x.ModeloNovo && x.EntidadeId == documento).ToList();
+ for (int num = list2.Count - 1; num >= 0; num--)
+ {
+ ObservableCollection<Parcela> observableCollection2 = new ObservableCollection<Parcela>();
+ try
+ {
+ int num2 = num;
+ while (num2 >= 0 && list2[num2].DataHora < list2[num].DataHora.AddSeconds(4.0))
+ {
+ Parcela val = JsonConvert.DeserializeObject<Parcela>(Logs[num2].Descricao);
+ if (val != null && (numparcela == 0 || BuscaNumeroParcela(Logs[num2].Descricao) == numparcela))
+ {
+ observableCollection2.Add(val);
+ }
+ num = num2;
+ num2--;
+ }
+ }
+ catch (Exception)
+ {
+ try
+ {
+ List<Parcela> list3 = JsonConvert.DeserializeObject<List<Parcela>>(Logs[num].Descricao);
+ if (list3 != null && (numparcela == 0 || BuscaNumeroParcela(Logs[num].Descricao) == numparcela))
+ {
+ ExtensionMethods.AddRange<Parcela>((ICollection<Parcela>)observableCollection2, (IEnumerable<Parcela>)list3);
+ }
+ goto end_IL_01b0;
+ }
+ catch (Exception)
+ {
+ Logs[num].Descricao = Logs[num].Descricao ?? "";
+ observableCollection.Insert(0, Logs[num]);
+ }
+ continue;
+ end_IL_01b0:;
+ }
+ observableCollection2 = new ObservableCollection<Parcela>(observableCollection2.OrderBy((Parcela x) => x.NumeroParcela));
+ if (observableCollection2 != null && observableCollection2.Count != 0 && observableCollection2[0].Documento != null)
+ {
+ list2[num].Descricao = JsonConvert.SerializeObject((object)new Parcelas
+ {
+ ParcelasList = observableCollection2,
+ TipoRecebimento = observableCollection2[0].Documento.TipoRecebimento
+ }, new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = (ReferenceLoopHandling)1
+ });
+ observableCollection.Insert(0, list2[num]);
+ }
+ }
+ List<RegistroLog> list4 = new List<RegistroLog>();
+ List<RegistroLog> list5 = Logs.Where((RegistroLog x) => x.ModeloNovo).ToList();
+ if (numparcela == 0)
+ {
+ list4.AddRange(list5);
+ }
+ else
+ {
+ foreach (RegistroLog item in list5)
+ {
+ int num3 = BuscaNumeroParcela(item.Descricao);
+ if ((num3 != 0 && num3 == numparcela) || (numparcela != 0 && parcelas.Count == 1 && item.EntidadeId != documento))
+ {
+ list4.Add(item);
+ }
+ }
+ }
+ Logs = observableCollection;
+ ExtensionMethods.AddRange<RegistroLog>((ICollection<RegistroLog>)Logs, (IEnumerable<RegistroLog>)list4);
+ if (Logs.Count > 0)
+ {
+ SelectedLog = Logs[0];
+ }
+ else
+ {
+ SetListaFiltrada(Lists);
+ }
+ Loading(isLoading: false);
+ }
+
+ private async void Seleciona(TipoTela tela, long id, List<long> parcelas = null, long? parcela = null)
+ {
+ //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);
+ Logs = new ObservableCollection<RegistroLog>(await _servico.FindByEntityId(tela, id));
+ if ((int)tela == 37)
+ {
+ ObservableCollection<RegistroLog> observableCollection = new ObservableCollection<RegistroLog>();
+ List<RegistroLog> list = Logs.Where((RegistroLog x) => !x.ModeloNovo).ToList();
+ for (int num = list.Count - 1; num >= 0; num--)
+ {
+ ObservableCollection<VendedorParcela> observableCollection2 = new ObservableCollection<VendedorParcela>();
+ int num2 = num;
+ while (num2 >= 0 && list[num2].DataHora < list[num].DataHora.AddSeconds(4.0))
+ {
+ observableCollection2.Add(JsonConvert.DeserializeObject<VendedorParcela>(list[num2].Descricao));
+ num = num2;
+ num2--;
+ }
+ observableCollection2 = new ObservableCollection<VendedorParcela>(observableCollection2.OrderBy((VendedorParcela x) => ((DomainBase)x).Id));
+ list[num].Descricao = JsonConvert.SerializeObject((object)new VendedorParcelas
+ {
+ VendedorParcelasList = observableCollection2
+ }, new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = (ReferenceLoopHandling)1
+ });
+ observableCollection.Insert(0, list[num]);
+ }
+ List<RegistroLog> list2 = Logs.Where((RegistroLog x) => x.ModeloNovo).ToList();
+ Logs = observableCollection;
+ ExtensionMethods.AddRange<RegistroLog>((ICollection<RegistroLog>)Logs, (IEnumerable<RegistroLog>)list2);
+ }
+ if (Logs.Count > 0)
+ {
+ SelectedLog = Logs[0];
+ }
+ else
+ {
+ SetListaFiltrada(Lists);
+ }
+ Loading(isLoading: false);
+ }
+
+ public void SetListaFiltrada(List<TupleList> listAtual)
+ {
+ //IL_0036: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003c: Invalid comparison between Unknown and I4
+ //IL_0083: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d0: Invalid comparison between Unknown and I4
+ //IL_0173: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0178: Unknown result type (might be due to invalid IL or missing references)
+ //IL_017a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_017d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0263: Expected I4, but got Unknown
+ //IL_0e13: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0e18: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0e28: Expected O, but got Unknown
+ //IL_0d23: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0d28: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0d34: Expected O, but got Unknown
+ //IL_0b11: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0b16: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0b22: Expected O, but got Unknown
+ //IL_1026: Unknown result type (might be due to invalid IL or missing references)
+ //IL_102b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_103b: Expected O, but got Unknown
+ //IL_13d8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_13dd: Unknown result type (might be due to invalid IL or missing references)
+ //IL_13ed: Expected O, but got Unknown
+ //IL_1770: Unknown result type (might be due to invalid IL or missing references)
+ //IL_1775: Unknown result type (might be due to invalid IL or missing references)
+ //IL_1785: Expected O, but got Unknown
+ if (Logs.Count == 0)
+ {
+ ListsAlterados = null;
+ ListsAdicionados = null;
+ ListsRemovidos = null;
+ return;
+ }
+ if (SelectedLog.ModeloNovo && (int)SelectedLog.Acao == 1)
+ {
+ TextAdicoes = "ALTERAÇÕES";
+ ListsAdicionados = null;
+ ListsRemovidos = null;
+ ListsAlterados = new ObservableCollection<TupleList>(Lists);
+ MostrarMensagem = false;
+ return;
+ }
+ if (SelectedLog.ModeloNovo && (int)SelectedLog.Acao == 0)
+ {
+ TextAdicoes = "INCLUSÕES";
+ ListsAlterados = null;
+ ListsRemovidos = null;
+ ListsAdicionados = new ObservableCollection<TupleList>(listAtual);
+ MostrarMensagem = false;
+ return;
+ }
+ if (SelectedLog.ModeloNovo && (int)SelectedLog.Acao == 2)
+ {
+ TextAdicoes = "EXCLUSÕES";
+ ListsAlterados = null;
+ ListsAdicionados = null;
+ ListsRemovidos = new ObservableCollection<TupleList>(listAtual);
+ MostrarMensagem = false;
+ return;
+ }
+ if (Mostrar || Logs.Last() == SelectedLog)
+ {
+ TextAdicoes = ((Logs.Last() != SelectedLog) ? "LOG COMPLETO" : "INCLUSÃO");
+ ListsAlterados = null;
+ ListsAdicionados = new ObservableCollection<TupleList>(listAtual);
+ ListsRemovidos = null;
+ return;
+ }
+ TextAdicoes = "INCLUSÃO";
+ List<TupleList> list = new List<TupleList>();
+ try
+ {
+ TipoTela tipoTela = _tipoTela;
+ switch (tipoTela - 1)
+ {
+ case 1:
+ list = JsonConvert.DeserializeObject<Documento>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(Restricao((TipoRestricao)14));
+ break;
+ case 4:
+ list = JsonConvert.DeserializeObject<Parcelas>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95));
+ break;
+ case 36:
+ list = JsonConvert.DeserializeObject<VendedorParcelas>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log(Restricao((TipoRestricao)14), Restricao((TipoRestricao)95));
+ break;
+ case 0:
+ list = JsonConvert.DeserializeObject<Cliente>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 2:
+ {
+ Item val = JsonConvert.DeserializeObject<Item>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao);
+ if (val.Aeronautico != null)
+ {
+ list = Aeronautico.Log(val);
+ }
+ else if (val.Auto != null)
+ {
+ list = Auto.Log(val);
+ }
+ else if (val.Granizo != null)
+ {
+ list = Granizo.Log(val);
+ }
+ else if (val.Patrimonial != null)
+ {
+ list = Patrimonial.Log(val);
+ }
+ else if (val.RiscosDiversos != null)
+ {
+ list = RiscosDiversos.Log(val);
+ }
+ else if (val.Vida != null)
+ {
+ list = Vida.Log(val);
+ }
+ break;
+ }
+ case 12:
+ list = JsonConvert.DeserializeObject<Seguradora>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 11:
+ {
+ Ramo ramo = JsonConvert.DeserializeObject<Ramo>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao);
+ List<CoberturaPadrao> list5 = (from x in Recursos.Coberturas
+ where x.IdRamo == ((DomainBase)ramo).Id
+ orderby x.Padrao descending, x.Descricao
+ select x).ToList();
+ list = ramo.Log(list5);
+ break;
+ }
+ case 9:
+ list = JsonConvert.DeserializeObject<Produto>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 8:
+ list = JsonConvert.DeserializeObject<Estipulante>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 14:
+ list = JsonConvert.DeserializeObject<Vendedor>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 13:
+ list = JsonConvert.DeserializeObject<TipoVendedor>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 15:
+ list = JsonConvert.DeserializeObject<Usuario>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 16:
+ list = JsonConvert.DeserializeObject<Credencial>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 17:
+ list = JsonConvert.DeserializeObject<Empresa>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 21:
+ list = JsonConvert.DeserializeObject<Parceiro>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 23:
+ list = JsonConvert.DeserializeObject<Fornecedor>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 25:
+ list = JsonConvert.DeserializeObject<BancosContas>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 27:
+ list = JsonConvert.DeserializeObject<Planos>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 28:
+ list = JsonConvert.DeserializeObject<Centro>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 3:
+ list = JsonConvert.DeserializeObject<Trilha>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 32:
+ list = JsonConvert.DeserializeObject<Prospeccao>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 37:
+ list = JsonConvert.DeserializeObject<Tarefa>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 33:
+ list = JsonConvert.DeserializeObject<Agenda>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 18:
+ list = JsonConvert.DeserializeObject<Socio>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 40:
+ list = JsonConvert.DeserializeObject<TrocaCliente>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 41:
+ list = JsonConvert.DeserializeObject<Recibo>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 35:
+ list = JsonConvert.DeserializeObject<Adiantamento>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 29:
+ list = JsonConvert.DeserializeObject<MetaVendedor>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 10:
+ list = JsonConvert.DeserializeObject<Status>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 30:
+ list = JsonConvert.DeserializeObject<MetaSeguradora>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 45:
+ list = JsonConvert.DeserializeObject<Expedicao>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 6:
+ list = JsonConvert.DeserializeObject<Sinistro>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 42:
+ {
+ List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>> list4 = JsonConvert.DeserializeObject<List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>>>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao);
+ List<TupleList> list3 = new List<TupleList>();
+ foreach (Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>> item in list4)
+ {
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>(item.Item1 + "$", "", "")
+ };
+ foreach (Tuple<string, List<Tuple<string, string>>> item2 in item.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" " + item2.Item1 + "$", "", ""));
+ foreach (Tuple<string, string> item3 in item2.Item2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" " + item3.Item1, item3.Item2, ""));
+ }
+ }
+ list3.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ }
+ foreach (TupleList item4 in list3)
+ {
+ list.Add(item4);
+ }
+ break;
+ }
+ case 47:
+ list = JsonConvert.DeserializeObject<Qualificacao>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 51:
+ list = JsonConvert.DeserializeObject<TipoDeTarefa>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 53:
+ list = JsonConvert.DeserializeObject<Repasse>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 54:
+ list = JsonConvert.DeserializeObject<NotaFiscal>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 55:
+ list = JsonConvert.DeserializeObject<Imposto>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao).Log();
+ break;
+ case 44:
+ {
+ List<Vendedor> list2 = JsonConvert.DeserializeObject<List<Vendedor>>(Logs[Logs.IndexOf(SelectedLog) + 1].Descricao);
+ List<TupleList> list3 = new List<TupleList>();
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("VENDEDORES VINCULADOS$", "", "")
+ };
+ foreach (Vendedor item5 in list2)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" VENDEDOR {list2.IndexOf(item5) + 1}", item5.Nome, ""));
+ }
+ list3.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ foreach (TupleList item6 in list3)
+ {
+ list.Add(item6);
+ }
+ break;
+ }
+ case 5:
+ case 7:
+ case 19:
+ case 20:
+ case 22:
+ case 24:
+ case 26:
+ case 31:
+ case 34:
+ case 38:
+ case 39:
+ case 43:
+ case 46:
+ case 48:
+ case 49:
+ case 50:
+ case 52:
+ break;
+ }
+ }
+ catch (Exception)
+ {
+ }
+ ObservableCollection<TupleList> observableCollection2 = new ObservableCollection<TupleList>();
+ foreach (TupleList item7 in listAtual)
+ {
+ int num = -1;
+ if (list.Count - 1 < listAtual.IndexOf(item7))
+ {
+ continue;
+ }
+ for (int i = 0; i < item7.Tuples.Count; i++)
+ {
+ Tuple<string, string, string> tuple = item7.Tuples[i];
+ if (QntEspaco(tuple.Item1) == 0)
+ {
+ if (tuple.Item2 != list[listAtual.IndexOf(item7)].Tuples[item7.Tuples.IndexOf(tuple)].Item2)
+ {
+ if (num < listAtual.IndexOf(item7))
+ {
+ observableCollection2.Add(new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>()
+ });
+ num = listAtual.IndexOf(item7);
+ }
+ observableCollection2.Last().Tuples.Add(new Tuple<string, string, string>(tuple.Item1, tuple.Item2, list[listAtual.IndexOf(item7)].Tuples[item7.Tuples.IndexOf(tuple)].Item2));
+ }
+ continue;
+ }
+ List<string> list6 = new List<string>();
+ int num2 = QntEspaco(tuple.Item1);
+ for (int num3 = i; num3 >= 0; num3--)
+ {
+ if (QntEspaco(item7.Tuples[num3].Item1) <= num2)
+ {
+ list6.Insert(0, item7.Tuples[num3].Item1);
+ num2 = QntEspaco(item7.Tuples[num3].Item1);
+ }
+ }
+ bool flag = false;
+ int num4 = 0;
+ foreach (string item8 in list6)
+ {
+ if (flag)
+ {
+ break;
+ }
+ for (int j = num4; j < list[listAtual.IndexOf(item7)].Tuples.Count; j++)
+ {
+ if (j == list[listAtual.IndexOf(item7)].Tuples.Count - 1 && item8 != list[listAtual.IndexOf(item7)].Tuples[j].Item1)
+ {
+ flag = true;
+ break;
+ }
+ if (item8 == list[listAtual.IndexOf(item7)].Tuples[j].Item1)
+ {
+ num4 = j;
+ break;
+ }
+ }
+ }
+ if (flag || !(tuple.Item2 != list[listAtual.IndexOf(item7)].Tuples[num4].Item2))
+ {
+ continue;
+ }
+ if (num < listAtual.IndexOf(item7))
+ {
+ observableCollection2.Add(new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>()
+ });
+ num = listAtual.IndexOf(item7);
+ }
+ int count = observableCollection2.Last().Tuples.Count;
+ int num5 = QntEspaco(tuple.Item1);
+ for (int num6 = i - 1; num6 >= 0; num6--)
+ {
+ if (QntEspaco(item7.Tuples[num6].Item1) < QntEspaco(tuple.Item1) && QntEspaco(item7.Tuples[num6].Item1) < num5)
+ {
+ bool flag2 = false;
+ for (int num7 = observableCollection2.Last().Tuples.Count - 1; num7 >= 0; num7--)
+ {
+ if (observableCollection2.Last().Tuples[num7].Item1 == item7.Tuples[num6].Item1)
+ {
+ flag2 = true;
+ break;
+ }
+ }
+ if (flag2)
+ {
+ break;
+ }
+ num5 = QntEspaco(item7.Tuples[num6].Item1);
+ observableCollection2.Last().Tuples.Insert(count, new Tuple<string, string, string>(item7.Tuples[num6].Item1, item7.Tuples[num6].Item2, ""));
+ }
+ }
+ observableCollection2.Last().Tuples.Add(new Tuple<string, string, string>(tuple.Item1, tuple.Item2, list[listAtual.IndexOf(item7)].Tuples[num4].Item2));
+ }
+ }
+ ListsAlterados = ((observableCollection2.Count == 0) ? null : observableCollection2);
+ observableCollection2 = new ObservableCollection<TupleList>();
+ foreach (TupleList item9 in listAtual)
+ {
+ int num8 = -1;
+ if (list.Count - 1 < listAtual.IndexOf(item9))
+ {
+ continue;
+ }
+ for (int k = 0; k < item9.Tuples.Count; k++)
+ {
+ Tuple<string, string, string> tuple2 = item9.Tuples[k];
+ if (QntEspaco(tuple2.Item1) <= 0)
+ {
+ continue;
+ }
+ List<string> list7 = new List<string>();
+ int num9 = QntEspaco(tuple2.Item1);
+ for (int num10 = k; num10 >= 0; num10--)
+ {
+ if (QntEspaco(item9.Tuples[num10].Item1) <= num9)
+ {
+ list7.Insert(0, item9.Tuples[num10].Item1);
+ num9 = QntEspaco(item9.Tuples[num10].Item1);
+ }
+ }
+ bool flag3 = false;
+ int num11 = 0;
+ foreach (string item10 in list7)
+ {
+ if (flag3)
+ {
+ break;
+ }
+ for (int l = num11; l < list[listAtual.IndexOf(item9)].Tuples.Count; l++)
+ {
+ if (l == list[listAtual.IndexOf(item9)].Tuples.Count - 1 && item10 != list[listAtual.IndexOf(item9)].Tuples[l].Item1)
+ {
+ flag3 = true;
+ break;
+ }
+ if (item10 == list[listAtual.IndexOf(item9)].Tuples[l].Item1)
+ {
+ num11 = l;
+ break;
+ }
+ }
+ }
+ if (!flag3)
+ {
+ continue;
+ }
+ if (num8 < listAtual.IndexOf(item9))
+ {
+ observableCollection2.Add(new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>()
+ });
+ num8 = listAtual.IndexOf(item9);
+ }
+ int count2 = observableCollection2.Last().Tuples.Count;
+ int num12 = QntEspaco(tuple2.Item1);
+ for (int num13 = k - 1; num13 >= 0; num13--)
+ {
+ if (QntEspaco(item9.Tuples[num13].Item1) < QntEspaco(tuple2.Item1) && QntEspaco(item9.Tuples[num13].Item1) < num12)
+ {
+ bool flag4 = false;
+ for (int num14 = observableCollection2.Last().Tuples.Count - 1; num14 >= 0; num14--)
+ {
+ if (observableCollection2.Last().Tuples[num14].Item1 == item9.Tuples[num13].Item1)
+ {
+ flag4 = true;
+ break;
+ }
+ }
+ if (flag4)
+ {
+ break;
+ }
+ num12 = QntEspaco(item9.Tuples[num13].Item1);
+ observableCollection2.Last().Tuples.Insert(count2, new Tuple<string, string, string>(item9.Tuples[num13].Item1, item9.Tuples[num13].Item2, ""));
+ }
+ }
+ observableCollection2.Last().Tuples.Add(new Tuple<string, string, string>(tuple2.Item1, tuple2.Item2, ""));
+ }
+ }
+ ListsAdicionados = ((observableCollection2.Count == 0) ? null : observableCollection2);
+ observableCollection2 = new ObservableCollection<TupleList>();
+ foreach (TupleList item11 in list)
+ {
+ int num15 = -1;
+ for (int m = 0; m < item11.Tuples.Count; m++)
+ {
+ Tuple<string, string, string> tuple3 = item11.Tuples[m];
+ if (QntEspaco(tuple3.Item1) <= 0)
+ {
+ continue;
+ }
+ List<string> list8 = new List<string>();
+ int num16 = QntEspaco(tuple3.Item1);
+ for (int num17 = m; num17 >= 0; num17--)
+ {
+ if (QntEspaco(item11.Tuples[num17].Item1) <= num16)
+ {
+ list8.Insert(0, item11.Tuples[num17].Item1);
+ num16 = QntEspaco(item11.Tuples[num17].Item1);
+ }
+ }
+ bool flag5 = false;
+ int num18 = 0;
+ foreach (string item12 in list8)
+ {
+ if (flag5)
+ {
+ break;
+ }
+ if (listAtual.Count - 1 < list.IndexOf(item11))
+ {
+ continue;
+ }
+ for (int n = num18; n < listAtual[list.IndexOf(item11)].Tuples.Count; n++)
+ {
+ if (n == listAtual[list.IndexOf(item11)].Tuples.Count - 1 && item12 != listAtual[list.IndexOf(item11)].Tuples[n].Item1)
+ {
+ flag5 = true;
+ break;
+ }
+ if (item12 == listAtual[list.IndexOf(item11)].Tuples[n].Item1)
+ {
+ num18 = n;
+ break;
+ }
+ }
+ }
+ if (!flag5)
+ {
+ continue;
+ }
+ if (num15 < list.IndexOf(item11))
+ {
+ observableCollection2.Add(new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>()
+ });
+ num15 = list.IndexOf(item11);
+ }
+ int count3 = observableCollection2.Last().Tuples.Count;
+ int num19 = QntEspaco(tuple3.Item1);
+ for (int num20 = m - 1; num20 >= 0; num20--)
+ {
+ if (QntEspaco(item11.Tuples[num20].Item1) < QntEspaco(tuple3.Item1) && QntEspaco(item11.Tuples[num20].Item1) < num19)
+ {
+ bool flag6 = false;
+ for (int num21 = observableCollection2.Last().Tuples.Count - 1; num21 >= 0; num21--)
+ {
+ if (observableCollection2.Last().Tuples[num21].Item1 == item11.Tuples[num20].Item1)
+ {
+ flag6 = true;
+ break;
+ }
+ }
+ if (flag6)
+ {
+ break;
+ }
+ num19 = QntEspaco(item11.Tuples[num20].Item1);
+ observableCollection2.Last().Tuples.Insert(count3, new Tuple<string, string, string>(item11.Tuples[num20].Item1, item11.Tuples[num20].Item2, ""));
+ }
+ }
+ observableCollection2.Last().Tuples.Add(new Tuple<string, string, string>(tuple3.Item1, "", tuple3.Item2));
+ }
+ }
+ ListsRemovidos = ((observableCollection2.Count == 0) ? null : observableCollection2);
+ }
+
+ private static int QntEspaco(string str)
+ {
+ return Regex.Match(str, "[^\\s]").Index;
+ }
+
+ public void MostrarCampos()
+ {
+ if (SelectedLog != null && !SelectedLog.ModeloNovo)
+ {
+ Mostrar = !Mostrar;
+ Lists = Lists;
+ }
+ }
+
+ public void Imprimir()
+ {
+ //IL_063c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0662: Unknown result type (might be due to invalid IL or missing references)
+ //IL_067d: Unknown result type (might be due to invalid IL or missing references)
+ string text = "<html><head><style type='text/css'>@page{size: A4; margin: 0cm}</style><title>LOGS</title></head><body><div align='center'>";
+ ObservableCollection<TupleList> listsAlterados = ListsAlterados;
+ if (listsAlterados != null && listsAlterados.Count > 0)
+ {
+ text += "<font size='5px' face='Arial' style='font-weight: 900;'>ALTERAÇÃO</font>";
+ }
+ if (ListsAlterados != null)
+ {
+ foreach (TupleList listsAlterado in ListsAlterados)
+ {
+ foreach (Tuple<string, string, string> tuple in listsAlterado.Tuples)
+ {
+ if (tuple == listsAlterado.Tuples.First())
+ {
+ text = 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: " + (Mostrar ? "483px" : "240px") + "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>";
+ if (!Mostrar)
+ {
+ text += "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</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(" ", "&nbsp;").Replace("$", "") + "</font></td><td style='width: " + (Mostrar ? "483px" : "240px") + "'><font size='2px' face='Arial' style='padding-left: 5px'>" + tuple.Item2 + "</font></td>";
+ if (!Mostrar)
+ {
+ text = text + "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>" + tuple.Item3 + "</font></td>";
+ }
+ text += "</tr></table>";
+ }
+ if (listsAlterado != ListsAlterados.Last())
+ {
+ text += "<br>";
+ }
+ }
+ }
+ ObservableCollection<TupleList> listsAdicionados = ListsAdicionados;
+ if (listsAdicionados != null && listsAdicionados.Count > 0)
+ {
+ ObservableCollection<TupleList> listsAlterados2 = ListsAlterados;
+ if (listsAlterados2 != null && listsAlterados2.Count > 0)
+ {
+ text += "<br><br><br>";
+ }
+ text += "<font size='5px' face='Arial' style='font-weight: 900;'>INCLUSÃO</font>";
+ }
+ if (ListsAdicionados != null)
+ {
+ foreach (TupleList listsAdicionado in ListsAdicionados)
+ {
+ foreach (Tuple<string, string, string> tuple2 in listsAdicionado.Tuples)
+ {
+ if (tuple2 == listsAdicionado.Tuples.First())
+ {
+ text = 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: " + (Mostrar ? "483px" : "240px") + "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>";
+ if (!Mostrar)
+ {
+ text += "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>";
+ }
+ text += "</tr></table>";
+ }
+ bool flag2 = tuple2.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: " + (flag2 ? "900" : "700") + "; padding-left: 5px'>" + tuple2.Item1.Replace(" ", "&nbsp;").Replace("$", "") + "</font></td><td style='width: " + (Mostrar ? "483px" : "240px") + "'><font size='2px' face='Arial' style='padding-left: 5px'>" + tuple2.Item2 + "</font></td>";
+ if (!Mostrar)
+ {
+ text = text + "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>" + tuple2.Item3 + "</font></td>";
+ }
+ text += "</tr></table>";
+ }
+ if (listsAdicionado != ListsAdicionados.Last())
+ {
+ text += "<br>";
+ }
+ }
+ }
+ ObservableCollection<TupleList> listsRemovidos = ListsRemovidos;
+ if (listsRemovidos != null && listsRemovidos.Count > 0)
+ {
+ ObservableCollection<TupleList> listsAlterados3 = ListsAlterados;
+ if (listsAlterados3 == null || listsAlterados3.Count <= 0)
+ {
+ ObservableCollection<TupleList> listsAdicionados2 = ListsAdicionados;
+ if (listsAdicionados2 == null || listsAdicionados2.Count <= 0)
+ {
+ goto IL_0428;
+ }
+ }
+ text += "<br><br><br>";
+ goto IL_0428;
+ }
+ goto IL_0434;
+ IL_0434:
+ if (ListsRemovidos != null)
+ {
+ foreach (TupleList listsRemovido in ListsRemovidos)
+ {
+ foreach (Tuple<string, string, string> tuple3 in listsRemovido.Tuples)
+ {
+ if (tuple3 == listsRemovido.Tuples.First())
+ {
+ text = 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: " + (Mostrar ? "483px" : "240px") + "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>";
+ if (!Mostrar)
+ {
+ text += "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>";
+ }
+ text += "</tr></table>";
+ }
+ bool flag3 = tuple3.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: " + (flag3 ? "900" : "700") + "; padding-left: 5px'>" + tuple3.Item1.Replace(" ", "&nbsp;").Replace("$", "") + "</font></td><td style='width: " + (Mostrar ? "483px" : "240px") + "'><font size='2px' face='Arial' style='padding-left: 5px'>" + tuple3.Item2 + "</font></td>";
+ if (!Mostrar)
+ {
+ text = text + "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>" + tuple3.Item3 + "</font></td>";
+ }
+ text += "</tr></table>";
+ }
+ if (listsRemovido != ListsRemovidos.Last())
+ {
+ text += "<br>";
+ }
+ }
+ }
+ text += "</div></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);
+ RegistrarAcao($"IMPRIMIU O LOG DE ALTERAÇÕES DE {Funcoes.GetDescription((Enum)(object)_tipoTela)} DO ID \"{_id}\"", _id, _tipoTela, $"ID ENTIDADE: {_id}\nTIPO: {Funcoes.GetDescription((Enum)(object)_tipoTela)}");
+ return;
+ IL_0428:
+ text += "<font size='5px' face='Arial' style='font-weight: 900;'>EXCLUSÃO</font>";
+ goto IL_0434;
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs
new file mode 100644
index 0000000..4e162a9
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaSeguradoraViewModel.cs
@@ -0,0 +1,212 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Assinador.Infrastructure.Helpers;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class MetaSeguradoraViewModel : BaseSegurosViewModel
+{
+ private readonly MetaSeguradoraServico _servico;
+
+ private readonly Seguradora _selectedSeguradora;
+
+ private MetaSeguradora _selectedMetaSeguradora = new MetaSeguradora();
+
+ private ObservableCollection<MetaSeguradora> _metasSeguradora = new ObservableCollection<MetaSeguradora>();
+
+ private bool _carregando;
+
+ public MetaSeguradora CancelMetaSeguradora;
+
+ public MetaSeguradora SelectedMetaSeguradora
+ {
+ get
+ {
+ return _selectedMetaSeguradora;
+ }
+ set
+ {
+ _selectedMetaSeguradora = value;
+ CancelMetaSeguradora = ((value != null && ((DomainBase)value).Id > 0) ? value : CancelMetaSeguradora);
+ VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null);
+ OnPropertyChanged("SelectedMetaSeguradora");
+ }
+ }
+
+ public ObservableCollection<MetaSeguradora> MetasSeguradora
+ {
+ get
+ {
+ return _metasSeguradora;
+ }
+ set
+ {
+ _metasSeguradora = value;
+ OnPropertyChanged("MetasSeguradora");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public MetaSeguradoraViewModel(Seguradora seguradora)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000b: Expected O, but got Unknown
+ _servico = new MetaSeguradoraServico();
+ Seleciona(seguradora);
+ _selectedSeguradora = seguradora;
+ }
+
+ private async void Seleciona(Seguradora seguradora)
+ {
+ Loading(isLoading: true);
+ await PermissaoTela((TipoTela)31);
+ await SelecionaMetasSeguradora(seguradora);
+ Loading(isLoading: false);
+ }
+
+ public void SelecionaMetaSeguradora(MetaSeguradora metaSeguradora)
+ {
+ SelectedMetaSeguradora = metaSeguradora;
+ }
+
+ private async Task SelecionaMetasSeguradora(Seguradora seguradora)
+ {
+ Carregando = true;
+ await CarregarMetas(seguradora);
+ if (MetasSeguradora.Count > 0)
+ {
+ SelecionaMetaSeguradora(MetasSeguradora.First());
+ }
+ else
+ {
+ SelectedMetaSeguradora = new MetaSeguradora();
+ Alterar(alterar: false);
+ base.EnableMenu = false;
+ base.EnableAlterar = false;
+ base.EnableExcluir = false;
+ }
+ Carregando = false;
+ }
+
+ public void Incluir()
+ {
+ //IL_000f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0014: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0022: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0034: Expected O, but got Unknown
+ DateTime date = Funcoes.GetNetworkTime().Date;
+ SelectedMetaSeguradora = new MetaSeguradora
+ {
+ Ano = date.Year,
+ Mes = (Mes)date.Month
+ };
+ Alterar(alterar: true);
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar()
+ {
+ SelectedMetaSeguradora.Seguradora = _selectedSeguradora;
+ string acao = ((((DomainBase)SelectedMetaSeguradora).Id == 0L) ? "INCLUIU" : "ALTEROU");
+ MetaSeguradora value = await _servico.Save(SelectedMetaSeguradora);
+ if (!_servico.Sucesso)
+ {
+ return null;
+ }
+ RegistrarAcao(acao + " META DA SEGURADORA \"" + value.Seguradora.Nome + "\"", ((DomainBase)value).Id, (TipoTela)31, $"ID: {((DomainBase)value).Id}\nVALOR: {value.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)value.Mes)}\nANO: {value.Ano}");
+ if (MetasSeguradora.Any((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id))
+ {
+ DomainBase.Copy<MetaSeguradora, MetaSeguradora>(MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value);
+ }
+ else
+ {
+ MetasSeguradora.Add(value);
+ }
+ MetasSeguradora = new ObservableCollection<MetaSeguradora>(MetasSeguradora);
+ SelectedMetaSeguradora = MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)value).Id);
+ Alterar(alterar: false);
+ return null;
+ }
+
+ public async Task<bool> Excluir()
+ {
+ if (SelectedMetaSeguradora == null || ((DomainBase)SelectedMetaSeguradora).Id == 0L)
+ {
+ return false;
+ }
+ if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO")))
+ {
+ return false;
+ }
+ Carregando = true;
+ if (!(await _servico.Delete(SelectedMetaSeguradora)))
+ {
+ Carregando = false;
+ Alterar(alterar: false);
+ return false;
+ }
+ MetaSeguradoraViewModel metaSeguradoraViewModel = this;
+ Seguradora seguradora = SelectedMetaSeguradora.Seguradora;
+ metaSeguradoraViewModel.RegistrarAcao("EXCLUIU META DA SEGURADORA \"" + ((seguradora != null) ? seguradora.Nome : null) + "\"", ((DomainBase)SelectedMetaSeguradora).Id, (TipoTela)31, $"ID: {((DomainBase)SelectedMetaSeguradora).Id}\nVALOR: {SelectedMetaSeguradora.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)SelectedMetaSeguradora.Mes)}\nANO: {SelectedMetaSeguradora.Ano}");
+ int num = MetasSeguradora.IndexOf(SelectedMetaSeguradora);
+ MetasSeguradora.Remove(SelectedMetaSeguradora);
+ MetasSeguradora.Remove(SelectedMetaSeguradora);
+ MetasSeguradora = new ObservableCollection<MetaSeguradora>(MetasSeguradora);
+ if (MetasSeguradora.Count > 0)
+ {
+ SelectedMetaSeguradora = ((num < MetasSeguradora.Count) ? MetasSeguradora.ElementAt(num) : MetasSeguradora.Last());
+ }
+ else
+ {
+ SelectedMetaSeguradora = new MetaSeguradora();
+ Alterar(alterar: false);
+ base.EnableMenu = false;
+ base.EnableAlterar = false;
+ base.EnableExcluir = false;
+ }
+ Carregando = false;
+ return true;
+ }
+
+ public void CancelarAlteracao()
+ {
+ Carregando = true;
+ if (CancelMetaSeguradora != null && MetasSeguradora.Any((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaSeguradora).Id))
+ {
+ DomainBase.Copy<MetaSeguradora, MetaSeguradora>(MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaSeguradora).Id), CancelMetaSeguradora);
+ SelectedMetaSeguradora = MetasSeguradora.First((MetaSeguradora x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaSeguradora).Id);
+ }
+ Alterar(alterar: false);
+ Carregando = false;
+ }
+
+ private async Task CarregarMetas(Seguradora seguradora)
+ {
+ MetasSeguradora = new ObservableCollection<MetaSeguradora>(from x in await new BaseServico().BuscarMetaSeguradoraAsync(seguradora)
+ orderby x.Mes, x.Valor
+ select x);
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs
new file mode 100644
index 0000000..55f706c
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/MetaVendedorViewModel.cs
@@ -0,0 +1,209 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Assinador.Infrastructure.Helpers;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class MetaVendedorViewModel : BaseSegurosViewModel
+{
+ private readonly MetaVendedorServico _servico;
+
+ private readonly Vendedor _selectedVendedor;
+
+ private MetaVendedor _selectedMetaVendedor = new MetaVendedor();
+
+ private ObservableCollection<MetaVendedor> _metasVendedor = new ObservableCollection<MetaVendedor>();
+
+ private bool _carregando;
+
+ public MetaVendedor CancelMetaVendedor;
+
+ public MetaVendedor SelectedMetaVendedor
+ {
+ get
+ {
+ return _selectedMetaVendedor;
+ }
+ set
+ {
+ _selectedMetaVendedor = value;
+ CancelMetaVendedor = ((value != null && ((DomainBase)value).Id > 0) ? value : CancelMetaVendedor);
+ VerificarEnables((value != null) ? new long?(((DomainBase)value).Id) : null);
+ OnPropertyChanged("SelectedMetaVendedor");
+ }
+ }
+
+ public ObservableCollection<MetaVendedor> MetasVendedor
+ {
+ get
+ {
+ return _metasVendedor;
+ }
+ set
+ {
+ _metasVendedor = value;
+ OnPropertyChanged("MetasVendedor");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public MetaVendedorViewModel(Vendedor vendedor)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000b: Expected O, but got Unknown
+ _servico = new MetaVendedorServico();
+ Seleciona(vendedor);
+ _selectedVendedor = vendedor;
+ }
+
+ private async void Seleciona(Vendedor vendedor)
+ {
+ Loading(isLoading: true);
+ await PermissaoTela((TipoTela)30);
+ await SelecionaMetasVendedor(vendedor);
+ Loading(isLoading: false);
+ }
+
+ public void SelecionaMetaVendedor(MetaVendedor metaVendedor)
+ {
+ SelectedMetaVendedor = metaVendedor;
+ }
+
+ private async Task SelecionaMetasVendedor(Vendedor vendedor)
+ {
+ Carregando = true;
+ await CarregarMetas(vendedor);
+ if (MetasVendedor.Count > 0)
+ {
+ SelecionaMetaVendedor(MetasVendedor.First());
+ }
+ else
+ {
+ SelectedMetaVendedor = new MetaVendedor();
+ Alterar(alterar: false);
+ base.EnableMenu = false;
+ }
+ Carregando = false;
+ }
+
+ public void Incluir()
+ {
+ //IL_000f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0014: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0022: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0034: Expected O, but got Unknown
+ DateTime date = Funcoes.GetNetworkTime().Date;
+ SelectedMetaVendedor = new MetaVendedor
+ {
+ Ano = date.Year,
+ Mes = (Mes)date.Month
+ };
+ Alterar(alterar: true);
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar()
+ {
+ SelectedMetaVendedor.Vendedor = _selectedVendedor;
+ _servico.Sucesso = true;
+ string acao = ((((DomainBase)SelectedMetaVendedor).Id == 0L) ? "INCLUIU" : "ALTEROU");
+ MetaVendedor value = await _servico.Save(SelectedMetaVendedor);
+ if (!_servico.Sucesso)
+ {
+ return null;
+ }
+ RegistrarAcao(acao + " META DO VENDEDOR \"" + value.Vendedor.Nome + "\"", ((DomainBase)value).Id, (TipoTela)30, $"ID: {((DomainBase)value).Id}\nVALOR: {value.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)value.Mes)}\nANO: {value.Ano}");
+ if (MetasVendedor.Any((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id))
+ {
+ DomainBase.Copy<MetaVendedor, MetaVendedor>(MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id), value);
+ }
+ else
+ {
+ MetasVendedor.Add(value);
+ }
+ MetasVendedor = new ObservableCollection<MetaVendedor>(MetasVendedor);
+ SelectedMetaVendedor = MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)value).Id);
+ Alterar(alterar: false);
+ return null;
+ }
+
+ public async Task<bool> Excluir()
+ {
+ if (SelectedMetaVendedor == null || ((DomainBase)SelectedMetaVendedor).Id == 0L)
+ {
+ return false;
+ }
+ if (!(await ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO")))
+ {
+ return false;
+ }
+ Carregando = true;
+ string log = "EXCLUIU META DO VENDEDOR \"" + _selectedVendedor.Nome + "\"";
+ long id = ((DomainBase)SelectedMetaVendedor).Id;
+ string descricao = $"ID: {((DomainBase)SelectedMetaVendedor).Id}\nVALOR: {SelectedMetaVendedor.Valor:C}\nMÊS: {Functions.GetDescription((Enum)(object)SelectedMetaVendedor.Mes)}\nANO: {SelectedMetaVendedor.Ano}";
+ if (!(await _servico.Delete(SelectedMetaVendedor)))
+ {
+ Carregando = false;
+ Alterar(alterar: false);
+ return false;
+ }
+ RegistrarAcao(log, id, (TipoTela)30, descricao);
+ await CarregarMetas(_selectedVendedor);
+ if (MetasVendedor.Count > 0)
+ {
+ SelectedMetaVendedor = MetasVendedor.First();
+ }
+ else
+ {
+ SelectedMetaVendedor = new MetaVendedor();
+ Alterar(alterar: false);
+ base.EnableMenu = false;
+ base.EnableAlterar = false;
+ base.EnableExcluir = false;
+ }
+ Carregando = false;
+ return true;
+ }
+
+ public void CancelarAlteracao()
+ {
+ Carregando = true;
+ if (CancelMetaVendedor != null && MetasVendedor.Any((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaVendedor).Id))
+ {
+ DomainBase.Copy<MetaVendedor, MetaVendedor>(MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaVendedor).Id), CancelMetaVendedor);
+ SelectedMetaVendedor = MetasVendedor.First((MetaVendedor x) => ((DomainBase)x).Id == ((DomainBase)CancelMetaVendedor).Id);
+ }
+ Alterar(alterar: false);
+ Carregando = false;
+ }
+
+ private async Task CarregarMetas(Vendedor vendedor)
+ {
+ MetasVendedor = new ObservableCollection<MetaVendedor>((from x in await new BaseServico().BuscarMetaVendedorAsync(vendedor)
+ orderby x.Mes, x.Valor
+ select x).ToList());
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs
new file mode 100644
index 0000000..393faa6
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/PermissaoUsuarioViewModel.cs
@@ -0,0 +1,1704 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using Gestor.Application.Actions;
+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.Generic;
+using Gestor.Model.Domain.Relatorios;
+using Gestor.Model.Domain.Relatorios.ApolicePendente;
+using Gestor.Model.Domain.Relatorios.Auditoria;
+using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos;
+using Gestor.Model.Domain.Relatorios.Comissao;
+using Gestor.Model.Domain.Relatorios.ExtratoBaixado;
+using Gestor.Model.Domain.Relatorios.FaturaPendente;
+using Gestor.Model.Domain.Relatorios.Fechamento;
+using Gestor.Model.Domain.Relatorios.Licenciamento;
+using Gestor.Model.Domain.Relatorios.LogsEnvio;
+using Gestor.Model.Domain.Relatorios.MetaSeguradora;
+using Gestor.Model.Domain.Relatorios.MetaVendedor;
+using Gestor.Model.Domain.Relatorios.NotaFiscal;
+using Gestor.Model.Domain.Relatorios.Pendente;
+using Gestor.Model.Domain.Relatorios.Placa;
+using Gestor.Model.Domain.Relatorios.PrevisaoPagamentoComissao;
+using Gestor.Model.Domain.Relatorios.Producao;
+using Gestor.Model.Domain.Relatorios.Renovacao;
+using Gestor.Model.Domain.Relatorios.Sinistro;
+using Gestor.Model.Domain.Relatorios.Tarefa;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class PermissaoUsuarioViewModel : BaseSegurosViewModel
+{
+ private readonly UsuarioServico _servicoUsuario;
+
+ private Usuario _selectedUsuario;
+
+ private bool _expandedBis;
+
+ private bool _expandedSeguros;
+
+ private bool _expandedRelatorios;
+
+ private bool _expandedCampos;
+
+ private bool _expandedTotalizacoes;
+
+ private bool _expandedFinanceiros;
+
+ private bool _expandedFerramentas;
+
+ private bool _expandedAjudas;
+
+ private ObservableCollection<PermissaoUsuario> _seguros;
+
+ private ObservableCollection<PermissaoUsuario> _ferramentas;
+
+ private ObservableCollection<PermissaoArquivoDigital> _arquivosDigitais;
+
+ private bool _enableAlterarPermiss = true;
+
+ private ObservableCollection<RestricaoUsuario> _restricoesBisFiltradas;
+
+ private ObservableCollection<RestricaoUsuario> _restricoesSegurosFiltradas;
+
+ private ObservableCollection<RestricaoUsuario> _restricoesRelatoriosFiltrados;
+
+ private ObservableCollection<RestricaoUsuario> _restricoesTotalizacoesRelatoriosFiltrados;
+
+ private ObservableCollection<RestricaoUsuarioCamposRelatorios> _restricoesCamposRelatoriosFiltrados;
+
+ private ObservableCollection<RestricaoUsuario> _restricoesFinanceirosFiltradas;
+
+ private ObservableCollection<RestricaoUsuario> _restricoesFerramentasFiltradas;
+
+ private ObservableCollection<RestricaoUsuario> _restricoesAjudasFiltrados;
+
+ private List<RestricaoUsuario> _restricoesBis;
+
+ private List<RestricaoUsuario> _restricoesSeguros;
+
+ private List<RestricaoUsuario> _restricoesRelatorios;
+
+ private List<RestricaoUsuario> _restricoesTotalizacoesRelatorios;
+
+ private List<RestricaoUsuarioCamposRelatorios> _restricoesCamposRelatorios;
+
+ private List<RestricaoUsuario> _restricoesFinanceiros;
+
+ private List<RestricaoUsuario> _restricoesFerramentas;
+
+ private List<RestricaoUsuario> _restricoesAjudas;
+
+ private Visibility _restricoesBisVisibility;
+
+ private Visibility _restricoesSegurosVisibility;
+
+ private Visibility _restricoesRelatoriosVisibility;
+
+ private Visibility _restricoesTotalizacoesRelatoriosVisibility;
+
+ private Visibility _restricoesCamposRelatoriosVisibility;
+
+ private Visibility _restricoesFinanceirosVisibility;
+
+ private Visibility _restricoesFerramentasVisibility;
+
+ private Visibility _restricoesAjudasVisibility;
+
+ private List<PermissaoAggilizador> _permissaoAggilizador;
+
+ private PermissaoAggilizador _selectedPermissao;
+
+ private bool _admUsuario;
+
+ private bool _importarEnabled;
+
+ private bool _carregando;
+
+ private bool _ativarDesativarPermissoesBool = true;
+
+ private bool _ativarDesativarRestricoesBool = true;
+
+ public Usuario SelectedUsuario
+ {
+ get
+ {
+ return _selectedUsuario;
+ }
+ set
+ {
+ _selectedUsuario = value;
+ OnPropertyChanged("SelectedUsuario");
+ }
+ }
+
+ public bool Carregado { get; set; }
+
+ public bool ExpandedBis
+ {
+ get
+ {
+ return _expandedBis;
+ }
+ set
+ {
+ _expandedBis = value;
+ OnPropertyChanged("ExpandedBis");
+ }
+ }
+
+ public bool ExpandedSeguros
+ {
+ get
+ {
+ return _expandedSeguros;
+ }
+ set
+ {
+ _expandedSeguros = value;
+ OnPropertyChanged("ExpandedSeguros");
+ }
+ }
+
+ public bool ExpandedRelatorios
+ {
+ get
+ {
+ return _expandedRelatorios;
+ }
+ set
+ {
+ _expandedRelatorios = value;
+ OnPropertyChanged("ExpandedRelatorios");
+ }
+ }
+
+ public bool ExpandedCampos
+ {
+ get
+ {
+ return _expandedCampos;
+ }
+ set
+ {
+ _expandedCampos = value;
+ OnPropertyChanged("ExpandedCampos");
+ }
+ }
+
+ public bool ExpandedTotalizacoes
+ {
+ get
+ {
+ return _expandedTotalizacoes;
+ }
+ set
+ {
+ _expandedTotalizacoes = value;
+ OnPropertyChanged("ExpandedTotalizacoes");
+ }
+ }
+
+ public bool ExpandedFinanceiros
+ {
+ get
+ {
+ return _expandedFinanceiros;
+ }
+ set
+ {
+ _expandedFinanceiros = value;
+ OnPropertyChanged("ExpandedFinanceiros");
+ }
+ }
+
+ public bool ExpandedFerramentas
+ {
+ get
+ {
+ return _expandedFerramentas;
+ }
+ set
+ {
+ _expandedFerramentas = value;
+ OnPropertyChanged("ExpandedFerramentas");
+ }
+ }
+
+ public bool ExpandedAjudas
+ {
+ get
+ {
+ return _expandedAjudas;
+ }
+ set
+ {
+ _expandedAjudas = value;
+ OnPropertyChanged("ExpandedAjudas");
+ }
+ }
+
+ public ObservableCollection<PermissaoUsuario> Seguros
+ {
+ get
+ {
+ return _seguros;
+ }
+ set
+ {
+ _seguros = value;
+ OnPropertyChanged("Seguros");
+ if (value != null && Ferramentas != null && value.All((PermissaoUsuario x) => ((int)x.Tela == 21 && x.Consultar) || ((int)x.Tela == 5 && x.Alterar && x.Incluir && x.Excluir) || ((int)x.Tela != 21 && (int)x.Tela != 5 && x.Consultar && x.Alterar && x.Incluir && x.Excluir)) && Ferramentas.All((PermissaoUsuario x) => ((int)x.Tela == 18 && x.Consultar && x.Alterar) || ((int)x.Tela == 10 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela == 12 && x.Consultar && x.Alterar) || ((int)x.Tela == 13 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela != 18 && (int)x.Tela != 10 && (int)x.Tela != 12 && (int)x.Tela != 13 && x.Consultar && x.Alterar && x.Incluir && x.Excluir)))
+ {
+ AtivarDesativarPermissoesBool = false;
+ }
+ Gestor.Application.Actions.Actions.OcultarTogglesSeguros();
+ }
+ }
+
+ public ObservableCollection<PermissaoUsuario> Ferramentas
+ {
+ get
+ {
+ return _ferramentas;
+ }
+ set
+ {
+ _ferramentas = value;
+ OnPropertyChanged("Ferramentas");
+ if (value != null && Seguros != null && value.All((PermissaoUsuario x) => ((int)x.Tela == 18 && x.Consultar && x.Alterar) || ((int)x.Tela == 10 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela == 12 && x.Consultar && x.Alterar) || ((int)x.Tela == 13 && x.Consultar && x.Alterar && x.Incluir) || ((int)x.Tela != 18 && (int)x.Tela != 10 && (int)x.Tela != 12 && (int)x.Tela != 13 && x.Consultar && x.Alterar && x.Incluir && x.Excluir)) && Seguros.All((PermissaoUsuario x) => ((int)x.Tela == 21 && x.Consultar) || ((int)x.Tela == 5 && x.Alterar && x.Incluir && x.Excluir) || ((int)x.Tela != 21 && (int)x.Tela != 5 && x.Consultar && x.Alterar && x.Incluir && x.Excluir)))
+ {
+ AtivarDesativarPermissoesBool = false;
+ }
+ Gestor.Application.Actions.Actions.OcultarTogglesFerramentas();
+ }
+ }
+
+ public ObservableCollection<PermissaoArquivoDigital> ArquivosDigitais
+ {
+ get
+ {
+ return _arquivosDigitais;
+ }
+ set
+ {
+ _arquivosDigitais = value;
+ OnPropertyChanged("ArquivosDigitais");
+ Gestor.Application.Actions.Actions.OcultarTogglesArquivoDigital();
+ }
+ }
+
+ public bool EnableAlterarPermiss
+ {
+ get
+ {
+ return _enableAlterarPermiss;
+ }
+ set
+ {
+ _enableAlterarPermiss = value;
+ OnPropertyChanged("EnableAlterarPermiss");
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuario> RestricoesBisFiltradas
+ {
+ get
+ {
+ return _restricoesBisFiltradas;
+ }
+ set
+ {
+ RestricoesBisVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesBisFiltradas = new ObservableCollection<RestricaoUsuario>(from x in value.ToList()
+ orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo)
+ select x);
+ OnPropertyChanged("RestricoesBisFiltradas");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuario> RestricoesSegurosFiltradas
+ {
+ get
+ {
+ return _restricoesSegurosFiltradas;
+ }
+ set
+ {
+ RestricoesSegurosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesSegurosFiltradas = new ObservableCollection<RestricaoUsuario>(from x in value.ToList()
+ orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo)
+ select x);
+ OnPropertyChanged("RestricoesSegurosFiltradas");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuario> RestricoesRelatoriosFiltrados
+ {
+ get
+ {
+ return _restricoesRelatoriosFiltrados;
+ }
+ set
+ {
+ RestricoesRelatoriosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(from x in value.ToList()
+ orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo)
+ select x);
+ OnPropertyChanged("RestricoesRelatoriosFiltrados");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuario> RestricoesTotalizacoesRelatoriosFiltrados
+ {
+ get
+ {
+ return _restricoesTotalizacoesRelatoriosFiltrados;
+ }
+ set
+ {
+ RestricoesTotalizacoesRelatoriosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(from x in value.ToList()
+ orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo)
+ select x);
+ OnPropertyChanged("RestricoesTotalizacoesRelatoriosFiltrados");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuarioCamposRelatorios> RestricoesCamposRelatoriosFiltrados
+ {
+ get
+ {
+ return _restricoesCamposRelatoriosFiltrados;
+ }
+ set
+ {
+ RestricoesCamposRelatoriosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesCamposRelatoriosFiltrados = new ObservableCollection<RestricaoUsuarioCamposRelatorios>(from x in value.ToList()
+ orderby x.Relatorio, x.Campo
+ select x);
+ OnPropertyChanged("RestricoesCamposRelatoriosFiltrados");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuario> RestricoesFinanceirosFiltradas
+ {
+ get
+ {
+ return _restricoesFinanceirosFiltradas;
+ }
+ set
+ {
+ RestricoesFinanceirosVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesFinanceirosFiltradas = new ObservableCollection<RestricaoUsuario>(from x in value.ToList()
+ orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo)
+ select x);
+ OnPropertyChanged("RestricoesFinanceirosFiltradas");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuario> RestricoesFerramentasFiltradas
+ {
+ get
+ {
+ return _restricoesFerramentasFiltradas;
+ }
+ set
+ {
+ RestricoesFerramentasVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesFerramentasFiltradas = new ObservableCollection<RestricaoUsuario>(from x in value.ToList()
+ orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo)
+ select x);
+ OnPropertyChanged("RestricoesFerramentasFiltradas");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public ObservableCollection<RestricaoUsuario> RestricoesAjudasFiltrados
+ {
+ get
+ {
+ return _restricoesAjudasFiltrados;
+ }
+ set
+ {
+ RestricoesAjudasVisibility = (Visibility)((value == null || value.Count <= 0) ? 2 : 0);
+ _restricoesAjudasFiltrados = new ObservableCollection<RestricaoUsuario>(from x in value.ToList()
+ orderby ValidationHelper.GetDescription((Enum)(object)x.Tipo)
+ select x);
+ OnPropertyChanged("RestricoesAjudasFiltrados");
+ AtivarDesativarRestricoes();
+ }
+ }
+
+ public List<RestricaoUsuario> RestricoesBis
+ {
+ get
+ {
+ return _restricoesBis;
+ }
+ set
+ {
+ _restricoesBis = value;
+ OnPropertyChanged("RestricoesBis");
+ }
+ }
+
+ public List<RestricaoUsuario> RestricoesSeguros
+ {
+ get
+ {
+ return _restricoesSeguros;
+ }
+ set
+ {
+ _restricoesSeguros = value;
+ OnPropertyChanged("RestricoesSeguros");
+ }
+ }
+
+ public List<RestricaoUsuario> RestricoesRelatorios
+ {
+ get
+ {
+ return _restricoesRelatorios;
+ }
+ set
+ {
+ _restricoesRelatorios = value;
+ OnPropertyChanged("RestricoesRelatorios");
+ }
+ }
+
+ public List<RestricaoUsuario> RestricoesTotalizacoesRelatorios
+ {
+ get
+ {
+ return _restricoesTotalizacoesRelatorios;
+ }
+ set
+ {
+ _restricoesTotalizacoesRelatorios = value;
+ OnPropertyChanged("RestricoesTotalizacoesRelatorios");
+ }
+ }
+
+ public List<RestricaoUsuarioCamposRelatorios> RestricoesCamposRelatorios
+ {
+ get
+ {
+ return _restricoesCamposRelatorios;
+ }
+ set
+ {
+ _restricoesCamposRelatorios = value;
+ OnPropertyChanged("RestricoesCamposRelatorios");
+ }
+ }
+
+ public List<RestricaoUsuario> RestricoesFinanceiros
+ {
+ get
+ {
+ return _restricoesFinanceiros;
+ }
+ set
+ {
+ _restricoesFinanceiros = value;
+ OnPropertyChanged("RestricoesFinanceiros");
+ }
+ }
+
+ public List<RestricaoUsuario> RestricoesFerramentas
+ {
+ get
+ {
+ return _restricoesFerramentas;
+ }
+ set
+ {
+ _restricoesFerramentas = value;
+ OnPropertyChanged("RestricoesFerramentas");
+ }
+ }
+
+ public List<RestricaoUsuario> RestricoesAjudas
+ {
+ get
+ {
+ return _restricoesAjudas;
+ }
+ set
+ {
+ _restricoesAjudas = value;
+ OnPropertyChanged("RestricoesAjudas");
+ }
+ }
+
+ public Visibility RestricoesBisVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesBisVisibility;
+ }
+ 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)
+ _restricoesBisVisibility = value;
+ OnPropertyChanged("RestricoesBisVisibility");
+ }
+ }
+
+ public Visibility RestricoesSegurosVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesSegurosVisibility;
+ }
+ 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)
+ _restricoesSegurosVisibility = value;
+ OnPropertyChanged("RestricoesSegurosVisibility");
+ }
+ }
+
+ public Visibility RestricoesRelatoriosVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesRelatoriosVisibility;
+ }
+ 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)
+ _restricoesRelatoriosVisibility = value;
+ OnPropertyChanged("RestricoesRelatoriosVisibility");
+ }
+ }
+
+ public Visibility RestricoesTotalizacoesRelatoriosVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesTotalizacoesRelatoriosVisibility;
+ }
+ 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)
+ _restricoesTotalizacoesRelatoriosVisibility = value;
+ OnPropertyChanged("RestricoesTotalizacoesRelatoriosVisibility");
+ }
+ }
+
+ public Visibility RestricoesCamposRelatoriosVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesCamposRelatoriosVisibility;
+ }
+ 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)
+ _restricoesCamposRelatoriosVisibility = value;
+ OnPropertyChanged("RestricoesCamposRelatoriosVisibility");
+ }
+ }
+
+ public Visibility RestricoesFinanceirosVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesFinanceirosVisibility;
+ }
+ 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)
+ _restricoesFinanceirosVisibility = value;
+ OnPropertyChanged("RestricoesFinanceirosVisibility");
+ }
+ }
+
+ public Visibility RestricoesFerramentasVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesFerramentasVisibility;
+ }
+ 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)
+ _restricoesFerramentasVisibility = value;
+ OnPropertyChanged("RestricoesFerramentasVisibility");
+ }
+ }
+
+ public Visibility RestricoesAjudasVisibility
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _restricoesAjudasVisibility;
+ }
+ 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)
+ _restricoesAjudasVisibility = value;
+ OnPropertyChanged("RestricoesAjudasVisibility");
+ }
+ }
+
+ public List<PermissaoAggilizador> PermissaoAggilizador
+ {
+ get
+ {
+ return _permissaoAggilizador;
+ }
+ set
+ {
+ _permissaoAggilizador = value;
+ OnPropertyChanged("PermissaoAggilizador");
+ }
+ }
+
+ public PermissaoAggilizador SelectedPermissao
+ {
+ get
+ {
+ return _selectedPermissao;
+ }
+ set
+ {
+ _selectedPermissao = value;
+ OnPropertyChanged("SelectedPermissao");
+ }
+ }
+
+ public bool AdmUsuario
+ {
+ get
+ {
+ return _admUsuario;
+ }
+ set
+ {
+ _admUsuario = value;
+ ImportarEnabled = !value;
+ SelectedUsuario.Administrador = value;
+ if (value && !Carregando)
+ {
+ AtivarDesativarPermissoes(permiss: true);
+ AtivarDesativarRestricoes(restricao: false);
+ }
+ OnPropertyChanged("AdmUsuario");
+ }
+ }
+
+ public bool ImportarEnabled
+ {
+ get
+ {
+ return _importarEnabled;
+ }
+ set
+ {
+ _importarEnabled = value;
+ OnPropertyChanged("ImportarEnabled");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ base.EnableMenu = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public bool AtivarDesativarPermissoesBool
+ {
+ get
+ {
+ return _ativarDesativarPermissoesBool;
+ }
+ set
+ {
+ _ativarDesativarPermissoesBool = value;
+ OnPropertyChanged("AtivarDesativarPermissoesBool");
+ }
+ }
+
+ public bool AtivarDesativarRestricoesBool
+ {
+ get
+ {
+ return _ativarDesativarRestricoesBool;
+ }
+ set
+ {
+ _ativarDesativarRestricoesBool = value;
+ OnPropertyChanged("AtivarDesativarRestricoesBool");
+ }
+ }
+
+ public PermissaoUsuarioViewModel(Usuario usuario)
+ {
+ SelectedUsuario = usuario;
+ _servicoUsuario = new UsuarioServico();
+ CarregarModulos(usuario);
+ EnableAlterarPermiss = ((DomainBase)Recursos.Usuario).Id > 0;
+ }
+
+ private async void CarregarModulos(Usuario usuario)
+ {
+ await Modulos(usuario);
+ Carregado = true;
+ }
+
+ private async Task Modulos(Usuario usuario)
+ {
+ Carregando = true;
+ usuario = await _servicoUsuario.BuscarUsuarioPorId(((DomainBase)usuario).Id);
+ Seguros = new ObservableCollection<PermissaoUsuario>(await GetPermissoes(usuario, "seguros"));
+ Ferramentas = new ObservableCollection<PermissaoUsuario>(await GetPermissoes(usuario, "ferramentas"));
+ ArquivosDigitais = new ObservableCollection<PermissaoArquivoDigital>(await GetPermissoesArquivoDigital(usuario));
+ PermissaoAggilizador = new List<PermissaoAggilizador>(await _servicoUsuario.BuscarPermissaoAggilizador());
+ RestricoesBis = await GetRestricoes(usuario, "b.i.");
+ RestricoesBisFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesBis);
+ RestricoesSeguros = await GetRestricoes(usuario, "seguros");
+ RestricoesSegurosFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesSeguros);
+ RestricoesRelatorios = await GetRestricoes(usuario, "relatorios");
+ RestricoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(RestricoesRelatorios);
+ RestricoesFinanceiros = await GetRestricoes(usuario, "financeiro");
+ RestricoesFinanceirosFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesFinanceiros);
+ RestricoesFerramentas = await GetRestricoes(usuario, "ferramentas");
+ RestricoesFerramentasFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesFerramentas);
+ RestricoesAjudas = await GetRestricoes(usuario, "ajuda");
+ RestricoesAjudasFiltrados = new ObservableCollection<RestricaoUsuario>(RestricoesAjudas);
+ RestricoesTotalizacoesRelatorios = await GetRestricoes(usuario, "totalizacoesRelatorios");
+ RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(RestricoesTotalizacoesRelatorios);
+ RestricoesCamposRelatorios = await GetRestricoesCamposRelatorios(usuario);
+ RestricoesCamposRelatoriosFiltrados = new ObservableCollection<RestricaoUsuarioCamposRelatorios>(RestricoesCamposRelatorios);
+ Carregando = false;
+ AdmUsuario = usuario.Administrador;
+ SelectedPermissao = ((!usuario.PermissaoAggilizador.HasValue) ? ((IEnumerable<PermissaoAggilizador>)PermissaoAggilizador).FirstOrDefault((Func<PermissaoAggilizador, bool>)((PermissaoAggilizador x) => ((DomainBase)x).Id == 2)) : ((IEnumerable<PermissaoAggilizador>)PermissaoAggilizador).FirstOrDefault((Func<PermissaoAggilizador, bool>)((PermissaoAggilizador x) => ((DomainBase)x).Id == usuario.PermissaoAggilizador)));
+ }
+
+ private async Task<List<PermissaoArquivoDigital>> GetPermissoesArquivoDigital(Usuario usuario)
+ {
+ List<PermissaoArquivoDigital> list = new List<PermissaoArquivoDigital>();
+ List<string> telas = (from TipoArquivoDigital v in Enum.GetValues(typeof(TipoArquivoDigital))
+ select ((object)(TipoArquivoDigital)(ref v)).ToString() into x
+ orderby x
+ select x).ToList();
+ List<PermissaoArquivoDigital> permissoes = await ServicoPermissArquivoDigital.PermissArquivoDigital(usuario);
+ telas.ForEach(delegate(string x)
+ {
+ //IL_0017: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00fa: Expected O, but got Unknown
+ TipoArquivoDigital tela = (TipoArquivoDigital)Enum.Parse(typeof(TipoArquivoDigital), x);
+ long id = 0L;
+ bool consultar = true;
+ bool incluir = true;
+ bool excluir = true;
+ if (permissoes.Count > 0 && permissoes.Any((PermissaoArquivoDigital y) => y.Tela == tela))
+ {
+ id = ((DomainBase)permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela)).Id;
+ consultar = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Consultar;
+ incluir = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Incluir;
+ excluir = permissoes.First((PermissaoArquivoDigital y) => y.Tela == tela).Excluir;
+ }
+ PermissaoArquivoDigital item = new PermissaoArquivoDigital
+ {
+ Id = id,
+ Tela = tela,
+ Consultar = consultar,
+ Incluir = incluir,
+ Excluir = excluir
+ };
+ list.Add(item);
+ });
+ return list;
+ }
+
+ private async Task<List<PermissaoUsuario>> GetPermissoes(Usuario usuario, string modulo)
+ {
+ List<PermissaoUsuario> list = new List<PermissaoUsuario>();
+ List<string> telas = (from TipoTela v in Enum.GetValues(typeof(TipoTela))
+ select ((object)(TipoTela)(ref v)).ToString() into x
+ orderby x
+ select x).ToList();
+ List<PermissaoUsuario> permissoes = await ServicoPermissUsuario.PermissUsuario(usuario);
+ telas.ForEach(delegate(string x)
+ {
+ //IL_0017: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0022: Unknown result type (might be due to invalid IL or missing references)
+ //IL_010d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0112: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0119: Unknown result type (might be due to invalid IL or missing references)
+ //IL_011b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0125: Unknown result type (might be due to invalid IL or missing references)
+ //IL_012c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0133: Unknown result type (might be due to invalid IL or missing references)
+ //IL_013b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0145: Expected O, but got Unknown
+ TipoTela tela = (TipoTela)Enum.Parse(typeof(TipoTela), x);
+ if (string.Equals(ValidationHelper.GetCategory((Enum)(object)tela), modulo, StringComparison.CurrentCultureIgnoreCase))
+ {
+ long id = 0L;
+ bool consultar = true;
+ bool incluir = true;
+ bool alterar = true;
+ bool excluir = true;
+ if (permissoes.Count > 0 && permissoes.Any((PermissaoUsuario y) => y.Tela == tela))
+ {
+ id = ((DomainBase)permissoes.First((PermissaoUsuario y) => y.Tela == tela)).Id;
+ consultar = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Consultar;
+ incluir = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Incluir;
+ alterar = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Alterar;
+ excluir = permissoes.First((PermissaoUsuario y) => y.Tela == tela).Excluir;
+ }
+ PermissaoUsuario item = new PermissaoUsuario
+ {
+ Id = id,
+ Tela = tela,
+ Consultar = consultar,
+ Incluir = incluir,
+ Alterar = alterar,
+ Excluir = excluir
+ };
+ list.Add(item);
+ }
+ });
+ return list;
+ }
+
+ private async Task<List<RestricaoUsuario>> GetRestricoes(Usuario usuario, string modulo)
+ {
+ List<RestricaoUsuario> list = new List<RestricaoUsuario>();
+ List<string> tipos = (from TipoRestricao v in Enum.GetValues(typeof(TipoRestricao))
+ select ((object)(TipoRestricao)(ref v)).ToString() into x
+ orderby x
+ select x).ToList();
+ List<RestricaoUsuario> restricoesUsuario = await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)usuario).Id);
+ tipos.ForEach(delegate(string x)
+ {
+ //IL_0017: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0022: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0041: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00df: Expected O, but got Unknown
+ TipoRestricao tipo = (TipoRestricao)Enum.Parse(typeof(TipoRestricao), x);
+ if (string.Equals(ValidationHelper.GetCategory((Enum)(object)tipo), modulo, StringComparison.CurrentCultureIgnoreCase))
+ {
+ string help = ValidationHelper.GetHelp((Enum)(object)tipo);
+ long id = 0L;
+ bool restricao = false;
+ if (restricoesUsuario.Count > 0 && restricoesUsuario.Any((RestricaoUsuario y) => y.Tipo == tipo))
+ {
+ id = ((DomainBase)restricoesUsuario.First((RestricaoUsuario y) => y.Tipo == tipo)).Id;
+ restricao = restricoesUsuario.First((RestricaoUsuario y) => y.Tipo == tipo).Restricao;
+ }
+ RestricaoUsuario item = new RestricaoUsuario
+ {
+ Id = id,
+ Tipo = tipo,
+ Restricao = restricao,
+ Ajuda = help
+ };
+ list.Add(item);
+ }
+ });
+ return list;
+ }
+
+ private async Task<List<RestricaoUsuarioCamposRelatorios>> GetRestricoesCamposRelatorios(Usuario usuario)
+ {
+ List<RestricaoUsuarioCamposRelatorios> list = new List<RestricaoUsuarioCamposRelatorios>();
+ List<ParametrosRelatorio> parametros = new List<ParametrosRelatorio>();
+ foreach (Relatorio item2 in Enum.GetValues(typeof(Relatorio)).Cast<Relatorio>())
+ {
+ switch ((int)item2)
+ {
+ case 0:
+ case 1:
+ parametros.AddRange(Funcoes.ColunasRelatorio<ClientesAtivosInativos>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 2:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Producao>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 3:
+ parametros.AddRange(Funcoes.ColunasRelatorio<ApolicePendente>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 18:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Tarefa>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 4:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Renovacao>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 5:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Comissao>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 6:
+ case 16:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Pendente>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 9:
+ case 10:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Sinistro>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 23:
+ parametros.AddRange(Funcoes.ColunasRelatorio<LogsEnvio>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 8:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Auditoria>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 13:
+ parametros.AddRange(Funcoes.ColunasRelatorio<ExtratoBaixadoRelatorio>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 12:
+ parametros.AddRange(Funcoes.ColunasRelatorio<FaturaPendente>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 14:
+ parametros.AddRange(Funcoes.ColunasRelatorio<MetaSeguradoraRelatorio>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 15:
+ parametros.AddRange(Funcoes.ColunasRelatorio<MetaVendedorRelatorio>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 11:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Fechamento>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 17:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Licenciamento>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 27:
+ parametros.AddRange(Funcoes.ColunasRelatorio<Placas>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 7:
+ parametros.AddRange(Funcoes.ColunasRelatorio<DadosRelatorio>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 19:
+ parametros.AddRange(Funcoes.ColunasRelatorio<NotaFiscalRelatorio>(item2, new List<ParametrosRelatorio>()));
+ break;
+ case 20:
+ parametros.AddRange(Funcoes.ColunasRelatorio<PrevisaoPagamento>(item2, new List<ParametrosRelatorio>()));
+ break;
+ }
+ }
+ List<RestricaoUsuarioCamposRelatorios> restricoesUsuario = await ServicoRestriUsuario.BuscarRestricoesCamposRelatorios(((DomainBase)usuario).Id);
+ parametros.ForEach(delegate(ParametrosRelatorio x)
+ {
+ //IL_0073: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0078: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0090: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0097: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a9: Expected O, but got Unknown
+ long id = 0L;
+ bool restricao = false;
+ if (restricoesUsuario.Count > 0 && restricoesUsuario.Any((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio))
+ {
+ id = ((DomainBase)restricoesUsuario.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio)).Id;
+ restricao = restricoesUsuario.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Header && y.Relatorio == x.Relatorio).Restricao;
+ }
+ RestricaoUsuarioCamposRelatorios item = new RestricaoUsuarioCamposRelatorios
+ {
+ Id = id,
+ Campo = x.Header,
+ Relatorio = x.Relatorio,
+ Restricao = restricao
+ };
+ list.Add(item);
+ });
+ return list;
+ }
+
+ public async Task<bool> Salvar(long? idUsuario = null, bool registrar = true)
+ {
+ PermissaoUsuario obj = ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)43);
+ if (obj != null && !obj.Alterar && !Recursos.Usuario.Administrador)
+ {
+ await ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA ALTERAR PERMISSÕES!");
+ return false;
+ }
+ Usuario usuario = await _servicoUsuario.BuscarUsuarioPorId(idUsuario ?? ((DomainBase)_selectedUsuario).Id);
+ List<PermissaoUsuario> prevPer = new List<PermissaoUsuario>();
+ List<PermissaoUsuario> list = prevPer;
+ list.AddRange(await GetPermissoes(usuario, "seguros"));
+ list = prevPer;
+ list.AddRange(await GetPermissoes(usuario, "ferramentas"));
+ List<PermissaoArquivoDigital> prevPerArquivoDigital = new List<PermissaoArquivoDigital>();
+ List<PermissaoArquivoDigital> list2 = prevPerArquivoDigital;
+ list2.AddRange(await GetPermissoesArquivoDigital(usuario));
+ List<PermissaoArquivoDigital> permissao = ((IEnumerable<PermissaoArquivoDigital>)ArquivosDigitais).Select((Func<PermissaoArquivoDigital, PermissaoArquivoDigital>)((PermissaoArquivoDigital x) => new PermissaoArquivoDigital
+ {
+ Id = ((prevPerArquivoDigital.Count == 0) ? 0 : ((DomainBase)prevPerArquivoDigital.First((PermissaoArquivoDigital y) => y.Tela == x.Tela)).Id),
+ Tela = x.Tela,
+ Consultar = x.Consultar,
+ Incluir = x.Incluir,
+ Excluir = x.Excluir,
+ Usuario = usuario
+ })).ToList();
+ List<PermissaoUsuario> permissoes = new List<PermissaoUsuario>();
+ List<PermissaoUsuario> collection = ((IEnumerable<PermissaoUsuario>)Seguros).Select((Func<PermissaoUsuario, PermissaoUsuario>)((PermissaoUsuario x) => new PermissaoUsuario
+ {
+ Id = ((prevPer.Count == 0) ? 0 : ((DomainBase)prevPer.First((PermissaoUsuario y) => y.Tela == x.Tela)).Id),
+ Tela = x.Tela,
+ Consultar = x.Consultar,
+ Incluir = x.Incluir,
+ Alterar = x.Alterar,
+ Excluir = x.Excluir,
+ Usuario = usuario
+ })).ToList();
+ permissoes.AddRange(collection);
+ collection = ((IEnumerable<PermissaoUsuario>)Ferramentas).Select((Func<PermissaoUsuario, PermissaoUsuario>)((PermissaoUsuario x) => new PermissaoUsuario
+ {
+ Id = ((prevPer.Count == 0) ? 0 : ((DomainBase)prevPer.First((PermissaoUsuario y) => y.Tela == x.Tela)).Id),
+ Tela = x.Tela,
+ Consultar = x.Consultar,
+ Incluir = x.Incluir,
+ Alterar = x.Alterar,
+ Excluir = x.Excluir,
+ Usuario = usuario
+ })).ToList();
+ permissoes.AddRange(collection);
+ Usuario obj2 = usuario;
+ PermissaoAggilizador selectedPermissao = SelectedPermissao;
+ obj2.PermissaoAggilizador = ((selectedPermissao != null) ? ((DomainBase)selectedPermissao).Id : 0);
+ usuario.Administrador = AdmUsuario;
+ await ServicoPermissArquivoDigital.SavePermiss(permissao, prevPerArquivoDigital);
+ if (!ServicoPermissArquivoDigital.Sucesso)
+ {
+ return false;
+ }
+ await ServicoPermissUsuario.SavePermiss(permissoes, prevPer);
+ if (!ServicoPermissUsuario.Sucesso)
+ {
+ return false;
+ }
+ await _servicoUsuario.Save(usuario);
+ if (!_servicoUsuario.Sucesso)
+ {
+ return false;
+ }
+ if (((DomainBase)Recursos.Usuario).Id == ((DomainBase)_selectedUsuario).Id)
+ {
+ Recursos.Usuario = usuario;
+ }
+ List<RestricaoUsuario> prevRes = new List<RestricaoUsuario>();
+ List<RestricaoUsuario> list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "b.i."));
+ list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "seguros"));
+ list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "relatorios"));
+ list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "financeiro"));
+ list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "ferramentas"));
+ list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "ajuda"));
+ list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "totalizacoesRelatorios"));
+ list3 = prevRes;
+ list3.AddRange(await GetRestricoes(usuario, "camposRelatorios"));
+ List<RestricaoUsuarioCamposRelatorios> prevResCamposRelatorios = new List<RestricaoUsuarioCamposRelatorios>();
+ List<RestricaoUsuarioCamposRelatorios> list4 = prevResCamposRelatorios;
+ list4.AddRange(await GetRestricoesCamposRelatorios(usuario));
+ List<RestricaoUsuario> list5 = new List<RestricaoUsuario>();
+ List<RestricaoUsuarioCamposRelatorios> restricoesCamposRelatorios = new List<RestricaoUsuarioCamposRelatorios>();
+ List<RestricaoUsuario> collection2 = ((IEnumerable<RestricaoUsuario>)RestricoesBis).Select((Func<RestricaoUsuario, RestricaoUsuario>)((RestricaoUsuario x) => new RestricaoUsuario
+ {
+ Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id),
+ Tipo = x.Tipo,
+ Restricao = x.Restricao,
+ Usuario = usuario
+ })).ToList();
+ list5.AddRange(collection2);
+ collection2 = ((IEnumerable<RestricaoUsuario>)RestricoesSeguros).Select((Func<RestricaoUsuario, RestricaoUsuario>)((RestricaoUsuario x) => new RestricaoUsuario
+ {
+ Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id),
+ Tipo = x.Tipo,
+ Restricao = x.Restricao,
+ Usuario = usuario
+ })).ToList();
+ list5.AddRange(collection2);
+ collection2 = ((IEnumerable<RestricaoUsuario>)RestricoesRelatorios).Select((Func<RestricaoUsuario, RestricaoUsuario>)((RestricaoUsuario x) => new RestricaoUsuario
+ {
+ Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id),
+ Tipo = x.Tipo,
+ Restricao = x.Restricao,
+ Usuario = usuario
+ })).ToList();
+ list5.AddRange(collection2);
+ collection2 = ((IEnumerable<RestricaoUsuario>)RestricoesTotalizacoesRelatorios).Select((Func<RestricaoUsuario, RestricaoUsuario>)((RestricaoUsuario x) => new RestricaoUsuario
+ {
+ Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id),
+ Tipo = x.Tipo,
+ Restricao = x.Restricao,
+ Usuario = usuario
+ })).ToList();
+ list5.AddRange(collection2);
+ collection2 = ((IEnumerable<RestricaoUsuario>)RestricoesFinanceiros).Select((Func<RestricaoUsuario, RestricaoUsuario>)((RestricaoUsuario x) => new RestricaoUsuario
+ {
+ Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id),
+ Tipo = x.Tipo,
+ Restricao = x.Restricao,
+ Usuario = usuario
+ })).ToList();
+ list5.AddRange(collection2);
+ collection2 = ((IEnumerable<RestricaoUsuario>)RestricoesFerramentas).Select((Func<RestricaoUsuario, RestricaoUsuario>)((RestricaoUsuario x) => new RestricaoUsuario
+ {
+ Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id),
+ Tipo = x.Tipo,
+ Restricao = x.Restricao,
+ Usuario = usuario
+ })).ToList();
+ list5.AddRange(collection2);
+ collection2 = ((IEnumerable<RestricaoUsuario>)RestricoesAjudas).Select((Func<RestricaoUsuario, RestricaoUsuario>)((RestricaoUsuario x) => new RestricaoUsuario
+ {
+ Id = ((prevRes.Count == 0) ? 0 : ((DomainBase)prevRes.First((RestricaoUsuario y) => y.Tipo == x.Tipo)).Id),
+ Tipo = x.Tipo,
+ Restricao = x.Restricao,
+ Usuario = usuario
+ })).ToList();
+ list5.AddRange(collection2);
+ List<RestricaoUsuarioCamposRelatorios> collection3 = ((IEnumerable<RestricaoUsuarioCamposRelatorios>)RestricoesCamposRelatorios).Select((Func<RestricaoUsuarioCamposRelatorios, RestricaoUsuarioCamposRelatorios>)((RestricaoUsuarioCamposRelatorios x) => new RestricaoUsuarioCamposRelatorios
+ {
+ Id = ((prevResCamposRelatorios.Count == 0) ? 0 : ((DomainBase)prevResCamposRelatorios.First((RestricaoUsuarioCamposRelatorios y) => y.Campo == x.Campo && y.Relatorio == x.Relatorio)).Id),
+ Campo = x.Campo,
+ Restricao = x.Restricao,
+ Relatorio = x.Relatorio,
+ Usuario = usuario
+ })).ToList();
+ restricoesCamposRelatorios.AddRange(collection3);
+ await ServicoRestriUsuario.SaveRestri(list5, prevRes);
+ if (!ServicoRestriUsuario.Sucesso)
+ {
+ return false;
+ }
+ await ServicoRestriUsuario.SaveRestriCamposRelatorios(restricoesCamposRelatorios, prevResCamposRelatorios);
+ if (!ServicoRestriUsuario.Sucesso)
+ {
+ return false;
+ }
+ if (registrar)
+ {
+ RegistrarAcao("ALTEROU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"" + SelectedUsuario.Nome + "\"", ((DomainBase)SelectedUsuario).Id, (TipoTela)43, "ACESSE O LOG DE ALTERAÇÕES NA TELA DE PERMISSÕES/RESTRIÇÕES PARA VER EXATAMENTE O QUE FOI ALTERADO.");
+ }
+ return true;
+ }
+
+ internal async Task<List<RestricaoUsuario>> FiltrarRestricoesBi(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesBis(value));
+ }
+
+ internal async Task<List<RestricaoUsuario>> FiltrarRestricoesSeguro(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesSeguros(value));
+ }
+
+ internal async Task<List<RestricaoUsuario>> FiltrarRestricoesRelatorio(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesRelatorios(value));
+ }
+
+ internal async Task<List<RestricaoUsuario>> FiltrarRestricoesTotalizacoesRelatorio(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesTotalizacoesRelatorios(value));
+ }
+
+ internal async Task<List<RestricaoUsuarioCamposRelatorios>> FiltrarRestricoesCamposRelatorio(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesCamposRelatorios(value));
+ }
+
+ internal async Task<List<RestricaoUsuario>> FiltrarRestricoesFinanceiro(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesFinanceiros(value));
+ }
+
+ internal async Task<List<RestricaoUsuario>> FiltrarRestricoesFerramenta(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesFerramentas(value));
+ }
+
+ internal async Task<List<RestricaoUsuario>> FiltrarRestricoesAjuda(string value)
+ {
+ return await Task.Run(() => FiltrarRestricoesAjudas(value));
+ }
+
+ public List<RestricaoUsuario> FiltrarRestricoesBis(string filter)
+ {
+ RestricoesBisFiltradas = ((filter == "") ? new ObservableCollection<RestricaoUsuario>(RestricoesBis) : new ObservableCollection<RestricaoUsuario>(RestricoesBis.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedBis = RestricoesBisFiltradas.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesBisFiltradas.ToList();
+ }
+ return null;
+ }
+
+ public List<RestricaoUsuario> FiltrarRestricoesSeguros(string filter)
+ {
+ RestricoesSegurosFiltradas = ((filter == "") ? new ObservableCollection<RestricaoUsuario>(RestricoesSeguros) : new ObservableCollection<RestricaoUsuario>(RestricoesSeguros.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedSeguros = RestricoesSegurosFiltradas.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesSegurosFiltradas.ToList();
+ }
+ return null;
+ }
+
+ public List<RestricaoUsuario> FiltrarRestricoesRelatorios(string filter)
+ {
+ RestricoesRelatoriosFiltrados = ((filter == "") ? new ObservableCollection<RestricaoUsuario>(RestricoesRelatorios) : new ObservableCollection<RestricaoUsuario>(RestricoesRelatorios.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedRelatorios = RestricoesRelatoriosFiltrados.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesRelatoriosFiltrados.ToList();
+ }
+ return null;
+ }
+
+ public List<RestricaoUsuario> FiltrarRestricoesTotalizacoesRelatorios(string filter)
+ {
+ RestricoesTotalizacoesRelatoriosFiltrados = ((filter == "") ? new ObservableCollection<RestricaoUsuario>(RestricoesTotalizacoesRelatorios) : new ObservableCollection<RestricaoUsuario>(RestricoesTotalizacoesRelatorios.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedTotalizacoes = RestricoesTotalizacoesRelatoriosFiltrados.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesTotalizacoesRelatoriosFiltrados.ToList();
+ }
+ return null;
+ }
+
+ public List<RestricaoUsuarioCamposRelatorios> FiltrarRestricoesCamposRelatorios(string filter)
+ {
+ RestricoesCamposRelatoriosFiltrados = ((filter == "") ? new ObservableCollection<RestricaoUsuarioCamposRelatorios>(RestricoesCamposRelatorios) : new ObservableCollection<RestricaoUsuarioCamposRelatorios>(RestricoesCamposRelatorios.Where((RestricaoUsuarioCamposRelatorios x) => ValidationHelper.RemoveDiacritics(x.Campo.ToUpper().Trim()).Contains(filter.ToUpper()) || ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Relatorio).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedCampos = RestricoesCamposRelatoriosFiltrados.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesCamposRelatoriosFiltrados.ToList();
+ }
+ return null;
+ }
+
+ public List<RestricaoUsuario> FiltrarRestricoesFinanceiros(string filter)
+ {
+ RestricoesFinanceirosFiltradas = ((filter == "") ? new ObservableCollection<RestricaoUsuario>(RestricoesFinanceiros) : new ObservableCollection<RestricaoUsuario>(RestricoesFinanceiros.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedFinanceiros = RestricoesFinanceirosFiltradas.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesFinanceirosFiltradas.ToList();
+ }
+ return null;
+ }
+
+ public List<RestricaoUsuario> FiltrarRestricoesFerramentas(string filter)
+ {
+ RestricoesFerramentasFiltradas = ((filter == "") ? new ObservableCollection<RestricaoUsuario>(RestricoesFerramentas) : new ObservableCollection<RestricaoUsuario>(RestricoesFerramentas.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedFerramentas = RestricoesFerramentasFiltradas.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesFerramentasFiltradas.ToList();
+ }
+ return null;
+ }
+
+ public List<RestricaoUsuario> FiltrarRestricoesAjudas(string filter)
+ {
+ RestricoesAjudasFiltrados = ((filter == "") ? new ObservableCollection<RestricaoUsuario>(RestricoesAjudas) : new ObservableCollection<RestricaoUsuario>(RestricoesAjudas.Where((RestricaoUsuario x) => ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription((Enum)(object)x.Tipo).Trim()).ToUpper().Contains(filter.ToUpper()))));
+ ExpandedAjudas = RestricoesAjudasFiltrados.Count > 0 && filter != "";
+ if (!(filter == ""))
+ {
+ return RestricoesAjudasFiltrados.ToList();
+ }
+ return null;
+ }
+
+ public bool CopiarPermissoes(Tuple<List<PermissaoUsuario>, Usuario, List<RestricaoUsuario>, List<PermissaoArquivoDigital>, List<RestricaoUsuarioCamposRelatorios>> copiarPermiss)
+ {
+ if (copiarPermiss.Item1.Count > 0)
+ {
+ copiarPermiss.Item1.ForEach(delegate(PermissaoUsuario x)
+ {
+ Seguros.ToList().ForEach(delegate(PermissaoUsuario y)
+ {
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000c: Unknown result type (might be due to invalid IL or missing references)
+ if (x.Tela == y.Tela)
+ {
+ y.Consultar = x.Consultar;
+ y.Incluir = x.Incluir;
+ y.Alterar = x.Alterar;
+ y.Excluir = x.Excluir;
+ y.Usuario = _selectedUsuario;
+ }
+ });
+ Ferramentas.ToList().ForEach(delegate(PermissaoUsuario y)
+ {
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000c: Unknown result type (might be due to invalid IL or missing references)
+ if (x.Tela == y.Tela)
+ {
+ y.Consultar = x.Consultar;
+ y.Incluir = x.Incluir;
+ y.Alterar = x.Alterar;
+ y.Excluir = x.Excluir;
+ y.Usuario = _selectedUsuario;
+ }
+ });
+ });
+ }
+ else
+ {
+ Seguros.ToList().ForEach(delegate(PermissaoUsuario x)
+ {
+ x.Consultar = false;
+ x.Incluir = false;
+ x.Alterar = false;
+ x.Excluir = false;
+ x.Usuario = _selectedUsuario;
+ });
+ Ferramentas.ToList().ForEach(delegate(PermissaoUsuario x)
+ {
+ x.Consultar = false;
+ x.Incluir = false;
+ x.Alterar = false;
+ x.Excluir = false;
+ x.Usuario = _selectedUsuario;
+ });
+ }
+ if (copiarPermiss.Item4.Count > 0)
+ {
+ copiarPermiss.Item4.ForEach(delegate(PermissaoArquivoDigital x)
+ {
+ ArquivosDigitais.ToList().ForEach(delegate(PermissaoArquivoDigital y)
+ {
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000c: Unknown result type (might be due to invalid IL or missing references)
+ if (x.Tela == y.Tela)
+ {
+ y.Consultar = x.Consultar;
+ y.Incluir = x.Incluir;
+ y.Excluir = x.Excluir;
+ y.Usuario = _selectedUsuario;
+ }
+ });
+ });
+ }
+ else
+ {
+ ArquivosDigitais.ToList().ForEach(delegate(PermissaoArquivoDigital x)
+ {
+ x.Consultar = false;
+ x.Incluir = false;
+ x.Excluir = false;
+ x.Usuario = _selectedUsuario;
+ });
+ }
+ SelectedPermissao = (copiarPermiss.Item2.PermissaoAggilizador.HasValue ? ((IEnumerable<PermissaoAggilizador>)PermissaoAggilizador).FirstOrDefault((Func<PermissaoAggilizador, bool>)((PermissaoAggilizador x) => ((DomainBase)x).Id == copiarPermiss.Item2.PermissaoAggilizador)) : null);
+ copiarPermiss.Item3.ForEach(delegate(RestricaoUsuario x)
+ {
+ //IL_001c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0022: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0081: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00da: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_013b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0141: Unknown result type (might be due to invalid IL or missing references)
+ //IL_019e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01a4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0201: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0207: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0264: Unknown result type (might be due to invalid IL or missing references)
+ //IL_026a: Unknown result type (might be due to invalid IL or missing references)
+ foreach (RestricaoUsuario restricoesBi in RestricoesBis)
+ {
+ if (restricoesBi.Tipo == x.Tipo)
+ {
+ restricoesBi.Restricao = x.Restricao;
+ restricoesBi.Usuario = _selectedUsuario;
+ }
+ }
+ foreach (RestricaoUsuario restricoesSeguro in RestricoesSeguros)
+ {
+ if (restricoesSeguro.Tipo == x.Tipo)
+ {
+ restricoesSeguro.Restricao = x.Restricao;
+ restricoesSeguro.Usuario = _selectedUsuario;
+ }
+ }
+ foreach (RestricaoUsuario restricoesRelatorio in RestricoesRelatorios)
+ {
+ if (restricoesRelatorio.Tipo == x.Tipo)
+ {
+ restricoesRelatorio.Restricao = x.Restricao;
+ restricoesRelatorio.Usuario = _selectedUsuario;
+ }
+ }
+ foreach (RestricaoUsuario restricoesTotalizacoesRelatorio in RestricoesTotalizacoesRelatorios)
+ {
+ if (restricoesTotalizacoesRelatorio.Tipo == x.Tipo)
+ {
+ restricoesTotalizacoesRelatorio.Restricao = x.Restricao;
+ restricoesTotalizacoesRelatorio.Usuario = _selectedUsuario;
+ }
+ }
+ foreach (RestricaoUsuario restricoesFinanceiro in RestricoesFinanceiros)
+ {
+ if (restricoesFinanceiro.Tipo == x.Tipo)
+ {
+ restricoesFinanceiro.Restricao = x.Restricao;
+ restricoesFinanceiro.Usuario = _selectedUsuario;
+ }
+ }
+ foreach (RestricaoUsuario restricoesFerramenta in RestricoesFerramentas)
+ {
+ if (restricoesFerramenta.Tipo == x.Tipo)
+ {
+ restricoesFerramenta.Restricao = x.Restricao;
+ restricoesFerramenta.Usuario = _selectedUsuario;
+ }
+ }
+ foreach (RestricaoUsuario restricoesAjuda in RestricoesAjudas)
+ {
+ if (restricoesAjuda.Tipo == x.Tipo)
+ {
+ restricoesAjuda.Restricao = x.Restricao;
+ restricoesAjuda.Usuario = _selectedUsuario;
+ }
+ }
+ });
+ copiarPermiss.Item5.ForEach(delegate(RestricaoUsuarioCamposRelatorios x)
+ {
+ //IL_002f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0035: Unknown result type (might be due to invalid IL or missing references)
+ foreach (RestricaoUsuarioCamposRelatorios restricoesCamposRelatorio in RestricoesCamposRelatorios)
+ {
+ if (restricoesCamposRelatorio.Campo == x.Campo && restricoesCamposRelatorio.Relatorio == x.Relatorio)
+ {
+ restricoesCamposRelatorio.Restricao = x.Restricao;
+ restricoesCamposRelatorio.Usuario = _selectedUsuario;
+ }
+ }
+ });
+ RegistrarAcao("IMPORTOU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"" + copiarPermiss.Item2.Nome + "\"", ((DomainBase)SelectedUsuario).Id, (TipoTela)43, $"ID USUÁRIO: {((DomainBase)copiarPermiss.Item2).Id}");
+ return true;
+ }
+
+ public async Task<bool> ExportarPermissoes(List<Usuario> usuarios)
+ {
+ foreach (Usuario item in usuarios.Where((Usuario x) => x.Selecionado))
+ {
+ await Salvar(((DomainBase)item).Id, registrar: false);
+ }
+ RegistrarAcao(string.Format("EXPORTOU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"{0}\" PARA {1} USUÁRIO{2}", SelectedUsuario.Nome, usuarios.Count, (usuarios.Count == 1) ? "" : "S"), ((DomainBase)SelectedUsuario).Id, (TipoTela)43, "IDS E NOMES DOS USUÁRIOS: " + string.Join("\n", usuarios.Select((Usuario x) => $"{((DomainBase)x).Id}: \"{x.Nome}\"")));
+ return true;
+ }
+
+ public void AtivarDesativarPermissoes(bool permiss)
+ {
+ AtivarDesativarPermissoesBool = !permiss;
+ Seguros.ToList().ForEach(delegate(PermissaoUsuario x)
+ {
+ x.Consultar = permiss;
+ x.Incluir = permiss;
+ x.Alterar = permiss;
+ x.Excluir = permiss;
+ });
+ Ferramentas.ToList().ForEach(delegate(PermissaoUsuario x)
+ {
+ x.Consultar = permiss;
+ x.Incluir = permiss;
+ x.Alterar = permiss;
+ x.Excluir = permiss;
+ });
+ ArquivosDigitais.ToList().ForEach(delegate(PermissaoArquivoDigital x)
+ {
+ x.Consultar = permiss;
+ x.Incluir = permiss;
+ x.Excluir = permiss;
+ });
+ SelectedPermissao = (permiss ? ((IEnumerable<PermissaoAggilizador>)PermissaoAggilizador).FirstOrDefault((Func<PermissaoAggilizador, bool>)((PermissaoAggilizador x) => x.Descricao == "ADMINISTRADOR")) : null);
+ Seguros = new ObservableCollection<PermissaoUsuario>(Seguros);
+ Ferramentas = new ObservableCollection<PermissaoUsuario>(Ferramentas);
+ ArquivosDigitais = new ObservableCollection<PermissaoArquivoDigital>(ArquivosDigitais);
+ }
+
+ public void AtivarDesativarRestricoes(bool restricao)
+ {
+ AtivarDesativarRestricoesBool = !restricao;
+ foreach (RestricaoUsuario restricoesBisFiltrada in RestricoesBisFiltradas)
+ {
+ restricoesBisFiltrada.Restricao = restricao;
+ }
+ foreach (RestricaoUsuario restricoesSegurosFiltrada in RestricoesSegurosFiltradas)
+ {
+ restricoesSegurosFiltrada.Restricao = restricao;
+ }
+ foreach (RestricaoUsuario restricoesRelatoriosFiltrado in RestricoesRelatoriosFiltrados)
+ {
+ restricoesRelatoriosFiltrado.Restricao = restricao;
+ }
+ foreach (RestricaoUsuario restricoesTotalizacoesRelatoriosFiltrado in RestricoesTotalizacoesRelatoriosFiltrados)
+ {
+ restricoesTotalizacoesRelatoriosFiltrado.Restricao = restricao;
+ }
+ foreach (RestricaoUsuarioCamposRelatorios restricoesCamposRelatoriosFiltrado in RestricoesCamposRelatoriosFiltrados)
+ {
+ restricoesCamposRelatoriosFiltrado.Restricao = restricao;
+ }
+ foreach (RestricaoUsuario restricoesFinanceirosFiltrada in RestricoesFinanceirosFiltradas)
+ {
+ restricoesFinanceirosFiltrada.Restricao = restricao;
+ }
+ foreach (RestricaoUsuario restricoesFerramentasFiltrada in RestricoesFerramentasFiltradas)
+ {
+ restricoesFerramentasFiltrada.Restricao = restricao;
+ }
+ foreach (RestricaoUsuario restricoesAjudasFiltrado in RestricoesAjudasFiltrados)
+ {
+ restricoesAjudasFiltrado.Restricao = restricao;
+ }
+ RestricoesBisFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesBisFiltradas);
+ RestricoesSegurosFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesSegurosFiltradas);
+ RestricoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(RestricoesRelatoriosFiltrados);
+ RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(RestricoesTotalizacoesRelatoriosFiltrados);
+ RestricoesCamposRelatoriosFiltrados = new ObservableCollection<RestricaoUsuarioCamposRelatorios>(RestricoesCamposRelatoriosFiltrados);
+ RestricoesFinanceirosFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesFinanceirosFiltradas);
+ RestricoesFerramentasFiltradas = new ObservableCollection<RestricaoUsuario>(RestricoesFerramentasFiltradas);
+ RestricoesAjudasFiltrados = new ObservableCollection<RestricaoUsuario>(RestricoesAjudasFiltrados);
+ }
+
+ public void AtivarDesativarRestricoes()
+ {
+ if (RestricoesBisFiltradas != null && RestricoesAjudasFiltrados != null && RestricoesSegurosFiltradas != null && RestricoesRelatoriosFiltrados != null && RestricoesFinanceirosFiltradas != null && RestricoesFerramentasFiltradas != null && RestricoesTotalizacoesRelatoriosFiltrados != null && RestricoesCamposRelatoriosFiltrados != null && RestricoesBisFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesAjudasFiltrados.All((RestricaoUsuario x) => x.Restricao) && RestricoesSegurosFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesRelatoriosFiltrados.All((RestricaoUsuario x) => x.Restricao) && RestricoesFinanceirosFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesFerramentasFiltradas.All((RestricaoUsuario x) => x.Restricao) && RestricoesTotalizacoesRelatoriosFiltrados.All((RestricaoUsuario x) => x.Restricao) && RestricoesCamposRelatoriosFiltrados.All((RestricaoUsuarioCamposRelatorios x) => x.Restricao))
+ {
+ AtivarDesativarRestricoesBool = false;
+ }
+ }
+
+ public void DesabilitarArquivoDigital(PermissaoArquivoDigital desabilitar)
+ {
+ PermissaoArquivoDigital val = ArquivosDigitais.First((PermissaoArquivoDigital x) => x.Tela == desabilitar.Tela);
+ if (val.Incluir || val.Excluir)
+ {
+ val.Incluir = false;
+ val.Excluir = false;
+ ArquivosDigitais = new ObservableCollection<PermissaoArquivoDigital>(ArquivosDigitais);
+ }
+ }
+
+ public void DesabilitarConsulta(PermissaoUsuario desabilitar, string source)
+ {
+ if (!(source == "Ferramentas"))
+ {
+ PermissaoUsuario val = Seguros.First((PermissaoUsuario x) => x.Tela == desabilitar.Tela);
+ if (val.Incluir || val.Alterar || val.Excluir)
+ {
+ val.Alterar = false;
+ val.Incluir = false;
+ val.Excluir = false;
+ Seguros = new ObservableCollection<PermissaoUsuario>(Seguros);
+ }
+ }
+ else
+ {
+ PermissaoUsuario val2 = Ferramentas.First((PermissaoUsuario x) => x.Tela == desabilitar.Tela);
+ if (val2.Incluir || val2.Alterar || val2.Excluir)
+ {
+ val2.Alterar = false;
+ val2.Incluir = false;
+ val2.Excluir = false;
+ Ferramentas = new ObservableCollection<PermissaoUsuario>(Ferramentas);
+ }
+ }
+ }
+
+ public void HabilitarArquivoDigital(PermissaoArquivoDigital habilitar)
+ {
+ PermissaoArquivoDigital val = ArquivosDigitais.First((PermissaoArquivoDigital x) => x.Tela == habilitar.Tela);
+ if (!val.Consultar)
+ {
+ val.Consultar = true;
+ ArquivosDigitais = new ObservableCollection<PermissaoArquivoDigital>(ArquivosDigitais);
+ }
+ }
+
+ public void HabilitarConsulta(PermissaoUsuario habilitar, string source)
+ {
+ if (!(source == "Ferramentas"))
+ {
+ PermissaoUsuario val = Seguros.First((PermissaoUsuario x) => x.Tela == habilitar.Tela);
+ if (!val.Consultar)
+ {
+ val.Consultar = true;
+ Seguros = new ObservableCollection<PermissaoUsuario>(Seguros);
+ }
+ }
+ else
+ {
+ PermissaoUsuario val2 = Ferramentas.First((PermissaoUsuario x) => x.Tela == habilitar.Tela);
+ if (!val2.Consultar)
+ {
+ val2.Consultar = true;
+ Ferramentas = new ObservableCollection<PermissaoUsuario>(Ferramentas);
+ }
+ }
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs
new file mode 100644
index 0000000..4231c90
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/TarefaDrawerViewModel.cs
@@ -0,0 +1,1064 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Seguros;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Configuracoes;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.Helper;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class TarefaDrawerViewModel : BaseTarefaViewModel
+{
+ private bool _enableMenu = true;
+
+ private GridLength _dados = new GridLength(0.0, (GridUnitType)1);
+
+ private GridLength _grid = new GridLength(1.0, (GridUnitType)2);
+
+ private GridLength _anotacoesLength = new GridLength(0.0, (GridUnitType)1);
+
+ private GridLength _descricaoLength = new GridLength(1.0, (GridUnitType)2);
+
+ private GridLength _anotacoesInternasLength = new GridLength(0.0, (GridUnitType)1);
+
+ private GridLength _descricaoInternaLength = new GridLength(1.0, (GridUnitType)2);
+
+ private bool _enableAlterarTarefa = true;
+
+ private Visibility _visibilityMenu;
+
+ private bool _isVisibleDescricao;
+
+ private bool _isSelected;
+
+ private bool _concluido;
+
+ private bool _carregando;
+
+ private string _tituloTarefas;
+
+ private string _titulo;
+
+ private string _subTitulo;
+
+ private Tarefa _tarefa = new Tarefa();
+
+ private ObservableCollection<Tarefa> _tarefasFiltradas = new ObservableCollection<Tarefa>();
+
+ private List<Tarefa> _tarefas = new List<Tarefa>();
+
+ private bool _isAnotacoes = true;
+
+ private Tarefa _selectedTarefa;
+
+ private ObservableCollection<Usuario> _usuarios;
+
+ private ObservableCollection<TipoDeTarefa> _tiposTarefa;
+
+ private List<TelefoneBase> _telefones;
+
+ private DateTime _dataAgendamento = Funcoes.GetNetworkTime();
+
+ private DateTime _horaAgendamento = Funcoes.GetNetworkTime();
+
+ private Usuario _selectedUsuario;
+
+ private TipoDeTarefa _selectedTipoTarefa;
+
+ private ArquivoDigital _selectedAnexado = new ArquivoDigital();
+
+ private ObservableCollection<ArquivoDigital> _arquivosAnexados = new ObservableCollection<ArquivoDigital>();
+
+ private List<ArquivoDigital> _arquivosFinais = new List<ArquivoDigital>();
+
+ private bool _inclusaoArquivoDigitalEnable = true;
+
+ private new TarefaServico Servico { get; }
+
+ public GridLength Dados
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _dados;
+ }
+ 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)
+ _dados = value;
+ OnPropertyChanged("Dados");
+ }
+ }
+
+ public GridLength Grid
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _grid;
+ }
+ 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)
+ _grid = value;
+ OnPropertyChanged("Grid");
+ }
+ }
+
+ public GridLength AnotacoesLength
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _anotacoesLength;
+ }
+ 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)
+ _anotacoesLength = value;
+ OnPropertyChanged("AnotacoesLength");
+ }
+ }
+
+ public GridLength DescricaoLength
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _descricaoLength;
+ }
+ 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)
+ _descricaoLength = value;
+ OnPropertyChanged("DescricaoLength");
+ }
+ }
+
+ public GridLength AnotacoesInternasLength
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _anotacoesInternasLength;
+ }
+ 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)
+ _anotacoesInternasLength = value;
+ OnPropertyChanged("AnotacoesInternasLength");
+ }
+ }
+
+ public GridLength DescricaoInternaLength
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _descricaoInternaLength;
+ }
+ 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)
+ _descricaoInternaLength = value;
+ OnPropertyChanged("DescricaoInternaLength");
+ }
+ }
+
+ public override bool EnableAlterarTarefa
+ {
+ get
+ {
+ return _enableAlterarTarefa;
+ }
+ set
+ {
+ _enableAlterarTarefa = _alterarPermissEnabled && value;
+ OnPropertyChanged("EnableAlterarTarefa");
+ }
+ }
+
+ public long IdCliente { get; set; }
+
+ private int Index { get; set; } = 1;
+
+
+ public Visibility VisibilityMenu
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _visibilityMenu;
+ }
+ 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)
+ _visibilityMenu = value;
+ OnPropertyChanged("VisibilityMenu");
+ }
+ }
+
+ public bool IsVisibleDescricao
+ {
+ get
+ {
+ return _isVisibleDescricao;
+ }
+ set
+ {
+ _isVisibleDescricao = value;
+ OnPropertyChanged("IsVisibleDescricao");
+ }
+ }
+
+ public bool IsSelected
+ {
+ get
+ {
+ return _isSelected;
+ }
+ set
+ {
+ _isSelected = value;
+ OnPropertyChanged("IsSelected");
+ }
+ }
+
+ public bool Concluido
+ {
+ get
+ {
+ return _concluido;
+ }
+ set
+ {
+ _concluido = value;
+ OnPropertyChanged("Concluido");
+ }
+ }
+
+ public bool Carregando
+ {
+ get
+ {
+ return _carregando;
+ }
+ set
+ {
+ _carregando = value;
+ base.IsEnabled = !value;
+ OnPropertyChanged("Carregando");
+ }
+ }
+
+ public string TituloTarefas
+ {
+ get
+ {
+ return _tituloTarefas;
+ }
+ set
+ {
+ _tituloTarefas = value;
+ OnPropertyChanged("TituloTarefas");
+ }
+ }
+
+ public string Titulo
+ {
+ get
+ {
+ return _titulo;
+ }
+ set
+ {
+ _titulo = value;
+ OnPropertyChanged("Titulo");
+ }
+ }
+
+ public string SubTitulo
+ {
+ get
+ {
+ return _subTitulo;
+ }
+ set
+ {
+ _subTitulo = value;
+ OnPropertyChanged("SubTitulo");
+ }
+ }
+
+ public Tarefa Tarefa
+ {
+ get
+ {
+ return _tarefa;
+ }
+ set
+ {
+ _tarefa = value;
+ OnPropertyChanged("Tarefa");
+ }
+ }
+
+ public ObservableCollection<Tarefa> TarefasFiltradas
+ {
+ get
+ {
+ return _tarefasFiltradas;
+ }
+ set
+ {
+ _tarefasFiltradas = value;
+ OnPropertyChanged("TarefasFiltradas");
+ }
+ }
+
+ public List<Tarefa> Tarefas
+ {
+ get
+ {
+ return _tarefas;
+ }
+ set
+ {
+ _tarefas = value;
+ OnPropertyChanged("Tarefas");
+ }
+ }
+
+ public bool IsAnotacoes
+ {
+ get
+ {
+ return _isAnotacoes;
+ }
+ set
+ {
+ _isAnotacoes = value;
+ OnPropertyChanged("IsAnotacoes");
+ }
+ }
+
+ public override Tarefa SelectedTarefa
+ {
+ get
+ {
+ return _selectedTarefa;
+ }
+ set
+ {
+ //IL_007b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0081: Invalid comparison between Unknown and I4
+ //IL_0147: Unknown result type (might be due to invalid IL or missing references)
+ //IL_015c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0194: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0183: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00eb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0102: Expected O, but got Unknown
+ //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01bb: Unknown result type (might be due to invalid IL or missing references)
+ DateTime networkTime = Funcoes.GetNetworkTime();
+ IsSelected = value != null;
+ _selectedTarefa = value;
+ Tarefa obj = value;
+ DataAgendamento = ((obj != null) ? obj.Agendamento : networkTime);
+ Tarefa obj2 = value;
+ HoraAgendamento = ((obj2 != null) ? obj2.Agendamento : networkTime);
+ IsVisibleDescricao = value != null;
+ Tarefa obj3 = value;
+ Concluido = obj3 != null && (int)obj3.Status == 2;
+ base.Responsaveis = ((value == null) ? new ObservableCollection<ResponsavelTarefa>() : ((value.Responsaveis == null) ? new ObservableCollection<ResponsavelTarefa>() : new ObservableCollection<ResponsavelTarefa>(value.Responsaveis)));
+ if (!base.Responsaveis.Any())
+ {
+ Tarefa obj4 = value;
+ base.Responsaveis = ((((obj4 != null) ? obj4.Usuario : null) == null) ? new ObservableCollection<ResponsavelTarefa>() : new ObservableCollection<ResponsavelTarefa>((IEnumerable<ResponsavelTarefa>)(object)new ResponsavelTarefa[1]
+ {
+ new ResponsavelTarefa
+ {
+ Usuario = value.Usuario
+ }
+ }));
+ }
+ if (value != null && ((DomainBase)value).Id > 0)
+ {
+ AlterarTamanho(alterar: false);
+ }
+ if (value != null)
+ {
+ AnotacoesLength = new GridLength(0.0, (GridUnitType)1);
+ AnotacoesInternasLength = new GridLength(0.0, (GridUnitType)1);
+ DescricaoLength = (string.IsNullOrWhiteSpace(value.Descricao) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2));
+ DescricaoInternaLength = (string.IsNullOrWhiteSpace(value.DescricaoInterna) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2));
+ }
+ Tarefa obj5 = value;
+ if (((obj5 != null) ? obj5.TipoDeTarefa : null) != null)
+ {
+ if (TiposTarefa.All((TipoDeTarefa x) => ((DomainBase)x).Id != ((DomainBase)value).Id) && !value.TipoDeTarefa.Ativo)
+ {
+ TiposTarefa.Add(value.TipoDeTarefa);
+ }
+ else
+ {
+ TiposTarefa = new ObservableCollection<TipoDeTarefa>(TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList());
+ }
+ }
+ Tarefa obj6 = value;
+ SelectedTipoTarefa = ((obj6 != null) ? obj6.TipoDeTarefa : null);
+ if (base.EnableIncluir || base.EnableFields || base.EnableButtons)
+ {
+ Tarefa obj7 = value;
+ VerificarEnables((obj7 != null) ? new long?(((DomainBase)obj7).Id) : null);
+ }
+ ValidaPermissaoParaEditarTarefa();
+ OnPropertyChanged("SelectedTarefa");
+ }
+ }
+
+ public ObservableCollection<Usuario> Usuarios
+ {
+ get
+ {
+ return _usuarios;
+ }
+ set
+ {
+ _usuarios = value;
+ OnPropertyChanged("Usuarios");
+ }
+ }
+
+ public ObservableCollection<TipoDeTarefa> TiposTarefa
+ {
+ get
+ {
+ return _tiposTarefa;
+ }
+ set
+ {
+ _tiposTarefa = value;
+ OnPropertyChanged("TiposTarefa");
+ }
+ }
+
+ public List<TelefoneBase> Telefones
+ {
+ get
+ {
+ return _telefones;
+ }
+ set
+ {
+ _telefones = value;
+ OnPropertyChanged("Telefones");
+ }
+ }
+
+ public DateTime DataAgendamento
+ {
+ get
+ {
+ return _dataAgendamento;
+ }
+ set
+ {
+ _dataAgendamento = value;
+ if (SelectedTarefa != null)
+ {
+ SelectedTarefa.Agendamento = DateTime.Parse($"{value:d} {SelectedTarefa.Agendamento:T}");
+ }
+ OnPropertyChanged("DataAgendamento");
+ }
+ }
+
+ public DateTime HoraAgendamento
+ {
+ get
+ {
+ return _horaAgendamento;
+ }
+ set
+ {
+ _horaAgendamento = value;
+ if (SelectedTarefa != null)
+ {
+ SelectedTarefa.Agendamento = DateTime.Parse($"{SelectedTarefa.Agendamento:d} {value:T}");
+ }
+ OnPropertyChanged("HoraAgendamento");
+ }
+ }
+
+ public Usuario SelectedUsuario
+ {
+ get
+ {
+ return _selectedUsuario;
+ }
+ set
+ {
+ _selectedUsuario = value;
+ OnPropertyChanged("SelectedUsuario");
+ }
+ }
+
+ public TipoDeTarefa SelectedTipoTarefa
+ {
+ get
+ {
+ return _selectedTipoTarefa;
+ }
+ set
+ {
+ _selectedTipoTarefa = value;
+ OnPropertyChanged("SelectedTipoTarefa");
+ }
+ }
+
+ public ArquivoDigital SelectedAnexado
+ {
+ get
+ {
+ return _selectedAnexado;
+ }
+ set
+ {
+ _selectedAnexado = value;
+ OnPropertyChanged("SelectedAnexado");
+ }
+ }
+
+ public ObservableCollection<ArquivoDigital> ArquivosAnexados
+ {
+ get
+ {
+ return _arquivosAnexados;
+ }
+ set
+ {
+ _arquivosAnexados = value;
+ OnPropertyChanged("ArquivosAnexados");
+ }
+ }
+
+ public List<ArquivoDigital> ArquivosFinais
+ {
+ get
+ {
+ return _arquivosFinais;
+ }
+ set
+ {
+ _arquivosFinais = value;
+ OnPropertyChanged("ArquivosFinais");
+ }
+ }
+
+ public bool InclusaoArquivoDigitalEnable
+ {
+ get
+ {
+ return _inclusaoArquivoDigitalEnable;
+ }
+ set
+ {
+ _inclusaoArquivoDigitalEnable = value;
+ OnPropertyChanged("InclusaoArquivoDigitalEnable");
+ }
+ }
+
+ public TarefaDrawerViewModel(Tarefa tarefa, bool enableMenu)
+ {
+ //IL_0012: 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)
+ //IL_0027: Unknown result type (might be due to invalid IL or missing references)
+ //IL_002c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0041: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0051: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0056: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0066: Unknown result type (might be due to invalid IL or missing references)
+ //IL_006b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0080: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0094: Unknown result type (might be due to invalid IL or missing references)
+ //IL_009e: Expected O, but got Unknown
+ //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00dc: Expected O, but got Unknown
+ Servico = new TarefaServico();
+ Tarefa = tarefa;
+ _enableMenu = enableMenu;
+ CarregarUsuarios();
+ TiposTarefa = new ObservableCollection<TipoDeTarefa>(Recursos.TiposTarefa.Where((TipoDeTarefa x) => x.Ativo).ToList());
+ SelecionarTarefas(tarefa, tarefa.Conclusao.HasValue);
+ TituloTarefas = (tarefa.Conclusao.HasValue ? "TAREFAS CONCLUÍDAS" : "TAREFAS PENDENTES");
+ base.EnableMenu = true;
+ }
+
+ private void CarregarUsuarios()
+ {
+ Usuarios = new ObservableCollection<Usuario>((from x in Recursos.Usuarios
+ where (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 36) || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido && x.PermissaoAggilizador != 4
+ orderby x.Nome
+ select x).ToList());
+ }
+
+ public async void SelecionarTarefas(Tarefa tarefa, bool? concluido)
+ {
+ await PermissaoTela((TipoTela)38);
+ CarregarInformacoes(tarefa);
+ await CarregarTarefas(tarefa, concluido);
+ if (((DomainBase)tarefa).Id != 0L && !_enableMenu)
+ {
+ VisibilityMenu = (Visibility)2;
+ }
+ }
+
+ public async void CarregarInformacoes(Tarefa tarefa)
+ {
+ ClienteServico clienteServico = new ClienteServico();
+ SubTitulo = ((tarefa.IdEntidade != 0L) ? "TODAS AS TAREFAS PENDENTES DO CLIENTE" : "");
+ IdCliente = tarefa.IdCliente;
+ Titulo = tarefa.Cliente;
+ Telefones = (await clienteServico.BuscarTelefonesAsync(tarefa.IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func<ClienteTelefone, TelefoneBase>)((ClienteTelefone x) => new TelefoneBase
+ {
+ Tipo = ((TelefoneBase)x).Tipo,
+ Id = ((DomainBase)x).Id,
+ Numero = ((TelefoneBase)x).Numero,
+ Prefixo = ((TelefoneBase)x).Prefixo
+ })).ToList();
+ if (tarefa.IdEntidade == 0L)
+ {
+ return;
+ }
+ TipoTarefa entidade = tarefa.Entidade;
+ if ((int)entidade != 0)
+ {
+ if ((int)entidade != 4)
+ {
+ return;
+ }
+ Sinistro val = await new SinistroServico().BuscarSinistro(tarefa.IdEntidade);
+ if (val != null)
+ {
+ IdCliente = ((DomainBase)val.ControleSinistro.Item.Documento.Controle.Cliente).Id;
+ Titulo = val.ControleSinistro.Item.Documento.Controle.Cliente.Nome;
+ SubTitulo = "SINISTRO " + val.Numero + " ITEM " + val.ItemSinistrado;
+ Telefones = (await clienteServico.BuscarTelefonesAsync(IdCliente)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func<ClienteTelefone, TelefoneBase>)((ClienteTelefone x) => new TelefoneBase
+ {
+ Tipo = ((TelefoneBase)x).Tipo,
+ Id = ((DomainBase)x).Id,
+ Numero = ((TelefoneBase)x).Numero,
+ Prefixo = ((TelefoneBase)x).Prefixo
+ })).ToList();
+ }
+ }
+ else
+ {
+ Documento val2 = await new ApoliceServico().BuscarApoliceAsync(tarefa.IdEntidade);
+ IdCliente = ((DomainBase)val2.Controle.Cliente).Id;
+ Titulo = val2.Controle.Cliente.Nome;
+ SubTitulo = ((val2.Tipo == 0 && !string.IsNullOrWhiteSpace(val2.Apolice)) ? ("APÓLICE NÚMERO " + val2.Apolice) : ((val2.Tipo > 0) ? ("APÓLICE NÚMERO " + val2.Apolice + " ENDOSSO " + val2.Endosso) : ("PROPOSTA NÚMERO " + val2.Proposta)));
+ Telefones = (await clienteServico.BuscarTelefonesAsync(((DomainBase)val2.Controle.Cliente).Id)).Where((ClienteTelefone x) => ValidationHelper.ValidacaoTelefone(((TelefoneBase)x).Numero)).Select((Func<ClienteTelefone, TelefoneBase>)((ClienteTelefone x) => new TelefoneBase
+ {
+ Tipo = ((TelefoneBase)x).Tipo,
+ Id = ((DomainBase)x).Id,
+ Numero = ((TelefoneBase)x).Numero,
+ Prefixo = ((TelefoneBase)x).Prefixo
+ })).ToList();
+ }
+ }
+
+ public async Task CarregarTarefas(int index)
+ {
+ if (Tarefa.IdEntidade != 0L)
+ {
+ Carregando = true;
+ Tarefa tarefa = new Tarefa
+ {
+ Cliente = Tarefa.Cliente,
+ IdCliente = Tarefa.IdCliente,
+ Entidade = Tarefa.Entidade,
+ IdEntidade = Tarefa.IdEntidade
+ };
+ Index = index;
+ List<Tarefa> source;
+ switch (index)
+ {
+ default:
+ CarregarInformacoes(tarefa);
+ source = await Servico.BuscarTarefas(Tarefa.Entidade, Tarefa.IdEntidade, true);
+ break;
+ case 1:
+ CarregarInformacoes(tarefa);
+ source = await Servico.BuscarTarefas(Tarefa.Entidade, Tarefa.IdEntidade, false);
+ break;
+ case 2:
+ tarefa.Entidade = (TipoTarefa)2;
+ CarregarInformacoes(tarefa);
+ source = await Servico.BuscarTarefasCliente(Tarefa.IdCliente);
+ break;
+ }
+ Tarefas = source.OrderByDescending((Tarefa x) => x.Agendamento).ToList();
+ TarefasFiltradas = new ObservableCollection<Tarefa>(Tarefas);
+ SelectedTarefa = (Tarefa)((TarefasFiltradas == null || TarefasFiltradas.Count == 0) ? null : ((((DomainBase)tarefa).Id != 0L) ? ((object)((IEnumerable<Tarefa>)TarefasFiltradas).FirstOrDefault((Func<Tarefa, bool>)((Tarefa x) => ((DomainBase)x).Id == ((DomainBase)tarefa).Id))) : ((object)TarefasFiltradas.First())));
+ Carregando = false;
+ }
+ }
+
+ public async Task CarregarTarefas(Tarefa tarefa, bool? concluido)
+ {
+ Carregando = true;
+ if (tarefa.IdEntidade != 0L)
+ {
+ Tarefas = (await Servico.BuscarTarefas(tarefa.Entidade, tarefa.IdEntidade, concluido)).OrderBy((Tarefa x) => x.Agendamento).ToList();
+ TarefasFiltradas = new ObservableCollection<Tarefa>(Tarefas);
+ SelectedTarefa = (Tarefa)((TarefasFiltradas == null || TarefasFiltradas.Count == 0) ? null : ((((DomainBase)tarefa).Id != 0L) ? ((object)((IEnumerable<Tarefa>)TarefasFiltradas).FirstOrDefault((Func<Tarefa, bool>)((Tarefa x) => ((DomainBase)x).Id == ((DomainBase)tarefa).Id))) : ((object)TarefasFiltradas.First())));
+ }
+ else if (((DomainBase)tarefa).Id > 0)
+ {
+ SelectedTarefa = await Servico.BuscarTarefa(((DomainBase)tarefa).Id);
+ }
+ Carregando = false;
+ }
+
+ public async Task Incluir()
+ {
+ CarregarUsuarios();
+ base.Responsaveis = new ObservableCollection<ResponsavelTarefa>();
+ SelectedTarefa = new Tarefa
+ {
+ IdCliente = IdCliente,
+ Cliente = Titulo,
+ Referencia = SubTitulo,
+ Entidade = Tarefa.Entidade,
+ IdEntidade = Tarefa.IdEntidade,
+ Trilha = Tarefa.Trilha,
+ Status = (StatusTarefa)0,
+ Agendamento = Funcoes.GetNetworkTime().AddHours(1.0),
+ UsuarioCadastro = Recursos.Usuario,
+ Usuario = ((IEnumerable<Usuario>)Usuarios).FirstOrDefault((Func<Usuario, bool>)((Usuario x) => ((DomainBase)x).Id == ((DomainBase)Recursos.Usuario).Id)),
+ Restrito = false,
+ Responsaveis = base.Responsaveis.ToList()
+ };
+ ArquivosFinais = new List<ArquivoDigital>();
+ AlterarTamanho(alterar: true);
+ TituloTarefas += " (INCLUINDO)";
+ Alterar(alterar: true);
+ AnotacoesLength = new GridLength(1.0, (GridUnitType)2);
+ AnotacoesInternasLength = new GridLength(1.0, (GridUnitType)2);
+ DescricaoLength = new GridLength(0.0, (GridUnitType)1);
+ DescricaoInternaLength = new GridLength(0.0, (GridUnitType)1);
+ EnableAlterarTarefa = false;
+ }
+
+ public void AlterarTamanho(bool alterar)
+ {
+ //IL_007d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_006c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0095: Unknown result type (might be due to invalid IL or missing references)
+ if (!alterar)
+ {
+ if (TituloTarefas.Contains("TODAS"))
+ {
+ TituloTarefas = "TODAS TAREFAS DO CLIENTE";
+ }
+ else if (TituloTarefas.Contains("PENDENTES"))
+ {
+ TituloTarefas = "TAREFAS PENDENTES";
+ }
+ else if (TituloTarefas.Contains("CONCLUÍDAS"))
+ {
+ TituloTarefas = "TAREFAS CONCLUÍDAS";
+ }
+ }
+ Grid = (alterar ? new GridLength(0.0, (GridUnitType)2) : new GridLength(1.0, (GridUnitType)2));
+ Dados = (alterar ? new GridLength(1.0, (GridUnitType)2) : new GridLength(360.0, (GridUnitType)1));
+ }
+
+ public async Task<List<KeyValuePair<string, string>>> Salvar(string anotacoes, string anotacoesInternas)
+ {
+ DateTime networkTime = Funcoes.GetNetworkTime();
+ if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 45) && (int)SelectedTarefa.Status != 2 && SelectedTarefa.Agendamento < networkTime)
+ {
+ SelectedTarefa.Agendamento = networkTime;
+ }
+ if ((int)SelectedTarefa.Status == 2)
+ {
+ SelectedTarefa.Conclusao = networkTime;
+ }
+ if ((int)SelectedTarefa.Status == 0)
+ {
+ SelectedTarefa.Conclusao = null;
+ }
+ SelectedTarefa.Responsaveis = base.Responsaveis.ToList();
+ Tarefa selectedTarefa = SelectedTarefa;
+ ResponsavelTarefa? obj = base.Responsaveis.FirstOrDefault();
+ selectedTarefa.Usuario = ((obj != null) ? obj.Usuario : null);
+ SelectedTarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45);
+ List<KeyValuePair<string, string>> list = SelectedTarefa.Validate();
+ if (SelectedTarefa.Descricao == null && string.IsNullOrWhiteSpace(anotacoes) && string.IsNullOrWhiteSpace(anotacoesInternas))
+ {
+ list.Add(new KeyValuePair<string, string>("ANOTAÇÕES", "OBRIGATÓRIO"));
+ }
+ if (list.Count > 0)
+ {
+ return list;
+ }
+ if (!string.IsNullOrWhiteSpace(anotacoes))
+ {
+ SelectedTarefa.Anotacoes = Funcoes.AdicionarLog(SelectedTarefa.Anotacoes);
+ SelectedTarefa.Descricao = SelectedTarefa.Anotacoes + " <p> " + SelectedTarefa.Descricao + " </p>";
+ }
+ if (!string.IsNullOrWhiteSpace(anotacoesInternas))
+ {
+ SelectedTarefa.AnotacoesInternas = Funcoes.AdicionarLog(SelectedTarefa.AnotacoesInternas);
+ SelectedTarefa.DescricaoInterna = SelectedTarefa.AnotacoesInternas + " <p> " + SelectedTarefa.DescricaoInterna + " </p>";
+ }
+ SelectedTarefa.TipoDeTarefa = SelectedTipoTarefa;
+ bool inclusao = ((DomainBase)SelectedTarefa).Id == 0;
+ SelectedTarefa = await Servico.Salvar(SelectedTarefa);
+ string text = (inclusao ? "INCLUIU" : "ALTEROU");
+ RegistrarAcao(text + " TAREFA", ((DomainBase)SelectedTarefa).Id, (TipoTela)38, $"TAREFA \"{SelectedTarefa.Titulo}\", ID: {((DomainBase)SelectedTarefa).Id}");
+ if (inclusao)
+ {
+ foreach (ArquivoDigital arquivosFinai in ArquivosFinais)
+ {
+ arquivosFinai.IdTarefa = ((DomainBase)SelectedTarefa).Id;
+ }
+ await ArquivoDigitalServico.Insert(ArquivosFinais);
+ }
+ if (!Servico.Sucesso)
+ {
+ return null;
+ }
+ long id = ((DomainBase)SelectedTarefa).Id;
+ await CarregarTarefas(Index);
+ SelectedTarefa = ((IEnumerable<Tarefa>)TarefasFiltradas).FirstOrDefault((Func<Tarefa, bool>)((Tarefa x) => ((DomainBase)x).Id == id));
+ return null;
+ }
+
+ public void AlterarTarefa()
+ {
+ //IL_0055: Unknown result type (might be due to invalid IL or missing references)
+ //IL_006a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0098: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
+ CarregarUsuarios();
+ if (SelectedTarefa != null)
+ {
+ EnableAlterarTarefa = false;
+ AlterarTamanho(alterar: true);
+ TituloTarefas = TituloTarefas + " (ALTERANDO \"" + SelectedTarefa.Titulo + "\")";
+ Alterar(alterar: true);
+ AnotacoesLength = new GridLength(1.0, (GridUnitType)2);
+ AnotacoesInternasLength = new GridLength(1.0, (GridUnitType)2);
+ Tarefa selectedTarefa = SelectedTarefa;
+ DescricaoLength = (string.IsNullOrWhiteSpace((selectedTarefa != null) ? selectedTarefa.Descricao : null) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2));
+ Tarefa selectedTarefa2 = SelectedTarefa;
+ DescricaoInternaLength = (string.IsNullOrWhiteSpace((selectedTarefa2 != null) ? selectedTarefa2.DescricaoInterna : null) ? new GridLength(0.0, (GridUnitType)1) : new GridLength(1.0, (GridUnitType)2));
+ TarefasFiltradas = new ObservableCollection<Tarefa> { SelectedTarefa };
+ ListaUsuariosResponsaveis();
+ base.Responsaveis.ToList().ForEach(delegate(ResponsavelTarefa x)
+ {
+ Usuarios.Remove(x.Usuario);
+ });
+ }
+ }
+
+ public async Task Cancelar()
+ {
+ CarregarUsuarios();
+ AlterarTamanho(alterar: false);
+ Tarefa selectedTarefa = SelectedTarefa;
+ long id = ((selectedTarefa != null) ? ((DomainBase)selectedTarefa).Id : 0);
+ await CarregarTarefas(Index);
+ Alterar(alterar: false);
+ await ValidaPermissaoParaEditarTarefa();
+ if (id != 0L)
+ {
+ SelectedTarefa = ((IEnumerable<Tarefa>)TarefasFiltradas).FirstOrDefault((Func<Tarefa, bool>)((Tarefa x) => ((DomainBase)x).Id == id));
+ }
+ }
+
+ public async Task<bool> Excluir(Tarefa item)
+ {
+ if ((int)VisibilityMenu == 2)
+ {
+ await ShowMessage("NÃO É POSSÍVEL EXCLUIR TAREFA PELO RELATÓRIO!");
+ return false;
+ }
+ if (!(await ShowMessage("DESEJA REALMENTE EXCLUIR A TAREFA " + item.Titulo + "?" + Environment.NewLine + "ESSE PROCEDIMENTO É IRREVERSÍVEL", "SIM", "NÃO")))
+ {
+ return false;
+ }
+ string titulo = item.Titulo;
+ long id = ((DomainBase)item).Id;
+ if (!(await Servico.Excluir(((DomainBase)item).Id)))
+ {
+ Alterar(alterar: false);
+ return true;
+ }
+ RegistrarAcao("EXCLUIU TAREFA", ((DomainBase)item).Id, (TipoTela)38, $"TAREFA \"{titulo}\", ID: {id}");
+ await CarregarTarefas(Index);
+ Alterar(alterar: false);
+ return true;
+ }
+
+ public void AdcionarResponsavel()
+ {
+ //IL_000f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0014: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0020: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0036: Expected O, but got Unknown
+ if (SelectedUsuario != null)
+ {
+ base.Responsaveis.Add(new ResponsavelTarefa
+ {
+ Usuario = SelectedUsuario,
+ IdTarefa = ((DomainBase)SelectedTarefa).Id
+ });
+ Usuarios.Remove(SelectedUsuario);
+ SelectedUsuario = null;
+ }
+ }
+
+ public async void Editar(IndiceArquivoDigital arquivo)
+ {
+ if (arquivo != null && arquivo.IdArquivoDigital != 0L)
+ {
+ await ArquivoDigitalServico.Save(arquivo);
+ }
+ }
+
+ public void Delete(ArquivoDigital arquivo)
+ {
+ if (SelectedAnexado != null)
+ {
+ ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao);
+ ArquivosAnexados.Remove(item);
+ ArquivosAnexados = new ObservableCollection<ArquivoDigital>(ArquivosAnexados);
+ }
+ }
+
+ public async void Anexar()
+ {
+ InclusaoArquivoDigitalEnable = false;
+ List<ArquivoDigital> arquivos = await AddAttachments(ArquivosAnexados.ToList(), new List<ArquivoDigital>());
+ await Task.Run(async delegate
+ {
+ await Task.Delay(200);
+ InclusaoArquivoDigitalEnable = true;
+ });
+ if (arquivos != null)
+ {
+ arquivos.AddRange(ArquivosAnexados);
+ ArquivosAnexados = new ObservableCollection<ArquivoDigital>(arquivos);
+ }
+ }
+
+ public void SalvarAnexos()
+ {
+ ArquivosFinais = ArquivosAnexados.ToList();
+ }
+
+ public void LimparAnexos()
+ {
+ ArquivosAnexados = new ObservableCollection<ArquivoDigital>();
+ }
+
+ public void Print()
+ {
+ string value = GerarHtml();
+ string tempPath = Path.GetTempPath();
+ string text = $"{tempPath}{(object)(TipoTela)38}_{Funcoes.GetNetworkTime():ddMMyyyyhhmmss}.html";
+ StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8);
+ streamWriter.Write(value);
+ streamWriter.Close();
+ Process.Start(text);
+ RegistrarAcao("IMPRIMIU A TAREFA", ((DomainBase)SelectedTarefa).Id, (TipoTela)38, $"TAREFA \"{SelectedTarefa.Titulo}\", ID: {((DomainBase)SelectedTarefa).Id}");
+ }
+
+ public string GerarHtml()
+ {
+ //IL_0205: Unknown result type (might be due to invalid IL or missing references)
+ string text = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=yes'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title> TAREFA </title></head><body bgcolor='#FFFFFF'><div align='center'>";
+ text += "<br>";
+ text += "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>";
+ text += "TAREFA</h4></td></table><br>";
+ text += "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 4pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>";
+ int num = 0;
+ text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>CLIENTE: </b>" + SelectedTarefa.Cliente + "</p></td></tr>";
+ text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>REFERÊNCIA: </b>" + SelectedTarefa.Referencia + "</p></td></tr>";
+ text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>TÍTULO: </b>" + SelectedTarefa.Titulo + "</p></td></tr>";
+ text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>AGENDAMENTO: </b>" + SelectedTarefa.Agendamento.ToString() + "</p></td></tr>";
+ text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>RESPONSÁVEL PRINCIPAL: </b>" + SelectedTarefa.Usuario.Nome + "</p></td></tr>";
+ text = text + "<tr><td width='333' bgcolor='" + ((num++ % 2 == 0) ? "WhiteSmoke" : "White") + "'><p align='left'><b>STATUS: </b>" + ValidationHelper.GetDescription((Enum)(object)SelectedTarefa.Status) + "</p></td></tr>";
+ string[] obj = new string[6]
+ {
+ text,
+ "<tr><td width='333' bgcolor='",
+ (num % 2 == 0) ? "WhiteSmoke" : "White",
+ "'><p align='left'><b>TIPO DE TAREFA: </b>",
+ null,
+ null
+ };
+ TipoDeTarefa selectedTipoTarefa = SelectedTipoTarefa;
+ obj[4] = ((selectedTipoTarefa != null) ? selectedTipoTarefa.Nome : null);
+ obj[5] = "</p></td></tr>";
+ text = string.Concat(obj);
+ text += "</font></table>";
+ if (base.Responsaveis != null && base.Responsaveis.Count > 0)
+ {
+ text += "<h2>RESPONSÁVEIS VINCULADOS</h2>";
+ text += "<br>";
+ text += "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>";
+ List<string> list = new List<string>();
+ foreach (ResponsavelTarefa responsavei in base.Responsaveis)
+ {
+ list.Add(responsavei.Usuario.Nome.Trim().ToUpper());
+ }
+ text = text + "<tr><td width='333'><p align='left'>" + string.Join(", ", list) + "</p></td></tr>";
+ text += "</font></table>";
+ text += "<br><br>";
+ }
+ text += "<br><br>";
+ if (SelectedTarefa.Descricao != null)
+ {
+ text += "<h2>ANOTAÇÕES</h2>";
+ text += "<br>";
+ text += "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>";
+ text = text + "<tr><td width='333'><p align='left'>" + SelectedTarefa.Descricao.Replace("<BODY>", "").Replace("</BODY>", "") + "</p></td></tr>";
+ text += "</font></table>";
+ text += "<br><br>";
+ }
+ return text + "</div></body>";
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs
new file mode 100644
index 0000000..e27a291
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresApoliceViewModel.cs
@@ -0,0 +1,306 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class ValoresApoliceViewModel : BaseSegurosViewModel
+{
+ private Visibility _isVisibleEspecial;
+
+ private Visibility _isVisibleVendedores;
+
+ private decimal _prevista;
+
+ private decimal _recebida;
+
+ private decimal _recebidaEspecial;
+
+ private decimal _pendente;
+
+ private decimal _repasse;
+
+ private decimal _repasseEspecial;
+
+ private decimal _paga;
+
+ private decimal _pagaEspecial;
+
+ private string _apoliceLabel = "DESCRIÇÃO DE VALORES";
+
+ private string _apoliceDescricao = "VALORES BASEADOS NO DOCUMENTO SELECIONADO ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.";
+
+ private Documento _selectedDocumento;
+
+ private ObservableCollection<VendedorParcela> _pagamentos;
+
+ public Visibility IsVisibleEspecial
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _isVisibleEspecial;
+ }
+ 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)
+ _isVisibleEspecial = value;
+ OnPropertyChanged("IsVisibleEspecial");
+ }
+ }
+
+ public Visibility IsVisibleVendedores
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _isVisibleVendedores;
+ }
+ 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)
+ _isVisibleVendedores = value;
+ OnPropertyChanged("IsVisibleVendedores");
+ }
+ }
+
+ public decimal Prevista
+ {
+ get
+ {
+ return _prevista;
+ }
+ set
+ {
+ _prevista = value;
+ OnPropertyChanged("Prevista");
+ }
+ }
+
+ public decimal Recebida
+ {
+ get
+ {
+ return _recebida;
+ }
+ set
+ {
+ _recebida = value;
+ OnPropertyChanged("Recebida");
+ }
+ }
+
+ public decimal RecebidaEspecial
+ {
+ get
+ {
+ return _recebidaEspecial;
+ }
+ set
+ {
+ _recebidaEspecial = value;
+ OnPropertyChanged("RecebidaEspecial");
+ }
+ }
+
+ public decimal Pendente
+ {
+ get
+ {
+ return _pendente;
+ }
+ set
+ {
+ _pendente = value;
+ OnPropertyChanged("Pendente");
+ }
+ }
+
+ public decimal Repasse
+ {
+ get
+ {
+ return _repasse;
+ }
+ set
+ {
+ _repasse = value;
+ OnPropertyChanged("Repasse");
+ }
+ }
+
+ public decimal RepasseEspecial
+ {
+ get
+ {
+ return _repasseEspecial;
+ }
+ set
+ {
+ _repasseEspecial = value;
+ OnPropertyChanged("RepasseEspecial");
+ }
+ }
+
+ public decimal Paga
+ {
+ get
+ {
+ return _paga;
+ }
+ set
+ {
+ _paga = value;
+ OnPropertyChanged("Paga");
+ }
+ }
+
+ public decimal PagaEspecial
+ {
+ get
+ {
+ return _pagaEspecial;
+ }
+ set
+ {
+ _pagaEspecial = value;
+ OnPropertyChanged("PagaEspecial");
+ }
+ }
+
+ public string ApoliceLabel
+ {
+ get
+ {
+ return _apoliceLabel;
+ }
+ set
+ {
+ _apoliceLabel = value;
+ OnPropertyChanged("ApoliceLabel");
+ }
+ }
+
+ public string ApoliceDescricao
+ {
+ get
+ {
+ return _apoliceDescricao;
+ }
+ set
+ {
+ _apoliceDescricao = value;
+ OnPropertyChanged("ApoliceDescricao");
+ }
+ }
+
+ public Documento SelectedDocumento
+ {
+ get
+ {
+ return _selectedDocumento;
+ }
+ set
+ {
+ _selectedDocumento = value;
+ OnPropertyChanged("SelectedDocumento");
+ }
+ }
+
+ public ObservableCollection<VendedorParcela> Pagamentos
+ {
+ get
+ {
+ return _pagamentos;
+ }
+ set
+ {
+ _pagamentos = value;
+ OnPropertyChanged("Pagamentos");
+ }
+ }
+
+ public ValoresApoliceViewModel(Documento documento)
+ {
+ base.EnableMenu = true;
+ Seleciona(documento);
+ }
+
+ public void Seleciona(Documento documento)
+ {
+ SelectedDocumento = documento;
+ if (SelectedDocumento.Tipo != 1)
+ {
+ ApoliceLabel = ((!SelectedDocumento.Emissao.HasValue) ? ("VALORES DA PROPOSTA " + SelectedDocumento.Proposta) : ("VALORES DA APÓLICE " + SelectedDocumento.Apolice));
+ ApoliceDescricao = ((!SelectedDocumento.Emissao.HasValue) ? ("VALORES BASEADOS NA PROPOSTA " + SelectedDocumento.Proposta + " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.") : ("VALORES BASEADOS NA APÓLICE " + SelectedDocumento.Apolice + " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS."));
+ }
+ CalculaComissao();
+ CalculaEspecial();
+ CalculaRepasse();
+ RegistrarAcao($"CONSULTOU MAIS INFORMAÇÕES DOS VALORES DO DOCUMENTO DE ID {((DomainBase)documento).Id}", ((DomainBase)documento).Id, (TipoTela)21);
+ }
+
+ private void CalculaRepasse()
+ {
+ if (SelectedDocumento.Pagamentos.All((VendedorParcela x) => x.Vendedor.Corretora))
+ {
+ IsVisibleVendedores = (Visibility)2;
+ return;
+ }
+ List<VendedorParcela> list = (from x in SelectedDocumento.Pagamentos
+ where !x.Vendedor.Corretora
+ group x by ((DomainBase)x.Vendedor).Id).Select((Func<IGrouping<long, VendedorParcela>, VendedorParcela>)((IGrouping<long, VendedorParcela> x) => new VendedorParcela
+ {
+ Repasse = x.First().Repasse,
+ Documento = SelectedDocumento,
+ ValorTotal = x.First().ValorTotal,
+ Vendedor = x.First().Vendedor,
+ ValorTotalPago = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo == 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse),
+ ValorRepasseB = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1).Sum((VendedorParcela y) => y.ValorRepasse),
+ ValorRepasse = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse),
+ PorcentagemRepasse = x.First().PorcentagemRepasse / (decimal?)100,
+ TipoVendedor = x.First().TipoVendedor
+ })).ToList();
+ Pagamentos = new ObservableCollection<VendedorParcela>(list);
+ }
+
+ private void CalculaComissao()
+ {
+ //IL_000e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0014: Invalid comparison between Unknown and I4
+ if ((int)SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1)
+ {
+ decimal num = (SelectedDocumento.AdicionalComiss ? (SelectedDocumento.PremioLiquido + SelectedDocumento.PremioAdicional) : SelectedDocumento.PremioLiquido);
+ decimal num2 = SelectedDocumento.Comissao * 0.01m;
+ Prevista = num * num2;
+ }
+ else
+ {
+ Prevista = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorLiquidoFatura * ((x.Comissao < 1m) ? x.Comissao : ((x.Comissao > 100m) ? 1m : (x.Comissao * 0.01m))));
+ }
+ Recebida = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo == 1).Sum((Parcela x) => x.ValorComissao);
+ Pendente = Prevista - Recebida;
+ Repasse = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault());
+ Paga = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo == 1 && x.DataPrePagamento.HasValue).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault());
+ }
+
+ private void CalculaEspecial()
+ {
+ if (SelectedDocumento.Parcelas.All((Parcela x) => (int)x.SubTipo == 1))
+ {
+ IsVisibleEspecial = (Visibility)2;
+ return;
+ }
+ RecebidaEspecial = SelectedDocumento.Parcelas.Where((Parcela x) => (int)x.SubTipo != 1).Sum((Parcela x) => x.ValorComissao);
+ RepasseEspecial = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo != 1).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault());
+ PagaEspecial = SelectedDocumento.Pagamentos.Where((VendedorParcela x) => (int)x.Parcela.SubTipo != 1 && x.DataPrePagamento.HasValue).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault());
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs
new file mode 100644
index 0000000..49cbccc
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/ValoresParcelaViewModel.cs
@@ -0,0 +1,490 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Aggilizador;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class ValoresParcelaViewModel : BaseSegurosViewModel
+{
+ private ParcelaPendente _pendecia;
+
+ private Visibility _isVisiblePendencia = (Visibility)2;
+
+ private Visibility _isVisibleFatura;
+
+ private Visibility _isVisibleVendedores;
+
+ private decimal _prevista;
+
+ private decimal _ir;
+
+ private decimal _iss;
+
+ private string _repassePago;
+
+ private decimal _recebidaLiquida;
+
+ private decimal _recebida;
+
+ private decimal _recebidaEspecial;
+
+ private decimal _pendente;
+
+ private decimal _repasse;
+
+ private decimal _repasseEspecial;
+
+ private decimal _paga;
+
+ private decimal _pagaEspecial;
+
+ private string _apoliceLabel = "DESCRIÇÃO DE VALORES";
+
+ private string _apoliceDescricao = "VALORES BASEADOS NO DOCUMENTO SELECIONADO ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.";
+
+ private Parcela _selectedParcela;
+
+ private string _statusBaixa;
+
+ private string _statusParc;
+
+ private Visibility _isVisiblestatusparc = (Visibility)2;
+
+ private ObservableCollection<VendedorParcela> _pagamentos;
+
+ public ParcelaPendente Pendecia
+ {
+ get
+ {
+ return _pendecia;
+ }
+ set
+ {
+ _pendecia = value;
+ IsVisiblePendencia = (Visibility)((value == null) ? 2 : 0);
+ OnPropertyChanged("Pendecia");
+ }
+ }
+
+ public Visibility IsVisiblePendencia
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _isVisiblePendencia;
+ }
+ 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)
+ _isVisiblePendencia = value;
+ OnPropertyChanged("IsVisiblePendencia");
+ }
+ }
+
+ public Visibility IsVisibleFatura
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _isVisibleFatura;
+ }
+ 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)
+ _isVisibleFatura = value;
+ OnPropertyChanged("IsVisibleFatura");
+ }
+ }
+
+ public Visibility IsVisibleVendedores
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _isVisibleVendedores;
+ }
+ 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)
+ _isVisibleVendedores = value;
+ OnPropertyChanged("IsVisibleVendedores");
+ }
+ }
+
+ public decimal Prevista
+ {
+ get
+ {
+ return _prevista;
+ }
+ set
+ {
+ _prevista = value;
+ OnPropertyChanged("Prevista");
+ }
+ }
+
+ public decimal Ir
+ {
+ get
+ {
+ return _ir;
+ }
+ set
+ {
+ _ir = value;
+ OnPropertyChanged("Ir");
+ }
+ }
+
+ public decimal Iss
+ {
+ get
+ {
+ return _iss;
+ }
+ set
+ {
+ _iss = value;
+ OnPropertyChanged("Iss");
+ }
+ }
+
+ public string RepassePago
+ {
+ get
+ {
+ return _repassePago;
+ }
+ set
+ {
+ _repassePago = value;
+ OnPropertyChanged("RepassePago");
+ }
+ }
+
+ public decimal RecebidaLiquida
+ {
+ get
+ {
+ return _recebidaLiquida;
+ }
+ set
+ {
+ _recebidaLiquida = value;
+ OnPropertyChanged("RecebidaLiquida");
+ }
+ }
+
+ public decimal Recebida
+ {
+ get
+ {
+ return _recebida;
+ }
+ set
+ {
+ _recebida = value;
+ OnPropertyChanged("Recebida");
+ }
+ }
+
+ public decimal RecebidaEspecial
+ {
+ get
+ {
+ return _recebidaEspecial;
+ }
+ set
+ {
+ _recebidaEspecial = value;
+ OnPropertyChanged("RecebidaEspecial");
+ }
+ }
+
+ public decimal Pendente
+ {
+ get
+ {
+ return _pendente;
+ }
+ set
+ {
+ if (value < 0.01m)
+ {
+ _pendente = default(decimal);
+ }
+ else
+ {
+ _pendente = value;
+ }
+ OnPropertyChanged("Pendente");
+ }
+ }
+
+ public decimal Repasse
+ {
+ get
+ {
+ return _repasse;
+ }
+ set
+ {
+ _repasse = value;
+ OnPropertyChanged("Repasse");
+ }
+ }
+
+ public decimal RepasseEspecial
+ {
+ get
+ {
+ return _repasseEspecial;
+ }
+ set
+ {
+ _repasseEspecial = value;
+ OnPropertyChanged("RepasseEspecial");
+ }
+ }
+
+ public decimal Paga
+ {
+ get
+ {
+ return _paga;
+ }
+ set
+ {
+ _paga = value;
+ OnPropertyChanged("Paga");
+ }
+ }
+
+ public decimal PagaEspecial
+ {
+ get
+ {
+ return _pagaEspecial;
+ }
+ set
+ {
+ _pagaEspecial = value;
+ OnPropertyChanged("PagaEspecial");
+ }
+ }
+
+ public string ApoliceLabel
+ {
+ get
+ {
+ return _apoliceLabel;
+ }
+ set
+ {
+ _apoliceLabel = value;
+ OnPropertyChanged("ApoliceLabel");
+ }
+ }
+
+ public string ApoliceDescricao
+ {
+ get
+ {
+ return _apoliceDescricao;
+ }
+ set
+ {
+ _apoliceDescricao = value;
+ OnPropertyChanged("ApoliceDescricao");
+ }
+ }
+
+ public Parcela SelectedParcela
+ {
+ get
+ {
+ return _selectedParcela;
+ }
+ set
+ {
+ _selectedParcela = value;
+ OnPropertyChanged("SelectedParcela");
+ }
+ }
+
+ public string StatusBaixa
+ {
+ get
+ {
+ return _statusBaixa;
+ }
+ set
+ {
+ _statusBaixa = value;
+ OnPropertyChanged("StatusBaixa");
+ }
+ }
+
+ public string StatusParc
+ {
+ get
+ {
+ return _statusParc;
+ }
+ set
+ {
+ _statusParc = value;
+ OnPropertyChanged("StatusParc");
+ }
+ }
+
+ public Visibility IsVisibleStatusParc
+ {
+ get
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ return _isVisiblestatusparc;
+ }
+ 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)
+ _isVisiblestatusparc = value;
+ OnPropertyChanged("IsVisibleStatusParc");
+ }
+ }
+
+ public ObservableCollection<VendedorParcela> Pagamentos
+ {
+ get
+ {
+ return _pagamentos;
+ }
+ set
+ {
+ _pagamentos = value;
+ OnPropertyChanged("Pagamentos");
+ }
+ }
+
+ public ValoresParcelaViewModel(Parcela parcela, Documento documento)
+ {
+ //IL_0002: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001f: Unknown result type (might be due to invalid IL or missing references)
+ Seleciona(parcela, documento);
+ }
+
+ public async void Seleciona(Parcela parcela, Documento documento)
+ {
+ SelectedParcela = parcela;
+ IsVisibleFatura = (Visibility)(((int)SelectedParcela.Documento.TipoRecebimento.GetValueOrDefault() != 2) ? 2 : 0);
+ ApoliceLabel = $"VALORES DA PARCELA {SelectedParcela.NumeroParcela} VENCIMENTO {parcela.Vencimento:d}";
+ ApoliceDescricao = $"VALORES BASEADOS NA PARCELA {SelectedParcela.NumeroParcela} ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.";
+ StatusBaixa = "PENDENTE";
+ RepassePago = "REPASSE A SER PAGO";
+ if (SelectedParcela.DataRecebimento.HasValue)
+ {
+ StatusBaixa = (((int)SelectedParcela.Documento.TipoRecebimento.GetValueOrDefault() == 2) ? "BAIXA MANUAL" : ((SelectedParcela.ValorRealizado == 0m) ? "BAIXA ESGOTAMENTO" : "BAIXA MANUAL"));
+ DetalheExtrato val = await new ServicoExtrato().FindByParcelaId(((DomainBase)SelectedParcela).Id);
+ if (val != null)
+ {
+ StatusParcela? status = val.Status;
+ if (status.HasValue)
+ {
+ StatusParcela valueOrDefault = status.GetValueOrDefault();
+ if ((int)valueOrDefault != 1)
+ {
+ if ((int)valueOrDefault == 5)
+ {
+ goto IL_021c;
+ }
+ switch (valueOrDefault - 10)
+ {
+ case 0:
+ case 3:
+ break;
+ case 2:
+ goto IL_021c;
+ default:
+ goto IL_0232;
+ }
+ }
+ IsVisibleStatusParc = (Visibility)0;
+ StatusParc = ValidationHelper.GetDescription((Enum)(object)val.Status);
+ RepassePago = "REPASSE PAGO";
+ StatusBaixa = ((SelectedParcela.ValorRealizado == 0m) ? "BAIXA AUTOMATICA ESGOTAMENTO" : "BAIXA AUTOMATICA");
+ }
+ }
+ }
+ goto IL_0232;
+ IL_021c:
+ RepassePago = "REPASSE PAGO";
+ StatusBaixa = "BAIXA MANUAL";
+ goto IL_0232;
+ IL_0232:
+ CalculaComissao(documento);
+ CalculaRepasse();
+ if (SelectedParcela.IdParcelaPendente > 0 && SelectedParcela.StatusPagamento != (StatusPagamento?)0)
+ {
+ BuscarPendencia();
+ }
+ }
+
+ private async void BuscarPendencia()
+ {
+ Pendecia = await new BaseServico().BuscarParcelaPendente(SelectedParcela.IdParcelaPendente);
+ }
+
+ private void CalculaRepasse()
+ {
+ if (SelectedParcela.Vendedores.All((VendedorParcela x) => x.Vendedor.Corretora))
+ {
+ IsVisibleVendedores = (Visibility)2;
+ return;
+ }
+ List<VendedorParcela> list = (from x in SelectedParcela.Vendedores
+ where !x.Vendedor.Corretora
+ group x by ((DomainBase)x.Vendedor).Id).Select((Func<IGrouping<long, VendedorParcela>, VendedorParcela>)((IGrouping<long, VendedorParcela> x) => new VendedorParcela
+ {
+ Repasse = x.First().Repasse,
+ Documento = SelectedParcela.Documento,
+ ValorTotal = x.First().ValorTotal,
+ Vendedor = x.First().Vendedor,
+ ValorTotalPago = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo == 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse),
+ ValorRepasseB = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1).Sum((VendedorParcela y) => y.ValorRepasse),
+ ValorRepasse = x.Where((VendedorParcela y) => (int)y.Parcela.SubTipo != 1 && y.DataPrePagamento.HasValue).Sum((VendedorParcela y) => y.ValorRepasse),
+ PorcentagemRepasse = x.First().PorcentagemRepasse / (decimal?)100,
+ TipoVendedor = x.First().TipoVendedor
+ })).ToList();
+ Pagamentos = new ObservableCollection<VendedorParcela>(list);
+ }
+
+ private void CalculaComissao(Documento documento)
+ {
+ //IL_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_000c: Invalid comparison between Unknown and I4
+ decimal num = (((int)SelectedParcela.SubTipo != 1) ? SelectedParcela.Valor : ((documento.NumeroParcelas == 0m) ? 0m : (documento.AdicionalComiss ? ((documento.PremioLiquido + documento.PremioAdicional) / documento.NumeroParcelas) : (documento.PremioLiquido / documento.NumeroParcelas))));
+ Prevista = ((SelectedParcela.ValorLiquidoFatura != 0m) ? (SelectedParcela.ValorLiquidoFatura * SelectedParcela.Comissao * 0.01m) : (num * SelectedParcela.Comissao * 0.01m));
+ Recebida = SelectedParcela.ValorComissao;
+ Pendente = Prevista - Recebida;
+ Repasse = SelectedParcela.Vendedores.Where((VendedorParcela x) => ((int)SelectedParcela.SubTipo != 1) ? ((int)x.Parcela.SubTipo != 1) : ((int)x.Parcela.SubTipo == 1)).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault());
+ Paga = SelectedParcela.Vendedores.Where((VendedorParcela x) => ((int)SelectedParcela.SubTipo != 1) ? ((int)x.Parcela.SubTipo != 1 && x.DataPrePagamento.HasValue) : ((int)x.Parcela.SubTipo == 1)).Sum((VendedorParcela x) => x.ValorRepasse.GetValueOrDefault());
+ Ir = SelectedParcela.Irr;
+ Iss = SelectedParcela.Iss;
+ RecebidaLiquida = SelectedParcela.ValorComDesconto;
+ }
+}
diff --git a/Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs
new file mode 100644
index 0000000..849ec7f
--- /dev/null
+++ b/Decompiler/Gestor.Application.ViewModels.Drawer/VinculoVendedorViewModel.cs
@@ -0,0 +1,258 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading.Tasks;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos;
+using Gestor.Application.Servicos.Ferramentas;
+using Gestor.Application.ViewModels.Generic;
+using Gestor.Common.Validation;
+using Gestor.Infrastructure.UnitOfWork.Generic;
+using Gestor.Infrastructure.UnitOfWork.Logic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using Newtonsoft.Json;
+
+namespace Gestor.Application.ViewModels.Drawer;
+
+public class VinculoVendedorViewModel : BaseSegurosViewModel
+{
+ private readonly VendedorUsuarioServico _servicoVendedorUsuario;
+
+ private readonly VendedorServico _servicoVendedor;
+
+ public readonly Usuario SelectedUsuario;
+
+ private bool _isVisibleVinculado;
+
+ private bool _enableAlterarVinculo;
+
+ private bool _isVisibleVendedor = true;
+
+ private List<VinculoVendedor> _vinculado;
+
+ private List<VinculoVendedor> _vinculadoFiltro;
+
+ private List<VinculoVendedor> _vendedor;
+
+ private List<VinculoVendedor> _vendedorFiltro;
+
+ public bool IsVisibleVinculado
+ {
+ get
+ {
+ return _isVisibleVinculado;
+ }
+ set
+ {
+ _isVisibleVinculado = value;
+ OnPropertyChanged("IsVisibleVinculado");
+ }
+ }
+
+ public bool EnableAlterarVinculo
+ {
+ get
+ {
+ return _enableAlterarVinculo;
+ }
+ set
+ {
+ _enableAlterarVinculo = value;
+ OnPropertyChanged("EnableAlterarVinculo");
+ }
+ }
+
+ public bool IsVisibleVendedor
+ {
+ get
+ {
+ return _isVisibleVendedor;
+ }
+ set
+ {
+ _isVisibleVendedor = value;
+ OnPropertyChanged("IsVisibleVendedor");
+ }
+ }
+
+ public List<VinculoVendedor> Vinculado
+ {
+ get
+ {
+ return _vinculado;
+ }
+ set
+ {
+ _vinculado = value;
+ IsVisibleVinculado = value != null && value.Count > 0;
+ OnPropertyChanged("Vinculado");
+ }
+ }
+
+ public List<VinculoVendedor> VinculadoFiltro
+ {
+ get
+ {
+ return _vinculadoFiltro;
+ }
+ set
+ {
+ _vinculadoFiltro = value;
+ OnPropertyChanged("VinculadoFiltro");
+ }
+ }
+
+ public List<VinculoVendedor> Vendedor
+ {
+ get
+ {
+ return _vendedor;
+ }
+ set
+ {
+ _vendedor = value;
+ IsVisibleVendedor = value != null && value.Count > 0;
+ OnPropertyChanged("Vendedor");
+ }
+ }
+
+ public List<VinculoVendedor> VendedorFiltro
+ {
+ get
+ {
+ return _vendedorFiltro;
+ }
+ set
+ {
+ _vendedorFiltro = value;
+ OnPropertyChanged("VendedorFiltro");
+ }
+ }
+
+ public VinculoVendedorViewModel(Usuario usuario)
+ {
+ SelectedUsuario = usuario;
+ _servicoVendedorUsuario = new VendedorUsuarioServico();
+ _servicoVendedor = new VendedorServico();
+ Load(usuario);
+ EnableAlterarVinculo = ((DomainBase)Recursos.Usuario).Id > 0;
+ base.EnableMenu = true;
+ }
+
+ private async void Load(Usuario usuario)
+ {
+ await AwaitLoad(usuario);
+ }
+
+ private async Task AwaitLoad(Usuario usuario)
+ {
+ Vinculado = await GetVinculo(usuario);
+ Vendedor = await GetVendedor(usuario);
+ VinculadoFiltro = Vinculado;
+ VendedorFiltro = Vendedor;
+ }
+
+ private async Task<List<VinculoVendedor>> GetVinculo(Usuario usuario)
+ {
+ List<VinculoVendedor> vinculado = new List<VinculoVendedor>();
+ (await _servicoVendedorUsuario.FindByVinculo(usuario)).ForEach(delegate(VendedorUsuario x)
+ {
+ //IL_0000: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0005: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0011: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0025: Expected O, but got Unknown
+ VinculoVendedor item = new VinculoVendedor
+ {
+ Id = ((DomainBase)x).Id,
+ Vendedor = x.Vendedor,
+ Vinculado = true
+ };
+ vinculado.Add(item);
+ });
+ return vinculado;
+ }
+
+ private async Task<List<VinculoVendedor>> GetVendedor(Usuario usuario)
+ {
+ List<Vendedor> list = (await _servicoVendedor.BuscarVendedoresAtivosAsync())?.Where((Vendedor x) => x.IdEmpresa == usuario.IdEmpresa).ToList();
+ return (list == null || list.Count == 0) ? null : list.Where((Vendedor vendedor) => Vinculado.All((VinculoVendedor x) => ((DomainBase)x.Vendedor).Id != ((DomainBase)vendedor).Id)).Select((Func<Vendedor, VinculoVendedor>)((Vendedor vendedor) => new VinculoVendedor
+ {
+ Id = 0L,
+ Vendedor = vendedor,
+ Vinculado = false
+ })).ToList();
+ }
+
+ internal async Task BuscarVinculoVendedor(string value)
+ {
+ await Task.Run(delegate
+ {
+ FiltrarVinculoVendedor(value);
+ });
+ }
+
+ internal void FiltrarVinculoVendedor(string filter)
+ {
+ Vinculado = (string.IsNullOrEmpty(filter) ? VinculadoFiltro : new List<VinculoVendedor>(VinculadoFiltro.Where((VinculoVendedor x) => ValidationHelper.RemoveDiacritics(x.Vendedor.Nome.ToUpper().Trim()).Contains(filter.ToUpper()))));
+ Vendedor = (string.IsNullOrEmpty(filter) ? VendedorFiltro : new List<VinculoVendedor>(VendedorFiltro.Where((VinculoVendedor x) => ValidationHelper.RemoveDiacritics(x.Vendedor.Nome.ToUpper().Trim()).Contains(filter.ToUpper()))));
+ }
+
+ public async Task Salvar()
+ {
+ List<VendedorUsuario> list = Vinculado.Where((VinculoVendedor x) => !x.Vinculado).Select((Func<VinculoVendedor, VendedorUsuario>)((VinculoVendedor x) => new VendedorUsuario
+ {
+ Id = ((DomainBase)x).Id,
+ Vendedor = x.Vendedor,
+ Usuario = SelectedUsuario
+ })).ToList();
+ if (list.Count > 0 && !(await _servicoVendedorUsuario.Delete(list)))
+ {
+ return;
+ }
+ List<VendedorUsuario> list2 = Vendedor.Where((VinculoVendedor x) => x.Vinculado).Select((Func<VinculoVendedor, VendedorUsuario>)((VinculoVendedor x) => new VendedorUsuario
+ {
+ Id = ((DomainBase)x).Id,
+ Vendedor = x.Vendedor,
+ Usuario = SelectedUsuario
+ })).ToList();
+ if (list2.Count > 0)
+ {
+ await _servicoVendedorUsuario.SaveOrUpdate(list2);
+ }
+ await AwaitLoad(SelectedUsuario);
+ UnitOfWork commited = Instancia.Commited;
+ try
+ {
+ IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+ RegistroLog keyValues = new RegistroLog
+ {
+ Acao = (TipoAcao)0,
+ Usuario = Recursos.Usuario,
+ DataHora = Funcoes.GetNetworkTime(),
+ Descricao = JsonConvert.SerializeObject((object)Vinculado.Select((VinculoVendedor x) => x.Vendedor).ToList(), new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = (ReferenceLoopHandling)1
+ }),
+ EntidadeId = ((DomainBase)SelectedUsuario).Id,
+ Tela = (TipoTela)45,
+ Versao = LoginViewModel.VersaoAtual,
+ NomeMaquina = Environment.MachineName,
+ UsuarioMaquina = Environment.UserName,
+ Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString()
+ };
+ _servicoVendedorUsuario.SaveLog(keyValues, commited);
+ ((GenericUnitOfWork)commited).Commit();
+ }
+ finally
+ {
+ ((IDisposable)commited)?.Dispose();
+ }
+ RegistrarAcao("ALTEROU VÍNCULOS DE VENDEDOR DO USUÁRIO \"" + SelectedUsuario.Nome + "\"", ((DomainBase)SelectedUsuario).Id, (TipoTela)45, $"ID: {((DomainBase)SelectedUsuario).Id}\n\nACESSE O LOG DE ALTERAÇÕES NA TELA DE VÍNCULO DE VENDEDOR PARA VER EXATAMENTE O QUE FOI ALTERADO.");
+ }
+}