From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../ViewModels/Drawer/AdiantamentoViewModel.cs | 310 -- .../ViewModels/Drawer/AgendaViewModel.cs | 427 -- .../Drawer/Ajuda/AtendimentosViewModel.cs | 514 -- .../Drawer/Ajuda/BoletosNotasViewModel.cs | 122 - .../ViewModels/Drawer/Ajuda/ContratosViewModel.cs | 112 - .../ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs | 281 - .../ViewModels/Drawer/ArquivoDigitalViewModel.cs | 1414 ----- .../ViewModels/Drawer/ExpedicaoViewModel.cs | 196 - .../ViewModels/Drawer/ExtratosViewModel.cs | 5516 -------------------- .../ViewModels/Drawer/ImpostoViewModel.cs | 484 -- .../ViewModels/Drawer/InfoViewModel.cs | 208 - .../ViewModels/Drawer/LogAcaoViewModel.cs | 262 - .../ViewModels/Drawer/LogEmailViewModel.cs | 163 - .../ViewModels/Drawer/LogSistemaAntigoViewModel.cs | 42 - .../ViewModels/Drawer/LogViewModel.cs | 1784 ------- .../ViewModels/Drawer/MetaSeguradoraViewModel.cs | 258 - .../ViewModels/Drawer/MetaVendedorViewModel.cs | 244 - .../ViewModels/Drawer/PermissaoUsuarioViewModel.cs | 1939 ------- .../ViewModels/Drawer/TarefaDrawerViewModel.cs | 1283 ----- .../ViewModels/Drawer/ValoresApoliceViewModel.cs | 345 -- .../ViewModels/Drawer/ValoresParcelaViewModel.cs | 583 --- .../ViewModels/Drawer/VinculoVendedorViewModel.cs | 307 -- 22 files changed, 16794 deletions(-) delete mode 100644 Gestor.Application/ViewModels/Drawer/AdiantamentoViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/AgendaViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/ExtratosViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/ImpostoViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/InfoViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/LogEmailViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/LogSistemaAntigoViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/LogViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/MetaSeguradoraViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/MetaVendedorViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/PermissaoUsuarioViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/TarefaDrawerViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/ValoresParcelaViewModel.cs delete mode 100644 Gestor.Application/ViewModels/Drawer/VinculoVendedorViewModel.cs (limited to 'Gestor.Application/ViewModels/Drawer') diff --git a/Gestor.Application/ViewModels/Drawer/AdiantamentoViewModel.cs b/Gestor.Application/ViewModels/Drawer/AdiantamentoViewModel.cs deleted file mode 100644 index 72b47ae..0000000 --- a/Gestor.Application/ViewModels/Drawer/AdiantamentoViewModel.cs +++ /dev/null @@ -1,310 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class AdiantamentoViewModel : BaseSegurosViewModel - { - private readonly AdiantamentoServico _servico; - - private readonly Vendedor _selectedVendedor; - - private bool _carregando; - - private ObservableCollection _adiantamento = new ObservableCollection(); - - private Gestor.Model.Domain.Seguros.Adiantamento _selectedAdiantamento = new Gestor.Model.Domain.Seguros.Adiantamento(); - - private bool _logEnabled; - - public Gestor.Model.Domain.Seguros.Adiantamento CancelAdiantamento; - - public ObservableCollection Adiantamento - { - get - { - return this._adiantamento; - } - set - { - this._adiantamento = value; - base.OnPropertyChanged("Adiantamento"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public bool LogEnabled - { - get - { - return this._logEnabled; - } - set - { - this._logEnabled = value; - base.OnPropertyChanged("LogEnabled"); - } - } - - public Gestor.Model.Domain.Seguros.Adiantamento SelectedAdiantamento - { - get - { - return this._selectedAdiantamento; - } - set - { - long? nullable; - this._selectedAdiantamento = value; - this.CancelAdiantamento = (value == null || value.get_Id() <= (long)0 ? this.CancelAdiantamento : value); - if (value != null) - { - nullable = new long?(value.get_Id()); - } - else - { - nullable = null; - } - base.VerificarEnables(nullable); - base.OnPropertyChanged("SelectedAdiantamento"); - } - } - - public AdiantamentoViewModel(Vendedor vendedor) - { - this._servico = new AdiantamentoServico(); - this.Seleciona(vendedor); - this._selectedVendedor = vendedor; - } - - public void CancelarAlteracao() - { - this.Carregando = true; - if (this.CancelAdiantamento != null && this.Adiantamento.Any((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == this.CancelAdiantamento.get_Id())) - { - DomainBase.Copy(this.Adiantamento.First((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == this.CancelAdiantamento.get_Id()), this.CancelAdiantamento); - this.SelectedAdiantamento = this.Adiantamento.First((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == this.CancelAdiantamento.get_Id()); - } - base.Alterar(false); - this.Carregando = false; - } - - public async Task CarregarAdiantamento(int index) - { - this.Carregando = true; - this.Adiantamento = new ObservableCollection(await this._servico.BuscarAdiantamentos(this._selectedVendedor.get_Id(), index != 0)); - if (this.Adiantamento == null || this.Adiantamento.Count <= 0) - { - this.LogEnabled = false; - } - else - { - this.SelectedAdiantamento = this.Adiantamento.First(); - this.LogEnabled = true; - } - this.Carregando = false; - } - - public async Task Excluir() - { - bool flag; - object obj; - object obj1; - Gestor.Model.Domain.Seguros.Adiantamento adiantamento; - Gestor.Model.Domain.Seguros.Adiantamento adiantamento1; - if (this.SelectedAdiantamento == null || this.SelectedAdiantamento.get_Id() == 0) - { - flag = false; - } - else if (await base.ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO", false)) - { - this.Carregando = true; - if (await this._servico.Delete(this.SelectedAdiantamento)) - { - AdiantamentoViewModel adiantamentoViewModel = this; - string str = string.Concat("EXCLUIU O ADIANTAMENTO DO VENDEDOR \"", this.SelectedAdiantamento.get_Vendedor().get_Nome(), "\""); - long id = this.SelectedAdiantamento.get_Id(); - TipoTela? nullable = new TipoTela?(36); - object[] valor = new object[] { this.SelectedAdiantamento.get_Id(), null, null, null, null }; - obj = (!this.SelectedAdiantamento.get_Data().HasValue ? "-" : string.Format("{0:d}", this.SelectedAdiantamento.get_Data())); - valor[1] = obj; - valor[2] = this.SelectedAdiantamento.get_Valor(); - valor[3] = Functions.GetDescription(this.SelectedAdiantamento.get_TipoPagamento()); - obj1 = (this.SelectedAdiantamento.get_Pago() ? "SIM" : "NÃO"); - valor[4] = obj1; - adiantamentoViewModel.RegistrarAcao(str, id, nullable, string.Format("ID: {0}\nDATA: {1}\nVALOR: {2:c}\nTIPO PAGAMENTO: {3}\nPAGO: {4}", valor)); - int num = this.Adiantamento.IndexOf(this.SelectedAdiantamento); - this.Adiantamento.Remove(this.SelectedAdiantamento); - this.Adiantamento.Remove(this.SelectedAdiantamento); - this.Adiantamento = new ObservableCollection(this.Adiantamento); - if (this.Adiantamento.Count <= 0) - { - this.SelectedAdiantamento = new Gestor.Model.Domain.Seguros.Adiantamento(); - base.Alterar(false); - base.EnableMenu = false; - this.LogEnabled = false; - } - else - { - AdiantamentoViewModel adiantamentoViewModel1 = this; - adiantamento1 = (num < this.Adiantamento.Count ? this.Adiantamento.ElementAt(num) : this.Adiantamento.Last()); - adiantamentoViewModel1.SelectedAdiantamento = adiantamento1; - this.LogEnabled = true; - } - if (this.Adiantamento.Count <= 0) - { - this.SelectedAdiantamento = new Gestor.Model.Domain.Seguros.Adiantamento(); - this.LogEnabled = false; - base.Alterar(false); - } - else - { - AdiantamentoViewModel adiantamentoViewModel2 = this; - adiantamento = (num < this.Adiantamento.Count ? this.Adiantamento.ElementAt(num) : this.Adiantamento.Last()); - adiantamentoViewModel2.SelecionaAdiantamento(adiantamento); - this.LogEnabled = true; - } - this.Carregando = false; - flag = true; - } - else - { - flag = false; - } - } - else - { - flag = false; - } - return flag; - } - - public void Incluir() - { - this.SelectedAdiantamento = new Gestor.Model.Domain.Seguros.Adiantamento(); - base.Alterar(true); - } - - public async Task>> Salvar() - { - List> keyValuePairs; - string str; - object obj; - object obj1; - string str1; - if (!string.IsNullOrWhiteSpace(this.SelectedAdiantamento.get_Historico())) - { - this.SelectedAdiantamento.set_Vendedor(this._selectedVendedor); - str = (this.SelectedAdiantamento.get_Id() == 0 ? "INCLUIU" : "ALTEROU"); - str1 = str; - Gestor.Model.Domain.Seguros.Adiantamento adiantamento = await this._servico.Save(this.SelectedAdiantamento); - if (this._servico.Sucesso) - { - AdiantamentoViewModel adiantamentoViewModel = this; - string str2 = string.Concat(str1, " ADIANTAMENTO DO VENDEDOR \"", adiantamento.get_Vendedor().get_Nome(), "\""); - long id = adiantamento.get_Id(); - TipoTela? nullable = new TipoTela?(36); - object[] valor = new object[] { adiantamento.get_Id(), null, null, null, null }; - obj = (!adiantamento.get_Data().HasValue ? "-" : string.Format("{0:d}", adiantamento.get_Data())); - valor[1] = obj; - valor[2] = adiantamento.get_Valor(); - valor[3] = Functions.GetDescription(adiantamento.get_TipoPagamento()); - obj1 = (adiantamento.get_Pago() ? "SIM" : "NÃO"); - valor[4] = obj1; - adiantamentoViewModel.RegistrarAcao(str2, id, nullable, string.Format("ID: {0}\nDATA: {1}\nVALOR: {2:c}\nTIPO PAGAMENTO: {3}\nPAGO: {4}", valor)); - if (!this.Adiantamento.Any((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == adiantamento.get_Id())) - { - this.Adiantamento.Add(adiantamento); - } - else - { - DomainBase.Copy(this.Adiantamento.First((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == adiantamento.get_Id()), adiantamento); - } - this.Adiantamento = new ObservableCollection(this.Adiantamento); - this.SelectedAdiantamento = this.Adiantamento.First((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == adiantamento.get_Id()); - this.LogEnabled = true; - base.Alterar(false); - keyValuePairs = null; - } - else - { - keyValuePairs = null; - } - } - else - { - keyValuePairs = new List>() - { - new KeyValuePair("Historico|HISTÓRICO", "OBRIGATÓRIO") - }; - } - str1 = null; - return keyValuePairs; - } - - private async void Seleciona(Vendedor vendedor) - { - base.Loading(true); - await base.PermissaoTela(15); - await this.SelecionaAdiantamento(vendedor); - base.Loading(false); - } - - public void SelecionaAdiantamento(Gestor.Model.Domain.Seguros.Adiantamento adiantamento) - { - this.SelectedAdiantamento = adiantamento; - } - - private async Task SelecionaAdiantamento(Vendedor vendedor) - { - this.Carregando = true; - List adiantamentos = await (new BaseServico()).BuscarAdiantamentoAsync(vendedor); - IOrderedEnumerable pago = - from x in adiantamentos - orderby x.get_Pago() - select x; - List list = pago.ThenBy((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Valor()).ToList(); - this.Adiantamento = new ObservableCollection(list); - if (this.Adiantamento.Count <= 0) - { - this.SelectedAdiantamento = new Gestor.Model.Domain.Seguros.Adiantamento(); - this.LogEnabled = false; - base.Alterar(false); - base.VerificarEnables(new long?(this.SelectedAdiantamento.get_Id())); - base.EnableMenu = false; - } - else - { - this.SelecionaAdiantamento(this.Adiantamento.First()); - this.LogEnabled = true; - } - this.Carregando = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/AgendaViewModel.cs b/Gestor.Application/ViewModels/Drawer/AgendaViewModel.cs deleted file mode 100644 index 4701416..0000000 --- a/Gestor.Application/ViewModels/Drawer/AgendaViewModel.cs +++ /dev/null @@ -1,427 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class AgendaViewModel : BaseSegurosViewModel - { - private readonly AgendaServico _servico; - - private Agenda _selectedAgenda; - - private ObservableCollection _telefones = new ObservableCollection(); - - private ObservableCollection _emails = new ObservableCollection(); - - private long _ultimoId; - - public Agenda CancelAgenda; - - private ObservableCollection _agendasFiltradas = new ObservableCollection(); - - private bool _carregando; - - public List Agendas - { - get; - set; - } - - public ObservableCollection AgendasFiltradas - { - get - { - return this._agendasFiltradas; - } - set - { - this._agendasFiltradas = value; - base.OnPropertyChanged("AgendasFiltradas"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public ObservableCollection Emails - { - get - { - return this._emails; - } - set - { - this._emails = value; - base.OnPropertyChanged("Emails"); - } - } - - public Agenda SelectedAgenda - { - get - { - return this._selectedAgenda; - } - set - { - long? nullable; - this._selectedAgenda = value; - if (value != null) - { - nullable = new long?(value.get_Id()); - } - else - { - nullable = null; - } - base.VerificarEnables(nullable); - base.OnPropertyChanged("SelectedAgenda"); - } - } - - public ObservableCollection Telefones - { - get - { - return this._telefones; - } - set - { - this._telefones = value; - base.OnPropertyChanged("Telefones"); - } - } - - public AgendaViewModel() - { - this._servico = new AgendaServico(); - this.Seleciona(); - } - - public void CancelarAlteracao() - { - this.Carregando = true; - if (this.SelectedAgenda.get_Id() != 0) - { - DomainBase.Copy(this.Agendas.First((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id()), this.CancelAgenda); - if (this.AgendasFiltradas.Count <= 0 || !this.AgendasFiltradas.Any((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id())) - { - this.AgendasFiltradas.Add(this.CancelAgenda); - } - else - { - DomainBase.Copy(this.AgendasFiltradas.First((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id()), this.CancelAgenda); - } - this.AgendasFiltradas = new ObservableCollection(this.AgendasFiltradas); - this.SelectedAgenda = this.AgendasFiltradas.First((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id()); - } - else if (this.AgendasFiltradas.Count <= 0 || !this.AgendasFiltradas.Any((Agenda x) => x.get_Id() == this._ultimoId)) - { - if (this.Agendas.Count <= 0 || !this.Agendas.Any((Agenda x) => x.get_Id() == this._ultimoId)) - { - this.SelectedAgenda = new Agenda(); - ObservableCollection observableCollection = new ObservableCollection(); - AgendaTelefone agendaTelefone = new AgendaTelefone(); - agendaTelefone.set_Agenda(this.SelectedAgenda); - agendaTelefone.set_Tipo(new TipoTelefone?(1)); - observableCollection.Add(agendaTelefone); - this.Telefones = observableCollection; - ObservableCollection observableCollection1 = new ObservableCollection(); - AgendaEmail agendaEmail = new AgendaEmail(); - agendaEmail.set_Agenda(this.SelectedAgenda); - observableCollection1.Add(agendaEmail); - this.Emails = observableCollection1; - base.Alterar(false); - this.Carregando = false; - return; - } - this.AgendasFiltradas.Add(this.Agendas.First((Agenda x) => x.get_Id() == this._ultimoId)); - this.SelectedAgenda = this.AgendasFiltradas.First((Agenda x) => x.get_Id() == this._ultimoId); - } - else - { - this.SelectedAgenda = this.AgendasFiltradas.First((Agenda x) => x.get_Id() == this._ultimoId); - } - base.Alterar(false); - this.Carregando = false; - } - - public async Task Excluir() - { - bool flag; - if (this.SelectedAgenda == null || this.SelectedAgenda.get_Id() == 0) - { - flag = false; - } - else if (await base.ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO", false)) - { - this.Carregando = true; - if (await this._servico.Delete(this.SelectedAgenda)) - { - int num = this.AgendasFiltradas.IndexOf(this.SelectedAgenda); - this.Agendas.Remove(this.SelectedAgenda); - this.AgendasFiltradas.Remove(this.SelectedAgenda); - this.AgendasFiltradas = new ObservableCollection(this.AgendasFiltradas); - if (this.AgendasFiltradas.Count <= 0) - { - this.SelectedAgenda = new Agenda(); - this.Telefones = new ObservableCollection(); - this.Emails = new ObservableCollection(); - base.Alterar(false); - } - else if (num >= this.AgendasFiltradas.Count) - { - await this.SelecionaAgenda(this.AgendasFiltradas.Last()); - } - else - { - await this.SelecionaAgenda(this.AgendasFiltradas.ElementAt(num)); - } - this.Carregando = false; - flag = true; - } - else - { - base.Alterar(false); - this.Carregando = false; - flag = false; - } - } - else - { - flag = false; - } - return flag; - } - - public void ExcluirEmail(AgendaEmail email) - { - this.Emails.Remove(email); - } - - public void ExcluirTelefone(AgendaTelefone telefone) - { - this.Telefones.Remove(telefone); - } - - internal async Task> Filtrar(string value) - { - List agendas = await Task.Run>(() => this.FiltrarAgenda(value)); - return agendas; - } - - public List FiltrarAgenda(string filter) - { - this.AgendasFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(this.Agendas) : new ObservableCollection( - from x in this.Agendas - where ValidationHelper.RemoveDiacritics(x.get_Nome().Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) - orderby x.get_Nome() - select x)); - return this.AgendasFiltradas.ToList(); - } - - public void Incluir() - { - if (this.SelectedAgenda != null) - { - this._ultimoId = this.SelectedAgenda.get_Id(); - } - this.SelectedAgenda = new Agenda(); - ObservableCollection observableCollection = new ObservableCollection(); - AgendaTelefone agendaTelefone = new AgendaTelefone(); - agendaTelefone.set_Agenda(this.SelectedAgenda); - agendaTelefone.set_Tipo(new TipoTelefone?(1)); - observableCollection.Add(agendaTelefone); - this.Telefones = observableCollection; - ObservableCollection observableCollection1 = new ObservableCollection(); - AgendaEmail agendaEmail = new AgendaEmail(); - agendaEmail.set_Agenda(this.SelectedAgenda); - observableCollection1.Add(agendaEmail); - this.Emails = observableCollection1; - base.Alterar(true); - } - - public void IncluirEmail() - { - if (this.SelectedAgenda == null) - { - return; - } - if (this.Emails == null) - { - this.Emails = new ObservableCollection(); - } - AgendaEmail agendaEmail = new AgendaEmail(); - agendaEmail.set_Agenda(this.SelectedAgenda); - this.Emails.Add(agendaEmail); - base.OnPropertyChanged("IncluirEmail"); - } - - public void IncluirTelefone() - { - if (this.SelectedAgenda == null) - { - return; - } - if (this.Telefones == null) - { - this.Telefones = new ObservableCollection(); - } - AgendaTelefone agendaTelefone = new AgendaTelefone(); - agendaTelefone.set_Agenda(this.SelectedAgenda); - agendaTelefone.set_Tipo(new TipoTelefone?(1)); - this.Telefones.Add(agendaTelefone); - base.OnPropertyChanged("IncluirTelefone"); - } - - public async Task>> Salvar() - { - List> keyValuePairs; - int num; - List> keyValuePairs1 = this.SelectedAgenda.Validate(); - ObservableCollection telefones = this.Telefones; - List list = ( - from x in telefones - where !string.IsNullOrEmpty(x.get_Numero()) - select x).ToList(); - ObservableCollection emails = this.Emails; - List agendaEmails = ( - from x in emails - where !string.IsNullOrEmpty(x.get_Email()) - select x).ToList(); - foreach (AgendaTelefone agendaTelefone in list) - { - keyValuePairs1.AddRange(agendaTelefone.Validate()); - } - foreach (AgendaEmail agendaEmail in agendaEmails) - { - keyValuePairs1.AddRange(agendaEmail.Validate()); - } - if (keyValuePairs1.Count <= 0) - { - this.SelectedAgenda.set_Telefones(new ObservableCollection(list)); - this.SelectedAgenda.set_Emails(new ObservableCollection(agendaEmails)); - if (this.SelectedAgenda.get_Id() != 0) - { - this.SelectedAgenda = await this._servico.Save(this.SelectedAgenda); - if (this._servico.Sucesso) - { - this.Telefones = new ObservableCollection(this.SelectedAgenda.get_Telefones()); - this.Emails = new ObservableCollection(this.SelectedAgenda.get_Emails()); - DomainBase.Copy(this.Agendas.First((Agenda x) => x.get_Id() == this.SelectedAgenda.get_Id()), this.SelectedAgenda); - if (this.AgendasFiltradas.Count <= 0 || !this.AgendasFiltradas.Any((Agenda x) => x.get_Id() == this.SelectedAgenda.get_Id())) - { - this.AgendasFiltradas.Add(this.SelectedAgenda); - } - else - { - DomainBase.Copy(this.AgendasFiltradas.First((Agenda x) => x.get_Id() == this.SelectedAgenda.get_Id()), this.SelectedAgenda); - } - } - else - { - keyValuePairs = null; - return keyValuePairs; - } - } - else - { - this.SelectedAgenda = await this._servico.Save(this.SelectedAgenda); - if (this._servico.Sucesso) - { - this.Telefones = new ObservableCollection(this.SelectedAgenda.get_Telefones()); - this.Emails = new ObservableCollection(this.SelectedAgenda.get_Emails()); - this.Agendas.Add(this.SelectedAgenda); - ObservableCollection agendasFiltradas = this.AgendasFiltradas; - num = (this._ultimoId == 0 ? 0 : this.AgendasFiltradas.IndexOf(this.AgendasFiltradas.First((Agenda x) => x.get_Id() == this._ultimoId))); - agendasFiltradas.Insert(num, this.SelectedAgenda); - } - else - { - keyValuePairs = null; - return keyValuePairs; - } - } - this.AgendasFiltradas = new ObservableCollection(this.AgendasFiltradas); - this.SelectedAgenda = this.AgendasFiltradas.First((Agenda x) => x.get_Id() == this.SelectedAgenda.get_Id()); - base.Alterar(false); - keyValuePairs = null; - } - else - { - keyValuePairs = keyValuePairs1; - } - return keyValuePairs; - } - - private async void Seleciona() - { - base.Loading(true); - await base.PermissaoTela(34); - await this.SelecionaAgendas(); - base.Loading(false); - } - - public async Task SelecionaAgenda(Agenda agenda = null) - { - Agenda agenda1; - this.Carregando = true; - AgendaViewModel agendaViewModel = this; - agenda1 = (agenda == null ? this.AgendasFiltradas.FirstOrDefault() : this.AgendasFiltradas.FirstOrDefault((Agenda x) => x.get_Id() == agenda.get_Id())); - agendaViewModel.SelectedAgenda = agenda1; - if (this.SelectedAgenda == null) - { - this.Emails = null; - this.Telefones = null; - } - else - { - this.Emails = await this._servico.BuscarEmailsAsync(this.SelectedAgenda.get_Id()); - this.Telefones = await this._servico.BuscarTelefonesAsync(this.SelectedAgenda.get_Id()); - } - this.Carregando = false; - } - - private async Task SelecionaAgendas() - { - Agenda agenda; - this.Carregando = true; - List agendas = await (new BaseServico()).BuscarAgendasAsync(); - AgendaViewModel list = this; - List agendas1 = agendas; - list.Agendas = ( - from x in agendas1 - orderby x.get_Nome() - select x).ToList(); - this.AgendasFiltradas = new ObservableCollection(this.Agendas); - AgendaViewModel agendaViewModel = this; - agenda = (this.AgendasFiltradas.Count > 0 ? this.AgendasFiltradas.First() : new Agenda()); - agendaViewModel.SelectedAgenda = agenda; - this.Carregando = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs deleted file mode 100644 index 6adad6a..0000000 --- a/Gestor.Application/ViewModels/Drawer/Ajuda/AtendimentosViewModel.cs +++ /dev/null @@ -1,514 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.Model.Ajuda; -using Gestor.Application.Servicos.Ajuda; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.API; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using Gestor.Model.Helper; -using Gestor.Model.Resources; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; - -namespace Gestor.Application.ViewModels.Drawer.Ajuda -{ - public class AtendimentosViewModel : BaseViewModel - { - private readonly AjudaServico _ajudaServico; - - private List _status; - - private string _webbody; - - private Visibility _envioEmailVisibility = Visibility.Collapsed; - - private Visibility _atendimentoVisibility; - - private ObservableCollection _atendimentos; - - private Atendimento _selectedAtendimento; - - private string _nome; - - private string _ddd; - - private string _telefone; - - private string _email; - - private string _assunto; - - private string _idacesso; - - private string _corpo; - - private string _senhaacesso; - - private ObservableCollection _arquivosAnexados = new ObservableCollection(); - - private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital(); - - private string _head; - - public ObservableCollection ArquivosAnexados - { - get - { - return this._arquivosAnexados; - } - set - { - this._arquivosAnexados = value; - base.OnPropertyChanged("ArquivosAnexados"); - } - } - - public string Assunto - { - get - { - return this._assunto; - } - set - { - this._assunto = value; - base.OnPropertyChanged("Assunto"); - } - } - - public ObservableCollection Atendimentos - { - get - { - return this._atendimentos; - } - set - { - this._atendimentos = value; - base.OnPropertyChanged("Atendimentos"); - } - } - - public Visibility AtendimentoVisibility - { - get - { - return this._atendimentoVisibility; - } - set - { - this._atendimentoVisibility = value; - base.OnPropertyChanged("AtendimentoVisibility"); - } - } - - public string Corpo - { - get - { - return this._corpo; - } - set - { - this._corpo = value; - base.OnPropertyChanged("Corpo"); - } - } - - public string Ddd - { - get - { - return this._ddd; - } - set - { - this._ddd = value; - base.OnPropertyChanged("Ddd"); - } - } - - public string Email - { - get - { - return this._email; - } - set - { - this._email = value; - base.OnPropertyChanged("Email"); - } - } - - public Visibility EnvioEmailVisibility - { - get - { - return this._envioEmailVisibility; - } - set - { - this._envioEmailVisibility = value; - base.OnPropertyChanged("EnvioEmailVisibility"); - } - } - - public string Head - { - get - { - return this._head; - } - set - { - this._head = value; - base.OnPropertyChanged("Head"); - } - } - - public Gestor.Model.API.HorarioAtendimento HorarioAtendimento - { - get; - set; - } - - public string IdAcesso - { - get - { - return this._idacesso; - } - set - { - this._idacesso = value; - base.OnPropertyChanged("IdAcesso"); - } - } - - public string Nome - { - get - { - return this._nome; - } - set - { - this._nome = value; - base.OnPropertyChanged("Nome"); - } - } - - public Gestor.Model.Domain.Common.ArquivoDigital SelectedAnexado - { - get - { - return this._selectedAnexado; - } - set - { - this._selectedAnexado = value; - base.OnPropertyChanged("SelectedAnexado"); - } - } - - public Atendimento SelectedAtendimento - { - get - { - return this._selectedAtendimento; - } - set - { - this._selectedAtendimento = value; - this.WorkOnSelectedAtendimento(value); - base.OnPropertyChanged("SelectedAtendimento"); - } - } - - public string SenhaAcesso - { - get - { - return this._senhaacesso; - } - set - { - this._senhaacesso = value; - base.OnPropertyChanged("SenhaAcesso"); - } - } - - public List Status - { - get - { - return this._status; - } - set - { - this._status = value; - base.OnPropertyChanged("Status"); - } - } - - public string Telefone - { - get - { - return this._telefone; - } - set - { - this._telefone = value; - base.OnPropertyChanged("Telefone"); - } - } - - public string WebBody - { - get - { - string str = this._webbody; - if (str == null) - { - return null; - } - return str.ToUpper().Trim(); - } - set - { - this._webbody = value; - base.OnPropertyChanged("WebBody"); - } - } - - public AtendimentosViewModel() - { - base.EnableButtons = true; - this._ajudaServico = new AjudaServico(); - this.LoadCombo(); - this.InitialLoad(); - } - - public async void Anexar() - { - List arquivoDigitals = await base.AddAttachments(new List(), new List()); - if (arquivoDigitals != null) - { - arquivoDigitals.AddRange(this.ArquivosAnexados); - this.ArquivosAnexados = new ObservableCollection(arquivoDigitals); - } - } - - public void Delete(Gestor.Model.Domain.Common.ArquivoDigital arquivo) - { - if (this.SelectedAnexado == null) - { - return; - } - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = this.ArquivosAnexados.First((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao()); - this.ArquivosAnexados.Remove(arquivoDigital); - this.ArquivosAnexados = new ObservableCollection(this.ArquivosAnexados); - } - - public async Task>> Enviar() - { - List> keyValuePairs; - object obj; - try - { - List> keyValuePairs1 = this.Validate(); - if (keyValuePairs1.Count <= 0) - { - CustomerData customerDatum = new CustomerData(); - customerDatum.set_Corretora(Recursos.Empresa.get_Nome()); - customerDatum.set_Name(this.Nome); - customerDatum.set_AreaCode(this.Ddd); - customerDatum.set_Number(this.Telefone); - customerDatum.set_Email(this.Email); - CustomerData customerDatum1 = customerDatum; - object[] corpo = new object[] { this.Corpo, this.IdAcesso, this.SenhaAcesso, ApplicationHelper.Versao, Recursos.Usuario.get_Id(), Recursos.Usuario.get_Login(), JsonConvert.SerializeObject(customerDatum1) }; - string str = string.Format("{0}

ID Acesso: {1}
Senha Acesso: {2}

VERSÃO DO SISTEMA: {3}
USUÁRIO SISTEMA:{4} {5}

{6}

", corpo); - CustomerAttendance customerAttendance = new CustomerAttendance(); - customerAttendance.set_CustomerData(customerDatum1); - customerAttendance.set_Subject(this.Assunto); - customerAttendance.set_Body(str); - ObservableCollection arquivosAnexados = this.ArquivosAnexados; - customerAttendance.set_Attachments(arquivosAnexados.Select((Gestor.Model.Domain.Common.ArquivoDigital x) => { - Attachment attachment = new Attachment(); - attachment.set_Description(x.get_Descricao()); - attachment.set_Extension(x.get_Extensao()); - attachment.set_File(x.get_Arquivo()); - return attachment; - }).ToList()); - this.LimparComponentes(); - this.SelecionaAtendimento(); - if (await Connection.Post("Attendance/Send", customerAttendance) == null) - { - obj = null; - } - else - { - obj = new List>(); - ((List>)obj).Add(new KeyValuePair("fail", "")); - } - keyValuePairs = (List>)obj; - } - else - { - keyValuePairs = keyValuePairs1; - } - } - catch (Exception exception) - { - keyValuePairs = new List>() - { - new KeyValuePair("fail", "") - }; - } - return keyValuePairs; - } - - private async void HabilitarAtendimento(Gestor.Model.API.HorarioAtendimento horario) - { - bool id; - string str; - if (horario == null || horario.get_Autorizado()) - { - AtendimentosViewModel atendimentosViewModel = this; - Usuario usuario = Recursos.Usuario; - if (usuario != null) - { - id = usuario.get_Id() > (long)0; - } - else - { - id = false; - } - atendimentosViewModel.EnableButtons = id; - } - else - { - base.EnableButtons = false; - if (horario.get_InicioDia().HasValue) - { - string[] strArrays = new string[] { " de ", horario.get_InicioDia().DiaDaSemana(), " à ", horario.get_FimDia().DiaDaSemana(), ", das ", horario.get_InicioHora(), "hs às ", horario.get_FimHora(), "hs" }; - str = string.Concat(strArrays); - } - else - { - string[] inicioHora = new string[] { " das ", horario.get_InicioHora(), "hs às ", horario.get_FimHora(), "hs" }; - str = string.Concat(inicioHora); - } - string str1 = str; - string[] newLine = new string[] { "Prezado Cliente,", Environment.NewLine, Environment.NewLine, "Informamos Nosso horário de atendimento e recepção dos mesmos é ", str1, ".", Environment.NewLine, "Infelizmente não realizamos agendamento de data/hora de atendimento, por gentileza realize a solicitação dentro do horário comercial que retornaremos a você." }; - await base.ShowMessage(string.Concat(newLine), "OK", "", false); - } - } - - private async void InitialLoad() - { - base.IsEnabled = false; - this.HorarioAtendimento = await Connection.Get("Attendance", true, false); - this.HabilitarAtendimento(this.HorarioAtendimento); - base.IsEnabled = true; - } - - public void LimparComponentes() - { - this.Nome = Recursos.Usuario.get_Nome(); - this.Ddd = Recursos.Usuario.get_Prefixo(); - this.Telefone = Recursos.Usuario.get_Telefone(); - this.Email = Recursos.Usuario.get_Email(); - this.Assunto = null; - this.IdAcesso = null; - this.SenhaAcesso = null; - this.Corpo = string.Empty; - this.ArquivosAnexados = new ObservableCollection(); - } - - private void LoadCombo() - { - this.Status = new List() - { - "PENDENTES", - "FINALIZADOS" - }; - } - - public void SelecionaAtendimento() - { - if (this.Atendimentos != null && this.Atendimentos.Count > 0) - { - this.SelectedAtendimento = this.Atendimentos[0]; - } - this.AtendimentoVisibility = Visibility.Visible; - this.EnvioEmailVisibility = Visibility.Collapsed; - } - - public List> Validate() - { - List> keyValuePairs = ValidationHelper.AddValue(); - if (string.IsNullOrWhiteSpace(this.Nome)) - { - ValidationHelper.AddValue(keyValuePairs, "Nome", Messages.get_Obrigatorio(), true); - } - if (string.IsNullOrWhiteSpace(this.Ddd)) - { - ValidationHelper.AddValue(keyValuePairs, "Ddd", Messages.get_Obrigatorio(), true); - } - else if (!ValidationHelper.ValidacaoPrefixo(this.Ddd)) - { - ValidationHelper.AddValue(keyValuePairs, "Ddd", Messages.get_Invalido(), true); - } - if (string.IsNullOrWhiteSpace(this.Telefone)) - { - ValidationHelper.AddValue(keyValuePairs, "Telefone", Messages.get_Obrigatorio(), true); - } - else if (!ValidationHelper.ValidacaoTelefone(this.Telefone)) - { - ValidationHelper.AddValue(keyValuePairs, "Telefone", Messages.get_Invalido(), true); - } - if (string.IsNullOrWhiteSpace(this.Email)) - { - ValidationHelper.AddValue(keyValuePairs, "Email", Messages.get_Obrigatorio(), true); - } - else if (!ValidationHelper.ValidacaoEmail(this.Email)) - { - ValidationHelper.AddValue(keyValuePairs, "Email", Messages.get_Invalido(), true); - } - if (string.IsNullOrWhiteSpace(this.Corpo)) - { - ValidationHelper.AddValue(keyValuePairs, "Corpo", Messages.get_Obrigatorio(), true); - } - if (string.IsNullOrWhiteSpace(this.Assunto)) - { - ValidationHelper.AddValue(keyValuePairs, "Assunto", Messages.get_Obrigatorio(), true); - } - return keyValuePairs; - } - - private async void WorkOnSelectedAtendimento(Atendimento value) - { - if (value != null) - { - this.WebBody = await this._ajudaServico.BuscarCorpoAtendimentos(value.IdAtendimento); - } - } - - public async void WorkOnSelectedStatus(string value) - { - this.Atendimentos = await this._ajudaServico.BuscarAtendimentos(value); - this.SelecionaAtendimento(); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs deleted file mode 100644 index 6f2e250..0000000 --- a/Gestor.Application/ViewModels/Drawer/Ajuda/BoletosNotasViewModel.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Gestor.Application.Model.Ajuda; -using Gestor.Application.Servicos.Ajuda; -using Gestor.Application.ViewModels.Generic; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Gestor.Application.ViewModels.Drawer.Ajuda -{ - public class BoletosNotasViewModel : BaseViewModel - { - private readonly AjudaServico _ajudaServico; - - private bool _carregando; - - private List _boletos; - - private string _boletoDisponivel; - - private List _status; - - public string BoletoDisponivel - { - get - { - return this._boletoDisponivel; - } - set - { - this._boletoDisponivel = value; - base.OnPropertyChanged("BoletoDisponivel"); - } - } - - public List Boletos - { - get - { - return this._boletos; - } - set - { - this._boletos = value; - base.OnPropertyChanged("Boletos"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public List Status - { - get - { - return this._status; - } - set - { - this._status = value; - base.OnPropertyChanged("Status"); - } - } - - public BoletosNotasViewModel() - { - this._ajudaServico = new AjudaServico(); - this.LoadCombos(); - this.BoletoDisponivel = "Disponível para impressão a partir de\n10 (dez) dias antes do vencimento"; - } - - private void LoadCombos() - { - this.Status = new List() - { - "PENDENTES", - "BAIXADOS" - }; - } - - public async void WorkOnSelectedStatus(string value) - { - List list; - this.Carregando = true; - this.Boletos = new List(); - List boletos = await this._ajudaServico.BuscarBoletosNotas(value); - BoletosNotasViewModel boletosNotasViewModel = this; - if (value == "BAIXADOS") - { - List boletos1 = boletos; - IEnumerable hasValue = - from x in boletos1 - where x.Pagamento.HasValue - select x; - list = ( - from x in hasValue - orderby x.Pagamento descending - select x).ToList(); - } - else - { - list = boletos; - } - boletosNotasViewModel.Boletos = list; - this.Carregando = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs deleted file mode 100644 index fe46bb4..0000000 --- a/Gestor.Application/ViewModels/Drawer/Ajuda/ContratosViewModel.cs +++ /dev/null @@ -1,112 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.Model.Ajuda; -using Gestor.Application.Servicos.Ajuda; -using Gestor.Application.ViewModels.Generic; -using Gestor.Common.Validation; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.License; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Runtime.CompilerServices; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace Gestor.Application.ViewModels.Drawer.Ajuda -{ - public class ContratosViewModel : BaseViewModel - { - private readonly AjudaServico _ajudaServico; - - private bool _carregando; - - private List _contratos; - - private Licenca _selectedContrato; - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public List Contratos - { - get - { - return this._contratos; - } - set - { - this._contratos = value; - base.OnPropertyChanged("Contratos"); - } - } - - public Licenca SelectedContrato - { - get - { - return this._selectedContrato; - } - set - { - this._selectedContrato = value; - this.WorkOnSelectedContrato(value); - base.OnPropertyChanged("SelectedContrato"); - } - } - - public ContratosViewModel() - { - this._ajudaServico = new AjudaServico(); - this.Contratos = LicenseHelper.Produtos; - } - - internal async void WorkOnSelectedContrato(Licenca value) - { - Contrato contrato = await this._ajudaServico.BuscarContrato(value.get_Produto()); - if (!string.IsNullOrEmpty(contrato.HtmlContrato) || contrato.IdModulo != (long)7) - { - if (string.IsNullOrEmpty(contrato.HtmlContrato) && contrato.IdModulo != (long)7) - { - contrato = await this._ajudaServico.BuscarContrato(1); - } - string empty = string.Empty; - LicenseHelper.Produtos.ForEach((Licenca x) => empty = string.Concat(empty, (string.IsNullOrEmpty(empty) ? ValidationHelper.GetDescription(x.get_Produto()) : string.Concat("/ ", ValidationHelper.GetDescription(x.get_Produto()))))); - contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<NOME>]", Recursos.Empresa.get_Nome()); - contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<ENDERECO>]", Recursos.Empresa.get_Endereco()); - contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<CIDADE>]", Recursos.Empresa.get_Cidade()); - contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<CNPJ>]", Recursos.Empresa.get_Documento()); - contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<NS>]", Recursos.Empresa.get_Serial()); - string htmlContrato = contrato.HtmlContrato; - DateTime date = Funcoes.GetNetworkTime().Date; - contrato.HtmlContrato = htmlContrato.Replace("[<DATA>]", date.ToString("dd/MM/yyyy")); - contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<VALOR>]", "Conforme Mensalidade"); - contrato.HtmlContrato = contrato.HtmlContrato.Replace("[<OUTROS>]", empty.Replace("*", "")); - string tempPath = Path.GetTempPath(); - string str = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (new Regex(string.Concat("[", Regex.Escape(string.Concat(new string(Path.GetInvalidFileNameChars()), new string(Path.GetInvalidPathChars()))), "]"))).Replace(ValidationHelper.GetDescription(value.get_Produto()), ""), Funcoes.GetNetworkTime()); - StreamWriter streamWriter = new StreamWriter(str, true, Encoding.UTF8); - streamWriter.Write(contrato.HtmlContrato); - streamWriter.Close(); - Process.Start(str); - } - else - { - Process.Start(string.Format("https://aggilizador.com.br/Contrato.aspx?id={0}", ApplicationHelper.IdFornecedor)); - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs b/Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs deleted file mode 100644 index 8ee9f0b..0000000 --- a/Gestor.Application/ViewModels/Drawer/Ajuda/InstalacaoViewModel.cs +++ /dev/null @@ -1,281 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.Model.Ajuda; -using Gestor.Application.Servicos.Ajuda; -using Gestor.Application.ViewModels.Generic; -using Gestor.Common.Validation; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using Gestor.Model.License; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows.Controls; - -namespace Gestor.Application.ViewModels.Drawer.Ajuda -{ - public class InstalacaoViewModel : BaseViewModel - { - private readonly AjudaServico _ajudaServico; - - private bool _enableExclusao; - - private bool _mostrarAggilizador; - - private string _infoGestor; - - private string _infoAggilizador; - - private bool _carregando; - - private List _agger; - - private ObservableCollection _aggerFiltrado; - - private List _aggilizador; - - public List Agger - { - get - { - return this._agger; - } - set - { - this._agger = value; - base.OnPropertyChanged("Agger"); - } - } - - public ObservableCollection AggerFiltrado - { - get - { - return this._aggerFiltrado; - } - set - { - this._aggerFiltrado = value; - base.OnPropertyChanged("AggerFiltrado"); - } - } - - public List Aggilizador - { - get - { - return this._aggilizador; - } - set - { - this._aggilizador = value; - base.OnPropertyChanged("Aggilizador"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public bool EnableExclusao - { - get - { - return this._enableExclusao; - } - set - { - this._enableExclusao = value; - base.OnPropertyChanged("EnableExclusao"); - } - } - - public string InfoAggilizador - { - get - { - return this._infoAggilizador; - } - set - { - this._infoAggilizador = value; - base.OnPropertyChanged("InfoAggilizador"); - } - } - - public string InfoGestor - { - get - { - return this._infoGestor; - } - set - { - this._infoGestor = value; - base.OnPropertyChanged("InfoGestor"); - } - } - - public AutoCompleteFilterPredicate InstalacaoItemFilter - { - get - { - AutoCompleteFilterPredicate u003cu003e9_370 = InstalacaoViewModel.u003cu003ec.u003cu003e9__37_0; - if (u003cu003e9_370 == null) - { - u003cu003e9_370 = new AutoCompleteFilterPredicate(InstalacaoViewModel.u003cu003ec.u003cu003e9, (string searchText, object obj) => { - if (((Gestor.Application.Model.Ajuda.Instalacao)obj).Maquina.ToUpper().Contains(searchText.ToUpper()) || ((Gestor.Application.Model.Ajuda.Instalacao)obj).Usuario.ToUpper().Contains(searchText.ToUpper())) - { - return true; - } - return ((Gestor.Application.Model.Ajuda.Instalacao)obj).DataIntalacao.ToString().Contains(searchText.ToUpper()); - }); - InstalacaoViewModel.u003cu003ec.u003cu003e9__37_0 = u003cu003e9_370; - } - return u003cu003e9_370; - } - } - - public bool MostrarAggilizador - { - get - { - return this._mostrarAggilizador; - } - set - { - this._mostrarAggilizador = value; - base.OnPropertyChanged("MostrarAggilizador"); - } - } - - public InstalacaoViewModel() - { - Usuario usuario = Recursos.Usuario; - if (usuario != null) - { - id = usuario.get_Id() > (long)0; - } - else - { - id = false; - } - this._enableExclusao = id; - base(); - bool id; - this._ajudaServico = new AjudaServico(); - this.LoadInstalacoes(); - } - - public async void Excluir(long id) - { - if (await this._ajudaServico.ExcluirInstalacao(id)) - { - this.LoadInstalacoes(); - } - } - - internal async Task> Filtrar(string value) - { - List instalacaos = await Task.Run>(() => this.FiltrarInstalacao(value)); - return instalacaos; - } - - public List FiltrarInstalacao(string filter) - { - this.AggerFiltrado = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection(this.Agger) : new ObservableCollection(this.Agger.Where((Gestor.Application.Model.Ajuda.Instalacao x) => { - if (ValidationHelper.RemoveDiacritics(x.Maquina.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) || ValidationHelper.RemoveDiacritics(x.Usuario.Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter))) - { - return true; - } - return x.DataIntalacao.ToString().Contains(ValidationHelper.RemoveDiacritics(filter)); - }))); - return this.AggerFiltrado.ToList(); - } - - private async void LoadInstalacoes() - { - int? nullable; - List instalacaos; - int? nullable1; - int? nullable2; - string str; - this.Carregando = true; - ObservableCollection observableCollection = await this._ajudaServico.BuscarLicencas(); - InstalacaoViewModel list = this; - ObservableCollection observableCollection1 = observableCollection; - list.Agger = ( - from x in observableCollection1 - where !string.IsNullOrEmpty(x.IdGerenciador) - select x).ToList(); - this.AggerFiltrado = new ObservableCollection(this.Agger); - InstalacaoViewModel instalacaoViewModel = this; - List produtos = LicenseHelper.Produtos; - if (produtos.Any((Licenca x) => x.get_Produto() == 81)) - { - instalacaos = new List(); - } - else - { - ObservableCollection observableCollection2 = observableCollection; - instalacaos = ( - from x in observableCollection2 - where !string.IsNullOrEmpty(x.IdAggilizador) - select x).ToList(); - } - instalacaoViewModel.Aggilizador = instalacaos; - InstalacaoViewModel instalacaoViewModel1 = this; - object count = this.Agger.Count; - List licencas = LicenseHelper.Produtos; - Licenca licenca = licencas.FirstOrDefault((Licenca x) => x.get_Produto() == 1); - if (licenca != null) - { - nullable1 = new int?(licenca.get_Quantidade()); - } - else - { - nullable = null; - nullable1 = nullable; - } - instalacaoViewModel1.InfoGestor = string.Format("{0} LICENÇAS INSTALADAS DE {1} LICENÇAS CONTRATADAS.", count, nullable1); - InstalacaoViewModel instalacaoViewModel2 = this; - if (this.Aggilizador.Count > 0) - { - object obj = this.Aggilizador.Count; - List produtos1 = LicenseHelper.Produtos; - Licenca licenca1 = produtos1.FirstOrDefault((Licenca x) => x.get_Produto() == 81); - if (licenca1 != null) - { - nullable2 = new int?(licenca1.get_Quantidade()); - } - else - { - nullable = null; - nullable2 = nullable; - } - str = string.Format("{0} LICENÇAS INSTALADAS DE {1} LICENÇAS CONTRATADAS.", obj, nullable2); - } - else - { - str = ""; - } - instalacaoViewModel2.InfoAggilizador = str; - this.MostrarAggilizador = this.Aggilizador.Count > 0; - this.Carregando = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs b/Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs deleted file mode 100644 index 6963a1e..0000000 --- a/Gestor.Application/ViewModels/Drawer/ArquivoDigitalViewModel.cs +++ /dev/null @@ -1,1414 +0,0 @@ -using Assinador.Model.Domain; -using Assinador.Model.Generic; -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; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class ArquivoDigitalViewModel : BaseSegurosViewModel - { - private readonly ClienteServico _servico; - - private Visibility _assinarVisibility = Visibility.Collapsed; - - private Visibility _visibilityWhatsApp = Visibility.Collapsed; - - 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 _telefones = new ObservableCollection(); - - private ObservableCollection _arquivos = new ObservableCollection(); - - private ObservableCollection _arquivosTela = new ObservableCollection(); - - private IndiceArquivoDigital _selectedArquivo = new IndiceArquivoDigital(); - - private ObservableCollection _arquivosAnexados = new ObservableCollection(); - - private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital(); - - private string _titulo = ""; - - private ObservableCollection _emails = new ObservableCollection(); - - private string _assunto; - - private string _corpo; - - private string _nome; - - private string _documento; - - private string _email; - - private string _licencas; - - private string _assinadorKey; - - public bool Activated - { - get - { - return this._activated; - } - set - { - this._activated = value; - base.OnPropertyChanged("Activated"); - } - } - - public bool AdDocumento - { - get - { - return this._adDocumento; - } - set - { - this._adDocumento = value; - this.CarregarArquivos(); - base.OnPropertyChanged("AdDocumento"); - } - } - - public Visibility AdDocumentoVisibility - { - get - { - return this._adDocumentoVisibility; - } - set - { - this._adDocumentoVisibility = value; - base.OnPropertyChanged("AdDocumentoVisibility"); - } - } - - public ObservableCollection Arquivos - { - get - { - return this._arquivos; - } - set - { - this._arquivos = value; - this.ArquivosTela = value; - base.OnPropertyChanged("Arquivos"); - } - } - - public ObservableCollection ArquivosAnexados - { - get - { - return this._arquivosAnexados; - } - set - { - this._arquivosAnexados = value; - this.IsVisibleSalvar = (value == null ? false : value.Count > 0); - base.OnPropertyChanged("ArquivosAnexados"); - } - } - - public ObservableCollection ArquivosTela - { - get - { - return this._arquivosTela; - } - set - { - this._arquivosTela = value; - base.OnPropertyChanged("ArquivosTela"); - } - } - - public Visibility AssinarVisibility - { - get - { - return this._assinarVisibility; - } - set - { - this._assinarVisibility = value; - base.OnPropertyChanged("AssinarVisibility"); - } - } - - public string Assunto - { - get - { - return this._assunto; - } - set - { - this._assunto = value; - base.OnPropertyChanged("Assunto"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public string Corpo - { - get - { - return this._corpo; - } - set - { - this._corpo = value; - base.OnPropertyChanged("Corpo"); - } - } - - public string Documento - { - get - { - return this._documento; - } - set - { - this._documento = value; - base.OnPropertyChanged("Documento"); - } - } - - public string Email - { - get - { - return this._email; - } - set - { - string str; - if (value != null) - { - str = value.Trim(); - } - else - { - str = null; - } - this._email = str; - base.OnPropertyChanged("Email"); - } - } - - public ObservableCollection Emails - { - get - { - return this._emails; - } - set - { - this._emails = value; - base.OnPropertyChanged("Emails"); - } - } - - public Visibility EnviarSelecionadosVisibility - { - get - { - return this._enviarSelecionadosVisibility; - } - set - { - this._enviarSelecionadosVisibility = (!base.Restricao(20) ? value : Visibility.Collapsed); - base.OnPropertyChanged("EnviarSelecionadosVisibility"); - } - } - - private FiltroArquivoDigital Filtro - { - get; - } - - public bool IsVisibleSalvar - { - get - { - return this._isVisibleSalvar; - } - set - { - this._isVisibleSalvar = value; - base.OnPropertyChanged("IsVisibleSalvar"); - } - } - - public string Licencas - { - get - { - return this._licencas; - } - set - { - this._licencas = value; - base.OnPropertyChanged("Licencas"); - } - } - - public string Nome - { - get - { - return this._nome; - } - set - { - this._nome = value; - base.OnPropertyChanged("Nome"); - } - } - - public Gestor.Model.Domain.Common.ArquivoDigital SelectedAnexado - { - get - { - return this._selectedAnexado; - } - set - { - this._selectedAnexado = value; - base.OnPropertyChanged("SelectedAnexado"); - } - } - - public IndiceArquivoDigital SelectedArquivo - { - get - { - return this._selectedArquivo; - } - set - { - this._selectedArquivo = value; - base.OnPropertyChanged("SelectedArquivo"); - } - } - - public Cliente SelectedCliente - { - get - { - return this._selectedCliente; - } - set - { - this._selectedCliente = value; - base.OnPropertyChanged("SelectedCliente"); - } - } - - public ObservableCollection Telefones - { - get - { - return this._telefones; - } - set - { - this._telefones = value; - base.OnPropertyChanged("Telefones"); - } - } - - public string Titulo - { - get - { - return this._titulo; - } - set - { - this._titulo = value; - base.OnPropertyChanged("Titulo"); - } - } - - public Visibility VisibilityWhatsApp - { - get - { - return this._visibilityWhatsApp; - } - set - { - this._visibilityWhatsApp = value; - base.OnPropertyChanged("VisibilityWhatsApp"); - } - } - - public ArquivoDigitalViewModel(FiltroArquivoDigital filtro) - { - this.Filtro = filtro; - this._servico = new ClienteServico(); - this.CarregarArquivos(); - this.VisibilityWhatsApp = (filtro.get_Tipo() == 2 || filtro.get_Tipo() == 3 || filtro.get_Tipo() == 4 || filtro.get_Tipo() == 5 ? Visibility.Visible : Visibility.Collapsed); - this.AdDocumentoVisibility = ((filtro.get_Tipo() == 4 || filtro.get_Tipo() == 3 || filtro.get_Tipo() == 5) && (new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 2).get_Consultar() ? Visibility.Visible : Visibility.Collapsed); - base.EnableMenu = true; - switch (filtro.get_Tipo()) - { - case 0: - case 6: - case 7: - case 8: - case 9: - case 10: - case 12: - case 13: - case 14: - case 15: - case 17: - { - this.EnviarSelecionadosVisibility = Visibility.Collapsed; - return; - } - default: - { - this.EnviarSelecionadosVisibility = Visibility.Visible; - return; - } - } - } - - public async void Anexar() - { - ObservableCollection arquivos = this.Arquivos; - List list = arquivos.Select((IndiceArquivoDigital x) => { - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = new Gestor.Model.Domain.Common.ArquivoDigital(); - arquivoDigital.set_Descricao(x.get_Descricao()); - arquivoDigital.set_Extensao(x.get_Extensao()); - return arquivoDigital; - }).ToList(); - List arquivoDigitals = await base.AddAttachments(this.ArquivosAnexados.ToList(), list); - if (arquivoDigitals != null) - { - List configuracoes = Recursos.Configuracoes; - if (!configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 47)) - { - arquivoDigitals = await base.ShowDialogAnexar(arquivoDigitals, false); - if (arquivoDigitals == null) - { - return; - } - } - arquivoDigitals.AddRange(this.ArquivosAnexados); - this.ArquivosAnexados = new ObservableCollection(arquivoDigitals); - } - } - - public async Task Assinar(IndiceArquivoDigital indice, bool lote = false) - { - ArquivoParaAssinaturaAssinador arquivoParaAssinaturaAssinador; - object obj; - int num = 0; - try - { - AssinaturaServico assinaturaServico = new AssinaturaServico(); - Gestor.Application.Servicos.ArquivoDigitalServico arquivoDigitalServico = new Gestor.Application.Servicos.ArquivoDigitalServico(); - if (await assinaturaServico.VerificarAssinado(indice.get_Id())) - { - if (!lote) - { - await base.ShowMessage("ARQUIVO JÁ ASSINADO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (await assinaturaServico.VerificarEnviado(indice.get_Id())) - { - arquivoParaAssinaturaAssinador = await assinaturaServico.Reenviar(indice.get_Id()); - return arquivoParaAssinaturaAssinador; - } - else if (this.Nome == null || string.IsNullOrWhiteSpace(this.Nome)) - { - if (!lote) - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM NOME VÁLIDO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (this.Documento == null || !Gestor.Common.Validation.ValidationHelper.ValidateDocument(this.Documento)) - { - if (!lote) - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM DOCUMENTO VÁLIDO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (this.Documento.Length > 14) - { - if (!lote) - { - await base.ShowMessage("O DOCUMENTO DO ASSINANTE DEVE SER CPF E NÃO CNPJ", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else if (this.Email == null || !Gestor.Model.Helper.ValidationHelper.ValidacaoEmail(this.Email)) - { - if (!lote) - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO", "OK", "", false); - } - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - else - { - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = await arquivoDigitalServico.BuscarPorId(indice.get_IdArquivoDigital(), indice.get_Bd()); - long id = (long)0; - Gestor.Model.Domain.Seguros.Documento documento = new Gestor.Model.Domain.Seguros.Documento(); - switch (this.Filtro.get_Tipo()) - { - case 2: - { - id = ((Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente()).get_Id(); - break; - } - case 3: - { - id = ((Parcela)this.Filtro.get_Parente()).get_Documento().get_Id(); - break; - } - case 4: - { - id = ((Item)this.Filtro.get_Parente()).get_Documento().get_Id(); - break; - } - case 5: - { - id = ((Sinistro)this.Filtro.get_Parente()).get_ControleSinistro().get_Item().get_Documento().get_Id(); - break; - } - default: - { - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - } - AssinaturaServico assinaturaServico1 = assinaturaServico; - ApoliceAssinador apoliceAssinador = new ApoliceAssinador(); - apoliceAssinador.set_ArquivoId(indice.get_Id()); - apoliceAssinador.set_ClienteId(this.SelectedCliente.get_Id()); - apoliceAssinador.set_Cliente(this.Nome); - apoliceAssinador.set_Email(this.Email); - apoliceAssinador.set_Documento(this.Documento); - apoliceAssinador.set_Id(id); - ArquivoParaAssinaturaAssinador arquivoParaAssinaturaAssinador1 = await assinaturaServico1.Assinar(arquivoDigital, apoliceAssinador); - arquivoParaAssinaturaAssinador = await assinaturaServico.Save(arquivoParaAssinaturaAssinador1); - return arquivoParaAssinaturaAssinador; - } - } - catch (Exception exception) - { - obj = exception; - num = 1; - } - if (num != 1) - { - throw null; - } - Exception exception1 = (Exception)obj; - string[] newLine = new string[] { "ERRO AO ENVIAR PARA ASSINATURA", Environment.NewLine, exception1.Message, Environment.NewLine, "POR FAVOR CONTATE A AGGER ATRAVÉS DO PAINEL DE ATENDIMENTOS" }; - await base.ShowMessage(string.Concat(newLine), "OK", "", false); - arquivoParaAssinaturaAssinador = null; - return arquivoParaAssinaturaAssinador; - } - - private void AtualizaEmpresa() - { - Recursos.Empresa = (new BaseServico()).BuscarEmpresa(Recursos.Usuario.get_IdEmpresa()); - } - - public void Baixar(IndiceArquivoDigital arquivo, bool abrir = false) - { - if (arquivo == null || arquivo.get_IdArquivoDigital() == 0) - { - return; - } - base.Download(arquivo, abrir); - } - - public async Task BaixarTodos() - { - bool flag; - if (this.Arquivos == null || this.Arquivos.Count == 0) - { - flag = false; - } - else - { - flag = await base.DownloadAll(this.Arquivos.ToList(), this.Filtro.get_Id()); - } - return flag; - } - - public async Task CarregaArquivos() - { - TipoArquivoDigital tipo; - bool id; - string email; - object emailResponsavel; - object nomeResponsavel; - object documentoResponsavel; - string str; - string str1; - Cliente cliente; - FiltroArquivoDigital filtro = this.Filtro; - if (filtro != null) - { - id = filtro.get_Id() == (long)0; - } - else - { - id = false; - } - if (!id) - { - this.Carregando = true; - base.IsVisible = Visibility.Collapsed; - this.AssinarVisibility = Visibility.Collapsed; - if (this.Filtro != null) - { - List indiceArquivoDigitals = await this.ArquivoDigitalServico.BuscarPorTipo(this.Filtro.get_Tipo(), this.Filtro.get_Id()); - if (this.AdDocumento) - { - List indiceArquivoDigitals1 = indiceArquivoDigitals; - List indiceArquivoDigitals2 = await this.ArquivoDigitalServico.BuscarPorTipo(2, this.Filtro.get_IdApolice()); - indiceArquivoDigitals1.AddRange(indiceArquivoDigitals2); - indiceArquivoDigitals1 = null; - } - ArquivoDigitalViewModel observableCollection = this; - List indiceArquivoDigitals3 = indiceArquivoDigitals; - observableCollection.Arquivos = new ObservableCollection( - from x in indiceArquivoDigitals3 - orderby x.get_Descricao() - select x); - tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 2: - { - this.AssinarVisibility = Visibility.Visible; - Gestor.Model.Domain.Seguros.Documento parente = (Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente(); - this.SelectedCliente = parente.get_Controle().get_Cliente(); - ArquivoDigitalViewModel arquivoDigitalViewModel = this; - str = (parente.get_Apolice() != string.Empty ? string.Concat("ARQUIVO DIGITAL DA APÓLICE \"", parente.get_Apolice(), "\"") : string.Concat("ARQUIVO DIGITAL DA PROPOSTA \"", parente.get_Proposta(), "\"")); - arquivoDigitalViewModel.Titulo = str; - break; - } - case 3: - { - this.AssinarVisibility = Visibility.Visible; - Parcela parcela = (Parcela)this.Filtro.get_Parente(); - this.SelectedCliente = parcela.get_Documento().get_Controle().get_Cliente(); - ArquivoDigitalViewModel arquivoDigitalViewModel1 = this; - str1 = (parcela.get_Documento().get_Apolice() != string.Empty ? string.Format("ARQUIVO DIGITAL DA PARCELA \"{0}\" DA APÓLICE \"{1}\"", parcela.get_NumeroParcela(), parcela.get_Documento().get_Apolice()) : string.Format("ARQUIVO DIGITAL DA PARCELA \"{0}\" DA PROPOSTA \"{1}\"", parcela.get_NumeroParcela(), parcela.get_Documento().get_Proposta())); - arquivoDigitalViewModel1.Titulo = str1; - DetalheExtrato detalheExtrato = await (new ServicoExtrato()).FindByParcelaId(parcela.get_Id()); - if (detalheExtrato == null) - { - break; - } - indiceArquivoDigitals = await this.ArquivoDigitalServico.BuscarPorTipo(7, detalheExtrato.get_Extrato().get_Id()); - List indiceArquivoDigitals4 = indiceArquivoDigitals; - indiceArquivoDigitals4.ForEach((IndiceArquivoDigital x) => x.set_NaoExcluir(true)); - ObservableCollection arquivos = this.Arquivos; - List indiceArquivoDigitals5 = indiceArquivoDigitals; - ExtensionMethods.AddRange(arquivos, new ObservableCollection( - from x in indiceArquivoDigitals5 - orderby x.get_Descricao() - select x)); - break; - } - case 4: - { - this.AssinarVisibility = Visibility.Visible; - Item item = (Item)this.Filtro.get_Parente(); - this.SelectedCliente = item.get_Documento().get_Controle().get_Cliente(); - this.Titulo = string.Concat("ARQUIVO DIGITAL DO ITEM \"", item.get_Descricao(), "\""); - break; - } - case 5: - { - this.AssinarVisibility = Visibility.Visible; - Sinistro sinistro = (Sinistro)this.Filtro.get_Parente(); - this.SelectedCliente = sinistro.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente(); - string[] numero = new string[] { "ARQUIVO DIGITAL DO SINITRO \"", sinistro.get_Numero(), "\" DO ITEM \"", sinistro.get_ControleSinistro().get_Item().get_Descricao(), "\"" }; - this.Titulo = string.Concat(numero); - break; - } - case 6: - { - Vendedor vendedor = (Vendedor)this.Filtro.get_Parente(); - Cliente cliente1 = new Cliente(); - cliente1.set_Id(vendedor.get_Id()); - cliente1.set_Nome(vendedor.get_Nome()); - this.SelectedCliente = cliente1; - this.Titulo = string.Format("ARQUIVO DIGITAL DO VENDEDOR {0} {1}", vendedor.get_Nome(), vendedor.get_Id()); - break; - } - case 7: - { - Extrato extrato = (Extrato)this.Filtro.get_Parente(); - Cliente cliente2 = new Cliente(); - cliente2.set_Nome(string.Concat("EXTRATO ", extrato.get_Numero())); - this.SelectedCliente = cliente2; - this.Titulo = string.Format("ARQUIVO DIGITAL DO EXTRATO {0} ID:{1}", extrato.get_Numero(), extrato.get_Id()); - break; - } - case 8: - { - Seguradora seguradora = (Seguradora)this.Filtro.get_Parente(); - Cliente cliente3 = new Cliente(); - cliente3.set_Id(seguradora.get_Id()); - cliente3.set_Nome(seguradora.get_Nome()); - this.SelectedCliente = cliente3; - this.Titulo = string.Format("ARQUIVO DIGITAL DA SEGURADORA {0} {1}", seguradora.get_Nome(), seguradora.get_Id()); - break; - } - case 9: - { - Lancamento lancamento = (Lancamento)this.Filtro.get_Parente(); - if (!lancamento.get_Historico().Equals("TRANSFERÊNCIA ENTRE CONTAS")) - { - Cliente cliente4 = new Cliente(); - cliente4.set_Id(lancamento.get_Controle().get_Fornecedor().get_Id()); - cliente4.set_Nome(lancamento.get_Controle().get_Fornecedor().get_Nome()); - this.SelectedCliente = cliente4; - this.Titulo = string.Format("ARQUIVO DIGITAL DO LANCAMENTO {0}, PLANO {1}, CENTRO {2}", lancamento.get_Id(), lancamento.get_Controle().get_Plano().get_Nome(), lancamento.get_Controle().get_Centro().get_Descricao()); - break; - } - else - { - await base.ShowMessage("NÃO É POSSIVEL INCLUIR ARQUIVOS EM TRANSFERÊNCIA ENTRE CONTAS", "OK", "", false); - base.CloseDrawer(); - return; - } - } - case 10: - { - Fornecedor fornecedor = (Fornecedor)this.Filtro.get_Parente(); - Cliente cliente5 = new Cliente(); - cliente5.set_Id(fornecedor.get_Id()); - cliente5.set_Nome(fornecedor.get_Nome()); - this.SelectedCliente = cliente5; - this.Titulo = string.Format("ARQUIVO DIGITAL DO FORNECEDOR {0} {1}", fornecedor.get_Nome(), fornecedor.get_Id()); - break; - } - case 11: - { - Prospeccao prospeccao = (Prospeccao)this.Filtro.get_Parente(); - Cliente cliente6 = new Cliente(); - cliente6.set_Id(prospeccao.get_Id()); - cliente6.set_Nome(prospeccao.get_Nome()); - this.SelectedCliente = cliente6; - this.Titulo = string.Format("ARQUIVO DIGITAL DA PROSPECÇÃO {0} {1} {2}", prospeccao.get_Nome(), prospeccao.get_Id(), prospeccao.get_Item()); - break; - } - case 12: - { - Usuario usuario = (Usuario)this.Filtro.get_Parente(); - Cliente cliente7 = new Cliente(); - cliente7.set_Id(usuario.get_Id()); - cliente7.set_Nome(usuario.get_Nome()); - this.SelectedCliente = cliente7; - this.Titulo = string.Format("ARQUIVO DIGITAL DO USUÁRIO {0} {1}", usuario.get_Nome(), usuario.get_Id()); - break; - } - case 13: - { - Empresa empresa = (Empresa)this.Filtro.get_Parente(); - Cliente cliente8 = new Cliente(); - cliente8.set_Id(empresa.get_Id()); - cliente8.set_Nome(empresa.get_Nome()); - this.SelectedCliente = cliente8; - this.Titulo = string.Format("ARQUIVO DIGITAL DA EMPRESA {0} {1}", empresa.get_Nome(), empresa.get_Id()); - break; - } - case 14: - { - Socio socio = (Socio)this.Filtro.get_Parente(); - Cliente cliente9 = new Cliente(); - cliente9.set_Id(socio.get_Id()); - cliente9.set_Nome(socio.get_Nome()); - this.SelectedCliente = cliente9; - this.Titulo = string.Format("ARQUIVO DIGITAL DO SÓCIO {0} {1}", socio.get_Nome(), socio.get_Id()); - break; - } - case 15: - { - Tarefa tarefa = (Tarefa)this.Filtro.get_Parente(); - Cliente cliente10 = new Cliente(); - cliente10.set_Id(tarefa.get_Id()); - cliente10.set_Nome(string.Concat("TAREFA - ", tarefa.get_Titulo())); - this.SelectedCliente = cliente10; - this.Titulo = string.Format("ANEXO DA TAREFA {0} {1}", tarefa.get_Titulo(), tarefa.get_Id()); - break; - } - case 16: - { - NotaFiscal notaFiscal = (NotaFiscal)this.Filtro.get_Parente(); - Cliente cliente11 = new Cliente(); - cliente11.set_Id(notaFiscal.get_Id()); - cliente11.set_Nome(string.Format("NOTA FISCAL - {0} {1:d}", notaFiscal.get_Seguradora().get_NomeSocial(), notaFiscal.get_Data())); - this.SelectedCliente = cliente11; - this.Titulo = string.Format("ANEXO DA NOTA FISCAL {0} {1:d}", notaFiscal.get_Seguradora().get_NomeSocial(), notaFiscal.get_Data()); - break; - } - case 17: - { - Estipulante estipulante = (Estipulante)this.Filtro.get_Parente(); - Cliente cliente12 = new Cliente(); - cliente12.set_Id(estipulante.get_Id()); - cliente12.set_Nome(string.Concat("ESTIPULANTE - ", estipulante.get_Nome())); - this.SelectedCliente = cliente12; - this.Titulo = string.Concat("ANEXO DO ESTIPULANTE ", estipulante.get_Nome()); - break; - } - default: - { - this.SelectedCliente = (Cliente)this.Filtro.get_Parente(); - this.Titulo = string.Concat("ARQUIVO DIGITAL DO CLIENTE \"", this.SelectedCliente.get_Nome(), "\""); - break; - } - } - indiceArquivoDigitals = null; - } - if (this.Filtro != null) - { - tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 1: - case 2: - case 3: - case 4: - case 5: - { - cliente = await this._servico.BuscarClienteAsync(this.SelectedCliente.get_Id()); - this.Telefones = await this._servico.BuscarTelefonesAsync(this.SelectedCliente.get_Id()); - ObservableCollection observableCollection1 = await (new ClienteServico()).BuscarEmailsAsync(this.SelectedCliente.get_Id()); - if (this.SelectedCliente.get_Documento() == null || Gestor.Common.Validation.ValidationHelper.OnlyNumber(this.SelectedCliente.get_Documento()).Length <= 11) - { - ArquivoDigitalViewModel arquivoDigitalViewModel2 = this; - ClienteEmail clienteEmail = observableCollection1.FirstOrDefault(); - if (clienteEmail != null) - { - email = clienteEmail.get_Email(); - } - else - { - email = null; - } - arquivoDigitalViewModel2.Email = email; - this.Nome = this.SelectedCliente.get_Nome(); - this.Documento = this.SelectedCliente.get_Documento(); - goto case 8; - } - else - { - ArquivoDigitalViewModel arquivoDigitalViewModel3 = this; - Cliente cliente13 = cliente; - if (cliente13 != null) - { - ResponsavelAssinatura responsavelAssinatura = cliente13.get_ResponsavelAssinatura(); - if (responsavelAssinatura != null) - { - emailResponsavel = responsavelAssinatura.get_EmailResponsavel(); - } - else - { - emailResponsavel = null; - } - } - else - { - emailResponsavel = null; - } - if (emailResponsavel == null) - { - ClienteEmail clienteEmail1 = observableCollection1.FirstOrDefault(); - if (clienteEmail1 != null) - { - emailResponsavel = clienteEmail1.get_Email(); - } - else - { - emailResponsavel = null; - } - } - arquivoDigitalViewModel3.Email = (string)emailResponsavel; - ArquivoDigitalViewModel arquivoDigitalViewModel4 = this; - Cliente cliente14 = cliente; - if (cliente14 != null) - { - ResponsavelAssinatura responsavelAssinatura1 = cliente14.get_ResponsavelAssinatura(); - if (responsavelAssinatura1 != null) - { - nomeResponsavel = responsavelAssinatura1.get_NomeResponsavel(); - } - else - { - nomeResponsavel = null; - } - } - else - { - nomeResponsavel = null; - } - if (nomeResponsavel == null) - { - nomeResponsavel = this.SelectedCliente.get_Nome(); - } - arquivoDigitalViewModel4.Nome = (string)nomeResponsavel; - ArquivoDigitalViewModel arquivoDigitalViewModel5 = this; - Cliente cliente15 = cliente; - if (cliente15 != null) - { - ResponsavelAssinatura responsavelAssinatura2 = cliente15.get_ResponsavelAssinatura(); - if (responsavelAssinatura2 != null) - { - documentoResponsavel = responsavelAssinatura2.get_DocumentoResponsavel(); - } - else - { - documentoResponsavel = null; - } - } - else - { - documentoResponsavel = null; - } - if (documentoResponsavel == null) - { - documentoResponsavel = this.SelectedCliente.get_Documento(); - } - arquivoDigitalViewModel5.Documento = (string)documentoResponsavel; - goto case 8; - } - } - case 6: - case 7: - case 8: - { - cliente = null; - break; - } - case 9: - { - Lancamento parente1 = (Lancamento)this.Filtro.get_Parente(); - ObservableCollection observableCollection2 = new ObservableCollection(); - ClienteTelefone clienteTelefone = new ClienteTelefone(); - clienteTelefone.set_Prefixo(parente1.get_Controle().get_Fornecedor().get_Prefixo1()); - clienteTelefone.set_Numero(parente1.get_Controle().get_Fornecedor().get_Telefone1()); - observableCollection2.Add(clienteTelefone); - ClienteTelefone clienteTelefone1 = new ClienteTelefone(); - clienteTelefone1.set_Prefixo(parente1.get_Controle().get_Fornecedor().get_Prefixo2()); - clienteTelefone1.set_Numero(parente1.get_Controle().get_Fornecedor().get_Telefone2()); - observableCollection2.Add(clienteTelefone1); - this.Telefones = observableCollection2; - goto case 8; - } - case 10: - { - Fornecedor fornecedor1 = (Fornecedor)this.Filtro.get_Parente(); - ObservableCollection observableCollection3 = new ObservableCollection(); - ClienteTelefone clienteTelefone2 = new ClienteTelefone(); - clienteTelefone2.set_Prefixo(fornecedor1.get_Prefixo1()); - clienteTelefone2.set_Numero(fornecedor1.get_Telefone1()); - observableCollection3.Add(clienteTelefone2); - ClienteTelefone clienteTelefone3 = new ClienteTelefone(); - clienteTelefone3.set_Prefixo(fornecedor1.get_Prefixo2()); - clienteTelefone3.set_Numero(fornecedor1.get_Telefone2()); - observableCollection3.Add(clienteTelefone3); - this.Telefones = observableCollection3; - goto case 8; - } - default: - { - if (tipo == 17) - { - Estipulante estipulante1 = (Estipulante)this.Filtro.get_Parente(); - ObservableCollection observableCollection4 = new ObservableCollection(); - ClienteTelefone clienteTelefone4 = new ClienteTelefone(); - clienteTelefone4.set_Prefixo(estipulante1.get_PrimeiroPrefixo()); - clienteTelefone4.set_Numero(estipulante1.get_PrimeiroTelefone()); - observableCollection4.Add(clienteTelefone4); - ClienteTelefone clienteTelefone5 = new ClienteTelefone(); - clienteTelefone5.set_Prefixo(estipulante1.get_SegundoPrefixo()); - clienteTelefone5.set_Numero(estipulante1.get_SegundoTelefone()); - observableCollection4.Add(clienteTelefone5); - this.Telefones = observableCollection4; - goto case 8; - } - else - { - goto case 8; - } - } - } - } - base.IsVisible = Visibility.Visible; - this.Carregando = false; - } - } - - public async void CarregarArquivos() - { - await base.PermissaoTela(6); - await base.PermissaoArquivoDigital(this.Filtro.get_Tipo()); - await this.CarregaArquivos(); - string str = "PRODUTO NÃO CONTRATADO"; - List produtos = LicenseHelper.Produtos; - if (produtos.Any((Licenca x) => x.get_Produto() == 86)) - { - this._assinadorKey = await AssinadorHelper.Key(); - int num = await AssinadorHelper.Licencas(this._assinadorKey); - str = string.Format("{0} LICENÇAS DISPONÍVEIS", num); - } - this.Licencas = str; - base.VerificarEnables(new long?((long)0)); - } - - public string CarregarMensagem() - { - Gestor.Model.Domain.Seguros.Documento parente; - Item item; - string str; - string str1; - this.AtualizaEmpresa(); - if (Recursos.Empresa.get_TipoTelefone1() == 11) - { - str1 = "0300"; - } - else - { - str1 = (Recursos.Empresa.get_TipoTelefone1() == 10 ? "0800" : ""); - } - string str2 = str1; - str2 = string.Concat(new string[] { str2, " ", Recursos.Empresa.get_PrimeiroPrefixo(), " ", Recursos.Empresa.get_PrimeiroTelefone() }); - TipoArquivoDigital tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 1: - { - return string.Concat(new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_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 ", str2, ".", Environment.NewLine, "Atenciosamente ", Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()), "." }); - } - case 2: - { - parente = (Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. ", Environment.NewLine, null }; - strArrays[4] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays); - } - case 3: - { - Parcela parcela = (Parcela)this.Filtro.get_Parente(); - parente = parcela.get_Documento(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays1 = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente a sua parcela. ", Environment.NewLine, null, null }; - strArrays1[4] = string.Format("Parcela {0} de {1}, valor {2:C2} de vencimento {3:d}. {4}", new object[] { parcela.get_NumeroParcela(), parente.get_NumeroParcelas(), parcela.get_Valor(), parcela.get_Vencimento(), Environment.NewLine }); - strArrays1[5] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays1); - } - case 4: - { - item = (Item)this.Filtro.get_Parente(); - parente = item.get_Documento(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays2 = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu seguro. ", Environment.NewLine, "Item ", item.get_Descricao(), ". ", Environment.NewLine, null }; - strArrays2[8] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays2); - } - case 5: - { - Sinistro sinistro = (Sinistro)this.Filtro.get_Parente(); - item = sinistro.get_ControleSinistro().get_Item(); - parente = item.get_Documento(); - str = (string.IsNullOrWhiteSpace(parente.get_Apolice()) ? string.Concat("Proposta Número ", parente.get_Proposta()) : string.Concat("Apólice Número ", parente.get_Apolice())); - string[] strArrays3 = new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_Nome()), " segue o(s) link(s) para download do(s) arquivo(s) referente ao seu sinistro. ", Environment.NewLine, "Sinistro de número ", sinistro.get_Numero(), " Item sinistrado ", sinistro.get_ItemSinistrado(), ". ", Environment.NewLine, null }; - strArrays3[10] = string.Format("{0}, {1}, {2} de Vigências entre {3:d} e {4:d}. {5}{6}[*LINK*]{7}{8}<|LINKASSINATURA|>Para mais informações entre contato conosco pelo {9}.{10}Atenciosamente {11}.", new object[] { Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Seguradora().get_Nome()), Gestor.Common.Validation.ValidationHelper.Captalize(parente.get_Controle().get_Ramo().get_Nome()), str, parente.get_Vigencia1(), parente.get_Vigencia2(), Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, str2, Environment.NewLine, Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()) }); - return string.Concat(strArrays3); - } - default: - { - if (tipo == 13) - { - break; - } - else - { - goto Label0; - } - } - } - return string.Concat(new string[] { "Prezado(a) ", Gestor.Common.Validation.ValidationHelper.Captalize(this.SelectedCliente.get_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 ", str2, ".", Environment.NewLine, "Atenciosamente ", Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()), "." }); - Label0: - return string.Concat(new string[] { "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 ", str2, ".", Environment.NewLine, "Atenciosamente ", Gestor.Common.Validation.ValidationHelper.Captalize(Recursos.Empresa.get_Nome()), "." }); - } - - public async Task CreateLink(IndiceArquivoDigital indice) - { - DateTime networkTime = Funcoes.GetNetworkTime(); - string str = string.Format("{0}:{1}:F:{2}", networkTime.Ticks, ApplicationHelper.IdFornecedor, indice.get_Id()).Base64Encode(); - return Recursos.ApiArquivo.AddQuery("search", str); - } - - public void Delete(Gestor.Model.Domain.Common.ArquivoDigital arquivo) - { - if (this.SelectedAnexado == null) - { - return; - } - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = this.ArquivosAnexados.First((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao()); - this.ArquivosAnexados.Remove(arquivoDigital); - this.ArquivosAnexados = new ObservableCollection(this.ArquivosAnexados); - } - - public async void Editar(IndiceArquivoDigital arquivo) - { - if (arquivo != null && arquivo.get_IdArquivoDigital() != 0) - { - await this.ArquivoDigitalServico.Save(arquivo); - } - } - - public async Task EnviarParaAssinatura() - { - bool flag; - object obj; - ObservableCollection arquivosTela = this.ArquivosTela; - if (!arquivosTela.Any((IndiceArquivoDigital x) => x.get_Assinar())) - { - await base.ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIAR PARA ASSINATURA.", "OK", "", false); - flag = false; - } - else if (!await base.ShowMessage("DESEJA ENVIAR OS ARQUIVOS SELECIONADOS PARA ASSINATURA ELETRÔNICA DO SEGURADO?", "SIM", "NÃO", false)) - { - flag = false; - } - else if (!this.Email.EndsWith(";")) - { - base.Loading(true); - this._assinadorKey = await AssinadorHelper.Key(); - int num = await AssinadorHelper.Licencas(this._assinadorKey); - int num1 = num; - ObservableCollection arquivos = this.Arquivos; - if (num1 >= arquivos.Count((IndiceArquivoDigital x) => { - if (!x.get_Assinar()) - { - return false; - } - return !x.get_EnviadoAssinatura(); - })) - { - AssinadorHelper.Parametros = await AssinaturaServico.BuscarParametrosAssinatura(Recursos.Usuario.get_IdEmpresa()); - int num2 = 0; - ObservableCollection observableCollection = this.ArquivosTela; - int num3 = ( - from x in observableCollection - where x.get_Assinar() - select x).Count(); - ObservableCollection arquivosTela1 = this.ArquivosTela; - foreach (IndiceArquivoDigital indiceArquivoDigital in - from x in arquivosTela1 - where x.get_Assinar() - select x) - { - if (indiceArquivoDigital.get_Assinado()) - { - continue; - } - if (!indiceArquivoDigital.get_EnviadoAssinatura()) - { - ArquivoParaAssinaturaAssinador arquivoParaAssinaturaAssinador = await this.Assinar(indiceArquivoDigital, false); - if (arquivoParaAssinaturaAssinador == null) - { - continue; - } - num--; - indiceArquivoDigital.set_EnviadoAssinatura(true); - indiceArquivoDigital.set_UrlAssinatura(arquivoParaAssinaturaAssinador.get_UrlAssinatura()); - num2++; - indiceArquivoDigital = null; - } - else - { - await (new AssinaturaServico()).Reenviar(indiceArquivoDigital.get_Id()); - } - } - base.Loading(false); - this.Arquivos = new ObservableCollection(this.Arquivos); - await base.ShowMessage(string.Format("{0} DE {1} ARQUIVOS FORAM ENVIADOS PARA ASSINATURA. VOCÊ SERÁ NOTIFICADO QUANDO OS DOCUMENTOS FOREM ASSINADOS", num2, num3), "OK", "", false); - flag = true; - } - else if (base.Restricao(113)) - { - await base.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.", "OK", "", false); - base.Loading(false); - flag = false; - } - else if (await base.ShowMessage("VOCÊ NÃO POSSUI MAIS LICENÇAS DISPONÍVEIS, DESEJA CONTRATAR MAIS?", "SIM", "NÃO", false)) - { - Token token = new Token(); - object[] numeroSerial = new object[] { ApplicationHelper.NumeroSerial, ApplicationHelper.IdFornecedor, Recursos.Usuario.get_Id(), null }; - obj = (ApplicationHelper.Beta ? "1" : "0"); - numeroSerial[3] = obj; - string str = token.Encrypt(string.Format("{0}:{1}:{2}:{3}", numeroSerial)); - Parameters parameter = new Parameters(); - parameter.set_Beta(ApplicationHelper.Beta); - parameter.set_Type(8); - parameter.set_Application("Assinador.Application.exe"); - parameter.set_Directory("Assinador.Application"); - parameter.set_Arguments(str); - parameter.set_Run(true); - (new DownloadWindow(parameter)).Show(); - base.Loading(false); - flag = false; - } - else - { - base.Loading(false); - flag = false; - } - } - else - { - await base.ShowMessage("É NECESSÁRIO QUE O ASSINANTE POSSUA UM E-MAIL VÁLIDO", "OK", "", false); - flag = false; - } - return flag; - } - - public async Task Excluir(IndiceArquivoDigital arquivo) - { - if (arquivo != null && arquivo.get_IdArquivoDigital() != 0) - { - if (await this.ArquivoDigitalServico.DeleteAttachment(arquivo)) - { - await this.CarregaArquivos(); - } - } - } - - public void LimparAnexos() - { - this.ArquivosAnexados = new ObservableCollection(); - } - - public async Task PrepararEnvio() - { - MalaDireta malaDiretum; - Item item; - string str; - Item item1; - string str1; - MalaDireta malaDiretum1; - Gestor.Model.Domain.Seguros.Documento parente; - Parcela parcela; - ObservableCollection arquivos = this.Arquivos; - if (arquivos.Any((IndiceArquivoDigital x) => x.get_Selecionado())) - { - MalaDireta malaDiretum2 = new MalaDireta(); - malaDiretum2.set_Cliente(this.SelectedCliente); - ObservableCollection observableCollection = this.Arquivos; - malaDiretum2.set_ArquivoDigital(( - from x in observableCollection - where x.get_Selecionado() - select x).ToList()); - malaDiretum1 = malaDiretum2; - TipoArquivoDigital tipo = this.Filtro.get_Tipo(); - switch (tipo) - { - case 2: - { - parente = (Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente(); - List items = await base.CarregarItem(parente.get_Controle().get_Id(), 0); - MalaDireta malaDiretum3 = malaDiretum1; - if (items.Count > 1) - { - item = new Item(); - item.set_Id((long)0); - item.set_Descricao("APÓLICE COLETIVA"); - } - else - { - item = items.FirstOrDefault(); - } - malaDiretum3.set_Item(item); - malaDiretum1.set_Apolice(parente); - ArquivoDigitalViewModel arquivoDigitalViewModel = this; - str = (parente.get_Apolice() != string.Empty ? string.Concat("DOCUMENTOS REFERENTES A APÓLICE ", parente.get_Apolice()) : string.Concat("DOCUMENTOS REFERENTES A PROPOSTA ", parente.get_Proposta())); - arquivoDigitalViewModel.Assunto = str; - this.Corpo = string.Concat("PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU SEGURO."); - malaDiretum1.set_Tela(2); - break; - } - case 3: - { - parcela = (Parcela)this.Filtro.get_Parente(); - malaDiretum1.set_Apolice(parcela.get_Documento()); - malaDiretum1.set_Parcela(parcela); - List items1 = await base.CarregarItem(parcela.get_Documento().get_Controle().get_Id(), 0); - MalaDireta malaDiretum4 = malaDiretum1; - if (items1.Count > 1) - { - item1 = new Item(); - item1.set_Id((long)0); - item1.set_Descricao("APÓLICE COLETIVA"); - } - else - { - item1 = items1.FirstOrDefault(); - } - malaDiretum4.set_Item(item1); - ArquivoDigitalViewModel arquivoDigitalViewModel1 = this; - str1 = (parcela.get_Documento().get_Apolice() != string.Empty ? string.Format("DOCUMENTOS REFERENTE A PARCELA {0} DA APÓLICE {1}", parcela.get_NumeroParcela(), parcela.get_Documento().get_Apolice()) : string.Format("DOCUMENTOS REFERENTE A PARCELA {0} DA PROPOSTA {1}", parcela.get_NumeroParcela(), parcela.get_Documento().get_Proposta())); - arquivoDigitalViewModel1.Assunto = str1; - this.Corpo = string.Concat("PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES AS PARCELAS DE SEU SEGURO."); - malaDiretum1.set_Tela(5); - break; - } - case 4: - { - Item parente1 = (Item)this.Filtro.get_Parente(); - malaDiretum1.set_Apolice(parente1.get_Documento()); - malaDiretum1.set_Item(parente1); - this.Assunto = string.Concat("DOCUMENTOS REFERENTES AO ITEM ", parente1.get_Descricao()); - this.Corpo = string.Concat("PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES AO SEU BEM."); - malaDiretum1.set_Tela(3); - break; - } - case 5: - { - Sinistro sinistro = (Sinistro)this.Filtro.get_Parente(); - malaDiretum1.set_Sinistro(sinistro); - malaDiretum1.set_Item(sinistro.get_ControleSinistro().get_Item()); - malaDiretum1.set_Apolice(sinistro.get_ControleSinistro().get_Item().get_Documento()); - this.Titulo = string.Concat("DOCUMENTOS REFERENTES AO SINITRO ", sinistro.get_Numero()); - string[] nome = new string[] { "PREZADO CLIENTE ", this.SelectedCliente.get_Nome(), ", EM ANEXO OS DOCUMENTOS REFERENTES SINISTRO DO ITEM ", sinistro.get_ControleSinistro().get_Item().get_Descricao(), "." }; - this.Corpo = string.Concat(nome); - malaDiretum1.set_Tela(7); - break; - } - default: - { - if (tipo == 11) - { - Prospeccao prospeccao = (Prospeccao)this.Filtro.get_Parente(); - malaDiretum1.set_Prospeccao(prospeccao); - malaDiretum1.get_Cliente().set_Id((long)0); - this.Assunto = string.Concat("DOCUMENTOS REFERENTES PROSPECÇÃO ", prospeccao.get_Nome()); - this.Corpo = ""; - malaDiretum1.set_Tela(33); - break; - } - else - { - this.SelectedCliente = (Cliente)this.Filtro.get_Parente(); - this.Titulo = string.Concat("ARQUIVO DIGITAL DO CLIENTE \"", this.SelectedCliente.get_Nome(), "\""); - break; - } - } - } - parente = null; - parcela = null; - malaDiretum = malaDiretum1; - } - else - { - await base.ShowMessage("É NECESSÁRIO SELECIONAR AO MENOS UM ARQUIVO PARA ENVIO.", "OK", "", false); - malaDiretum = null; - } - malaDiretum1 = null; - return malaDiretum; - } - - public async Task SalvarAnexos() - { - if (this.ArquivosAnexados != null && this.ArquivosAnexados.Count != 0) - { - this.Carregando = true; - List list = this.ArquivosAnexados.ToList(); - if (await base.SalvarAttachments(list, this.Filtro.get_Tipo(), this.Filtro.get_Id())) - { - await this.CarregaArquivos(); - this.ArquivosAnexados = new ObservableCollection(); - this.Carregando = false; - } - else - { - this.Carregando = false; - } - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs b/Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs deleted file mode 100644 index 2aff10f..0000000 --- a/Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs +++ /dev/null @@ -1,196 +0,0 @@ -using Gestor.Application.Servicos.Generic; -using Gestor.Application.Servicos.Seguros; -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -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 _expedicoes = new ObservableCollection(); - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public ObservableCollection Expedicoes - { - get - { - return this._expedicoes; - } - set - { - this._expedicoes = value; - base.OnPropertyChanged("Expedicoes"); - } - } - - public Expedicao SelectedExpedicao - { - get - { - return this._selectedExpedicao; - } - set - { - long? nullable; - this._selectedExpedicao = value; - if (value != null) - { - nullable = new long?(value.get_Id()); - } - else - { - nullable = null; - } - base.VerificarEnables(nullable); - base.OnPropertyChanged("SelectedExpedicao"); - } - } - - public ExpedicaoViewModel(Documento documento) - { - this._servico = new ExpedicaoServico(); - this._documento = documento; - this.Seleciona(documento); - } - - public async void CancelarAlteracao() - { - Expedicao expedicao; - this.Carregando = true; - long id = this.SelectedExpedicao.get_Id(); - await this.Carregar(this.SelectedExpedicao.get_Apolice()); - ExpedicaoViewModel expedicaoViewModel = this; - if (this.Expedicoes.Count <= 0 || id <= (long)0) - { - expedicao = (this.Expedicoes.Count <= 0 || id != 0 ? new Expedicao() : this.Expedicoes.First()); - } - else - { - expedicao = this.Expedicoes.FirstOrDefault((Expedicao x) => x.get_Id() == id); - } - expedicaoViewModel.SelectedExpedicao = expedicao; - base.Alterar(false); - this.Carregando = false; - } - - private async Task Carregar(Documento documento) - { - this.Expedicoes = new ObservableCollection(await this._servico.BuscarExpedicoes(documento)); - } - - public async Task Excluir() - { - bool flag; - Expedicao expedicao; - if (this.SelectedExpedicao == null || this.SelectedExpedicao.get_Id() == 0) - { - flag = false; - } - else if (await base.ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO", false)) - { - this.Carregando = true; - if (await this._servico.Delete(this.SelectedExpedicao)) - { - int num = this.Expedicoes.IndexOf(this.SelectedExpedicao); - this.Expedicoes.Remove(this.SelectedExpedicao); - if (this.Expedicoes.Count <= 0) - { - this.SelectedExpedicao = new Expedicao(); - } - else - { - ExpedicaoViewModel expedicaoViewModel = this; - expedicao = (num < this.Expedicoes.Count ? this.Expedicoes.ElementAt(num) : this.Expedicoes.Last()); - expedicaoViewModel.SelectedExpedicao = expedicao; - } - this.Carregando = false; - flag = true; - } - else - { - this.Carregando = false; - flag = false; - } - } - else - { - flag = false; - } - return flag; - } - - public void Incluir() - { - Expedicao expedicao = new Expedicao(); - expedicao.set_Apolice(this._documento); - this.SelectedExpedicao = expedicao; - base.Alterar(true); - } - - public async Task>> Salvar() - { - List> keyValuePairs; - this.SelectedExpedicao = await this._servico.Save(this.SelectedExpedicao); - if (this._servico.Sucesso) - { - long id = this.SelectedExpedicao.get_Id(); - await this.Carregar(this.SelectedExpedicao.get_Apolice()); - this.SelectedExpedicao = this.Expedicoes.FirstOrDefault((Expedicao x) => x.get_Id() == id); - base.Alterar(false); - keyValuePairs = null; - } - else - { - keyValuePairs = null; - } - return keyValuePairs; - } - - private async void Seleciona(Documento documento) - { - this.Carregando = true; - await base.PermissaoTela(46); - await this.Carregar(documento); - if (this.Expedicoes.Count <= 0) - { - this.SelectedExpedicao = new Expedicao(); - base.Alterar(false); - base.EnableMenu = false; - } - else - { - this.SelectedExpedicao = this.Expedicoes.First(); - } - this.Carregando = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/ExtratosViewModel.cs b/Gestor.Application/ViewModels/Drawer/ExtratosViewModel.cs deleted file mode 100644 index f07bd68..0000000 --- a/Gestor.Application/ViewModels/Drawer/ExtratosViewModel.cs +++ /dev/null @@ -1,5516 +0,0 @@ -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; -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.Generic; -using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; -using Gestor.Model.Domain.Seguros; -using NReco.PdfGenerator; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class ExtratosViewModel : BaseSegurosViewModel - { - private readonly ClienteServico _clienteServico = new ClienteServico(); - - private List _documentos; - - private List _prospeccoes; - - private List _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 _itensSelecionados; - - internal Relatorio? TipoDeRelatorio; - - public bool BeneficiariosItens - { - get - { - return this._beneficiariosItens; - } - set - { - this._beneficiariosItens = value; - base.OnPropertyChanged("BeneficiariosItens"); - } - } - - public bool BeneficiariosItensEnabled - { - get - { - return this._beneficiariosItensEnabled; - } - set - { - this._beneficiariosItensEnabled = value; - base.OnPropertyChanged("BeneficiariosItensEnabled"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public bool ClientePorPagina - { - get - { - return this._clientePorPagina; - } - set - { - this._clientePorPagina = value; - base.OnPropertyChanged("ClientePorPagina"); - } - } - - public bool ClientePorPaginaEnabled - { - get - { - return this._clientePorPaginaEnabled; - } - set - { - this._clientePorPaginaEnabled = value; - base.OnPropertyChanged("ClientePorPaginaEnabled"); - } - } - - public Visibility ClientePorPaginaVisibility - { - get - { - return this._clientePorPaginaVisibility; - } - set - { - this._clientePorPaginaVisibility = value; - base.OnPropertyChanged("ClientePorPaginaVisibility"); - } - } - - public List Clientes - { - get - { - return this._clientes; - } - set - { - this._clientes = value; - base.OnPropertyChanged("Clientes"); - } - } - - public bool ClienteVisibility - { - get - { - return this._clienteVisibility; - } - set - { - this._clienteVisibility = value; - base.OnPropertyChanged("ClienteVisibility"); - } - } - - public bool Coberturas - { - get - { - return this._coberturas; - } - set - { - this._coberturas = value; - base.OnPropertyChanged("Coberturas"); - } - } - - public bool CoberturasEnabled - { - get - { - return this._coberturasEnabled; - } - set - { - this._coberturasEnabled = value; - base.OnPropertyChanged("CoberturasEnabled"); - } - } - - public bool ComissaoDocumento - { - get - { - return this._comissaoDocumento; - } - set - { - this._comissaoDocumento = value; - base.OnPropertyChanged("ComissaoDocumento"); - } - } - - public bool ComissaoDocumentoEnabled - { - get - { - return this._comissaoDocumentoEnabled; - } - set - { - this._comissaoDocumentoEnabled = value; - base.OnPropertyChanged("ComissaoDocumentoEnabled"); - } - } - - public List Documentos - { - get - { - return this._documentos; - } - set - { - this._documentos = value; - base.OnPropertyChanged("Documentos"); - } - } - - public bool DocumentoVisibility - { - get - { - return this._documentoVisibility; - } - set - { - this._documentoVisibility = value; - base.OnPropertyChanged("DocumentoVisibility"); - } - } - - public bool EndossoEnabled - { - get - { - return this._endossoEnabled; - } - set - { - this._endossoEnabled = value; - base.OnPropertyChanged("EndossoEnabled"); - } - } - - public bool Endossos - { - get - { - return this._endossos; - } - set - { - this._endossos = value; - if (this.SomenteEndossos != !value) - { - this.SomenteEndossos = !value; - } - base.OnPropertyChanged("Endossos"); - } - } - - public Visibility EndossoVisibility - { - get - { - return this._endossoVisibility; - } - set - { - this._endossoVisibility = value; - base.OnPropertyChanged("EndossoVisibility"); - } - } - - public bool EsconderResumido - { - get - { - return this._esconderResumido; - } - set - { - this._esconderResumido = value; - base.OnPropertyChanged("EsconderResumido"); - } - } - - public bool ExtratoPorPagina - { - get - { - return this._extratoPorPagina; - } - set - { - this._extratoPorPagina = value; - base.OnPropertyChanged("ExtratoPorPagina"); - } - } - - public bool ExtratoResumido - { - get - { - return this._extratoResumido; - } - set - { - this._extratoResumido = value; - if (!value) - { - this.ClienteVisibility = true; - this.DocumentoVisibility = true; - this.ItemVisibility = true; - this.AjustaTipoSelecionado(this.SelectedTipoExtrato); - } - else - { - this.ClienteVisibility = false; - this.DocumentoVisibility = false; - this.ItemVisibility = this.CoberturasEnabled; - this.SelecionarItensVisibility = Visibility.Collapsed; - this.BeneficiariosItensEnabled = false; - this.ObsItemEnabled = false; - this.SepararPaginaEnabled = false; - } - base.OnPropertyChanged("ExtratoResumido"); - } - } - - public bool ItemVisibility - { - get - { - return this._itemVisibility; - } - set - { - this._itemVisibility = value; - base.OnPropertyChanged("ItemVisibility"); - } - } - - public bool ObsApolice - { - get - { - return this._obsApolice; - } - set - { - this._obsApolice = value; - base.OnPropertyChanged("ObsApolice"); - } - } - - public bool ObsApoliceEnabled - { - get - { - return this._obsApoliceEnabled; - } - set - { - this._obsApoliceEnabled = value; - base.OnPropertyChanged("ObsApoliceEnabled"); - } - } - - public bool ObsCliente - { - get - { - return this._obsCliente; - } - set - { - this._obsCliente = value; - base.OnPropertyChanged("ObsCliente"); - } - } - - public bool ObsClienteEnabled - { - get - { - return this._obsClienteEnabled; - } - set - { - this._obsClienteEnabled = value; - base.OnPropertyChanged("ObsClienteEnabled"); - } - } - - public Visibility ObsDocVisibility - { - get - { - return this._obsDocVisibility; - } - set - { - this._obsDocVisibility = value; - base.OnPropertyChanged("ObsDocVisibility"); - } - } - - public bool ObsItem - { - get - { - return this._obsItem; - } - set - { - this._obsItem = value; - base.OnPropertyChanged("ObsItem"); - } - } - - public bool ObsItemEnabled - { - get - { - return this._obsItemEnabled; - } - set - { - this._obsItemEnabled = value; - base.OnPropertyChanged("ObsItemEnabled"); - } - } - - public bool PerfilCondutor - { - get - { - return this._perfilCondutor; - } - set - { - this._perfilCondutor = value; - base.OnPropertyChanged("PerfilCondutor"); - } - } - - public bool PerfilCondutorEnabled - { - get - { - return this._perfilCondutorEnabled; - } - set - { - this._perfilCondutorEnabled = value; - base.OnPropertyChanged("PerfilCondutorEnabled"); - } - } - - public bool PerfilVisibility - { - get - { - return this._perfilVisibility; - } - set - { - this._perfilVisibility = value; - base.OnPropertyChanged("PerfilVisibility"); - } - } - - public bool PremioParcela - { - get - { - return this._premioParcela; - } - set - { - this._premioParcela = value; - base.OnPropertyChanged("PremioParcela"); - } - } - - public List Prospeccoes - { - get - { - return this._prospeccoes; - } - set - { - this._prospeccoes = value; - base.OnPropertyChanged("Prospeccoes"); - } - } - - public bool SegurosVigentes - { - get - { - return this._segurosVigentes; - } - set - { - this._segurosVigentes = value; - base.OnPropertyChanged("SegurosVigentes"); - } - } - - public Visibility SegurosVigentesVisibility - { - get - { - return this._segurosVigentesVisibility; - } - set - { - this._segurosVigentesVisibility = value; - base.OnPropertyChanged("SegurosVigentesVisibility"); - } - } - - public bool SelecionarItens - { - get - { - return this._selecionarItens; - } - set - { - this._selecionarItens = value; - if (!value) - { - this._itensSelecionados = new List(); - } - base.OnPropertyChanged("SelecionarItens"); - } - } - - public Visibility SelecionarItensVisibility - { - get - { - return this._selecionarItensVisibility; - } - set - { - this._selecionarItensVisibility = value; - base.OnPropertyChanged("SelecionarItensVisibility"); - } - } - - public TipoExtrato SelectedTipoExtrato - { - get - { - return this._selectedTipoExtrato; - } - set - { - this._selectedTipoExtrato = value; - this.AjustaTipoSelecionado(value); - base.OnPropertyChanged("SelectedTipoExtrato"); - } - } - - public bool SepararPagina - { - get - { - return this._separarPagina; - } - set - { - this._separarPagina = value; - base.OnPropertyChanged("SepararPagina"); - } - } - - public bool SepararPaginaEnabled - { - get - { - return this._separarPaginaEnabled; - } - set - { - this._separarPaginaEnabled = value; - base.OnPropertyChanged("SepararPaginaEnabled"); - } - } - - public bool SomenteEndossos - { - get - { - return this._somenteEndosso; - } - set - { - this._somenteEndosso = value; - if (this.Endossos != !value) - { - this.Endossos = !value; - } - base.OnPropertyChanged("SomenteEndossos"); - } - } - - public bool TipoExtratoEnabled - { - get - { - return this._tipoExtratoEnabled; - } - set - { - this._tipoExtratoEnabled = value; - base.OnPropertyChanged("TipoExtratoEnabled"); - } - } - - public ExtratosViewModel() - { - } - - public void AjustaTipoSelecionado(TipoExtrato tipoExtrato) - { - switch (tipoExtrato) - { - case 0: - { - this.ClienteVisibility = true; - this.ClientePorPaginaVisibility = Visibility.Hidden; - this.DocumentoVisibility = false; - this.ItemVisibility = false; - this.PerfilVisibility = false; - this.EsconderResumido = true; - this.SelecionarItensVisibility = Visibility.Collapsed; - this.SegurosVigentesVisibility = Visibility.Collapsed; - this.SegurosVigentes = false; - this.EndossoVisibility = Visibility.Collapsed; - this.ObsDocVisibility = Visibility.Collapsed; - this.ExtratoCliente(); - return; - } - case 1: - { - this.ClienteVisibility = true; - this.ClientePorPaginaVisibility = Visibility.Visible; - this.DocumentoVisibility = true; - this.ItemVisibility = true; - this.PerfilVisibility = true; - this.EsconderResumido = false; - this.SelecionarItensVisibility = (!this.TipoDeRelatorio.HasValue ? Visibility.Visible : Visibility.Collapsed); - this.SegurosVigentesVisibility = Visibility.Collapsed; - this.SegurosVigentes = false; - this.EndossoVisibility = Visibility.Visible; - this.ObsDocVisibility = Visibility.Visible; - this.ApoliceSelecionada(); - return; - } - case 2: - { - this.ClienteVisibility = false; - this.ClientePorPaginaVisibility = Visibility.Collapsed; - this.DocumentoVisibility = true; - this.ItemVisibility = false; - this.PerfilVisibility = true; - this.EsconderResumido = false; - this.SelecionarItensVisibility = Visibility.Collapsed; - this.SegurosVigentesVisibility = Visibility.Visible; - this.EndossoVisibility = Visibility.Collapsed; - this.ObsDocVisibility = Visibility.Collapsed; - this.RelacaoApolices(); - return; - } - default: - { - return; - } - } - } - - private void ApoliceSelecionada() - { - this.SetAllFalse(); - this.ObsClienteEnabled = true; - this.ClientePorPaginaEnabled = true; - this.ComissaoDocumentoEnabled = true; - this.ObsApoliceEnabled = true; - this.BeneficiariosItensEnabled = true; - this.ObsItemEnabled = true; - this.SepararPaginaEnabled = true; - this.PerfilCondutorEnabled = true; - this.EndossoEnabled = true; - this.CoberturasEnabled = true; - } - - private void ExtratoCliente() - { - this.SetAllFalse(); - this.ObsClienteEnabled = true; - } - - public async Task Gerar(Relatorio? tipoRelatorio = null, bool pdf = false) - { - DateTime date; - List items; - int numeroParcela; - DateTime? clienteDesde; - EstadoCivil? estadoCivil; - Sexo? sexo; - TipoTelefone? nullable; - TipoTelefone tipoTelefone; - decimal premioLiquido; - List controleSinistros; - long id; - Patrimonial patrimonial; - Auto auto; - TipoCobertura? tipoCobertura; - int? bonus; - TabelaReferencia? tabelaReferencia; - Vida vida; - RiscosDiversos riscosDiverso; - Aeronautico aeronautico; - Granizo granizo; - string str14; - string str15; - string str16; - string str17; - string str18; - string str19; - string str20; - string str21; - string str22; - string shortDateString; - string str23; - string str24; - string shortDateString1; - string str25; - string str26; - string str27; - string str28; - string str29; - string str30; - string str31; - string str32; - string shortDateString2; - string str33; - string str34; - string str35; - string str36; - string str37; - string str38; - string str39; - string str40; - string str41; - string str42; - string str43; - string str44; - string str45; - string str46; - string str47; - string str48; - string shortDateString3; - string str49; - string str50; - string str51; - string str52; - string str53; - string endosso; - string str54; - string str55; - string str56; - string str57; - string str58; - string str59; - string str60; - string str61; - string str62; - string str63; - string str64; - string str65; - string str66; - string str67; - string str68; - string str69; - string str70; - string str71; - string str72; - string shortDateString4; - string str73; - string shortDateString5; - string str74; - string str75; - string str76; - string str77; - string str78; - string str79; - string str80; - string str81; - string str82; - string str83; - string str84; - string str85; - string str86; - string str87; - string str88; - string str89; - string str90; - string description; - string str91; - string str92; - string str93; - string str94; - string description1; - string str95; - string str96; - string str97; - string str98; - string str99; - string str100; - string str101; - string str102; - string str103; - string str104; - string str105; - string str106; - DateTime? dataReclamacao; - string shortDateString6; - string str107; - string description2; - string str108; - string str109; - string currency; - string str110; - string str111; - string descricao; - string str112; - string str113; - string str114; - string str115; - string str116; - string str117; - string str118; - string shortDateString7; - string str119; - string str120; - string str121; - string str122; - string str123; - string str124; - string str125; - string str126; - string str127; - string str128; - string str129; - string str130; - string str131; - string str132; - string str133; - string str134; - string str135; - string str136; - string str137; - string str138; - string str139; - string str140; - string str141; - string str142; - string str143; - string str144; - string str145; - string str146; - string str147; - string str148; - string str149; - string str150; - string str151; - string str152; - string str153; - string str154; - string str155; - string str156; - string str157; - string str158; - string str159; - string str160; - string str161; - string str162; - string str163; - bool count; - string str164; - string str165; - string str166; - string str167; - string str168; - string str169; - string str170; - string str171; - string str172; - string str173; - string str174; - string str175; - NegocioCorretora negocioCorretora; - string str176; - string str177; - string str178; - string str179; - string shortDateString8; - string str180; - string str181; - string str182; - string str183; - string str184; - string str185; - string shortDateString9; - string str186; - string str187; - string str188; - string str189; - string str190; - string str191; - string str192; - string str193; - string str194; - string str195; - string str196; - string str197; - string str198; - string str199; - string str200; - string str201; - string str202; - string str203; - string str204; - string str205; - string str206; - string str207; - string str208; - string str209; - string str210; - string str211; - string str212; - string str213; - string str214; - string str215; - string str216; - string str217; - string str218; - string str219; - string str220; - string str221; - string str222; - string str223; - string str224; - string shortDateString10; - string str225; - string str226; - string str227; - string str228; - string str229; - string shortDateString11; - string str230; - string shortDateString12; - string str231; - string shortDateString13; - string str232; - string str233; - string str234; - string str235; - string str236; - string str237; - string str238; - string str239; - string str240; - string str241; - string str242; - string str243; - Documento documento; - string str244; - string str245; - string str246; - string shortDateString14; - string str247; - string str248; - string str249; - string str250; - string str251; - string endosso1; - string str252; - string str253; - string str254; - string str255; - string str256; - string str257; - string str258; - string str259; - string str260; - string str261; - string str262; - string str263; - string str264; - string str265; - string str266; - string str267; - string str268; - string str269; - string str270; - string str271; - string str272; - string str273; - string str274; - string str275; - string str276; - string str277; - string description3; - string str278; - string str279; - string str280; - string str281; - string description4; - string str282; - string str283; - string str284; - string str285; - string str286; - string str287; - string str288; - string str289; - string str290; - string str291; - DateTime? dataReclamacao1; - string shortDateString15; - string str292; - string str293; - string str294; - string str295; - string descricao1; - string str296; - string str297; - string str298; - string str299; - string str300; - string str301; - string str302; - string shortDateString16; - string str303; - string str304; - string str305; - string str306; - string str307; - string str308; - string str309; - string str310; - string str311; - string str312; - string str313; - string str314; - string str315; - string str316; - string str317; - string str318; - string str319; - string str320; - string str321; - string str322; - string str323; - string str324; - string str325; - string str326; - string str327; - string str328; - string str329; - string str330; - string str331; - NegocioCorretora negocioCorretora1; - string str332; - string str333; - string str334; - string str335; - string str336; - string str337; - string str338; - string str339; - string str340; - string str341; - string str342; - string str343; - string str344; - string str345; - string str346; - string str347; - string str348; - string str349; - string str350; - string str351; - string str352; - string shortDateString17; - string str353; - string str354; - string str355; - string str356; - string str357; - string str358; - string str359; - string str360; - string str361; - string str362; - string str363; - string str364; - string str365; - string str366; - string str367; - string str368; - string str369; - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable9 = null; - int num10; - List list; - Item item = null; - Item item1; - string str370; - string str371 = ""; - if (this.Clientes != null && this.Documentos == null) - { - str371 = string.Concat(str371, ""); - str367 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str367, " DO CLIENTE"); - str371 = string.Concat(str371, str370); - str371 = string.Concat(str371, "
"); - str371 = string.Concat(str371, ""); - long id1 = (long)0; - this.Clientes.ForEach((Cliente x) => { - TipoTelefone? tipo; - TipoTelefone valueOrDefault; - string str; - string str1; - string upper; - string str2; - string str3; - string str4; - string upper1; - string str5; - string str6; - string str7; - string str8; - int num = 0; - if (id1 != x.get_Id()) - { - id1 = x.get_Id(); - str371 = string.Concat(str371, (!this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
")); - str371 = string.Concat(str371, "

"); - str370 = string.Concat("EXTRATO", (this.ExtratoResumido ? " RESUMIDO" : ""), " DO CLIENTE: ", x.get_Nome()); - str371 = string.Concat(str371, str370, "


"); - string str9 = (x.get_Atividade() == null ? "NASCIMENTO" : "ABERTURA"); - bool pessoaFisica = x.get_PessoaFisica(); - ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals1 = variable9; - string[] strArrays = new string[] { str371, ""; - cSu0024u003cu003e8_locals1.html = string.Concat(strArrays); - if (!pessoaFisica) - { - num++; - } - else - { - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable = variable9; - string[] cSu0024u003cu003e8_locals11 = new string[] { str371, ""; - variable.html = string.Concat(cSu0024u003cu003e8_locals11); - } - str371 = string.Concat(str371, ""); - if (x.get_Atividade() != null) - { - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable1 = variable9; - string[] nome = new string[] { str371, ""; - variable1.html = string.Concat(nome); - if (!pessoaFisica) - { - num++; - } - } - if (this.SelectedTipoExtrato != 2) - { - str371 = string.Concat(str371, ""); - if (pessoaFisica) - { - ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals12 = variable9; - string[] strArrays1 = new string[] { str371, ""; - cSu0024u003cu003e8_locals12.html = string.Concat(strArrays1); - } - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable2 = variable9; - string[] strArrays2 = new string[] { str371, ""; - cSu0024u003cu003e8_locals13.html = string.Concat(strArrays3); - } - if (!string.IsNullOrWhiteSpace(x.get_Identidade())) - { - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable3 = variable9; - string[] cSu0024u003cu003e8_locals14 = new string[] { str371, ""; - variable3.html = string.Concat(cSu0024u003cu003e8_locals14); - } - if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable4 = variable9; - string[] strArrays4 = new string[] { str371, ""; - variable4.html = string.Concat(strArrays4); - } - if ((x.get_Telefones() != null || x.get_Emails() != null) && this.SelectedTipoExtrato != 2) - { - str371 = string.Concat(str371, ""); - if (x.get_Telefones() != null) - { - string str10 = ""; - foreach (ClienteTelefone telefone in x.get_Telefones()) - { - string[] prefixo = new string[] { str10, "
", null, null, null, null, null }; - tipo = telefone.get_Tipo(); - if (tipo.HasValue) - { - valueOrDefault = tipo.GetValueOrDefault(); - upper1 = valueOrDefault.ToString().ToUpper(); - } - else - { - upper1 = null; - } - prefixo[2] = upper1; - prefixo[3] = " ("; - prefixo[4] = telefone.get_Prefixo(); - prefixo[5] = ") "; - prefixo[6] = telefone.get_Numero(); - str10 = string.Concat(prefixo); - } - ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals15 = variable9; - string[] strArrays5 = new string[] { str371, "
"; - cSu0024u003cu003e8_locals15.html = string.Concat(strArrays5); - } - if (x.get_Emails() != null && !this.ExtratoResumido) - { - string str11 = ""; - foreach (ClienteEmail email in x.get_Emails()) - { - str11 = string.Concat(str11, "
", email.get_Email()); - } - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable5 = variable9; - string[] cSu0024u003cu003e8_locals16 = new string[] { str371, "
"; - variable5.html = string.Concat(cSu0024u003cu003e8_locals16); - } - num++; - str371 = string.Concat(str371, ""); - } - if (x.get_Enderecos() != null && this.SelectedTipoExtrato != 2) - { - string str12 = ""; - foreach (ClienteEndereco endereco in x.get_Enderecos()) - { - string[] bairro = new string[] { str12, "
", endereco.get_Endereco(), ", ", endereco.get_Numero(), ", ", null, null, null, null, null, null, null, null }; - bairro[6] = (string.IsNullOrWhiteSpace(endereco.get_Complemento()) ? "" : string.Concat(endereco.get_Complemento(), ", ")); - bairro[7] = endereco.get_Bairro(); - bairro[8] = " - "; - bairro[9] = endereco.get_Cidade(); - bairro[10] = " - "; - bairro[11] = endereco.get_Estado(); - bairro[12] = " - "; - bairro[13] = endereco.get_Cep(); - str12 = string.Concat(bairro); - } - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable6 = variable9; - string[] strArrays6 = new string[] { str371, "
"; - variable6.html = string.Concat(strArrays6); - } - if (x.get_Profissao() != null && this.SelectedTipoExtrato != 2) - { - ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals17 = variable9; - string[] nome1 = new string[] { str371, ""; - cSu0024u003cu003e8_locals17.html = string.Concat(nome1); - } - if (x.get_Contatos() != null && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - string str13 = ""; - foreach (MaisContato contato in x.get_Contatos()) - { - string[] nome2 = new string[15]; - nome2[0] = str13; - nome2[1] = "
NOME: "; - nome2[2] = contato.get_Nome(); - nome2[3] = (!string.IsNullOrWhiteSpace(contato.get_Documento()) ? string.Concat(", DOCUMENTO: ", contato.get_Documento()) : ""); - nascimento = contato.get_Nascimento(); - if (nascimento.HasValue) - { - nascimento = contato.get_Nascimento(); - str = string.Concat(", NASCIMENTO: ", (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null)); - } - else - { - str = ""; - } - nome2[4] = str; - Parentesco? parentesco = contato.get_Parentesco(); - if (parentesco.HasValue) - { - parentesco = contato.get_Parentesco(); - str1 = string.Concat(", PARENTESCO: ", (parentesco.HasValue ? parentesco.GetValueOrDefault().ToString().ToUpper() : null)); - } - else - { - str1 = ""; - } - nome2[5] = str1; - nome2[6] = (!string.IsNullOrWhiteSpace(contato.get_Banco()) || !string.IsNullOrWhiteSpace(contato.get_Agencia()) || !string.IsNullOrWhiteSpace(contato.get_Conta()) ? "
" : ""); - nome2[7] = (!string.IsNullOrWhiteSpace(contato.get_Banco()) ? string.Concat("BANCO: ", contato.get_Banco()) : ""); - nome2[8] = (!string.IsNullOrWhiteSpace(contato.get_Agencia()) ? string.Concat((!string.IsNullOrWhiteSpace(contato.get_Banco()) ? ", AGÊNCIA: " : "AGÊNCIA: "), contato.get_Agencia()) : ""); - nome2[9] = (!string.IsNullOrWhiteSpace(contato.get_Conta()) ? string.Concat((!string.IsNullOrWhiteSpace(contato.get_Banco()) || !string.IsNullOrWhiteSpace(contato.get_Agencia()) ? ", CONTA: " : "CONTA: "), contato.get_Conta()) : ""); - tipo = contato.get_Tipo(); - nome2[10] = (tipo.HasValue || !string.IsNullOrWhiteSpace(contato.get_Prefixo()) && !string.IsNullOrWhiteSpace(contato.get_Telefone()) || !string.IsNullOrWhiteSpace(contato.get_Email()) ? "
" : ""); - tipo = contato.get_Tipo(); - if (tipo.HasValue) - { - tipo = contato.get_Tipo(); - if (tipo.HasValue) - { - valueOrDefault = tipo.GetValueOrDefault(); - upper = valueOrDefault.ToString().ToUpper(); - } - else - { - upper = null; - } - str2 = string.Concat("TIPO DO TELEFONE: ", upper); - } - else - { - str2 = ""; - } - nome2[11] = str2; - if (string.IsNullOrWhiteSpace(contato.get_Prefixo()) || string.IsNullOrWhiteSpace(contato.get_Telefone())) - { - str3 = ""; - } - else - { - tipo = contato.get_Tipo(); - str3 = string.Concat((tipo.HasValue ? ", TELEFONE: (" : "TELEFONE: ("), contato.get_Prefixo(), ") ", contato.get_Telefone()); - } - nome2[12] = str3; - if (!string.IsNullOrWhiteSpace(contato.get_Email())) - { - tipo = contato.get_Tipo(); - str4 = string.Concat((tipo.HasValue || !string.IsNullOrWhiteSpace(contato.get_Prefixo()) && !string.IsNullOrWhiteSpace(contato.get_Telefone()) ? ", EMAIL: " : "EMAIL: "), contato.get_Email()); - } - else - { - str4 = ""; - } - nome2[13] = str4; - nome2[14] = "
"; - str13 = string.Concat(nome2); - } - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable7 = variable9; - string[] strArrays7 = new string[] { str371, "
"; - variable7.html = string.Concat(strArrays7); - } - if (this.ObsCliente && this.ClienteVisibility && this.ObsClienteEnabled && !string.IsNullOrWhiteSpace(x.get_Observacao()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - x.set_Observacao(string.Concat("
", x.get_Observacao().Replace("\r\n", "
"))); - ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals18 = variable9; - string[] observacao = new string[] { str371, "
"; - cSu0024u003cu003e8_locals18.html = string.Concat(observacao); - } - if (!string.IsNullOrWhiteSpace(x.get_Pasta()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable8 = variable9; - string[] pasta = new string[] { str371, ""; - variable8.html = string.Concat(pasta); - } - str371 = string.Concat(str371, "

CLIENTE: ", x.get_Nome(), "

CPF/CNPJ: ", x.get_Documento(), "

", str9, ": ", null, null }; - DateTime? nascimento = x.get_Nascimento(); - strArrays[20] = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); - strArrays[21] = "

FALECIDO: "; - cSu0024u003cu003e8_locals11[4] = (x.get_Falecido() ? "SIM" : "NÃO"); - cSu0024u003cu003e8_locals11[5] = "

RAMO DE ATIVIDADE: "; - nome[4] = x.get_Atividade().get_Nome(); - nome[5] = "

ESTADO CIVIL: "; - strArrays1[4] = (x.get_EstadoCivil().HasValue ? x.get_EstadoCivil().ToString().ToUpper() : "-"); - strArrays1[5] = "

SEXO: "; - strArrays1[8] = (x.get_Sexo().HasValue ? x.get_Sexo().ToString().ToUpper() : "-"); - strArrays1[9] = "

HABILITAÇÃO: ", (!string.IsNullOrWhiteSpace(x.get_Habilitacao()) ? x.get_Habilitacao() : "-"), "

CATEGORIA: ", (!string.IsNullOrWhiteSpace(x.get_CategoriaHabilitacao()) ? x.get_CategoriaHabilitacao() : "-"), "

1ª HAB.: ", null, null, null, null, null, null }; - nascimento = x.get_PrimeiraHabilitacao(); - if (nascimento.HasValue) - { - nascimento = x.get_PrimeiraHabilitacao(); - str6 = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); - } - else - { - str6 = "-"; - } - strArrays3[12] = str6; - strArrays3[13] = "

VENCIMENTO: "; - nascimento = x.get_VencimentoHabilitacao(); - if (nascimento.HasValue) - { - nascimento = x.get_VencimentoHabilitacao(); - str7 = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); - } - else - { - str7 = "-"; - } - strArrays3[16] = str7; - strArrays3[17] = "

RG: ", (!string.IsNullOrWhiteSpace(x.get_Identidade()) ? x.get_Identidade() : "-"), "

ORGÃO EMISSOR: ", (!string.IsNullOrWhiteSpace(x.get_Emissor()) ? x.get_Emissor() : "-"), "

ESTADO EMISSOR: ", (!string.IsNullOrWhiteSpace(x.get_EstadoEmissor()) ? x.get_EstadoEmissor() : "-"), "

EXPEDIÇÃO: "; - nascimento = x.get_Expedicao(); - if (nascimento.HasValue) - { - nascimento = x.get_Expedicao(); - str5 = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null); - } - else - { - str5 = "-"; - } - cSu0024u003cu003e8_locals14[16] = str5; - cSu0024u003cu003e8_locals14[17] = "

BANCO: ", (x.get_Banco() != null ? x.get_Banco().get_Nome() : "-"), "

AGÊNCIA: ", (!string.IsNullOrWhiteSpace(x.get_Agencia()) ? x.get_Agencia() : "-"), "

CONTA: ", (!string.IsNullOrWhiteSpace(x.get_Conta()) ? x.get_Conta() : "-"), "

TIPO: "; - strArrays4[16] = (!string.IsNullOrWhiteSpace(x.get_TipoConta()) ? x.get_TipoConta() : "-"); - strArrays4[17] = "

CONTATOS: "; - strArrays5[4] = str10; - strArrays5[5] = "

EMAILS: "; - cSu0024u003cu003e8_locals16[4] = str11; - cSu0024u003cu003e8_locals16[5] = "

ENDEREÇOS: "; - strArrays6[4] = str12; - strArrays6[5] = "

PROFISSÃO: "; - nome1[4] = x.get_Profissao().get_Nome(); - nome1[5] = "

MAIS CONTATOS: "; - strArrays7[4] = str13; - strArrays7[5] = "

OBSERVAÇÕES: "; - observacao[4] = x.get_Observacao(); - observacao[5] = "

PASTA: "; - pasta[4] = x.get_Pasta(); - pasta[5] = "

"); - str371 = string.Concat(str371, (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
")); - } - }); - DateTime networkTime = Funcoes.GetNetworkTime(); - string[] strArrays8 = new string[] { str371, "

", Recursos.Usuario.get_Nome(), " - ", null, null }; - date = networkTime.Date; - strArrays8[4] = date.ToShortDateString(); - strArrays8[5] = "
"; - str371 = string.Concat(strArrays8); - string tempPath = Path.GetTempPath(); - string str372 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (TipoExtrato)0, networkTime); - if (!pdf) - { - StreamWriter streamWriter = new StreamWriter(str372, true, Encoding.UTF8); - streamWriter.Write(str371); - streamWriter.Close(); - } - else - { - str372 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.pdf", tempPath, (TipoExtrato)0, networkTime); - File.WriteAllBytes(str372, (new NRecoHtmlToPdfConverter()).GeneratePdf(str371)); - } - Process.Start(str372); - ExtratosViewModel extratosViewModel = this; - str368 = (this.ExtratoResumido ? " RESUMIDO" : ""); - if (this.Clientes != null) - { - str369 = (this.Clientes.Count > 1 ? string.Format("DE {0} CLIENTES", this.Clientes.Count) : string.Concat("DO CLIENTE ", this.Clientes[0].get_Nome())); - } - else - { - str369 = ""; - } - string str373 = string.Concat("GEROU O EXTRATO", str368, " ", str369); - long num11 = (long)0; - TipoTela? nullable1 = new TipoTela?(23); - List clientes = this.Clientes; - extratosViewModel.RegistrarAcao(str373, num11, nullable1, string.Concat("NOMES DOS CLIENTES:\n", string.Join("\n", - from x in clientes - select x.get_Nome()), this.GerarOpcoes())); - this.Documentos = null; - this.Clientes = null; - } - else if ((this.Documentos != null || this.Prospeccoes != null) && this.Clientes == null) - { - str371 = ""; - str370 = ""; - switch (this.SelectedTipoExtrato) - { - case 0: - { - str14 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str14, " DO CLIENTE"); - break; - } - case 1: - { - str364 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str364, " DA APÓLICE SELECIONADA"); - if (!tipoRelatorio.HasValue || tipoRelatorio.GetValueOrDefault() != 4) - { - break; - } - str365 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str365, " DO RELATÓRIO DE RENOVAÇÕES"); - break; - } - case 2: - { - str366 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str366, " DE RELAÇÃO DE APÓLICES"); - break; - } - } - str371 = string.Concat(str371, str370); - str371 = string.Concat(str371, "
"); - List nums = new List(); - if (this.Documentos != null && this.Documentos.Count > 0) - { - List configuracoes = Recursos.Configuracoes; - bool flag = configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 42); - foreach (Documento documento1 in this.Documentos) - { - Documento documento2 = documento1; - ObservableCollection observableCollection = await (new ParcelaServico()).BuscarParcelasAsync(documento1.get_Id()); - documento2.set_Parcelas(observableCollection); - documento2 = null; - Controle controle = documento1.get_Controle(); - Cliente cliente = await this._clienteServico.BuscarCliente(documento1.get_Controle().get_Cliente().get_Id()); - controle.set_Cliente(cliente); - controle = null; - Cliente cliente1 = documento1.get_Controle().get_Cliente(); - ObservableCollection observableCollection1 = await this._clienteServico.BuscarEnderecosAsync(documento1.get_Controle().get_Cliente().get_Id()); - cliente1.set_Enderecos(observableCollection1); - cliente1 = null; - cliente1 = documento1.get_Controle().get_Cliente(); - ObservableCollection observableCollection2 = await this._clienteServico.BuscarEmailsAsync(documento1.get_Controle().get_Cliente().get_Id()); - cliente1.set_Emails(observableCollection2); - cliente1 = null; - cliente1 = documento1.get_Controle().get_Cliente(); - ObservableCollection observableCollection3 = await this._clienteServico.BuscarTelefonesAsync(documento1.get_Controle().get_Cliente().get_Id()); - cliente1.set_Telefones(observableCollection3); - cliente1 = null; - cliente1 = documento1.get_Controle().get_Cliente(); - ObservableCollection observableCollection4 = await this._clienteServico.BuscarContatosAsync(documento1.get_Controle().get_Cliente().get_Id()); - cliente1.set_Contatos(observableCollection4); - cliente1 = null; - } - bool flag1 = true; - foreach (Documento documento3 in this.Documentos) - { - List items1 = new List(); - items = (!this.Endossos ? await (new ItemServico()).BuscarItens(documento3.get_Controle().get_Id(), 0).ToList() : await (new ItemServico()).BuscarItens(documento3.get_Id(), 2).ToList()); - List items2 = items; - if (this._itensSelecionados == null || this._itensSelecionados.Count <= 0) - { - items1.AddRange(items2); - } - else - { - items2.ForEach((Item x) => { - if (this._itensSelecionados.Any((Item y) => y.get_Id() == x.get_Id())) - { - items1.Add(x); - } - }); - } - List perfils = await (new PerfilServico()).BuscarPerfis(documento3.get_Controle().get_Id()); - long num12 = (long)0; - num10 = 0; - if (!flag1) - { - string str374 = str371; - str363 = (this.ExtratoPorPagina ? "
" : ""); - str371 = string.Concat(str374, str363); - } - if (num12 != documento3.get_Controle().get_Cliente().get_Id()) - { - string str375 = str371; - str40 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled || this.ExtratoPorPagina ? "" : "
"); - str371 = string.Concat(str375, str40); - str371 = string.Concat(str371, "

"); - switch (this.SelectedTipoExtrato) - { - case 0: - { - str41 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str41, " DO CLIENTE: ", documento3.get_Controle().get_Cliente().get_Nome()); - break; - } - case 1: - { - str359 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str359, " DA APÓLICE SELECIONADA: ", documento3.get_Apolice()); - if (tipoRelatorio.HasValue && tipoRelatorio.GetValueOrDefault() == 4) - { - str361 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str361, " DA APÓLICE: ", documento3.get_Apolice()); - } - if (!string.IsNullOrEmpty(documento3.get_Endosso()) && !documento3.get_Endosso().Equals("0")) - { - str370 = string.Concat(str370, " E DO ENDOSSO: ", documento3.get_Endosso()); - } - if (!this.SomenteEndossos) - { - break; - } - str360 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str360, " DO ENDOSSO: ", documento3.get_Endosso()); - break; - } - case 2: - { - str362 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str362, " DE RELAÇÃO DE APÓLICES"); - break; - } - } - str371 = string.Concat(str371, str370, "


"); - str371 = string.Concat(str371, ""); - if (!this.ExtratoResumido) - { - if ((!this.Endossos || !this.SomenteEndossos) && !nums.Any((long x) => x == this.documento.get_Controle().get_Id())) - { - str176 = (documento3.get_Controle().get_Cliente().get_Atividade() == null ? "NASCIMENTO" : "ABERTURA"); - string str376 = str176; - bool flag2 = documento3.get_Controle().get_Cliente().get_PessoaFisica(); - string[] documento4 = new string[24]; - documento4[0] = str371; - documento4[1] = ""; - str371 = string.Concat(strArrays9); - } - str371 = string.Concat(str371, ""); - if (documento3.get_Controle().get_Cliente().get_Atividade() != null) - { - string[] strArrays10 = new string[] { str371, ""); - if (documento3.get_Controle().get_Cliente().get_Profissao() == null || this.SelectedTipoExtrato == 2) - { - numeroParcela = num10; - num10 = numeroParcela + 1; - } - else - { - string[] strArrays13 = new string[] { str371, ""; - str371 = string.Concat(strArrays13); - } - str371 = string.Concat(str371, ""); - } - if (flag2) - { - string[] strArrays14 = new string[18]; - strArrays14[0] = str371; - strArrays14[1] = ""; - str371 = string.Concat(strArrays14); - } - if (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade())) - { - string[] strArrays15 = new string[18]; - strArrays15[0] = str371; - strArrays15[1] = ""; - str371 = string.Concat(strArrays15); - } - if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - string[] strArrays16 = new string[18]; - strArrays16[0] = str371; - strArrays16[1] = ""; - str371 = string.Concat(strArrays16); - } - if ((documento3.get_Controle().get_Cliente().get_Telefones() != null || documento3.get_Controle().get_Cliente().get_Emails() != null) && this.SelectedTipoExtrato != 2) - { - str371 = string.Concat(str371, ""); - if (documento3.get_Controle().get_Cliente().get_Telefones() != null) - { - string str378 = ""; - foreach (ClienteTelefone clienteTelefone in documento3.get_Controle().get_Cliente().get_Telefones()) - { - string[] numero = new string[] { str378, "
", null, null, null, null, null, null, null, null }; - nullable = clienteTelefone.get_Tipo(); - if (nullable.HasValue) - { - tipoTelefone = nullable.GetValueOrDefault(); - str208 = tipoTelefone.ToString().ToUpper(); - } - else - { - str208 = null; - } - numero[2] = str208; - numero[3] = " ("; - numero[4] = clienteTelefone.get_Prefixo(); - numero[5] = ") "; - numero[6] = clienteTelefone.get_Numero(); - numero[7] = " ("; - numero[8] = clienteTelefone.get_Observacao(); - numero[9] = ") "; - str378 = string.Concat(numero); - } - string[] strArrays17 = new string[] { str371, "
"; - str371 = string.Concat(strArrays17); - } - if (documento3.get_Controle().get_Cliente().get_Emails() != null && !this.ExtratoResumido) - { - string str379 = ""; - foreach (ClienteEmail clienteEmail in documento3.get_Controle().get_Cliente().get_Emails()) - { - str379 = string.Concat(str379, "
", clienteEmail.get_Email()); - } - string[] strArrays18 = new string[] { str371, "
"; - str371 = string.Concat(strArrays18); - } - else if (documento3.get_Controle().get_Cliente().get_Enderecos() != null && this.SelectedTipoExtrato != 2) - { - string str380 = ""; - foreach (ClienteEndereco clienteEndereco in documento3.get_Controle().get_Cliente().get_Enderecos()) - { - string[] cidade = new string[] { str380, "
", clienteEndereco.get_Endereco(), ", ", clienteEndereco.get_Numero(), ", ", null, null, null, null, null, null, null, null }; - str205 = (string.IsNullOrWhiteSpace(clienteEndereco.get_Complemento()) ? "" : string.Concat(clienteEndereco.get_Complemento(), ", ")); - cidade[6] = str205; - cidade[7] = clienteEndereco.get_Bairro(); - cidade[8] = " - "; - cidade[9] = clienteEndereco.get_Cidade(); - cidade[10] = " - "; - cidade[11] = clienteEndereco.get_Estado(); - cidade[12] = " - "; - cidade[13] = clienteEndereco.get_Cep(); - str380 = string.Concat(cidade); - } - string[] strArrays19 = new string[] { str371, "
"; - str371 = string.Concat(strArrays19); - } - numeroParcela = num10; - num10 = numeroParcela + 1; - str371 = string.Concat(str371, ""); - } - if (documento3.get_Controle().get_Cliente().get_Enderecos() != null && this.SelectedTipoExtrato != 2 && documento3.get_Controle().get_Cliente().get_Emails() == null && this.ExtratoResumido) - { - string str381 = ""; - foreach (ClienteEndereco clienteEndereco1 in documento3.get_Controle().get_Cliente().get_Enderecos()) - { - string[] estado = new string[] { str381, "
", clienteEndereco1.get_Endereco(), ", ", clienteEndereco1.get_Numero(), ", ", null, null, null, null, null, null, null, null }; - str203 = (string.IsNullOrWhiteSpace(clienteEndereco1.get_Complemento()) ? "" : string.Concat(clienteEndereco1.get_Complemento(), ", ")); - estado[6] = str203; - estado[7] = clienteEndereco1.get_Bairro(); - estado[8] = " - "; - estado[9] = clienteEndereco1.get_Cidade(); - estado[10] = " - "; - estado[11] = clienteEndereco1.get_Estado(); - estado[12] = " - "; - estado[13] = clienteEndereco1.get_Cep(); - str381 = string.Concat(estado); - } - string[] strArrays20 = new string[] { str371, "
"; - str371 = string.Concat(strArrays20); - } - if (documento3.get_Controle().get_Cliente().get_Contatos() != null && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - string str382 = ""; - foreach (MaisContato maisContato in documento3.get_Controle().get_Cliente().get_Contatos()) - { - string[] strArrays21 = new string[15]; - strArrays21[0] = str382; - strArrays21[1] = "
NOME: "; - strArrays21[2] = maisContato.get_Nome(); - str185 = (!string.IsNullOrWhiteSpace(maisContato.get_Documento()) ? string.Concat(", DOCUMENTO: ", maisContato.get_Documento()) : ""); - strArrays21[3] = str185; - clienteDesde = maisContato.get_Nascimento(); - if (clienteDesde.HasValue) - { - clienteDesde = maisContato.get_Nascimento(); - if (clienteDesde.HasValue) - { - shortDateString9 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString9 = null; - } - str186 = string.Concat(", NASCIMENTO: ", shortDateString9); - } - else - { - str186 = ""; - } - strArrays21[4] = str186; - Parentesco? nullable2 = maisContato.get_Parentesco(); - if (nullable2.HasValue) - { - nullable2 = maisContato.get_Parentesco(); - if (nullable2.HasValue) - { - str187 = nullable2.GetValueOrDefault().ToString().ToUpper(); - } - else - { - str187 = null; - } - str188 = string.Concat(", PARENTESCO: ", str187); - } - else - { - str188 = ""; - } - strArrays21[5] = str188; - str189 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) || !string.IsNullOrWhiteSpace(maisContato.get_Agencia()) || !string.IsNullOrWhiteSpace(maisContato.get_Conta()) ? "
" : ""); - strArrays21[6] = str189; - str190 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) ? string.Concat("BANCO: ", maisContato.get_Banco()) : ""); - strArrays21[7] = str190; - if (!string.IsNullOrWhiteSpace(maisContato.get_Agencia())) - { - str191 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) ? ", AGÊNCIA: " : "AGÊNCIA: "); - str192 = string.Concat(str191, maisContato.get_Agencia()); - } - else - { - str192 = ""; - } - strArrays21[8] = str192; - if (!string.IsNullOrWhiteSpace(maisContato.get_Conta())) - { - str193 = (!string.IsNullOrWhiteSpace(maisContato.get_Banco()) || !string.IsNullOrWhiteSpace(maisContato.get_Agencia()) ? ", CONTA: " : "CONTA: "); - str194 = string.Concat(str193, maisContato.get_Conta()); - } - else - { - str194 = ""; - } - strArrays21[9] = str194; - nullable = maisContato.get_Tipo(); - str195 = (nullable.HasValue || !string.IsNullOrWhiteSpace(maisContato.get_Prefixo()) && !string.IsNullOrWhiteSpace(maisContato.get_Telefone()) || !string.IsNullOrWhiteSpace(maisContato.get_Email()) ? "
" : ""); - strArrays21[10] = str195; - nullable = maisContato.get_Tipo(); - if (nullable.HasValue) - { - nullable = maisContato.get_Tipo(); - if (nullable.HasValue) - { - tipoTelefone = nullable.GetValueOrDefault(); - str196 = tipoTelefone.ToString().ToUpper(); - } - else - { - str196 = null; - } - str197 = string.Concat("TIPO DO TELEFONE: ", str196); - } - else - { - str197 = ""; - } - strArrays21[11] = str197; - if (string.IsNullOrWhiteSpace(maisContato.get_Prefixo()) || string.IsNullOrWhiteSpace(maisContato.get_Telefone())) - { - str198 = ""; - } - else - { - nullable = maisContato.get_Tipo(); - str201 = (nullable.HasValue ? ", TELEFONE: (" : "TELEFONE: ("); - str198 = string.Concat(str201, maisContato.get_Prefixo(), ") ", maisContato.get_Telefone()); - } - strArrays21[12] = str198; - if (!string.IsNullOrWhiteSpace(maisContato.get_Email())) - { - nullable = maisContato.get_Tipo(); - str199 = (nullable.HasValue || !string.IsNullOrWhiteSpace(maisContato.get_Prefixo()) && !string.IsNullOrWhiteSpace(maisContato.get_Telefone()) ? ", EMAIL: " : "EMAIL: "); - str200 = string.Concat(str199, maisContato.get_Email()); - } - else - { - str200 = ""; - } - strArrays21[13] = str200; - strArrays21[14] = "
"; - str382 = string.Concat(strArrays21); - } - string[] strArrays22 = new string[] { str371, "
"; - str371 = string.Concat(strArrays22); - } - if (documento3.get_Controle().get_Cliente().get_Enderecos() != null && !this.ExtratoResumido) - { - string str383 = ""; - foreach (ClienteEndereco clienteEndereco2 in documento3.get_Controle().get_Cliente().get_Enderecos()) - { - string[] cep = new string[] { str383, "
", clienteEndereco2.get_Endereco(), ", ", clienteEndereco2.get_Numero(), ", ", null, null, null, null, null, null, null, null }; - str183 = (string.IsNullOrWhiteSpace(clienteEndereco2.get_Complemento()) ? "" : string.Concat(clienteEndereco2.get_Complemento(), ", ")); - cep[6] = str183; - cep[7] = clienteEndereco2.get_Bairro(); - cep[8] = " - "; - cep[9] = clienteEndereco2.get_Cidade(); - cep[10] = " - "; - cep[11] = clienteEndereco2.get_Estado(); - cep[12] = " - "; - cep[13] = clienteEndereco2.get_Cep(); - str383 = string.Concat(cep); - } - string[] strArrays23 = new string[] { str371, "
"; - str371 = string.Concat(strArrays23); - } - if (this.ObsCliente && this.ClienteVisibility && this.ObsClienteEnabled && !string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Observacao()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - documento3.get_Controle().get_Cliente().set_Observacao(string.Concat("
", documento3.get_Controle().get_Cliente().get_Observacao().Replace("\r\n", "
"))); - string[] strArrays24 = new string[] { str371, "
"; - str371 = string.Concat(strArrays24); - } - if (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Pasta()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - string[] strArrays25 = new string[] { str371, ""; - str371 = string.Concat(strArrays25); - } - str371 = string.Concat(str371, "

FALECIDO: "; - str239 = (documento3.get_Controle().get_Cliente().get_Falecido() ? "SIM" : "NÃO"); - strArrays9[4] = str239; - strArrays9[5] = "

ESTADO CIVIL: ", null, null, null, null, null, null, null, null }; - if (documento3.get_Controle().get_Cliente().get_EstadoCivil().HasValue) - { - estadoCivil = documento3.get_Controle().get_Cliente().get_EstadoCivil(); - str233 = estadoCivil.ToString().ToUpper(); - } - else - { - str233 = "-"; - } - strArrays12[2] = str233; - strArrays12[3] = "

SEXO: "; - if (documento3.get_Controle().get_Cliente().get_Sexo().HasValue) - { - sexo = documento3.get_Controle().get_Cliente().get_Sexo(); - str235 = sexo.ToString().ToUpper(); - } - else - { - str235 = "-"; - } - strArrays12[6] = str235; - strArrays12[7] = "

"; - str371 = string.Concat(strArrays12); - } - string str377 = str371; - clienteDesde = documento3.get_Controle().get_Cliente().get_ClienteDesde(); - if (clienteDesde.HasValue) - { - clienteDesde = documento3.get_Controle().get_Cliente().get_ClienteDesde(); - if (clienteDesde.HasValue) - { - shortDateString13 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString13 = null; - } - } - else - { - shortDateString13 = "-"; - } - str371 = string.Concat(str377, "

CLIENTE DESDE: ", shortDateString13, "

PROFISSÃO: "; - strArrays13[4] = documento3.get_Controle().get_Cliente().get_Profissao().get_Nome(); - strArrays13[5] = "

HABILITAÇÃO: "; - str226 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Habilitacao()) ? documento3.get_Controle().get_Cliente().get_Habilitacao() : "-"); - strArrays14[4] = str226; - strArrays14[5] = "

CATEGORIA: "; - str228 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_CategoriaHabilitacao()) ? documento3.get_Controle().get_Cliente().get_CategoriaHabilitacao() : "-"); - strArrays14[8] = str228; - strArrays14[9] = "

1ª HAB.: "; - clienteDesde = documento3.get_Controle().get_Cliente().get_PrimeiraHabilitacao(); - if (clienteDesde.HasValue) - { - clienteDesde = documento3.get_Controle().get_Cliente().get_PrimeiraHabilitacao(); - if (clienteDesde.HasValue) - { - shortDateString11 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString11 = null; - } - } - else - { - shortDateString11 = "-"; - } - strArrays14[12] = shortDateString11; - strArrays14[13] = "

VENCIMENTO: "; - clienteDesde = documento3.get_Controle().get_Cliente().get_VencimentoHabilitacao(); - if (clienteDesde.HasValue) - { - clienteDesde = documento3.get_Controle().get_Cliente().get_VencimentoHabilitacao(); - if (clienteDesde.HasValue) - { - shortDateString12 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString12 = null; - } - } - else - { - shortDateString12 = "-"; - } - strArrays14[16] = shortDateString12; - strArrays14[17] = "

RG: "; - str219 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); - strArrays15[4] = str219; - strArrays15[5] = "

ORGÃO EMISSOR: "; - str221 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Emissor()) ? documento3.get_Controle().get_Cliente().get_Emissor() : "-"); - strArrays15[8] = str221; - strArrays15[9] = "

ESTADO EMISSOR: "; - str223 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_EstadoEmissor()) ? documento3.get_Controle().get_Cliente().get_EstadoEmissor() : "-"); - strArrays15[12] = str223; - strArrays15[13] = "

EXPEDIÇÃO: "; - clienteDesde = documento3.get_Controle().get_Cliente().get_Expedicao(); - if (clienteDesde.HasValue) - { - clienteDesde = documento3.get_Controle().get_Cliente().get_Expedicao(); - if (clienteDesde.HasValue) - { - shortDateString10 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString10 = null; - } - } - else - { - shortDateString10 = "-"; - } - strArrays15[16] = shortDateString10; - strArrays15[17] = "

BANCO: "; - str211 = (documento3.get_Controle().get_Cliente().get_Banco() != null ? documento3.get_Controle().get_Cliente().get_Banco().get_Nome() : "-"); - strArrays16[4] = str211; - strArrays16[5] = "

AGÊNCIA: "; - str213 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Agencia()) ? documento3.get_Controle().get_Cliente().get_Agencia() : "-"); - strArrays16[8] = str213; - strArrays16[9] = "

CONTA: "; - str215 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Conta()) ? documento3.get_Controle().get_Cliente().get_Conta() : "-"); - strArrays16[12] = str215; - strArrays16[13] = "

TIPO: "; - str217 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_TipoConta()) ? documento3.get_Controle().get_Cliente().get_TipoConta() : "-"); - strArrays16[16] = str217; - strArrays16[17] = "

CONTATOS: "; - strArrays17[4] = str378; - strArrays17[5] = "

EMAILS: "; - strArrays18[4] = str379; - strArrays18[5] = "

ENDEREÇOS: "; - strArrays19[4] = str380; - strArrays19[5] = "

ENDEREÇOS: "; - strArrays20[4] = str381; - strArrays20[5] = "

MAIS CONTATOS: "; - strArrays22[4] = str382; - strArrays22[5] = "

ENDEREÇOS: "; - strArrays23[4] = str383; - strArrays23[5] = "

OBSERVAÇÕES: "; - strArrays24[4] = documento3.get_Controle().get_Cliente().get_Observacao(); - strArrays24[5] = "

PASTA: "; - strArrays25[4] = documento3.get_Controle().get_Cliente().get_Pasta(); - strArrays25[5] = "

"); - if (!flag1) - { - string str384 = str371; - str180 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); - str371 = string.Concat(str384, str180); - } - } - else - { - string[] documento5 = new string[14]; - documento5[0] = str371; - documento5[1] = "

CLIENTE: "; - documento5[4] = documento3.get_Controle().get_Cliente().get_Nome(); - documento5[5] = "

RG: "; - str44 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); - documento5[8] = str44; - documento5[9] = "

CPF/CNPJ: "; - documento5[12] = documento3.get_Controle().get_Cliente().get_Documento(); - documento5[13] = "

"; - str371 = string.Concat(documento5); - } - if (this.SelectedTipoExtrato != null) - { - num10 = 0; - string[] shortDateString18 = new string[58]; - shortDateString18[0] = str371; - shortDateString18[1] = "
"; - str371 = string.Concat(shortDateString18); - if (!documento3.get_NegocioCorretora().HasValue) - { - Documento documento6 = documento3; - negocioCorretora = (documento3.get_Situacao() != 2 || !documento3.get_Negocio().HasValue || documento3.get_Negocio().GetValueOrDefault() != 1 ? 0 : 1); - documento6.set_NegocioCorretora(new NegocioCorretora?(negocioCorretora)); - } - if (this.ComissaoDocumento && this.ComissaoDocumentoEnabled) - { - if (this.SelectedTipoExtrato == 2) - { - string[] strArrays26 = new string[] { str371, ""; - str371 = string.Concat(strArrays26); - } - else - { - string[] description5 = new string[14]; - description5[0] = str371; - description5[1] = ""; - str371 = string.Concat(description5); - } - } - else if (this.SelectedTipoExtrato != 2) - { - string[] description6 = new string[] { str371, ""; - str371 = string.Concat(description6); - } - string[] strArrays27 = new string[14]; - strArrays27[0] = str371; - strArrays27[1] = ""; - str371 = string.Concat(strArrays27); - if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido) - { - str371 = string.Concat(str371, ""); - string str385 = ""; - if (documento3.get_Estipulante1() != null) - { - str385 = string.Concat(str385, documento3.get_Estipulante1().get_Nome(), ", "); - } - if (documento3.get_Estipulante2() != null) - { - str385 = string.Concat(str385, documento3.get_Estipulante2().get_Nome(), ", "); - } - if (documento3.get_Estipulante3() != null) - { - str385 = string.Concat(str385, documento3.get_Estipulante3().get_Nome(), ", "); - } - if (documento3.get_Estipulante4() != null) - { - str385 = string.Concat(str385, documento3.get_Estipulante4().get_Nome(), ", "); - } - if (documento3.get_Estipulante5() != null) - { - str385 = string.Concat(str385, documento3.get_Estipulante5().get_Nome(), ", "); - } - if (!string.IsNullOrWhiteSpace(str385)) - { - int num13 = str385.LastIndexOf(", ", StringComparison.Ordinal); - str385 = str385.Remove(num13, 2).Insert(num13, "."); - } - string[] strArrays28 = new string[] { str371, ""; - str371 = string.Concat(strArrays28); - } - if (this.SelectedTipoExtrato == 2) - { - string[] strArrays29 = new string[] { str371, ""; - str371 = string.Concat(strArrays29); - } - else - { - string[] strArrays30 = new string[] { str371, ""; - str371 = string.Concat(strArrays30); - if (documento3.get_Controle().get_SeguradoraAnterior() != null && !this.ExtratoResumido) - { - string[] strArrays31 = new string[] { str371, ""; - str371 = string.Concat(strArrays31); - } - } - str371 = string.Concat(str371, "

RAMO: "; - shortDateString18[4] = documento3.get_Controle().get_Ramo().get_Nome(); - shortDateString18[5] = "

VIGÊNCIA INICIAL: "; - date = documento3.get_Vigencia1(); - shortDateString18[8] = date.ToShortDateString(); - shortDateString18[9] = "

VIGÊNCIA FINAL: "; - clienteDesde = documento3.get_Vigencia2(); - if (!clienteDesde.HasValue) - { - shortDateString3 = "-"; - } - else - { - clienteDesde = documento3.get_Vigencia2(); - if (clienteDesde.HasValue) - { - shortDateString3 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString3 = null; - } - } - shortDateString18[12] = shortDateString3; - shortDateString18[13] = "

CONTRATO: "; - str50 = (string.IsNullOrWhiteSpace(documento3.get_Apolice()) ? "-" : documento3.get_Apolice()); - shortDateString18[16] = str50; - shortDateString18[17] = "

POSSUI ENDOSSO? "; - str52 = (documento3.get_TemEndosso() ? "SIM" : "NÃO"); - shortDateString18[20] = str52; - shortDateString18[21] = "

ADITAMENTO: "; - if (string.IsNullOrWhiteSpace(documento3.get_Endosso())) - { - if (flag) - { - IList documentos = documento3.get_Controle().get_Documentos(); - if (documentos.Where((Documento x) => { - if (x.get_Excluido()) - { - return false; - } - return x.get_Ordem() != 0; - }).ToList().Count <= 0) - { - goto Label2; - } - IList documentos1 = documento3.get_Controle().get_Documentos(); - endosso = documentos1.Last((Documento x) => { - if (x.get_Excluido()) - { - return false; - } - return x.get_Ordem() != 0; - }).get_Endosso(); - goto Label1; - } - Label2: - endosso = "-"; - } - else - { - endosso = documento3.get_Endosso(); - } - Label1: - shortDateString18[24] = endosso; - shortDateString18[25] = "

APÓLICE ANTERIOR: "; - str55 = (string.IsNullOrWhiteSpace(documento3.get_ApoliceAnterior()) ? "-" : documento3.get_ApoliceAnterior()); - shortDateString18[28] = str55; - shortDateString18[29] = "

BANCO: "; - str57 = (documento3.get_Banco() == null ? "-" : documento3.get_Banco().get_Nome()); - shortDateString18[32] = str57; - shortDateString18[33] = "

AGÊNCIA: "; - str59 = (string.IsNullOrWhiteSpace(documento3.get_Agencia()) ? "-" : documento3.get_Agencia()); - shortDateString18[36] = str59; - shortDateString18[37] = "

CONTA: "; - str61 = (string.IsNullOrWhiteSpace(documento3.get_Conta()) ? "-" : documento3.get_Conta()); - shortDateString18[40] = str61; - shortDateString18[41] = "

NUMERO CARTÃO: "; - str63 = (string.IsNullOrWhiteSpace(documento3.get_NumeroCartao()) ? "-" : documento3.get_NumeroCartao()); - shortDateString18[44] = str63; - shortDateString18[45] = "

VENCIMENTO: "; - str65 = (string.IsNullOrWhiteSpace(documento3.get_VencimentoCartao()) ? "-" : documento3.get_VencimentoCartao()); - shortDateString18[48] = str65; - shortDateString18[49] = "

BANDEIRA: "; - str67 = (!documento3.get_Bandeira().HasValue ? "-" : ValidationHelper.GetDescription(documento3.get_Bandeira())); - shortDateString18[52] = str67; - shortDateString18[53] = "

TITULAR/PROPONENTE: "; - str69 = (string.IsNullOrWhiteSpace(documento3.get_NomeProponente()) ? "-" : documento3.get_NomeProponente()); - shortDateString18[56] = str69; - shortDateString18[57] = "

COMISSÃO: "; - strArrays26[4] = string.Format("{0}%", documento3.get_Comissao()); - strArrays26[5] = "

NEGÓCIO CORRETORA: "; - description5[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora()); - description5[5] = "

STATUS DO SEGURO: "; - description5[8] = ValidationHelper.GetDescription(documento3.get_Situacao()); - description5[9] = "

COMISSÃO: "; - description5[12] = string.Format("{0}%", documento3.get_Comissao()); - description5[13] = "

NEGÓCIO CORRETORA: "; - description6[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora()); - description6[5] = "

STATUS DO SEGURO: "; - description6[8] = ValidationHelper.GetDescription(documento3.get_Situacao()); - description6[9] = "

VENDEDOR: "; - str71 = (documento3.get_VendedorPrincipal() == null ? "-" : documento3.get_VendedorPrincipal().get_Nome()); - strArrays27[4] = str71; - strArrays27[5] = "

REMESSA: "; - clienteDesde = documento3.get_Remessa(); - if (!clienteDesde.HasValue) - { - shortDateString4 = "-"; - } - else - { - clienteDesde = documento3.get_Remessa(); - if (clienteDesde.HasValue) - { - shortDateString4 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString4 = null; - } - } - strArrays27[8] = shortDateString4; - strArrays27[9] = "

EMISSÃO: "; - clienteDesde = documento3.get_Emissao(); - if (!clienteDesde.HasValue) - { - shortDateString5 = "-"; - } - else - { - clienteDesde = documento3.get_Emissao(); - if (clienteDesde.HasValue) - { - shortDateString5 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString5 = null; - } - } - strArrays27[12] = shortDateString5; - strArrays27[13] = "

ESTIPULANTE(S): "; - str169 = (string.IsNullOrWhiteSpace(str385) ? "-" : str385); - strArrays28[4] = str169; - strArrays28[5] = "

SEGURADORA: "; - strArrays29[4] = documento3.get_Controle().get_Seguradora().get_Nome(); - strArrays29[5] = "

SEGURADORA: "; - strArrays30[4] = documento3.get_Controle().get_Seguradora().get_Nome(); - strArrays30[5] = "

APÓLICE SINISTRADA: "; - str166 = (documento3.get_Sinistro() ? "SIM" : "NÃO"); - strArrays30[8] = str166; - strArrays30[9] = "

SEGURADORA ANTERIOR: "; - strArrays31[4] = documento3.get_Controle().get_SeguradoraAnterior().get_Nome(); - strArrays31[5] = "

"); - if (!this.ExtratoResumido && (this.PremioParcela || this.ObsApoliceEnabled)) - { - str371 = string.Concat(str371, ""); - if (this.PremioParcela) - { - string[] strArrays32 = new string[24]; - strArrays32[0] = str371; - strArrays32[1] = "

PRÊMIO LÍQUIDO:
"; - premioLiquido = documento3.get_PremioLiquido(); - strArrays32[4] = premioLiquido.ToString("c"); - strArrays32[5] = "

ADICIONAL:
"; - premioLiquido = documento3.get_PremioAdicional(); - strArrays32[8] = premioLiquido.ToString("c"); - strArrays32[9] = "

CUSTO APÓLICE:
"; - premioLiquido = documento3.get_Custo(); - strArrays32[12] = premioLiquido.ToString("c"); - strArrays32[13] = "

I.O.F.:
"; - premioLiquido = documento3.get_Iof(); - strArrays32[16] = premioLiquido.ToString("c"); - strArrays32[17] = "

"); - str371 = string.Concat(str371, "

"); - ObservableCollection parcelas = documento3.get_Parcelas(); - if (parcelas != null) - { - count = parcelas.Count > 0; - } - else - { - count = false; - } - if (count) - { - str371 = string.Concat(str371, ""); - foreach (Parcela parcela in documento3.get_Parcelas()) - { - string[] description7 = new string[] { str371, ""; - str371 = string.Concat(description7); - } - } - } - if (this.ObsApolice && this.ObsApoliceEnabled) - { - string[] strArrays33 = new string[] { str371, ""; - str371 = string.Concat(strArrays33); - } - str371 = string.Concat(str371, "

PARCELA

VENCIMENTO

VALOR

FORMA DE PAGAMENTO

", null, null, null, null, null, null, null, null }; - numeroParcela = parcela.get_NumeroParcela(); - description7[2] = numeroParcela.ToString(); - description7[3] = "

"; - date = parcela.get_Vencimento(); - description7[4] = date.ToShortDateString(); - description7[5] = "

"; - description7[6] = string.Format("{0:c}", parcela.get_Valor()); - description7[7] = "

"; - description7[8] = ValidationHelper.GetDescription(documento3.get_FormaPagamento()); - description7[9] = "

OBSERVAÇÕES: "; - str157 = (string.IsNullOrWhiteSpace(documento3.get_Observacao()) ? "-" : documento3.get_Observacao()); - strArrays33[4] = str157; - strArrays33[5] = "

"); - } - if (this.PerfilCondutor && this.PerfilVisibility && documento3.get_Controle().get_Ramo().get_Id() == (long)5 && this.PerfilCondutorEnabled) - { - List list1 = perfils.ToList(); - foreach (Perfil perfil in list1) - { - num10 = 0; - if (string.IsNullOrEmpty(perfil.get_Nome())) - { - continue; - } - string[] description8 = new string[92]; - description8[0] = str371; - description8[1] = "

"; - description8[4] = string.Format("CONDUTOR {0}: ", list1.IndexOf(perfil) + 1); - description8[5] = ""; - description8[6] = perfil.get_Nome(); - description8[7] = "

CPF: "; - str117 = (string.IsNullOrWhiteSpace(perfil.get_Cpf()) ? "-" : perfil.get_Cpf()); - description8[10] = str117; - description8[11] = "

NASCIMENTO: "; - clienteDesde = perfil.get_Nascimento(); - if (!clienteDesde.HasValue) - { - shortDateString7 = "-"; - } - else - { - clienteDesde = perfil.get_Nascimento(); - if (clienteDesde.HasValue) - { - shortDateString7 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString7 = null; - } - } - description8[14] = shortDateString7; - description8[15] = "

ESTADO CIVIL: "; - str120 = (!perfil.get_EstadoCivil().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_EstadoCivil())); - description8[18] = str120; - description8[19] = "

SEXO: "; - str122 = (!perfil.get_Sexo().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_Sexo())); - description8[22] = str122; - description8[23] = "

RELAÇÃO SEGURADO/CONDUTOR: "; - description8[26] = ValidationHelper.GetDescription(perfil.get_Relacao()); - description8[27] = "

HABILITAÇÃO: "; - str125 = (string.IsNullOrWhiteSpace(perfil.get_Habilitacao()) ? "-" : perfil.get_Habilitacao()); - description8[30] = str125; - description8[31] = "

TEMPO DE HABILITAÇÃO: "; - str127 = (!perfil.get_TempoHabilitacao().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_TempoHabilitacao())); - description8[34] = str127; - description8[35] = "

QUATIDADE DE VEÍCULOS: "; - if (!perfil.get_VeiculoResidencia().HasValue) - { - str129 = "-"; - } - else - { - numeroParcela = perfil.get_VeiculoResidencia().Value; - str129 = numeroParcela.ToString(); - } - description8[38] = str129; - description8[39] = "

GARAGEM NA RESIDÊNCIA: "; - str131 = (!perfil.get_GaragemResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemResidencia())); - description8[42] = str131; - description8[43] = "

GARAGEM NO TRABALHO: "; - str133 = (!perfil.get_GaragemTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemTrabalho())); - description8[46] = str133; - description8[47] = "

GARAGEM NO ESTUDO: "; - str135 = (!perfil.get_GaragemEstudo().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemEstudo())); - description8[50] = str135; - description8[51] = "

TIPO DE RESIDÊNCIA: "; - str137 = (!perfil.get_TipoResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_TipoResidencia())); - description8[54] = str137; - description8[55] = "

QUILOMETRAGEM MENSAL: "; - str139 = (string.IsNullOrWhiteSpace(perfil.get_KmMensal()) ? "-" : perfil.get_KmMensal()); - description8[58] = str139; - description8[59] = "

DISTÂNCIA ATÉ O TRABALHO: "; - str141 = (!perfil.get_DistanciaResidenciaTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_DistanciaResidenciaTrabalho())); - description8[62] = str141; - description8[63] = "

USO PROFISSIONAL: "; - str143 = (!perfil.get_UsoProfissional().HasValue || !perfil.get_UsoProfissional().Value ? "NÃO" : "SIM"); - description8[66] = str143; - description8[67] = "

USO POR DEPENDENTES: "; - str145 = (!perfil.get_UsoDependentes().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_UsoDependentes())); - description8[70] = str145; - description8[71] = "

OCUPAÇÃO: "; - str147 = (!perfil.get_Ocupacao().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_Ocupacao())); - description8[74] = str147; - description8[75] = "

SEGURO VIDA: "; - str149 = (!perfil.get_SeguroVida().HasValue || !perfil.get_SeguroVida().Value ? "NÃO" : "SIM"); - description8[78] = str149; - description8[79] = "

ISENÇÃO DE IMPOSTOS: "; - str151 = (!perfil.get_Isencao().HasValue || !perfil.get_Isencao().Value ? "NÃO" : "SIM"); - description8[82] = str151; - description8[83] = "

ANTIFURTO: "; - str153 = (perfil.get_AntiFurto().HasValue ? ValidationHelper.GetDescription(perfil.get_AntiFurto()) : ""); - description8[86] = str153; - description8[87] = "

COBERTURA ESTENDIDA PARA RESIDENTES HABILITADOS: "; - str155 = (!perfil.get_EstenderCobertura().HasValue || !perfil.get_EstenderCobertura().Value ? "NÃO" : "SIM"); - description8[90] = str155; - description8[91] = "

"; - str371 = string.Concat(description8); - } - } - list = items1.ToList(); - if (list.Count != 0) - { - num10 = 0; - foreach (Item item in list) - { - if (item.get_Sinistros().Count > 0) - { - item1 = item; - controleSinistros = await (new SinistroServico()).BuscarControles(item.get_Id()); - item1.set_Sinistros(controleSinistros); - item1 = null; - } - string str386 = str371; - str75 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); - str371 = string.Concat(str386, str75); - string str387 = str371; - str76 = (this.SelectedTipoExtrato != 2 || list.IndexOf(item) == 0 ? "
" : ""); - str371 = string.Concat(str387, str76); - str371 = string.Concat(str371, ""); - str371 = string.Concat(str371, ""); - str371 = string.Concat(str371, ""); - if (this.SelectedTipoExtrato != 2) - { - id = documento3.get_Controle().get_Ramo().get_Id(); - if (id > (long)5) - { - if (id == (long)15 || id == (long)18) - { - goto Label5; - } - if (id == (long)37) - { - goto Label3; - } - goto Label4; - } - else - { - if (id - (long)1 <= (long)2) - { - goto Label5; - } - if (id == (long)5) - { - goto Label3; - } - goto Label4; - } - Label5: - item1 = item; - patrimonial = await (new ItemServico()).BuscaPatrimonial(item.get_Id()); - item1.set_Patrimonial(patrimonial); - item1 = null; - string[] numero1 = new string[19]; - numero1[0] = str371; - numero1[1] = ""; - str371 = string.Concat(numero1); - } - else - { - string[] descricao2 = new string[] { str371, ""; - str371 = string.Concat(descricao2); - } - Label9: - if (item.get_Sinistros().Count > 0) - { - Item item2 = item; - if (item2 != null) - { - IList sinistros = item2.get_Sinistros(); - if (sinistros != null) - { - ControleSinistro controleSinistro = sinistros.LastOrDefault(); - if (controleSinistro != null) - { - List sinistros1 = controleSinistro.get_Sinistros(); - if (sinistros1 != null) - { - Sinistro sinistro = sinistros1.LastOrDefault(); - if (sinistro != null) - { - dataReclamacao = sinistro.get_DataReclamacao(); - } - else - { - clienteDesde = null; - dataReclamacao = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao = clienteDesde; - } - DateTime? nullable3 = dataReclamacao; - if (nullable3.HasValue) - { - date = nullable3.Value; - shortDateString6 = date.ToShortDateString(); - } - else - { - shortDateString6 = "-"; - } - string str388 = shortDateString6; - string[] strArrays34 = new string[18]; - strArrays34[0] = str371; - strArrays34[1] = ""; - str371 = string.Concat(strArrays34); - } - str371 = string.Concat(str371, ""); - if (this.SelectedTipoExtrato != 2) - { - string[] strArrays35 = new string[] { str371, ""; - str371 = string.Concat(strArrays35); - id = documento3.get_Controle().get_Ramo().get_Id(); - long num14 = id - (long)1; - if (num14 <= (long)58) - { - switch ((uint)num14) - { - case 0: - case 1: - case 2: - case 14: - case 17: - { - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays36 = new string[] { str371, ""; - str371 = string.Concat(strArrays36); - break; - } - case 3: - case 7: - case 15: - case 16: - case 18: - case 22: - case 23: - case 25: - case 27: - case 30: - case 32: - case 38: - case 40: - case 43: - case 48: - case 58: - { - item1 = item; - riscosDiverso = await (new ItemServico()).BuscaRiscosDiversos(item.get_Id()); - item1.set_RiscosDiversos(riscosDiverso); - item1 = null; - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays37 = new string[] { str371, ""; - str371 = string.Concat(strArrays37); - break; - } - case 4: - case 36: - { - if (this.ObsItem && this.ObsItemEnabled) - { - string[] strArrays38 = new string[] { str371, ""; - str371 = string.Concat(strArrays38); - } - string[] strArrays39 = new string[30]; - strArrays39[0] = str371; - strArrays39[1] = ""; - str371 = string.Concat(strArrays39); - break; - } - case 5: - case 6: - case 8: - case 9: - case 52: - { - item1 = item; - vida = await (new ItemServico()).BuscaVida(item.get_Id()); - item1.set_Vida(vida); - item1 = null; - if (!item.get_Sinistrado() || !this.BeneficiariosItens || !this.BeneficiariosItensEnabled) - { - break; - } - string str389 = str371; - str102 = (num10 % 2 == 0 ? "WhiteSmoke" : "White"); - str371 = string.Concat(str389, ""); - break; - } - case 12: - { - item1 = item; - aeronautico = await (new ItemServico()).BuscaAeronautico(item.get_Id()); - item1.set_Aeronautico(aeronautico); - item1 = null; - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays40 = new string[] { str371, ""; - str371 = string.Concat(strArrays40); - break; - } - case 19: - { - item1 = item; - granizo = await (new ItemServico()).BuscaGranizo(item.get_Id()); - item1.set_Granizo(granizo); - item1 = null; - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays41 = new string[] { str371, ""; - str371 = string.Concat(strArrays41); - break; - } - } - } - else - { - } - } - str371 = string.Concat(str371, "

"; - numero1[4] = string.Format("ITEM {0}: ", item.get_Ordem()); - numero1[5] = ""; - numero1[6] = item.get_Patrimonial().get_Endereco(); - numero1[7] = ", "; - numero1[8] = item.get_Patrimonial().get_Numero(); - numero1[9] = ", "; - str78 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Complemento()) ? "" : string.Concat(item.get_Patrimonial().get_Complemento(), ", ")); - numero1[10] = str78; - numero1[11] = item.get_Patrimonial().get_Bairro(); - numero1[12] = " - "; - numero1[13] = item.get_Patrimonial().get_Cidade(); - numero1[14] = " - "; - numero1[15] = item.get_Patrimonial().get_Estado(); - numero1[16] = " - "; - numero1[17] = item.get_Patrimonial().get_Cep(); - numero1[18] = "

"; - descricao2[4] = string.Format("ITEM {0}: ", item.get_Ordem()); - descricao2[5] = ""; - descricao2[6] = item.get_Descricao(); - descricao2[7] = "

SINISTRO STATUS: "; - Item item3 = item; - if (item3 != null) - { - IList controleSinistros1 = item3.get_Sinistros(); - if (controleSinistros1 != null) - { - ControleSinistro controleSinistro1 = controleSinistros1.LastOrDefault(); - if (controleSinistro1 != null) - { - List sinistros2 = controleSinistro1.get_Sinistros(); - if (sinistros2 != null) - { - Sinistro sinistro1 = sinistros2.LastOrDefault(); - if (sinistro1 != null) - { - description2 = ValidationHelper.GetDescription(sinistro1.get_StatusSinistro()); - } - else - { - description2 = null; - } - } - else - { - description2 = null; - } - } - else - { - description2 = null; - } - } - else - { - description2 = null; - } - } - else - { - description2 = null; - } - strArrays34[4] = description2; - strArrays34[5] = "

DATA: "; - strArrays34[8] = str388; - strArrays34[9] = "

VALOR: "; - Item item4 = item; - if (item4 != null) - { - IList controleSinistros2 = item4.get_Sinistros(); - if (controleSinistros2 != null) - { - ControleSinistro controleSinistro2 = controleSinistros2.LastOrDefault(); - if (controleSinistro2 != null) - { - List sinistros3 = controleSinistro2.get_Sinistros(); - if (sinistros3 != null) - { - Sinistro sinistro2 = sinistros3.LastOrDefault(); - if (sinistro2 != null) - { - currency = ValidationHelper.ToCurrency(sinistro2.get_Valor(), "pt-BR"); - } - else - { - currency = null; - } - } - else - { - currency = null; - } - } - else - { - currency = null; - } - } - else - { - currency = null; - } - } - else - { - currency = null; - } - strArrays34[12] = currency; - strArrays34[13] = "

QTDE SINISTRO(S): "; - numeroParcela = item.get_Sinistros().Count; - strArrays34[16] = numeroParcela.ToString(); - strArrays34[17] = "

STATUS: "; - str81 = (string.IsNullOrWhiteSpace(item.get_Status()) ? item.get_StatusInclusao() : item.get_Status()); - strArrays35[4] = str81; - strArrays35[5] = "

ATIVO: "; - str83 = (!item.get_Substituido().HasValue ? "SIM" : "NÃO"); - strArrays35[8] = str83; - strArrays35[9] = "

OBSERVAÇÕES: "; - str85 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Item().get_Observacao()) ? "-" : item.get_Patrimonial().get_Item().get_Observacao()); - strArrays36[4] = str85; - strArrays36[5] = "

BENS E INFORMAÇÕES: "; - str87 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Bens()) ? "-" : item.get_Patrimonial().get_Bens()); - strArrays36[8] = str87; - strArrays36[9] = "

OBSERVAÇÕES: "; - str89 = (string.IsNullOrWhiteSpace(item.get_RiscosDiversos().get_Observacao()) ? "-" : item.get_RiscosDiversos().get_Observacao()); - strArrays37[4] = str89; - strArrays37[5] = "

OBSERVAÇÕES: "; - str101 = (string.IsNullOrWhiteSpace(item.get_Auto().get_Observacao()) ? "-" : item.get_Auto().get_Observacao()); - strArrays38[4] = str101; - strArrays38[5] = "

COBERTURA PADRÃO: "; - tipoCobertura = item.get_Auto().get_TipoCobertura(); - if (tipoCobertura.HasValue) - { - description = ValidationHelper.GetDescription(tipoCobertura.GetValueOrDefault()); - } - else - { - description = null; - } - strArrays39[4] = description; - strArrays39[5] = "

BÔNUS: "; - bonus = item.get_Auto().get_Bonus(); - strArrays39[8] = bonus.ToString(); - strArrays39[9] = "

REGIÃO DE CIRCULAÇÃO: "; - str93 = (string.IsNullOrWhiteSpace(item.get_Auto().get_RegiaoCirculacao()) ? "-" : item.get_Auto().get_RegiaoCirculacao()); - strArrays39[12] = str93; - strArrays39[13] = "

TABELA DE REFERÊNCIA: "; - tabelaReferencia = item.get_Auto().get_TabelaReferencia(); - if (tabelaReferencia.HasValue) - { - description1 = ValidationHelper.GetDescription(tabelaReferencia.GetValueOrDefault()); - } - else - { - description1 = null; - } - strArrays39[16] = description1; - strArrays39[17] = "

% DE REFERÊNCIA: "; - strArrays39[20] = string.Format("{0}%", item.get_Auto().get_PorcentagemReferencia()); - strArrays39[21] = "

CÓDIGO FIPE: "; - str97 = (string.IsNullOrWhiteSpace(item.get_Auto().get_Fipe()) ? "-" : item.get_Auto().get_Fipe()); - strArrays39[24] = str97; - strArrays39[25] = "

COR DO VEÍCULO: "; - str99 = (!item.get_Auto().get_Cor().HasValue ? "-" : ValidationHelper.GetDescription(item.get_Auto().get_Cor())); - strArrays39[28] = str99; - strArrays39[29] = "

BENEFICIÁRIOS: "); - string str390 = ""; - foreach (ControleSinistro sinistro3 in item.get_Sinistros()) - { - if (sinistro3.get_Sinistros() == null) - { - continue; - } - foreach (Sinistro sinistro4 in sinistro3.get_Sinistros()) - { - if (string.IsNullOrWhiteSpace(sinistro4.get_SinistroVida().get_Beneficiario())) - { - continue; - } - str390 = string.Concat(str390, sinistro4.get_SinistroVida().get_Beneficiario(), ", "); - } - } - if (!string.IsNullOrWhiteSpace(str390)) - { - int num15 = str390.LastIndexOf(", ", StringComparison.Ordinal); - str390 = str390.Remove(num15, 2).Insert(num15, "."); - } - str371 = string.Concat(str371, str390, "

OBSERVAÇÕES: "; - str104 = (string.IsNullOrWhiteSpace(item.get_Aeronautico().get_Observacao()) ? "-" : item.get_Aeronautico().get_Observacao()); - strArrays40[4] = str104; - strArrays40[5] = "

OBSERVAÇÕES: "; - str106 = (string.IsNullOrWhiteSpace(item.get_Granizo().get_Observacao()) ? "-" : item.get_Granizo().get_Observacao()); - strArrays41[4] = str106; - strArrays41[5] = "

"); - if (this.SelectedTipoExtrato != 2) - { - ObservableCollection observableCollection5 = await (new ItemServico()).BuscarCoberturasPorItemAsync(item.get_Id()); - if (observableCollection5.Count > 0 && this.Coberturas) - { - str371 = string.Concat(str371, "
"); - foreach (Cobertura cobertura in observableCollection5) - { - string[] strArrays42 = new string[] { str371, "" }; - str371 = string.Concat(strArrays42); - } - str371 = string.Concat(str371, "

COBERTURA

FRANQUIA

L.M.I.

PRÊMIO

", cobertura.get_Observacao(), "

", string.Format("{0:c}", cobertura.get_Franquia()), "

", string.Format("{0:c}", cobertura.get_Lmi()), "

", string.Format("{0:c}", cobertura.get_Premio()), "

"); - } - string str391 = str371; - str79 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); - str371 = string.Concat(str391, str79); - } - if (this.SelectedTipoExtrato != 2) - { - num10 = 0; - } - } - } - else - { - str371 = string.Concat(str371, "

ESTA APÓLICE NÃO POSSUI ITENS

"); - } - list = null; - } - else - { - variable9 = null; - return; - } - } - else - { - bool flag3 = documento3.get_Controle().get_Cliente().get_PessoaFisica(); - if ((!this.Endossos || !this.SomenteEndossos) && !nums.Any((long x) => x == this.documento.get_Controle().get_Id())) - { - string[] strArrays43 = new string[] { str371, ""; - str371 = string.Concat(strArrays44); - } - string[] documento7 = new string[] { str371, ""; - str371 = string.Concat(documento7); - if (this.SelectedTipoExtrato != 2) - { - str351 = (documento3.get_Controle().get_Cliente().get_Atividade() == null ? "NASCIMENTO" : "ABERTURA"); - string str392 = str351; - string[] strArrays45 = new string[] { str371, ""; - str371 = string.Concat(strArrays46); - } - } - if (this.SelectedTipoExtrato != 2) - { - string[] strArrays47 = new string[18]; - strArrays47[0] = str371; - strArrays47[1] = ""; - str371 = string.Concat(strArrays47); - } - if (this.SelectedTipoExtrato != 2) - { - str371 = string.Concat(str371, ""); - string str393 = ""; - if (documento3.get_Controle().get_Cliente().get_Telefones() != null) - { - foreach (ClienteTelefone clienteTelefone1 in documento3.get_Controle().get_Cliente().get_Telefones()) - { - string[] numero2 = new string[] { str393, "
", null, null, null, null, null }; - nullable = clienteTelefone1.get_Tipo(); - if (nullable.HasValue) - { - tipoTelefone = nullable.GetValueOrDefault(); - str342 = tipoTelefone.ToString().ToUpper(); - } - else - { - str342 = null; - } - numero2[2] = str342; - numero2[3] = " ("; - numero2[4] = clienteTelefone1.get_Prefixo(); - numero2[5] = ") "; - numero2[6] = clienteTelefone1.get_Numero(); - str393 = string.Concat(numero2); - } - } - string[] strArrays48 = new string[] { str371, "
"; - str371 = string.Concat(strArrays48); - string str394 = ""; - if (documento3.get_Controle().get_Cliente().get_Emails() != null) - { - foreach (ClienteEmail clienteEmail1 in documento3.get_Controle().get_Cliente().get_Emails()) - { - str394 = string.Concat(str394, "
", clienteEmail1.get_Email()); - } - } - string[] strArrays49 = new string[] { str371, "
"; - str371 = string.Concat(strArrays49); - string str395 = ""; - if (documento3.get_Controle().get_Cliente().get_Enderecos() != null) - { - foreach (ClienteEndereco clienteEndereco3 in documento3.get_Controle().get_Cliente().get_Enderecos()) - { - string[] cidade1 = new string[] { str395, "
", clienteEndereco3.get_Endereco(), ", ", clienteEndereco3.get_Numero(), ", ", null, null, null, null, null, null, null, null }; - str341 = (string.IsNullOrWhiteSpace(clienteEndereco3.get_Complemento()) ? "" : string.Concat(clienteEndereco3.get_Complemento(), ", ")); - cidade1[6] = str341; - cidade1[7] = clienteEndereco3.get_Bairro(); - cidade1[8] = " - "; - cidade1[9] = clienteEndereco3.get_Cidade(); - cidade1[10] = " - "; - cidade1[11] = clienteEndereco3.get_Estado(); - cidade1[12] = " - "; - cidade1[13] = clienteEndereco3.get_Cep(); - str395 = string.Concat(cidade1); - } - } - string[] strArrays50 = new string[] { str371, "
"; - str371 = string.Concat(strArrays50); - str371 = string.Concat(str371, ""); - } - str371 = string.Concat(str371, "

RG: "; - str358 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); - strArrays44[4] = str358; - strArrays44[5] = "

CPF/CNPJ: "; - documento7[4] = documento3.get_Controle().get_Cliente().get_Documento(); - documento7[5] = "

ESTADO CIVIL: "; - if (documento3.get_Controle().get_Cliente().get_EstadoCivil().HasValue) - { - estadoCivil = documento3.get_Controle().get_Cliente().get_EstadoCivil(); - str354 = estadoCivil.ToString().ToUpper(); - } - else - { - str354 = "-"; - } - strArrays46[4] = str354; - strArrays46[5] = "

SEXO: "; - if (documento3.get_Controle().get_Cliente().get_Sexo().HasValue) - { - sexo = documento3.get_Controle().get_Cliente().get_Sexo(); - str356 = sexo.ToString().ToUpper(); - } - else - { - str356 = "-"; - } - strArrays46[8] = str356; - strArrays46[9] = "

BANCO: "; - str344 = (documento3.get_Controle().get_Cliente().get_Banco() != null ? documento3.get_Controle().get_Cliente().get_Banco().get_Nome() : "-"); - strArrays47[4] = str344; - strArrays47[5] = "

AGÊNCIA: "; - str346 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Agencia()) ? documento3.get_Controle().get_Cliente().get_Agencia() : "-"); - strArrays47[8] = str346; - strArrays47[9] = "

CONTA: "; - str348 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Conta()) ? documento3.get_Controle().get_Cliente().get_Conta() : "-"); - strArrays47[12] = str348; - strArrays47[13] = "

TIPO: "; - str350 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_TipoConta()) ? documento3.get_Controle().get_Cliente().get_TipoConta() : "-"); - strArrays47[16] = str350; - strArrays47[17] = "

CONTATOS: "; - str336 = (string.IsNullOrEmpty(str393) ? "-" : str393); - strArrays48[4] = str336; - strArrays48[5] = "

EMAILS: "; - str338 = (string.IsNullOrEmpty(str394) ? "-" : str394); - strArrays49[4] = str338; - strArrays49[5] = "

ENDEREÇOS: "; - str340 = (string.IsNullOrEmpty(str395) ? "-" : str395); - strArrays50[4] = str340; - strArrays50[5] = "

"); - string str396 = str371; - str334 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); - str371 = string.Concat(str396, str334); - } - else - { - string[] documento8 = new string[14]; - documento8[0] = str371; - documento8[1] = "

CLIENTE: "; - documento8[4] = documento3.get_Controle().get_Cliente().get_Nome(); - documento8[5] = "

RG: "; - str242 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-"); - documento8[8] = str242; - documento8[9] = "

CPF/CNPJ: "; - documento8[12] = documento3.get_Controle().get_Cliente().get_Documento(); - documento8[13] = "

"; - str371 = string.Concat(documento8); - } - if (this.SelectedTipoExtrato != null) - { - num10 = 0; - IList documentos2 = documento3.get_Controle().get_Documentos(); - if (documentos2 != null) - { - documento = documentos2.LastOrDefault((Documento x) => { - if (x.get_Excluido()) - { - return false; - } - return x.get_Ordem() != 0; - }); - } - else - { - documento = null; - } - Documento documento9 = documento; - string[] shortDateString19 = new string[26]; - shortDateString19[0] = str371; - shortDateString19[1] = "
"; - str371 = string.Concat(shortDateString19); - if (!documento3.get_NegocioCorretora().HasValue) - { - Documento documento10 = documento3; - negocioCorretora1 = (documento3.get_Situacao() != 2 || !documento3.get_Negocio().HasValue || documento3.get_Negocio().GetValueOrDefault() != 1 ? 0 : 1); - documento10.set_NegocioCorretora(new NegocioCorretora?(negocioCorretora1)); - } - if (this.SelectedTipoExtrato != 2) - { - string[] description9 = new string[] { str371, ""; - str371 = string.Concat(description9); - } - string[] strArrays51 = new string[] { str371, ""; - str371 = string.Concat(strArrays51); - if (this.SelectedTipoExtrato != 2) - { - str371 = string.Concat(str371, ""); - string str397 = ""; - if (documento3.get_Estipulante1() != null) - { - str397 = string.Concat(str397, documento3.get_Estipulante1().get_Nome(), ", "); - } - if (documento3.get_Estipulante2() != null) - { - str397 = string.Concat(str397, documento3.get_Estipulante2().get_Nome(), ", "); - } - if (documento3.get_Estipulante3() != null) - { - str397 = string.Concat(str397, documento3.get_Estipulante3().get_Nome(), ", "); - } - if (documento3.get_Estipulante4() != null) - { - str397 = string.Concat(str397, documento3.get_Estipulante4().get_Nome(), ", "); - } - if (documento3.get_Estipulante5() != null) - { - str397 = string.Concat(str397, documento3.get_Estipulante5().get_Nome(), ", "); - } - if (!string.IsNullOrWhiteSpace(str397)) - { - int num16 = str397.LastIndexOf(", ", StringComparison.Ordinal); - str397 = str397.Remove(num16, 2).Insert(num16, "."); - } - string[] strArrays52 = new string[] { str371, ""; - str371 = string.Concat(strArrays52); - } - if (this.SelectedTipoExtrato == 2) - { - string[] strArrays53 = new string[] { str371, ""; - str371 = string.Concat(strArrays53); - } - else - { - string[] strArrays54 = new string[] { str371, ""; - str371 = string.Concat(strArrays54); - } - string[] description10 = new string[] { str371, ""; - str371 = string.Concat(description10); - str371 = string.Concat(str371, "

RAMO: "; - shortDateString19[4] = documento3.get_Controle().get_Ramo().get_Nome(); - shortDateString19[5] = "

VIGÊNCIA INICIAL: "; - date = documento3.get_Vigencia1(); - shortDateString19[8] = date.ToShortDateString(); - shortDateString19[9] = "

VIGÊNCIA FINAL: "; - clienteDesde = documento3.get_Vigencia2(); - if (!clienteDesde.HasValue) - { - shortDateString14 = "-"; - } - else - { - clienteDesde = documento3.get_Vigencia2(); - if (clienteDesde.HasValue) - { - shortDateString14 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString14 = null; - } - } - shortDateString19[12] = shortDateString14; - shortDateString19[13] = "

CONTRATO: "; - str248 = (string.IsNullOrWhiteSpace(documento3.get_Apolice()) ? "-" : documento3.get_Apolice()); - shortDateString19[16] = str248; - shortDateString19[17] = "

POSSUI ENDOSSO? "; - str250 = (documento3.get_TemEndosso() ? "SIM" : "NÃO"); - shortDateString19[20] = str250; - shortDateString19[21] = "

ADITAMENTO: "; - if (string.IsNullOrWhiteSpace(documento3.get_Endosso())) - { - endosso1 = (!flag || documento9 == null ? "-" : documento9.get_Endosso()); - } - else - { - endosso1 = documento3.get_Endosso(); - } - shortDateString19[24] = endosso1; - shortDateString19[25] = "

NEGÓCIO CORRETORA: "; - description9[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora()); - description9[5] = "

STATUS DO SEGURO: "; - description9[8] = ValidationHelper.GetDescription(documento3.get_Situacao()); - description9[9] = "

VENDEDOR: "; - str253 = (documento3.get_VendedorPrincipal() == null ? "-" : documento3.get_VendedorPrincipal().get_Nome()); - strArrays51[4] = str253; - strArrays51[5] = "

ESTIPULANTE(S): "; - str329 = (string.IsNullOrWhiteSpace(str397) ? "-" : str397); - strArrays52[4] = str329; - strArrays52[5] = "

SEGURADORA: "; - strArrays53[4] = documento3.get_Controle().get_Seguradora().get_Nome(); - strArrays53[5] = "

SEGURADORA: "; - strArrays54[4] = documento3.get_Controle().get_Seguradora().get_Nome(); - strArrays54[5] = "

APÓLICE SINISTRADA: "; - str327 = (documento3.get_Sinistro() ? "SIM" : "NÃO"); - strArrays54[8] = str327; - strArrays54[9] = "

FORMA PAGAMENTO: "; - description10[4] = ValidationHelper.GetDescription(documento3.get_FormaPagamento()); - description10[5] = "

"); - if (this.PremioParcela || this.ExtratoResumido) - { - str371 = string.Concat(str371, ""); - if (this.ComissaoDocumento && this.ComissaoDocumentoEnabled || this.ExtratoResumido) - { - string[] strArrays55 = new string[] { str371, ""; - str371 = string.Concat(strArrays55); - } - string[] strArrays56 = new string[26]; - strArrays56[0] = str371; - strArrays56[1] = ""; - str371 = string.Concat(strArrays56); - str371 = string.Concat(str371, "

COMISSÃO: "; - strArrays55[4] = string.Format("{0:n2}%", Math.Round(documento3.get_Comissao(), 2)); - strArrays55[5] = "

PRÊMIO LÍQUIDO: "; - strArrays56[4] = string.Format("{0:c}", Math.Round(documento3.get_PremioLiquido(), 2)); - strArrays56[5] = "

ADICIONAL: "; - strArrays56[8] = string.Format("{0:c}", Math.Round(documento3.get_PremioAdicional(), 2)); - strArrays56[9] = "

CUSTO APÓLICE: "; - strArrays56[12] = string.Format("{0:c}", Math.Round(documento3.get_Custo(), 2)); - strArrays56[13] = "

I.O.F.: "; - strArrays56[16] = string.Format("{0:c}", Math.Round(documento3.get_Iof(), 2)); - strArrays56[17] = "

PRÊMIO TOTAL: "; - strArrays56[20] = string.Format("{0:c}", Math.Round(documento3.get_PremioTotal(), 2)); - strArrays56[21] = "

Nº PARCELAS: "; - premioLiquido = documento3.get_NumeroParcelas(); - strArrays56[24] = premioLiquido.ToString(); - strArrays56[25] = "

"); - } - if (this.PerfilCondutor && this.PerfilVisibility && documento3.get_Controle().get_Ramo().get_Id() == (long)5 && this.PerfilCondutorEnabled) - { - List perfils1 = perfils.ToList(); - foreach (Perfil perfil1 in perfils1) - { - num10 = 0; - if (string.IsNullOrEmpty(perfil1.get_Nome())) - { - continue; - } - string[] description11 = new string[60]; - description11[0] = str371; - description11[1] = "

"; - description11[4] = string.Format("CONDUTOR {0}: ", perfils1.IndexOf(perfil1) + 1); - description11[5] = ""; - description11[6] = perfil1.get_Nome(); - description11[7] = "

CPF: "; - str301 = (string.IsNullOrWhiteSpace(perfil1.get_Cpf()) ? "-" : perfil1.get_Cpf()); - description11[10] = str301; - description11[11] = "

NASCIMENTO: "; - clienteDesde = perfil1.get_Nascimento(); - if (!clienteDesde.HasValue) - { - shortDateString16 = "-"; - } - else - { - clienteDesde = perfil1.get_Nascimento(); - if (clienteDesde.HasValue) - { - shortDateString16 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString16 = null; - } - } - description11[14] = shortDateString16; - description11[15] = "

ESTADO CIVIL: "; - str304 = (!perfil1.get_EstadoCivil().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_EstadoCivil())); - description11[18] = str304; - description11[19] = "

SEXO: "; - str306 = (!perfil1.get_Sexo().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_Sexo())); - description11[22] = str306; - description11[23] = "

RELAÇÃO SEGURADO/CONDUTOR: "; - description11[26] = ValidationHelper.GetDescription(perfil1.get_Relacao()); - description11[27] = "

GARAGEM NA RESIDÊNCIA: "; - str309 = (!perfil1.get_GaragemResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemResidencia())); - description11[30] = str309; - description11[31] = "

GARAGEM NO TRABALHO: "; - str311 = (!perfil1.get_GaragemTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemTrabalho())); - description11[34] = str311; - description11[35] = "

GARAGEM NO ESTUDO: "; - str313 = (!perfil1.get_GaragemEstudo().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemEstudo())); - description11[38] = str313; - description11[39] = "

TIPO DE RESIDÊNCIA: "; - str315 = (!perfil1.get_TipoResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_TipoResidencia())); - description11[42] = str315; - description11[43] = "

DISTÂNCIA ATÉ O TRABALHO: "; - str317 = (!perfil1.get_DistanciaResidenciaTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_DistanciaResidenciaTrabalho())); - description11[46] = str317; - description11[47] = "

USO PROFISSIONAL: "; - str319 = (!perfil1.get_UsoProfissional().HasValue || !perfil1.get_UsoProfissional().Value ? "NÃO" : "SIM"); - description11[50] = str319; - description11[51] = "

USO POR DEPENDENTES: "; - str321 = (!perfil1.get_UsoDependentes().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_UsoDependentes())); - description11[54] = str321; - description11[55] = "

ISENÇÃO DE IMPOSTOS: "; - str323 = (!perfil1.get_Isencao().HasValue || !perfil1.get_Isencao().Value ? "NÃO" : "SIM"); - description11[58] = str323; - description11[59] = "

"; - str371 = string.Concat(description11); - } - } - list = items1.ToList(); - if (list.Count != 0) - { - num10 = 0; - foreach (Item item5 in list) - { - if (item5.get_Sinistros().Count > 0) - { - item1 = item5; - controleSinistros = await (new SinistroServico()).BuscarControles(item5.get_Id()); - item1.set_Sinistros(controleSinistros); - item1 = null; - } - string str398 = str371; - str262 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); - str371 = string.Concat(str398, str262); - string str399 = str371; - str263 = (this.SelectedTipoExtrato != 2 || list.IndexOf(item5) == 0 ? "
" : ""); - str371 = string.Concat(str399, str263); - str371 = string.Concat(str371, ""); - str371 = string.Concat(str371, ""); - str371 = string.Concat(str371, ""); - if (this.SelectedTipoExtrato != 2) - { - id = documento3.get_Controle().get_Ramo().get_Id(); - if (id > (long)5) - { - if (id == (long)15 || id == (long)18) - { - goto Label8; - } - if (id == (long)37) - { - goto Label6; - } - goto Label7; - } - else - { - if (id - (long)1 <= (long)2) - { - goto Label8; - } - if (id == (long)5) - { - goto Label6; - } - goto Label7; - } - Label8: - item1 = item5; - patrimonial = await (new ItemServico()).BuscaPatrimonial(item5.get_Id()); - item1.set_Patrimonial(patrimonial); - item1 = null; - string[] estado1 = new string[19]; - estado1[0] = str371; - estado1[1] = ""; - str371 = string.Concat(estado1); - } - else - { - string[] descricao3 = new string[] { str371, ""; - str371 = string.Concat(descricao3); - } - Label10: - if (item5.get_Sinistros().Count > 0) - { - Item item6 = item5; - if (item6 != null) - { - IList controleSinistros3 = item6.get_Sinistros(); - if (controleSinistros3 != null) - { - ControleSinistro controleSinistro3 = controleSinistros3.LastOrDefault(); - if (controleSinistro3 != null) - { - List sinistros4 = controleSinistro3.get_Sinistros(); - if (sinistros4 != null) - { - Sinistro sinistro5 = sinistros4.LastOrDefault(); - if (sinistro5 != null) - { - dataReclamacao1 = sinistro5.get_DataReclamacao(); - } - else - { - clienteDesde = null; - dataReclamacao1 = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao1 = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao1 = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao1 = clienteDesde; - } - } - else - { - clienteDesde = null; - dataReclamacao1 = clienteDesde; - } - DateTime? nullable4 = dataReclamacao1; - if (nullable4.HasValue) - { - date = nullable4.Value; - shortDateString15 = date.ToShortDateString(); - } - else - { - shortDateString15 = "-"; - } - string str400 = shortDateString15; - string[] currency1 = new string[14]; - currency1[0] = str371; - currency1[1] = ""; - str371 = string.Concat(currency1); - } - str371 = string.Concat(str371, ""); - if (this.SelectedTipoExtrato != 2) - { - string[] strArrays57 = new string[] { str371, ""; - str371 = string.Concat(strArrays57); - id = documento3.get_Controle().get_Ramo().get_Id(); - long num17 = id - (long)1; - if (num17 <= (long)58) - { - switch ((uint)num17) - { - case 0: - case 1: - case 2: - case 14: - case 17: - { - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays58 = new string[] { str371, ""; - str371 = string.Concat(strArrays58); - break; - } - case 3: - case 7: - case 15: - case 16: - case 18: - case 22: - case 23: - case 25: - case 27: - case 30: - case 32: - case 38: - case 40: - case 43: - case 48: - case 58: - { - item1 = item5; - riscosDiverso = await (new ItemServico()).BuscaRiscosDiversos(item5.get_Id()); - item1.set_RiscosDiversos(riscosDiverso); - item1 = null; - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays59 = new string[] { str371, ""; - str371 = string.Concat(strArrays59); - break; - } - case 4: - case 36: - { - if (this.ObsItem && this.ObsItemEnabled) - { - string[] strArrays60 = new string[] { str371, ""; - str371 = string.Concat(strArrays60); - } - string[] strArrays61 = new string[26]; - strArrays61[0] = str371; - strArrays61[1] = ""; - str371 = string.Concat(strArrays61); - break; - } - case 5: - case 6: - case 8: - case 9: - case 52: - { - item1 = item5; - vida = await (new ItemServico()).BuscaVida(item5.get_Id()); - item1.set_Vida(vida); - item1 = null; - if (!item5.get_Sinistrado() || !this.BeneficiariosItens || !this.BeneficiariosItensEnabled) - { - break; - } - string str401 = str371; - str287 = (num10 % 2 == 0 ? "WhiteSmoke" : "White"); - str371 = string.Concat(str401, ""); - break; - } - case 12: - { - item1 = item5; - aeronautico = await (new ItemServico()).BuscaAeronautico(item5.get_Id()); - item1.set_Aeronautico(aeronautico); - item1 = null; - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays62 = new string[] { str371, ""; - str371 = string.Concat(strArrays62); - break; - } - case 19: - { - item1 = item5; - granizo = await (new ItemServico()).BuscaGranizo(item5.get_Id()); - item1.set_Granizo(granizo); - item1 = null; - if (!this.ObsItem || !this.ObsItemEnabled) - { - break; - } - string[] strArrays63 = new string[] { str371, ""; - str371 = string.Concat(strArrays63); - break; - } - } - } - else - { - } - } - str371 = string.Concat(str371, "

"; - estado1[4] = string.Format("ITEM {0}: ", item5.get_Ordem()); - estado1[5] = ""; - estado1[6] = item5.get_Patrimonial().get_Endereco(); - estado1[7] = ", "; - estado1[8] = item5.get_Patrimonial().get_Numero(); - estado1[9] = ", "; - str265 = (string.IsNullOrWhiteSpace(item5.get_Patrimonial().get_Complemento()) ? "" : string.Concat(item5.get_Patrimonial().get_Complemento(), ", ")); - estado1[10] = str265; - estado1[11] = item5.get_Patrimonial().get_Bairro(); - estado1[12] = " - "; - estado1[13] = item5.get_Patrimonial().get_Cidade(); - estado1[14] = " - "; - estado1[15] = item5.get_Patrimonial().get_Estado(); - estado1[16] = " - "; - estado1[17] = item5.get_Patrimonial().get_Cep(); - estado1[18] = "

"; - descricao3[4] = string.Format("ITEM {0}: ", item5.get_Ordem()); - descricao3[5] = ""; - descricao3[6] = item5.get_Descricao(); - descricao3[7] = "

SINISTRO STATUS: "; - currency1[4] = ValidationHelper.GetDescription(item5.get_Sinistros().LastOrDefault().get_Sinistros().LastOrDefault().get_StatusSinistro()); - currency1[5] = "

DATA: "; - currency1[8] = str400; - currency1[9] = "

VALOR: "; - currency1[12] = ValidationHelper.ToCurrency(item5.get_Sinistros().LastOrDefault().get_Sinistros().LastOrDefault().get_Valor(), "pt-BR"); - currency1[13] = "

ATIVO: "; - str272 = (!item5.get_Substituido().HasValue ? "SIM" : "NÃO"); - strArrays57[4] = str272; - strArrays57[5] = "

OBSERVAÇÕES: "; - str274 = (string.IsNullOrWhiteSpace(item5.get_Patrimonial().get_Bens()) ? "-" : item5.get_Patrimonial().get_Bens()); - strArrays58[4] = str274; - strArrays58[5] = "

OBSERVAÇÕES: "; - str276 = (string.IsNullOrWhiteSpace(item5.get_RiscosDiversos().get_Observacao()) ? "-" : item5.get_RiscosDiversos().get_Observacao()); - strArrays59[4] = str276; - strArrays59[5] = "

OBSERVAÇÕES: "; - str286 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_Observacao()) ? "-" : item5.get_Auto().get_Observacao()); - strArrays60[4] = str286; - strArrays60[5] = "

COBERTURA PADRÃO: "; - tipoCobertura = item5.get_Auto().get_TipoCobertura(); - if (tipoCobertura.HasValue) - { - description3 = ValidationHelper.GetDescription(tipoCobertura.GetValueOrDefault()); - } - else - { - description3 = null; - } - strArrays61[4] = description3; - strArrays61[5] = "

BÔNUS: "; - bonus = item5.get_Auto().get_Bonus(); - strArrays61[8] = bonus.ToString(); - strArrays61[9] = "

REGIÃO DE CIRCULAÇÃO: "; - str280 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_RegiaoCirculacao()) ? "-" : item5.get_Auto().get_RegiaoCirculacao()); - strArrays61[12] = str280; - strArrays61[13] = "

TABELA DE REFERÊNCIA: "; - tabelaReferencia = item5.get_Auto().get_TabelaReferencia(); - if (tabelaReferencia.HasValue) - { - description4 = ValidationHelper.GetDescription(tabelaReferencia.GetValueOrDefault()); - } - else - { - description4 = null; - } - strArrays61[16] = description4; - strArrays61[17] = "

FIPE: "; - str283 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_Fipe()) ? "-" : item5.get_Auto().get_Fipe()); - strArrays61[20] = str283; - strArrays61[21] = "

% DE REFERÊNCIA: "; - strArrays61[24] = string.Format("{0}%", item5.get_Auto().get_PorcentagemReferencia()); - strArrays61[25] = "

BENEFICIÁRIOS: "); - string str402 = ""; - foreach (ControleSinistro controleSinistro4 in item5.get_Sinistros()) - { - if (controleSinistro4.get_Sinistros() == null) - { - continue; - } - foreach (Sinistro sinistro6 in controleSinistro4.get_Sinistros()) - { - if (string.IsNullOrWhiteSpace(sinistro6.get_SinistroVida().get_Beneficiario())) - { - continue; - } - str402 = string.Concat(str402, sinistro6.get_SinistroVida().get_Beneficiario(), ", "); - } - } - if (!string.IsNullOrWhiteSpace(str402)) - { - int num18 = str402.LastIndexOf(", ", StringComparison.Ordinal); - str402 = str402.Remove(num18, 2).Insert(num18, "."); - } - str371 = string.Concat(str371, str402, "

OBSERVAÇÕES: "; - str289 = (string.IsNullOrWhiteSpace(item5.get_Aeronautico().get_Observacao()) ? "-" : item5.get_Aeronautico().get_Observacao()); - strArrays62[4] = str289; - strArrays62[5] = "

OBSERVAÇÕES: "; - str291 = (string.IsNullOrWhiteSpace(item5.get_Granizo().get_Observacao()) ? "-" : item5.get_Granizo().get_Observacao()); - strArrays63[4] = str291; - strArrays63[5] = "

"); - if (this.SelectedTipoExtrato != 2) - { - ObservableCollection observableCollection6 = await (new ItemServico()).BuscarCoberturasPorItemAsync(item5.get_Id()); - if (observableCollection6.Count > 0 && this.Coberturas) - { - str371 = string.Concat(str371, "
"); - foreach (Cobertura cobertura1 in observableCollection6) - { - numeroParcela = num10; - num10 = numeroParcela + 1; - string[] strArrays64 = new string[18]; - strArrays64[0] = str371; - strArrays64[1] = "

COBERTURA

FRANQUIA

LMI

PRÊMIO

"; - strArrays64[4] = cobertura1.get_Observacao(); - strArrays64[5] = "

"); - } - string str403 = str371; - str266 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "
"); - str371 = string.Concat(str403, str266); - } - if (this.SelectedTipoExtrato != 2) - { - num10 = 0; - } - } - } - else - { - str371 = string.Concat(str371, "

ESTA APÓLICE NÃO POSSUI ITENS

"); - } - list = null; - } - else - { - variable9 = null; - return; - } - } - } - nums.Add(documento3.get_Controle().get_Id()); - flag1 = false; - } - } - if (this.Prospeccoes != null && this.Prospeccoes.Count > 0) - { - foreach (Prospeccao prospecco in this.Prospeccoes) - { - int num19 = 0; - string str404 = str371; - str19 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); - str371 = string.Concat(str404, str19); - str371 = string.Concat(str371, "

"); - if (this.SelectedTipoExtrato == null) - { - str39 = (this.ExtratoResumido ? " RESUMIDO" : ""); - str370 = string.Concat("EXTRATO", str39, " DO CLIENTE: ", prospecco.get_Nome()); - } - str371 = string.Concat(str371, str370, "


"); - str371 = string.Concat(str371, ""); - if (!this.ExtratoResumido) - { - string str405 = "NASCIMENTO"; - string[] documento11 = new string[16]; - documento11[0] = str371; - documento11[1] = ""; - str371 = string.Concat(documento11); - if ((prospecco.get_Telefone1() != null || prospecco.get_Email() != null) && this.SelectedTipoExtrato != 2) - { - str371 = string.Concat(str371, ""); - if (prospecco.get_Telefone1() != null) - { - string str406 = ""; - string[] prefixo1 = new string[] { str406, "
(", prospecco.get_Prefixo1(), ") ", prospecco.get_Telefone1() }; - str406 = string.Concat(prefixo1); - if (prospecco.get_Telefone2() != null) - { - string[] prefixo2 = new string[] { str406, "
(", prospecco.get_Prefixo2(), ") ", prospecco.get_Telefone2() }; - str406 = string.Concat(prefixo2); - } - string[] strArrays65 = new string[] { str371, "
"; - str371 = string.Concat(strArrays65); - } - if (prospecco.get_Email() != null && !this.ExtratoResumido) - { - string str407 = ""; - str407 = string.Concat(str407, "
", prospecco.get_Email()); - string[] strArrays66 = new string[] { str371, "
"; - str371 = string.Concat(strArrays66); - } - num19++; - str371 = string.Concat(str371, ""); - } - string str408 = str371; - str23 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : ""); - str371 = string.Concat(str408, str23); - if (this.SelectedTipoExtrato != null) - { - num19 = 0; - string[] strArrays67 = new string[] { str371, "

CLIENTE: "; - documento11[4] = prospecco.get_Nome(); - documento11[5] = "

CPF/CNPJ: "; - documento11[8] = prospecco.get_Documento(); - documento11[9] = "

"; - documento11[12] = str405; - documento11[13] = ": "; - clienteDesde = prospecco.get_Nascimento(); - if (clienteDesde.HasValue) - { - shortDateString = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString = null; - } - documento11[14] = shortDateString; - documento11[15] = "

CONTATOS: "; - strArrays65[4] = str406; - strArrays65[5] = "

EMAILS: "; - strArrays66[4] = str407; - strArrays66[5] = "

"; - str371 = string.Concat(strArrays67); - string[] strArrays68 = new string[] { str371, ""; - str371 = string.Concat(strArrays68); - str371 = string.Concat(str371, "

VIGÊNCIA FINAL: "; - clienteDesde = prospecco.get_VigenciaFinal(); - if (!clienteDesde.HasValue) - { - shortDateString1 = "-"; - } - else - { - clienteDesde = prospecco.get_VigenciaFinal(); - if (clienteDesde.HasValue) - { - shortDateString1 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString1 = null; - } - } - strArrays67[4] = shortDateString1; - strArrays67[5] = "

VENDEDOR: "; - str26 = (prospecco.get_Vendedor() == null ? "-" : prospecco.get_Vendedor().get_Nome()); - strArrays68[4] = str26; - strArrays68[5] = "

"); - } - else - { - variable9 = null; - return; - } - } - else - { - string[] documento12 = new string[] { str371, ""; - str371 = string.Concat(documento12); - if (this.SelectedTipoExtrato != 2) - { - str371 = string.Concat(str371, ""); - string str409 = ""; - if (prospecco.get_Telefone1() != null) - { - string[] prefixo11 = new string[] { str409, "
(", prospecco.get_Prefixo1(), ") ", prospecco.get_Telefone1() }; - str409 = string.Concat(prefixo11); - } - if (prospecco.get_Telefone2() != null) - { - string[] prefixo21 = new string[] { str409, "
(", prospecco.get_Prefixo2(), ") ", prospecco.get_Telefone2() }; - str409 = string.Concat(prefixo21); - } - string[] strArrays69 = new string[] { str371, "
"; - str371 = string.Concat(strArrays69); - string str410 = ""; - if (prospecco.get_Email() != null) - { - str410 = string.Concat("
", prospecco.get_Email()); - } - string[] strArrays70 = new string[] { str371, "
"; - str371 = string.Concat(strArrays70); - } - str371 = string.Concat(str371, "

CLIENTE: "; - documento12[4] = prospecco.get_Nome(); - documento12[5] = "

CPF/CNPJ: "; - documento12[8] = prospecco.get_Documento(); - documento12[9] = "

CONTATOS: "; - str36 = (string.IsNullOrEmpty(str409) ? "-" : str409); - strArrays69[4] = str36; - strArrays69[5] = "

EMAILS: "; - str38 = (string.IsNullOrEmpty(str410) ? "-" : str410); - strArrays70[4] = str38; - strArrays70[5] = "

"); - string str411 = str371; - str31 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "
"); - str371 = string.Concat(str411, str31); - if (this.SelectedTipoExtrato != null) - { - num19 = 0; - string[] strArrays71 = new string[] { str371, "
"; - str371 = string.Concat(strArrays71); - string[] strArrays72 = new string[] { str371, ""; - str371 = string.Concat(strArrays72); - str371 = string.Concat(str371, "

VIGÊNCIA FINAL: "; - clienteDesde = prospecco.get_VigenciaFinal(); - if (!clienteDesde.HasValue) - { - shortDateString2 = "-"; - } - else - { - clienteDesde = prospecco.get_VigenciaFinal(); - if (clienteDesde.HasValue) - { - shortDateString2 = clienteDesde.GetValueOrDefault().ToShortDateString(); - } - else - { - shortDateString2 = null; - } - } - strArrays71[4] = shortDateString2; - strArrays71[5] = "

VENDEDOR: "; - str34 = (prospecco.get_Vendedor() == null ? "-" : prospecco.get_Vendedor().get_Nome()); - strArrays72[4] = str34; - strArrays72[5] = "

"); - } - else - { - variable9 = null; - return; - } - } - } - } - DateTime dateTime = Funcoes.GetNetworkTime(); - string[] shortDateString20 = new string[] { str371, "

", Recursos.Usuario.get_Nome(), " - ", null, null }; - date = dateTime.Date; - shortDateString20[4] = date.ToShortDateString(); - shortDateString20[5] = "
"; - str371 = string.Concat(shortDateString20); - string tempPath1 = Path.GetTempPath(); - string str412 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath1, (TipoExtrato)0, dateTime); - if (!pdf) - { - StreamWriter streamWriter1 = new StreamWriter(str412, true, Encoding.UTF8); - streamWriter1.Write(str371); - streamWriter1.Close(); - } - else - { - str412 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.pdf", tempPath1, (TipoExtrato)0, dateTime); - File.WriteAllBytes(str412, (new NRecoHtmlToPdfConverter()).GeneratePdf(str371)); - } - Process.Start(str412); - if (this.Documentos != null && this.Documentos.Count > 1) - { - ExtratosViewModel extratosViewModel1 = this; - str17 = (this.ExtratoResumido ? " RESUMIDO" : ""); - if (this.Documentos != null) - { - str18 = (this.Documentos.Count > 1 ? string.Format("DE {0} DOCUMENTOS", this.Documentos.Count) : string.Format("DO DOCUMENTO {0}", this.Documentos[0].get_Id())); - } - else - { - str18 = ""; - } - string str413 = string.Concat("GEROU O EXTRATO", str17, " ", str18); - long num24 = (long)0; - TipoTela? nullable5 = new TipoTela?(23); - List documentos3 = this.Documentos; - extratosViewModel1.RegistrarAcao(str413, num24, nullable5, string.Concat("IDS DOS DOCUMENTOS:\n", string.Join("\n", - from x in documentos3 - select x.get_Id()), this.GerarOpcoes())); - } - if (this.Prospeccoes != null && this.Prospeccoes.Count > 1) - { - ExtratosViewModel extratosViewModel2 = this; - str15 = (this.ExtratoResumido ? " RESUMIDO" : ""); - if (this.Prospeccoes != null) - { - str16 = (this.Prospeccoes.Count > 1 ? string.Format("DE {0} PROSPECÇÕES", this.Prospeccoes.Count) : string.Format("DA PROSPÇÃO{0}", this.Prospeccoes[0].get_Id())); - } - else - { - str16 = ""; - } - string str414 = string.Concat("GEROU O EXTRATO", str15, " ", str16); - long num25 = (long)0; - TipoTela? nullable6 = new TipoTela?(23); - List prospeccoes = this.Prospeccoes; - extratosViewModel2.RegistrarAcao(str414, num25, nullable6, string.Concat("IDS DOS DOCUMENTOS:\n", string.Join("\n", - from x in prospeccoes - select x.get_Id()), this.GerarOpcoes())); - } - this.Documentos = null; - this.Clientes = null; - this.Prospeccoes = null; - nums = null; - } - variable9 = null; - return; - Label3: - item1 = item; - auto = await (new ItemServico()).BuscaAuto(item.get_Id()); - item1.set_Auto(auto); - item1 = null; - string[] modelo = new string[26]; - modelo[0] = str371; - modelo[1] = "

"; - modelo[4] = string.Format("ITEM {0}: ", item.get_Ordem()); - modelo[5] = "
"; - Fabricante fabricante = item.get_Auto().get_Fabricante(); - if (fabricante != null) - { - descricao = fabricante.get_Descricao(); - } - else - { - descricao = null; - } - modelo[6] = descricao; - modelo[7] = " "; - modelo[8] = item.get_Auto().get_Modelo(); - modelo[9] = " ("; - modelo[10] = item.get_Auto().get_AnoFabricacao(); - modelo[11] = "/"; - modelo[12] = item.get_Auto().get_AnoModelo(); - modelo[13] = ")
PLACA: "; - modelo[14] = item.get_Auto().get_Placa(); - modelo[15] = ", CHASSI: "; - modelo[16] = item.get_Auto().get_Chassi(); - modelo[17] = "
C.I.: "; - modelo[18] = item.get_Auto().get_Ci(); - modelo[19] = ", RENAVAM: "; - modelo[20] = item.get_Auto().get_Renavam(); - modelo[21] = ", CEP PERNOITE: "; - modelo[22] = item.get_Auto().get_CepPernoite(); - modelo[23] = "
FINANCIADO: "; - str112 = (item.get_Auto().get_Financiado().GetValueOrDefault() ? "SIM" : "NÃO"); - modelo[24] = str112; - modelo[25] = "

"; - str371 = string.Concat(modelo); - goto Label9; - Label4: - string[] descricao4 = new string[] { str371, "

"; - descricao4[4] = string.Format("ITEM {0}: ", item.get_Ordem()); - descricao4[5] = ""; - descricao4[6] = item.get_Descricao(); - descricao4[7] = "

QTDE SINISTRO(S): "; - numeroParcela = item.get_Sinistros().Count; - descricao4[8] = numeroParcela.ToString(); - descricao4[9] = "

"; - str371 = string.Concat(descricao4); - goto Label9; - Label6: - item1 = item; - auto = await (new ItemServico()).BuscaAuto(item.get_Id()); - item1.set_Auto(auto); - item1 = null; - string[] anoFabricacao = new string[26]; - anoFabricacao[0] = str371; - anoFabricacao[1] = "

"; - anoFabricacao[4] = string.Format("ITEM {0}: ", item.get_Ordem()); - anoFabricacao[5] = "
"; - Fabricante fabricante1 = item.get_Auto().get_Fabricante(); - if (fabricante1 != null) - { - descricao1 = fabricante1.get_Descricao(); - } - else - { - descricao1 = null; - } - anoFabricacao[6] = descricao1; - anoFabricacao[7] = " "; - anoFabricacao[8] = item.get_Auto().get_Modelo(); - anoFabricacao[9] = " ("; - anoFabricacao[10] = item.get_Auto().get_AnoFabricacao(); - anoFabricacao[11] = "/"; - anoFabricacao[12] = item.get_Auto().get_AnoModelo(); - anoFabricacao[13] = ")
PLACA: "; - anoFabricacao[14] = item.get_Auto().get_Placa(); - anoFabricacao[15] = ", CHASSI: "; - anoFabricacao[16] = item.get_Auto().get_Chassi(); - anoFabricacao[17] = "
C.I.: "; - anoFabricacao[18] = item.get_Auto().get_Ci(); - anoFabricacao[19] = ", RENAVAM: "; - anoFabricacao[20] = item.get_Auto().get_Renavam(); - anoFabricacao[21] = ", CEP PERNOITE: "; - anoFabricacao[22] = item.get_Auto().get_CepPernoite(); - anoFabricacao[23] = "
FINANCIADO: "; - str296 = (item.get_Auto().get_Financiado().GetValueOrDefault() ? "SIM" : "NÃO"); - anoFabricacao[24] = str296; - anoFabricacao[25] = "

"; - str371 = string.Concat(anoFabricacao); - goto Label10; - Label7: - string[] descricao5 = new string[] { str371, "

"; - descricao5[4] = string.Format("ITEM {0}: ", item.get_Ordem()); - descricao5[5] = ""; - descricao5[6] = item.get_Descricao(); - descricao5[7] = "

"; - str371 = string.Concat(descricao5); - goto Label10; - } - - public string GerarOpcoes() - { - string str = ""; - if (this.ClienteVisibility && this.ObsCliente && this.ObsClienteEnabled) - { - str = string.Concat(str, "\nOBSERVAÇÕES DO CLIENTE"); - } - if (this.ClientePorPaginaVisibility == Visibility.Visible && this.ClientePorPagina && this.ClientePorPaginaEnabled) - { - str = string.Concat(str, "\nSEPARAR CLIENTES POR PÁGINA"); - } - if (this.DocumentoVisibility) - { - if (this.ComissaoDocumentoEnabled && this.ComissaoDocumento) - { - str = string.Concat(str, "\nCOMISSÕES DO DOCUMENTO"); - } - if (this.ObsApoliceEnabled && this.ObsApolice) - { - str = string.Concat(str, "\nOBSERVAÇÕES DA APÓLICE"); - } - if (this.SegurosVigentesVisibility == Visibility.Visible && this.SegurosVigentes) - { - str = string.Concat(str, "\nAPENAS SEGUROS VIGENTES"); - } - } - if (this.ItemVisibility) - { - if (this.SelecionarItensVisibility == Visibility.Visible && this.SelecionarItens) - { - str = string.Concat(str, "\nSELECIONAR ITENS"); - } - if (this.BeneficiariosItensEnabled && this.BeneficiariosItens) - { - str = string.Concat(str, "\nBENEFICIÁRIOS DOS ITENS"); - } - if (this.ObsItemEnabled && this.ObsItem) - { - str = string.Concat(str, "\nOBSERVAÇÕES DO ITEM"); - } - if (this.SepararPaginaEnabled && this.SepararPagina) - { - str = string.Concat(str, "\nSEPARAR ITENS POR PÁGINA"); - } - } - if (this.PerfilCondutor && this.PerfilVisibility && this.PerfilCondutorEnabled) - { - str = string.Concat(str, "\nPERFIL DO CONDUTOR"); - } - if (string.IsNullOrWhiteSpace(str)) - { - return ""; - } - return string.Concat("\n\nOPÇÕES:", str); - } - - public async Task PrepararExtrato(List clientes, List documentos, List prospeccoes, Relatorio? tipoRelatorio = null, List selecionadosDoc = null, List selecionadosPros = null, bool pdf = false) - { - ObservableCollection observableCollection; - ObservableCollection observableCollection1; - ObservableCollection observableCollection2; - ObservableCollection observableCollection3; - ObservableCollection observableCollection4; - bool count; - List documentos1; - bool flag; - List clientes1; - Cliente cliente; - Cliente cliente1; - List documentos2; - this.Carregando = true; - Relatorio? nullable = tipoRelatorio; - if (nullable.GetValueOrDefault() != 0 | !nullable.HasValue && tipoRelatorio.GetValueOrDefault() != 1) - { - if ((documentos == null || documentos.Count == 0) && (prospeccoes == null || prospeccoes.Count == 0)) - { - await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO", "OK", "", false); - this.Carregando = false; - return; - } - else - { - List documentos3 = documentos; - if (documentos3 != null) - { - count = documentos3.Count > 200; - } - else - { - count = false; - } - if (!count) - { - List prospeccaos = prospeccoes; - if (prospeccaos != null) - { - flag = prospeccaos.Count > 200; - } - else - { - flag = false; - } - if (!flag) - { - goto Label1; - } - } - if (!await base.ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO", false)) - { - this.Carregando = false; - return; - } - Label1: - switch (this.SelectedTipoExtrato) - { - case 0: - { - if (selecionadosDoc == null || selecionadosDoc.Count == 0) - { - await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO", "OK", "", false); - this.Carregando = false; - return; - } - else - { - clientes1 = new List(); - foreach (Documento documento in documentos) - { - cliente = await (new ClienteServico()).BuscarCliente(documento.get_Controle().get_Cliente().get_Id()); - cliente1 = cliente; - observableCollection = await this._clienteServico.BuscarEnderecosAsync(cliente.get_Id()); - cliente1.set_Enderecos(observableCollection); - cliente1 = null; - cliente1 = cliente; - observableCollection1 = await this._clienteServico.BuscarEmailsAsync(cliente.get_Id()); - cliente1.set_Emails(observableCollection1); - cliente1 = null; - cliente1 = cliente; - observableCollection2 = await this._clienteServico.BuscarTelefonesAsync(cliente.get_Id()); - cliente1.set_Telefones(observableCollection2); - cliente1 = null; - cliente1 = cliente; - observableCollection3 = await this._clienteServico.BuscarContatosAsync(cliente.get_Id()); - cliente1.set_Contatos(observableCollection3); - cliente1 = null; - cliente1 = cliente; - observableCollection4 = await this._clienteServico.BuscarVinculosAsync(cliente.get_Id()); - cliente1.set_Vinculos(observableCollection4); - cliente1 = null; - clientes1.Add(cliente); - cliente = null; - } - this.Clientes = clientes1; - this.Prospeccoes = prospeccoes; - break; - } - } - case 1: - { - if ((selecionadosDoc == null || selecionadosDoc.Count == 0) && (selecionadosPros == null || selecionadosPros.Count == 0)) - { - await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO SELECIONADO", "OK", "", false); - this.Carregando = false; - return; - } - else - { - this.Documentos = new List(); - this.Prospeccoes = new List(); - if (selecionadosDoc != null) - { - foreach (long num in selecionadosDoc) - { - Documento documento1 = await (new ApoliceServico()).BuscarApoliceAsync(num, false, true); - Documento documento2 = documento1; - documentos1 = (!this.SomenteEndossos || documento2.get_Ordem() == 1 ? new List() - { - documento2 - } : new List()); - List documentos4 = documentos1; - if (this.SomenteEndossos) - { - IEnumerable documentos5 = documento2.get_Controle().get_Documentos().Where((Documento x) => { - if (x.get_Excluido() || x.get_Ordem() == 0) - { - return false; - } - return !documentos4.Any((Documento y) => y.get_Id() == x.get_Id()); - }); - foreach (Documento documento3 in documentos5) - { - documento3.set_Sinistro(documento2.get_Sinistro()); - } - documentos4.AddRange(documentos5); - } - else if (this.Endossos) - { - IEnumerable documentos6 = documento2.get_Controle().get_Documentos().Where((Documento x) => { - if (x.get_Id() == documento2.get_Id()) - { - return false; - } - return !x.get_Excluido(); - }); - foreach (Documento documento4 in documentos6) - { - documento4.set_Sinistro(documento2.get_Sinistro()); - } - documentos4.AddRange(documentos6); - } - if (documento2.get_Controle().get_Documentos().Any((Documento x) => { - if (x.get_Id() == documento2.get_Id() || x.get_Excluido()) - { - return false; - } - return x.get_Ordem() > documento2.get_Ordem(); - })) - { - documento2.set_TemEndosso(true); - } - List configuracoes = Recursos.Configuracoes; - if (configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 31) && documento2.get_TemEndosso()) - { - Documento documento5 = documento2; - IList documentos7 = documento2.get_Controle().get_Documentos(); - IEnumerable excluido = - from x in documentos7 - where !x.get_Excluido() - select x; - documento5.set_PremioTotal(excluido.Sum((Documento x) => x.get_PremioTotal())); - Documento documento6 = documento2; - IList documentos8 = documento2.get_Controle().get_Documentos(); - IEnumerable excluido1 = - from x in documentos8 - where !x.get_Excluido() - select x; - documento6.set_Iof(excluido1.Sum((Documento x) => x.get_Iof())); - Documento documento7 = documento2; - IList documentos9 = documento2.get_Controle().get_Documentos(); - IEnumerable excluido2 = - from x in documentos9 - where !x.get_Excluido() - select x; - documento7.set_Custo(excluido2.Sum((Documento x) => x.get_Custo())); - Documento documento8 = documento2; - IList documentos10 = documento2.get_Controle().get_Documentos(); - IEnumerable excluido3 = - from x in documentos10 - where !x.get_Excluido() - select x; - documento8.set_PremioLiquido(excluido3.Sum((Documento x) => x.get_PremioLiquido())); - Documento documento9 = documento2; - IList documentos11 = documento2.get_Controle().get_Documentos(); - IEnumerable excluido4 = - from x in documentos11 - where !x.get_Excluido() - select x; - documento9.set_PremioAdicional(excluido4.Sum((Documento x) => x.get_PremioAdicional())); - } - List documentos12 = this.Documentos; - List documentos13 = documentos4; - documentos12.AddRange(( - from x in documentos13 - orderby x.get_Ordem() - select x).ToList()); - } - } - if (selecionadosPros != null) - { - foreach (long selecionadosPro in selecionadosPros) - { - Prospeccao prospeccao = await (new ProspeccaoServico()).BuscarProspeccao(selecionadosPro); - this.Prospeccoes.Add(prospeccao); - } - } - if (this.SelecionarItensVisibility == Visibility.Visible && this.SelecionarItens && this.Documentos != null && this.Documentos.Count > 0) - { - ObservableCollection observableCollection5 = await base.ShowSelecionarItensDialog(this.Documentos.First().get_Controle().get_Id()); - ExtratosViewModel list = this; - ObservableCollection observableCollection6 = observableCollection5; - list._itensSelecionados = ( - from x in observableCollection6 - where x.get_Selecionado() - select x).ToList(); - } - if (this.Documentos != null && this.Documentos.Count != 0 || this.Prospeccoes != null && this.Prospeccoes.Count != 0) - { - break; - } - if (!this.SomenteEndossos) - { - await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM DOCUMENTO OU PROSPECÇÃO SELECIONADO", "OK", "", false); - } - else - { - await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM ENDOSSO OU PROSPECÇÃO SELECIONADO", "OK", "", false); - } - this.Carregando = false; - return; - } - } - case 2: - { - documentos2 = new List(); - ApoliceServico apoliceServico = new ApoliceServico(); - long id = documentos.First().get_Controle().get_Cliente().get_Id(); - FiltroStatusDocumento statusSelecionado = MainViewModel.StatusSelecionado; - List vendedorUsuarios = await base.VerificaVinculoVendedor(Recursos.Usuario); - ObservableCollection observableCollection7 = await apoliceServico.BuscarApolicesAsync(id, statusSelecionado, vendedorUsuarios); - apoliceServico = null; - this.Documentos = new List(observableCollection7); - foreach (Documento documento10 in this.Documentos) - { - foreach (Documento documento11 in documento10.get_Controle().get_Documentos()) - { - if (documento11.get_Tipo() != 1) - { - continue; - } - documentos2.Add(documento11); - documento10.set_TemEndosso(true); - } - } - this.Documentos.AddRange(documentos2); - break; - } - } - documentos2 = null; - clientes1 = null; - } - } - else if (clientes == null || clientes.Count == 0) - { - await base.ShowMessage("É NECESSÁRIO HAVER AO MENOS UM CLIENTE", "OK", "", false); - this.Carregando = false; - return; - } - else - { - if (clientes.Count > 200) - { - if (!await base.ShowMessage("A SELEÇÃO DE MUITOS EXTRATOS PODE DEMORAR MAIS DE 30 MINUTOS! CONTINUAR?", "SIM", "NÃO", false)) - { - this.Carregando = false; - return; - } - } - clientes1 = new List(); - List clientesAtivosInativos = clientes; - foreach (ClientesAtivosInativos clientesAtivosInativo in - from x in clientesAtivosInativos - where x.get_Selecionado() - select x) - { - cliente = await (new ClienteServico()).BuscarCliente(clientesAtivosInativo.get_Id()); - cliente1 = cliente; - observableCollection = await this._clienteServico.BuscarEnderecosAsync(cliente.get_Id()); - cliente1.set_Enderecos(observableCollection); - cliente1 = null; - cliente1 = cliente; - observableCollection1 = await this._clienteServico.BuscarEmailsAsync(cliente.get_Id()); - cliente1.set_Emails(observableCollection1); - cliente1 = null; - cliente1 = cliente; - observableCollection2 = await this._clienteServico.BuscarTelefonesAsync(cliente.get_Id()); - cliente1.set_Telefones(observableCollection2); - cliente1 = null; - cliente1 = cliente; - observableCollection3 = await this._clienteServico.BuscarContatosAsync(cliente.get_Id()); - cliente1.set_Contatos(observableCollection3); - cliente1 = null; - cliente1 = cliente; - observableCollection4 = await this._clienteServico.BuscarVinculosAsync(cliente.get_Id()); - cliente1.set_Vinculos(observableCollection4); - cliente1 = null; - clientes1.Add(cliente); - cliente = null; - } - this.Clientes = clientes1; - clientes1 = null; - } - if (this.SegurosVigentesVisibility == Visibility.Visible && this.SegurosVigentes) - { - ExtratosViewModel extratosViewModel = this; - List documentos14 = this.Documentos; - extratosViewModel.Documentos = documentos14.Where((Documento x) => { - DateTime? vigencia2 = x.get_Vigencia2(); - DateTime dateTime = Funcoes.GetNetworkTime().Date.AddDays(-5); - if ((vigencia2.HasValue ? vigencia2.GetValueOrDefault() <= dateTime : true)) - { - vigencia2 = x.get_Vigencia2(); - if (vigencia2.HasValue) - { - return false; - } - } - return x.get_Situacao() != 7; - }).ToList(); - } - await this.Gerar(tipoRelatorio, pdf); - this.Carregando = false; - } - - private void RelacaoApolices() - { - this.SetAllFalse(); - this.ComissaoDocumentoEnabled = true; - this.PerfilCondutorEnabled = true; - } - - private void SetAllFalse() - { - this.ObsClienteEnabled = false; - this.ClientePorPaginaEnabled = false; - this.ComissaoDocumentoEnabled = false; - this.ObsApoliceEnabled = false; - this.BeneficiariosItensEnabled = false; - this.ObsItemEnabled = false; - this.SepararPaginaEnabled = false; - this.CoberturasEnabled = false; - this.PerfilCondutorEnabled = false; - this.EndossoEnabled = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/ImpostoViewModel.cs b/Gestor.Application/ViewModels/Drawer/ImpostoViewModel.cs deleted file mode 100644 index e2ec7d5..0000000 --- a/Gestor.Application/ViewModels/Drawer/ImpostoViewModel.cs +++ /dev/null @@ -1,484 +0,0 @@ -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.Configuracoes; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class ImpostoViewModel : BaseViewModel - { - private bool _carregando; - - private bool _apelido; - - public int Tipo; - - private List _seguradoras; - - private List _ramos; - - private ObservableCollection _impostos = new ObservableCollection(); - - private Imposto _selectedImposto = new Imposto(); - - private Ramo _selectedRamo = new Ramo(); - - private Seguradora _selectedSeguradora = new Seguradora(); - - public bool Apelido - { - get - { - return this._apelido; - } - set - { - this._apelido = value; - base.OnPropertyChanged("Apelido"); - } - } - - public bool? Ativo { get; set; } = new bool?(true); - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public ObservableCollection Impostos - { - get - { - return this._impostos; - } - set - { - this._impostos = value; - base.OnPropertyChanged("Impostos"); - } - } - - public List Ramos - { - get - { - return this._ramos; - } - set - { - this._ramos = value; - base.OnPropertyChanged("Ramos"); - } - } - - public List Seguradoras - { - get - { - return this._seguradoras; - } - set - { - this._seguradoras = value; - base.OnPropertyChanged("Seguradoras"); - } - } - - public Imposto SelectedImposto - { - get - { - return this._selectedImposto; - } - set - { - long? nullable; - this._selectedImposto = value; - if (value != null) - { - nullable = new long?(value.get_Id()); - } - else - { - nullable = null; - } - base.VerificarEnables(nullable); - base.OnPropertyChanged("SelectedImposto"); - } - } - - public Ramo SelectedRamo - { - get - { - return this._selectedRamo; - } - set - { - this._selectedRamo = value; - base.OnPropertyChanged("SelectedRamo"); - } - } - - public Seguradora SelectedSeguradora - { - get - { - return this._selectedSeguradora; - } - set - { - this._selectedSeguradora = value; - base.OnPropertyChanged("SelectedSeguradora"); - } - } - - private ImpostoServico Servico - { - get; - } - - public ImpostoViewModel() - { - this.Servico = new ImpostoServico(); - this.Apelido = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 6); - } - - public void AlterarImposto() - { - base.Alterar(true); - } - - public async Task Cancelar() - { - long id; - Imposto selectedImposto = this.SelectedImposto; - if (selectedImposto != null) - { - id = selectedImposto.get_Id(); - } - else - { - id = (long)0; - } - long num = id; - base.Alterar(false); - await this.Carregar(num); - } - - public async Task Carregar(int tipo, long id) - { - string str; - this.Tipo = tipo; - await base.PermissaoTela(56); - List list = Recursos.Seguradoras.Where((Seguradora x) => { - if (x.get_Ativo()) - { - return true; - } - if (tipo != 0) - { - return false; - } - return x.get_Id() == id; - }).OrderBy((Seguradora x) => { - if (!this.Apelido) - { - return x.get_Nome(); - } - return x.get_NomeSocial(); - }).ToList(); - Seguradora seguradora = new Seguradora(); - seguradora.set_Nome("TODAS SEGURADORAS"); - seguradora.set_NomeSocial("TODAS SEGURADORAS"); - seguradora.set_Id((long)0); - list.Insert(0, seguradora); - this.Seguradoras = list; - this.SelectedSeguradora = this.Seguradoras.First(); - IEnumerable ramos = Recursos.Ramos.Where((Ramo x) => { - if (x.get_Ativo()) - { - return true; - } - if (tipo != 1) - { - return false; - } - return x.get_Id() == id; - }); - List list1 = ( - from x in ramos - orderby x.get_Nome() - select x).ToList(); - Ramo ramo = new Ramo(); - ramo.set_Nome("TODOS OS RAMOS"); - ramo.set_Id((long)0); - list1.Insert(0, ramo); - this.Ramos = list1; - this.SelectedRamo = this.Ramos.First(); - str = (tipo == 1 ? string.Concat("O RAMO \"", this.Ramos.First((Ramo x) => x.get_Id() == id).get_Nome(), "\"") : string.Concat("A SEGURADORA \"", this.Seguradoras.First((Seguradora x) => x.get_Id() == id).get_Nome(), "\"")); - string str1 = str; - base.RegistrarAcao(string.Concat("ACESSOU IMPOSTOS D", str1), id, new TipoTela?(56), string.Format("ID: {0}", id)); - List impostos = await this.Servico.Buscar(new bool?(true)); - if (tipo == 1) - { - impostos = impostos.Where((Imposto x) => { - if (x.get_Ramo() == null || x.get_Ramo().get_Id() != id) - { - return false; - } - return x.get_Seguradora() == null; - }).ToList(); - this.SelectedRamo = this.Ramos.Find((Ramo x) => x.get_Id() == id); - } - else - { - impostos = impostos.Where((Imposto x) => { - if (x.get_Seguradora() == null || x.get_Seguradora().get_Id() != id) - { - return false; - } - return x.get_Ramo() == null; - }).ToList(); - this.SelectedSeguradora = this.Seguradoras.Find((Seguradora x) => x.get_Id() == id); - } - ImpostoViewModel observableCollection = this; - List impostos1 = impostos; - observableCollection.Impostos = new ObservableCollection( - from x in impostos1 - orderby x.get_Ativo() descending - select x); - this.SelectedImposto = this.Impostos.FirstOrDefault(); - } - - public async Task Carregar(long id = 0L) - { - Imposto imposto; - List list = await this.Servico.Buscar(this.Ativo); - if (this.SelectedSeguradora.get_Id() == 0) - { - List impostos = list; - list = ( - from x in impostos - where x.get_Seguradora() == null - select x).ToList(); - } - if (this.SelectedSeguradora.get_Id() > (long)0) - { - list = list.Where((Imposto x) => { - if (x.get_Seguradora() == null) - { - return false; - } - return x.get_Seguradora().get_Id() == this.SelectedSeguradora.get_Id(); - }).ToList(); - } - if (this.SelectedRamo.get_Id() == 0) - { - List impostos1 = list; - list = ( - from x in impostos1 - where x.get_Ramo() == null - select x).ToList(); - } - if (this.SelectedRamo.get_Id() > (long)0) - { - list = list.Where((Imposto x) => { - if (x.get_Ramo() == null) - { - return false; - } - return x.get_Ramo().get_Id() == this.SelectedRamo.get_Id(); - }).ToList(); - } - this.Impostos = new ObservableCollection(list.Where((Imposto x) => { - if (!this.Ativo.HasValue) - { - return true; - } - return x.get_Ativo() == this.Ativo.Value; - }).ToList()); - ImpostoViewModel impostoViewModel = this; - imposto = (id == 0 ? this.Impostos.FirstOrDefault() : this.Impostos.FirstOrDefault((Imposto x) => x.get_Id() == id)); - impostoViewModel.SelectedImposto = imposto; - } - - public void Incluir() - { - Seguradora selectedSeguradora; - Ramo selectedRamo; - Imposto imposto = new Imposto(); - if (this.SelectedSeguradora.get_Id() > (long)0) - { - selectedSeguradora = this.SelectedSeguradora; - } - else - { - selectedSeguradora = null; - } - imposto.set_Seguradora(selectedSeguradora); - if (this.SelectedRamo.get_Id() > (long)0) - { - selectedRamo = this.SelectedRamo; - } - else - { - selectedRamo = null; - } - imposto.set_Ramo(selectedRamo); - imposto.set_Ativo(true); - this.SelectedImposto = imposto; - base.Alterar(true); - } - - public async Task>> Salvar() - { - List> keyValuePairs; - string str; - string str1; - string str2; - object obj; - string str3; - List> keyValuePairs1 = this.SelectedImposto.Validate(); - keyValuePairs1.AddRange(this.Validate(this.SelectedImposto)); - if (keyValuePairs1.Count <= 0) - { - str = (this.SelectedImposto.get_Id() == 0 ? "INCLUIU" : "ALTEROU"); - str3 = str; - Imposto imposto = await this.Servico.Salvar(this.SelectedImposto); - if (this.Servico.Sucesso) - { - str1 = (imposto.get_Seguradora() == null ? "TODAS AS SEGURADORAS" : string.Concat(" SEGURADORA ", imposto.get_Seguradora().get_Nome())); - string str4 = str1; - str2 = (imposto.get_Ramo() == null ? "TODOS OS RAMOS" : string.Concat(" RAMO ", imposto.get_Ramo().get_Nome())); - string str5 = str2; - string str6 = string.Concat(" ", str4, " E ", str5); - ImpostoViewModel impostoViewModel = this; - string str7 = string.Concat(str3, " IMPOSTO PARA ", str6); - long id = imposto.get_Id(); - TipoTela? nullable = new TipoTela?(31); - object[] ir = new object[] { imposto.get_Id(), str4, str5, null, null, null, null, null }; - obj = (imposto.get_Ativo() ? "ATIVO" : "INATIVO"); - ir[3] = obj; - ir[4] = imposto.get_Ir(); - ir[5] = imposto.get_Iss(); - ir[6] = imposto.get_Outros(); - ir[7] = imposto.get_Desconto(); - impostoViewModel.RegistrarAcao(str7, id, nullable, string.Format("ID: {0}{1}{2}\nSTATUS: {3}\nIR: {4:p2}\nISS: {5:p2}\nOUTROS: {6:p2}\nDESCONTO: {7:p2}", ir)); - base.Alterar(false); - await this.Carregar(imposto.get_Id()); - keyValuePairs = null; - } - else - { - keyValuePairs = new List>() - { - new KeyValuePair("GRAVAR", "HOUVE UM ERRO AO SALVAR O IMPOSTO SELECIONADO.") - }; - } - } - else - { - keyValuePairs = keyValuePairs1; - } - str3 = null; - return keyValuePairs; - } - - public List> Validate(Imposto imposto) - { - List> keyValuePairs = new List>(); - if (imposto == null) - { - return keyValuePairs; - } - if (imposto.get_Ativo() && this.Impostos.Any((Imposto x) => { - long? nullable; - long? nullable1; - long? nullable2; - long? nullable3; - long? nullable4; - if (x.get_Id() != imposto.get_Id()) - { - Seguradora seguradora = x.get_Seguradora(); - if (seguradora != null) - { - nullable1 = new long?(seguradora.get_Id()); - } - else - { - nullable = null; - nullable1 = nullable; - } - long? nullable5 = nullable1; - Seguradora seguradora1 = imposto.get_Seguradora(); - if (seguradora1 != null) - { - nullable2 = new long?(seguradora1.get_Id()); - } - else - { - nullable = null; - nullable2 = nullable; - } - long? nullable6 = nullable2; - if (nullable5.GetValueOrDefault() == nullable6.GetValueOrDefault() & nullable5.HasValue == nullable6.HasValue) - { - Ramo ramo = x.get_Ramo(); - if (ramo != null) - { - nullable3 = new long?(ramo.get_Id()); - } - else - { - nullable = null; - nullable3 = nullable; - } - nullable6 = nullable3; - Ramo ramo1 = imposto.get_Ramo(); - if (ramo1 != null) - { - nullable4 = new long?(ramo1.get_Id()); - } - else - { - nullable = null; - nullable4 = nullable; - } - nullable5 = nullable4; - if (nullable6.GetValueOrDefault() == nullable5.GetValueOrDefault() & nullable6.HasValue == nullable5.HasValue) - { - return x.get_Ativo(); - } - } - } - return false; - })) - { - keyValuePairs.Add(new KeyValuePair("IMPOSTO DUPLICADO", "NÃO É POSSIVEL INSERIR UM NOVO PARAMETRO DE IMPOSTO, POIS JÁ EXISTEM PARAMETROS PARA A MESMA SEGURADORA E RAMO")); - } - return keyValuePairs.Distinct>().ToList>(); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/InfoViewModel.cs b/Gestor.Application/ViewModels/Drawer/InfoViewModel.cs deleted file mode 100644 index 1352f12..0000000 --- a/Gestor.Application/ViewModels/Drawer/InfoViewModel.cs +++ /dev/null @@ -1,208 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class InfoViewModel : BaseViewModel - { - private ObservableCollection _contatos = new ObservableCollection(); - - private ObservableCollection _itens = new ObservableCollection(); - - private ObservableCollection _parcelas = new ObservableCollection(); - - private Gestor.Model.Domain.Seguros.Documento _documento; - - private Visibility _ocultarInfos; - - private bool _carregando; - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public ObservableCollection Contatos - { - get - { - return this._contatos; - } - set - { - this._contatos = value; - base.OnPropertyChanged("Contatos"); - } - } - - public Gestor.Model.Domain.Seguros.Documento Documento - { - get - { - return this._documento; - } - set - { - this._documento = value; - base.OnPropertyChanged("Documento"); - } - } - - public ObservableCollection Itens - { - get - { - return this._itens; - } - set - { - this._itens = value; - base.OnPropertyChanged("Itens"); - } - } - - public Visibility OcultarInfos - { - get - { - return this._ocultarInfos; - } - set - { - this._ocultarInfos = value; - base.OnPropertyChanged("OcultarInfos"); - } - } - - public ObservableCollection Parcelas - { - get - { - return this._parcelas; - } - set - { - this._parcelas = value; - base.OnPropertyChanged("Parcelas"); - } - } - - public InfoViewModel(Gestor.Model.Domain.Seguros.Documento documento, bool ocultarInfos) - { - this.Documento = documento; - this.OcultarInfos = (ocultarInfos ? Visibility.Collapsed : Visibility.Visible); - this.Seleciona(); - } - - public string GerarObs(Gestor.Model.Domain.Seguros.Documento doc) - { - if (doc.get_Tipo() == 0) - { - return string.Format("CLIENTE: {0}{1}CÓDIGO: {2}{3}PROPOSTA: {4}{5}APÓLICE: {6}", new object[] { doc.get_Controle().get_Cliente().get_Nome(), Environment.NewLine, doc.get_Id(), Environment.NewLine, doc.get_Proposta(), Environment.NewLine, doc.get_Apolice() }); - } - return string.Format("CLIENTE: {0}{1}CÓDIGO: {2}{3}PROPOSTA: {4}{5}APÓLICE: {6}{7}PROPOSTA DE ENDOSSO: {8}{9}ENDOSSO: {10}", new object[] { doc.get_Controle().get_Cliente().get_Nome(), Environment.NewLine, doc.get_Id(), Environment.NewLine, doc.get_Proposta(), Environment.NewLine, doc.get_Apolice(), Environment.NewLine, doc.get_PropostaEndosso(), Environment.NewLine, doc.get_Endosso() }); - } - - public async void Seleciona() - { - bool controle; - ObservableCollection observableCollection; - this.Carregando = true; - if (this.Documento != null) - { - this.Documento = await (new ApoliceServico()).BuscarApoliceAsync(this.Documento.get_Id(), false, false); - } - if (this.OcultarInfos == Visibility.Visible && this.Documento != null) - { - ObservableCollection observableCollection1 = await (new ParcelaServico()).BuscarParcelasAsync(this.Documento.get_Id()); - InfoViewModel infoViewModel = this; - if (this.Documento.get_TipoRecebimento().GetValueOrDefault() == 2) - { - ObservableCollection observableCollection2 = observableCollection1; - observableCollection = new ObservableCollection( - from x in observableCollection2 - orderby x.get_VigenciaIncial() descending - select x); - } - else - { - observableCollection = observableCollection1; - } - infoViewModel.Parcelas = observableCollection; - } - Gestor.Model.Domain.Seguros.Documento documento = this.Documento; - if (documento != null) - { - controle = documento.get_Controle(); - } - else - { - controle = false; - } - if (controle) - { - this.Itens = await (new ItemServico()).BuscarItens(this.Documento.get_Controle().get_Id(), 0); - List contatos = new List(); - ClienteServico clienteServico = new ClienteServico(); - if (this.Documento.get_Controle().get_Cliente() != null) - { - ObservableCollection observableCollection3 = await clienteServico.BuscarTelefonesAsync(this.Documento.get_Controle().get_Cliente().get_Id()); - ObservableCollection observableCollection4 = await clienteServico.BuscarEmailsAsync(this.Documento.get_Controle().get_Cliente().get_Id()); - if (observableCollection3 != null) - { - List contatos1 = contatos; - ObservableCollection observableCollection5 = observableCollection3; - contatos1.AddRange(observableCollection5.Select((ClienteTelefone x) => { - Contato contato = new Contato(); - contato.set_Tipo(0); - contato.set_TipoTelefone(new TipoTelefone?(x.get_Tipo().GetValueOrDefault(1))); - contato.set_Numero(string.Concat(x.get_Prefixo(), " ", x.get_Numero())); - return contato; - }).Take(2).ToList()); - } - if (observableCollection4 != null) - { - List contatos2 = contatos; - ObservableCollection observableCollection6 = observableCollection4; - contatos2.AddRange(observableCollection6.Select((ClienteEmail x) => { - Contato contato = new Contato(); - contato.set_Tipo(1); - contato.set_TipoTelefone(null); - contato.set_Numero(x.get_Email()); - return contato; - }).Take(1).ToList()); - } - observableCollection3 = null; - } - this.Contatos = new ObservableCollection(contatos); - contatos = null; - clienteServico = null; - } - this.Carregando = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs b/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs deleted file mode 100644 index dec7ea3..0000000 --- a/Gestor.Application/ViewModels/Drawer/LogAcaoViewModel.cs +++ /dev/null @@ -1,262 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class LogAcaoViewModel : BaseViewModel - { - private RegistroAcao _log; - - private string _obs; - - public RegistroAcao Log - { - get - { - return this._log; - } - set - { - this._log = value; - base.OnPropertyChanged("Log"); - } - } - - public string Obs - { - get - { - return this._obs; - } - set - { - this._obs = value; - base.OnPropertyChanged("Obs"); - } - } - - private Gestor.Model.Common.Relatorio Relatorio - { - get; - set; - } - - public LogAcaoViewModel(RegistroAcao registro, Gestor.Model.Common.Relatorio relatorio) - { - this.Relatorio = relatorio; - this.CarregarLog(registro); - } - - private void CarregarLog(RegistroAcao registro) - { - string str; - string str1; - string str2; - string str3; - string str4; - string str5; - string str6; - string str7; - string str8; - string str9; - string str10; - if (registro.get_Tela().HasValue || string.IsNullOrEmpty(registro.get_Observacao()) || this.Relatorio == 25) - { - this.Log = registro; - this.Obs = registro.get_Observacao(); - return; - } - this.Log = registro; - Filtros filtro = JsonConvert.DeserializeObject(registro.get_Observacao()); - if (filtro.get_Seguradoras() == null || filtro.get_Seguradoras().Count == 0) - { - str = ""; - } - else - { - string[] newLine = new string[] { "SEGURADORAS FILTRADAS: ", Environment.NewLine, null, null, null }; - newLine[2] = string.Join(Environment.NewLine, - from x in Recursos.Seguradoras - where filtro.get_Seguradoras().Contains(x.get_Id()) - select x.get_NomeSocial()); - newLine[3] = Environment.NewLine; - newLine[4] = Environment.NewLine; - str = string.Concat(newLine); - } - string str11 = str; - if (filtro.get_Status() == null || filtro.get_Status().Count == 0) - { - str1 = ""; - } - else - { - string[] strArrays = new string[] { "STATUS FILTRADOS: ", Environment.NewLine, null, null, null }; - strArrays[2] = string.Join(Environment.NewLine, - from x in filtro.get_Status() - select (int)x); - strArrays[3] = Environment.NewLine; - strArrays[4] = Environment.NewLine; - str1 = string.Concat(strArrays); - } - string str12 = str1; - if (filtro.get_Ramos() == null || filtro.get_Ramos().Count == 0) - { - str2 = ""; - } - else - { - string[] newLine1 = new string[] { "RAMOS FILTRADOS: ", Environment.NewLine, null, null, null }; - newLine1[2] = string.Join(Environment.NewLine, - from x in Recursos.Ramos - where filtro.get_Ramos().Contains(x.get_Id()) - select x.get_Nome()); - newLine1[3] = Environment.NewLine; - newLine1[4] = Environment.NewLine; - str2 = string.Concat(newLine1); - } - string str13 = str2; - if (filtro.get_Vendedores() == null || filtro.get_Vendedores().Count == 0) - { - str3 = ""; - } - else - { - string[] strArrays1 = new string[] { "VENDEDORES FILTRADOS: ", Environment.NewLine, null, null, null }; - strArrays1[2] = string.Join(Environment.NewLine, - from x in Recursos.Vendedores - where filtro.get_Vendedores().Contains(x.get_Id()) - select x.get_Nome()); - strArrays1[3] = Environment.NewLine; - strArrays1[4] = Environment.NewLine; - str3 = string.Concat(strArrays1); - } - string str14 = str3; - if (filtro.get_Estipulantes() == null || filtro.get_Estipulantes().Count == 0) - { - str4 = ""; - } - else - { - string[] newLine2 = new string[] { "ESTIPULANTES FILTRADOS: ", Environment.NewLine, null, null, null }; - newLine2[2] = string.Join(Environment.NewLine, - from x in Recursos.Estipulantes - where filtro.get_Estipulantes().Contains(x.get_Id()) - select x.get_Nome()); - newLine2[3] = Environment.NewLine; - newLine2[4] = Environment.NewLine; - str4 = string.Concat(newLine2); - } - string str15 = str4; - if (filtro.get_Produtos() == null || filtro.get_Produtos().Count == 0) - { - str5 = ""; - } - else - { - string[] strArrays2 = new string[] { "PRODUTOS FILTRADOS: ", Environment.NewLine, null, null, null }; - strArrays2[2] = string.Join(Environment.NewLine, - from x in Recursos.Produtos - where filtro.get_Produtos().Contains(x.get_Id()) - select x.get_Nome()); - strArrays2[3] = Environment.NewLine; - strArrays2[4] = Environment.NewLine; - str5 = string.Concat(strArrays2); - } - string str16 = str5; - if (filtro.get_Negocio() == null || filtro.get_Negocio().Count == 0) - { - str6 = ""; - } - else - { - string[] newLine3 = new string[] { "TIPOS DE NEGÓCIOS FILTRADOS: ", Environment.NewLine, null, null, null }; - newLine3[2] = string.Join(Environment.NewLine, - from x in filtro.get_Negocio() - select (int)x); - newLine3[3] = Environment.NewLine; - newLine3[4] = Environment.NewLine; - str6 = string.Concat(newLine3); - } - string str17 = str6; - if (filtro.get_Usuarios() == null || filtro.get_Usuarios().Count == 0) - { - str7 = ""; - } - else - { - string[] strArrays3 = new string[] { "USUÁRIOS FILTRADOS: ", Environment.NewLine, null, null, null }; - strArrays3[2] = string.Join(Environment.NewLine, - from x in Recursos.Usuarios - where filtro.get_Usuarios().Contains(x.get_Id()) - select x.get_Nome()); - strArrays3[3] = Environment.NewLine; - strArrays3[4] = Environment.NewLine; - str7 = string.Concat(strArrays3); - } - string str18 = str7; - if (filtro.get_Telas() == null || filtro.get_Telas().Count == 0) - { - str8 = ""; - } - else - { - string[] newLine4 = new string[] { "TELAS FILTRADAS: ", Environment.NewLine, null, null, null }; - newLine4[2] = string.Join(Environment.NewLine, - from x in filtro.get_Telas() - select (int)x); - newLine4[3] = Environment.NewLine; - newLine4[4] = Environment.NewLine; - str8 = string.Concat(newLine4); - } - string str19 = str8; - if (filtro.get_Relatorios() == null || filtro.get_Relatorios().Count == 0) - { - str9 = ""; - } - else - { - string[] strArrays4 = new string[] { "RELATÓRIOS FILTRADOS: ", Environment.NewLine, null, null, null }; - strArrays4[2] = string.Join(Environment.NewLine, - from x in filtro.get_Relatorios() - select (int)x); - strArrays4[3] = Environment.NewLine; - strArrays4[4] = Environment.NewLine; - str9 = string.Concat(strArrays4); - } - string str20 = str9; - if (filtro.get_ParcelasEspeciais() != null) - { - if (!filtro.get_ParcelasEspeciais().Any((FiltroTipoParcela x) => x.get_Selecionado())) - { - goto Label1; - } - string[] newLine5 = new string[] { "TIPOS DE PARCELAS FILTRADOS: ", Environment.NewLine, null, null, null }; - newLine5[2] = string.Join(Environment.NewLine, - from x in filtro.get_ParcelasEspeciais() - select x.get_Tipo()); - newLine5[3] = Environment.NewLine; - newLine5[4] = Environment.NewLine; - str10 = string.Concat(newLine5); - goto Label0; - } - Label1: - str10 = ""; - Label0: - string str21 = str10; - string str22 = (filtro.get_IdEmpresa() == 0 ? "" : string.Concat(new string[] { "EMPRESA: ", Environment.NewLine, Recursos.Empresas.Find((Empresa x) => x.get_Id() == filtro.get_IdEmpresa()).get_Nome(), Environment.NewLine, Environment.NewLine })); - string.Format("PERÍODO DE {0:d} ATÉ {1:d}", filtro.get_Inicio(), filtro.get_Fim()); - this.Obs = string.Concat(new string[] { ValidationHelper.GetDescription(registro.get_Relatorio()), Environment.NewLine, Environment.NewLine, str22, str11, str13, str16, str14, str15, str12, str17, str21, str18, str19, str20 }); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/LogEmailViewModel.cs b/Gestor.Application/ViewModels/Drawer/LogEmailViewModel.cs deleted file mode 100644 index 8a71635..0000000 --- a/Gestor.Application/ViewModels/Drawer/LogEmailViewModel.cs +++ /dev/null @@ -1,163 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class LogEmailViewModel : BaseSegurosViewModel - { - private readonly LogServico _servico; - - private Visibility _visibilityDetalhesLog = Visibility.Hidden; - - private bool _mostrarMensagem; - - private ObservableCollection _logs = new ObservableCollection(); - - private LogEmail _selectedLog; - - private List _lists = new List(); - - public List Lists - { - get - { - return this._lists; - } - set - { - this._lists = value; - base.OnPropertyChanged("Lists"); - } - } - - public ObservableCollection Logs - { - get - { - return this._logs; - } - set - { - this._logs = value; - base.OnPropertyChanged("Logs"); - } - } - - public bool MostrarMensagem - { - get - { - return this._mostrarMensagem; - } - set - { - this._mostrarMensagem = value; - base.OnPropertyChanged("MostrarMensagem"); - } - } - - public LogEmail SelectedLog - { - get - { - return this._selectedLog; - } - set - { - this._selectedLog = value; - this.Lists = this.SelectedLog.CriarLogEmail(); - base.OnPropertyChanged("SelectedLog"); - } - } - - public Visibility VisiblityDetalhesLog - { - get - { - return this._visibilityDetalhesLog; - } - set - { - this._visibilityDetalhesLog = value; - base.OnPropertyChanged("VisiblityDetalhesLog"); - } - } - - public LogEmailViewModel(TipoTela tela, long id, bool singleMode) - { - this._servico = new LogServico(); - this.VisiblityDetalhesLog = (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => c.get_Configuracao() == 55) ? Visibility.Visible : Visibility.Hidden); - this.Seleciona(tela, id, singleMode); - } - - public void Imprimir() - { - string str = "LOGS
LOG ENVIO DE E-MAIL"; - foreach (TupleList list in this.Lists) - { - foreach (Tuple tuple in list.get_Tuples()) - { - if (tuple == list.get_Tuples().First>()) - { - str = string.Concat(str, ""); - str = string.Concat(str, "
DESCRIÇÃOE-MAIL ENVIADO
"); - } - bool flag = tuple.Item1.Contains("$"); - string[] item2 = new string[] { str, ""; - str = string.Concat(item2); - str = string.Concat(str, "
"; - item2[4] = tuple.Item1.Replace(" ", " ").Replace("$", ""); - item2[5] = ""; - item2[6] = tuple.Item2; - item2[7] = "
"); - } - } - str = string.Concat(str, "
"); - string tempPath = Path.GetTempPath(); - string str1 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (TipoExtrato)0, Funcoes.GetNetworkTime()); - StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8); - streamWriter.Write(str); - streamWriter.Close(); - Process.Start(str1); - } - - private async void Seleciona(TipoTela tela, long id, bool singleMode) - { - base.Loading(true); - if (!singleMode) - { - this.Logs = await this._servico.FindByEntity(tela, id); - } - else - { - this.Logs = await this._servico.FindById(id); - } - if (this.Logs.Count <= 0) - { - this.MostrarMensagem = true; - } - else - { - this.SelectedLog = this.Logs[0]; - } - base.Loading(false); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/LogSistemaAntigoViewModel.cs b/Gestor.Application/ViewModels/Drawer/LogSistemaAntigoViewModel.cs deleted file mode 100644 index 5c97aca..0000000 --- a/Gestor.Application/ViewModels/Drawer/LogSistemaAntigoViewModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Gestor.Application.ViewModels.Generic; -using System; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class LogSistemaAntigoViewModel : BaseViewModel - { - private string _descricao; - - private string _log; - - public string Descricao - { - get - { - return this._descricao; - } - set - { - this._descricao = value; - base.OnPropertyChanged("Descricao"); - } - } - - public string Log - { - get - { - return this._log; - } - set - { - this._log = value; - base.OnPropertyChanged("Log"); - } - } - - public LogSistemaAntigoViewModel() - { - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/LogViewModel.cs b/Gestor.Application/ViewModels/Drawer/LogViewModel.cs deleted file mode 100644 index cdeb60c..0000000 --- a/Gestor.Application/ViewModels/Drawer/LogViewModel.cs +++ /dev/null @@ -1,1784 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows; - -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.Hidden; - - private bool _mostrar; - - private bool _mostrarMensagem; - - private string _mostrarToolTip = "MOSTRAR TODAS OS CAMPOS"; - - private long _mostrarColuna = (long)120; - - private PackIcon _mostrarIcone; - - private ObservableCollection _logs; - - private string _currentDescription; - - private RegistroLog _selectedLog; - - private List _lists; - - private ObservableCollection _listsAlterados; - - private ObservableCollection _listsAdicionados; - - private ObservableCollection _listsRemovidos; - - private string _textAdicoes; - - public string CurrentDescription - { - get - { - return this._currentDescription; - } - set - { - this._currentDescription = value; - base.OnPropertyChanged("CurrentDescription"); - } - } - - public List Lists - { - get - { - return this._lists; - } - set - { - this._lists = value; - this.SetListaFiltrada(value); - base.OnPropertyChanged("Lists"); - } - } - - public ObservableCollection ListsAdicionados - { - get - { - return this._listsAdicionados; - } - set - { - this._listsAdicionados = value; - base.OnPropertyChanged("ListsAdicionados"); - } - } - - public ObservableCollection ListsAlterados - { - get - { - return this._listsAlterados; - } - set - { - this._listsAlterados = value; - base.OnPropertyChanged("ListsAlterados"); - } - } - - public ObservableCollection ListsRemovidos - { - get - { - return this._listsRemovidos; - } - set - { - this._listsRemovidos = value; - if (this.ListsAlterados != null || this.ListsAdicionados != null || value != null) - { - this.MostrarMensagem = false; - } - else - { - this.MostrarMensagem = true; - } - base.OnPropertyChanged("ListsRemovidos"); - } - } - - public ObservableCollection Logs - { - get - { - return this._logs; - } - set - { - this._logs = value; - base.OnPropertyChanged("Logs"); - } - } - - public bool Mostrar - { - get - { - return this._mostrar; - } - set - { - this._mostrar = value; - if (!value) - { - this.MostrarColuna = (long)240; - this.MostrarToolTip = "MOSTRAR TODOS OS CAMPOS"; - PackIcon packIcon = new PackIcon(); - packIcon.set_Kind(1497); - this.MostrarIcone = packIcon; - } - else - { - this.MostrarColuna = (long)240; - this.MostrarToolTip = "ESCONDER CAMPOS INALTERADOS"; - PackIcon packIcon1 = new PackIcon(); - packIcon1.set_Kind(1492); - this.MostrarIcone = packIcon1; - } - base.OnPropertyChanged("Mostrar"); - } - } - - public long MostrarColuna - { - get - { - return this._mostrarColuna; - } - set - { - this._mostrarColuna = value; - base.OnPropertyChanged("MostrarColuna"); - } - } - - public PackIcon MostrarIcone - { - get - { - return this._mostrarIcone; - } - set - { - this._mostrarIcone = value; - base.OnPropertyChanged("MostrarIcone"); - } - } - - public bool MostrarMensagem - { - get - { - return this._mostrarMensagem; - } - set - { - this._mostrarMensagem = value; - base.OnPropertyChanged("MostrarMensagem"); - } - } - - public string MostrarToolTip - { - get - { - return this._mostrarToolTip; - } - set - { - this._mostrarToolTip = value; - base.OnPropertyChanged("MostrarToolTip"); - } - } - - public RegistroLog SelectedLog - { - get - { - return this._selectedLog; - } - set - { - List tupleLists; - ObservableCollection> observableCollection; - List.Enumerator enumerator; - this._selectedLog = value; - List tupleLists1 = new List(); - try - { - if (!value.get_ModeloNovo()) - { - switch (this._tipoTela) - { - case 1: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 2: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(base.Restricao(14)); - break; - } - case 3: - { - Item item = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()); - if (item.get_Aeronautico() != null) - { - tupleLists1 = Aeronautico.Log(item); - break; - } - else if (item.get_Auto() != null) - { - tupleLists1 = Auto.Log(item); - break; - } - else if (item.get_Granizo() != null) - { - tupleLists1 = Granizo.Log(item); - break; - } - else if (item.get_Patrimonial() != null) - { - tupleLists1 = Patrimonial.Log(item); - break; - } - else if (item.get_RiscosDiversos() == null) - { - if (item.get_Vida() == null) - { - break; - } - tupleLists1 = Vida.Log(item); - break; - } - else - { - tupleLists1 = RiscosDiversos.Log(item); - break; - } - } - case 4: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 5: - { - try - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(base.Restricao(14), base.Restricao(95)); - break; - } - catch - { - tupleLists1 = LogViewModel.DefaultLog(this.SelectedLog.get_Descricao(), this.SelectedLog.get_Acao()); - break; - } - break; - } - case 6: - case 8: - case 20: - case 21: - case 23: - case 25: - case 27: - case 32: - case 35: - case 39: - case 40: - case 44: - case 47: - case 49: - case 50: - case 51: - case 53: - { - tupleLists1 = LogViewModel.DefaultLog(this.SelectedLog.get_Descricao(), this.SelectedLog.get_Acao()); - break; - } - case 7: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 9: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 10: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 11: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 12: - { - Ramo ramo = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()); - List list = ( - from x in Recursos.Coberturas - where x.get_IdRamo() == ramo.get_Id() - orderby x.get_Padrao() descending, x.get_Descricao() - select x).ToList(); - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(list); - break; - } - case 13: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 14: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 15: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 16: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 17: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 18: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 19: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 22: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 24: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 26: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 28: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 29: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 30: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 31: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 33: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 34: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 36: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 37: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(base.Restricao(14), base.Restricao(95)); - break; - } - case 38: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 41: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 42: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 43: - { - List>>>>> tuples = JsonConvert.DeserializeObject>>>>>>(this.SelectedLog.get_Descricao()); - tupleLists = new List(); - foreach (Tuple>>>> tuple in tuples) - { - observableCollection = new ObservableCollection>() - { - new Tuple(string.Concat(tuple.Item1, "$"), "", "") - }; - foreach (Tuple>> item2 in tuple.Item2) - { - observableCollection.Add(new Tuple(string.Concat(" ", item2.Item1, "$"), "", "")); - foreach (Tuple item21 in item2.Item2) - { - observableCollection.Add(new Tuple(string.Concat(" ", item21.Item1), item21.Item2, "")); - } - } - TupleList tupleList = new TupleList(); - tupleList.set_Tuples(observableCollection); - tupleLists.Add(tupleList); - } - enumerator = tupleLists.GetEnumerator(); - try - { - while (enumerator.MoveNext()) - { - tupleLists1.Add(enumerator.Current); - } - break; - } - finally - { - ((IDisposable)enumerator).Dispose(); - } - break; - } - case 45: - { - List vendedors = JsonConvert.DeserializeObject>(this.SelectedLog.get_Descricao()); - tupleLists = new List(); - observableCollection = new ObservableCollection>() - { - new Tuple("VENDEDORES VINCULADOS$", "", "") - }; - foreach (Vendedor vendedor in vendedors) - { - observableCollection.Add(new Tuple(string.Format(" VENDEDOR {0}", vendedors.IndexOf(vendedor) + 1), vendedor.get_Nome(), "")); - } - TupleList tupleList1 = new TupleList(); - tupleList1.set_Tuples(observableCollection); - tupleLists.Add(tupleList1); - enumerator = tupleLists.GetEnumerator(); - try - { - while (enumerator.MoveNext()) - { - tupleLists1.Add(enumerator.Current); - } - break; - } - finally - { - ((IDisposable)enumerator).Dispose(); - } - break; - } - case 46: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 48: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 52: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 54: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 55: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - case 56: - { - tupleLists1 = JsonConvert.DeserializeObject(this.SelectedLog.get_Descricao()).Log(); - break; - } - default: - { - goto case 53; - } - } - } - else - { - switch (value.get_Acao()) - { - case 0: - case 2: - { - tupleLists1 = JsonConvert.DeserializeObject>(this.SelectedLog.get_Descricao()).LogList(base.Restricao(14)); - break; - } - case 1: - { - tupleLists1 = JsonConvert.DeserializeObject>(this.SelectedLog.get_Descricao()).LogList(base.Restricao(14)); - break; - } - } - } - } - catch (Exception exception) - { - } - this.Lists = tupleLists1; - base.OnPropertyChanged("SelectedLog"); - } - } - - public string TextAdicoes - { - get - { - return this._textAdicoes; - } - set - { - this._textAdicoes = value; - base.OnPropertyChanged("TextAdicoes"); - } - } - - public Visibility VisiblityDetalhesLog - { - get - { - return this._visibilityDetalhesLog; - } - set - { - this._visibilityDetalhesLog = value; - base.OnPropertyChanged("VisiblityDetalhesLog"); - } - } - - public LogViewModel(TipoTela tela, long id, List parcelas = null, int numparcela = 0) - { - this._visibilityDetalhesLog = Visibility.Hidden; - this._mostrarToolTip = "MOSTRAR TODAS OS CAMPOS"; - this._mostrarColuna = (long)120; - PackIcon packIcon = new PackIcon(); - packIcon.set_Kind(1497); - this._mostrarIcone = packIcon; - this._logs = new ObservableCollection(); - this._currentDescription = ""; - this._lists = new List(); - this._listsAlterados = new ObservableCollection(); - this._listsAdicionados = new ObservableCollection(); - this._listsRemovidos = new ObservableCollection(); - this._textAdicoes = "INCLUSÃO"; - base(); - this._servico = new LogServico(); - this._tipoTela = tela; - this._id = id; - this.VisiblityDetalhesLog = (Recursos.Configuracoes.Any((ConfiguracaoSistema c) => c.get_Configuracao() == 55) ? Visibility.Visible : Visibility.Hidden); - base.EnableMenu = true; - if (parcelas != null) - { - this.LogParcelas(id, parcelas, numparcela); - return; - } - this.Seleciona(tela, id, null, null); - } - - public int BuscaNumeroParcela(string json) - { - int num; - int num1; - try - { - string[] strArrays = json.Split(new char[] { '}' }).FirstOrDefault((string x) => x.Contains("NumeroParcela")).Split(new char[] { ':' }); - num1 = (int.TryParse(strArrays[(int)strArrays.Length - 1].Replace("\"", ""), out num) ? num : 0); - } - catch - { - num1 = 0; - } - return num1; - } - - private static List DefaultLog(string log, TipoAcao acao) - { - List tupleLists = new List(); - TupleList tupleList = new TupleList(); - tupleList.set_Tuples(new ObservableCollection>() - { - new Tuple(Gestor.Model.Validation.Funcoes.GetDescription(acao), log, "") - }); - tupleLists.Add(tupleList); - return tupleLists; - } - - public void Imprimir() - { - bool count; - bool flag; - bool count1; - bool flag1; - bool count2; - bool flag2; - string str = "LOGS
"; - ObservableCollection listsAlterados = this.ListsAlterados; - if (listsAlterados != null) - { - count = listsAlterados.Count > 0; - } - else - { - count = false; - } - if (count) - { - str = string.Concat(str, "ALTERAÇÃO"); - } - if (this.ListsAlterados != null) - { - foreach (TupleList listsAlterado in this.ListsAlterados) - { - foreach (Tuple tuple in listsAlterado.get_Tuples()) - { - if (tuple == listsAlterado.get_Tuples().First>()) - { - str = string.Concat(str, ""); - if (!this.Mostrar) - { - str = string.Concat(str, ""); - } - str = string.Concat(str, "
DESCRIÇÃOVALOR LOG SELECIONADOVALOR LOG ANTERIOR
"); - } - bool flag3 = tuple.Item1.Contains("$"); - string[] item2 = new string[] { str, ""; - str = string.Concat(item2); - if (!this.Mostrar) - { - str = string.Concat(str, ""); - } - str = string.Concat(str, "
"; - item2[4] = tuple.Item1.Replace(" ", " ").Replace("$", ""); - item2[5] = ""; - item2[8] = tuple.Item2; - item2[9] = "", tuple.Item3, "
"); - } - if ((object)listsAlterado == (object)this.ListsAlterados.Last()) - { - continue; - } - str = string.Concat(str, "
"); - } - } - ObservableCollection listsAdicionados = this.ListsAdicionados; - if (listsAdicionados != null) - { - flag = listsAdicionados.Count > 0; - } - else - { - flag = false; - } - if (flag) - { - ObservableCollection observableCollection = this.ListsAlterados; - if (observableCollection != null) - { - flag2 = observableCollection.Count > 0; - } - else - { - flag2 = false; - } - if (flag2) - { - str = string.Concat(str, "


"); - } - str = string.Concat(str, "INCLUSÃO"); - } - if (this.ListsAdicionados != null) - { - foreach (TupleList listsAdicionado in this.ListsAdicionados) - { - foreach (Tuple tuple1 in listsAdicionado.get_Tuples()) - { - if (tuple1 == listsAdicionado.get_Tuples().First>()) - { - str = string.Concat(str, ""); - if (!this.Mostrar) - { - str = string.Concat(str, ""); - } - str = string.Concat(str, "
DESCRIÇÃOVALOR LOG SELECIONADOVALOR LOG ANTERIOR
"); - } - bool flag4 = tuple1.Item1.Contains("$"); - string[] strArrays = new string[] { str, ""; - str = string.Concat(strArrays); - if (!this.Mostrar) - { - str = string.Concat(str, ""); - } - str = string.Concat(str, "
"; - strArrays[4] = tuple1.Item1.Replace(" ", " ").Replace("$", ""); - strArrays[5] = ""; - strArrays[8] = tuple1.Item2; - strArrays[9] = "", tuple1.Item3, "
"); - } - if ((object)listsAdicionado == (object)this.ListsAdicionados.Last()) - { - continue; - } - str = string.Concat(str, "
"); - } - } - ObservableCollection listsRemovidos = this.ListsRemovidos; - if (listsRemovidos != null) - { - count1 = listsRemovidos.Count > 0; - } - else - { - count1 = false; - } - if (count1) - { - ObservableCollection listsAlterados1 = this.ListsAlterados; - if (listsAlterados1 != null) - { - flag1 = listsAlterados1.Count > 0; - } - else - { - flag1 = false; - } - if (!flag1) - { - ObservableCollection listsAdicionados1 = this.ListsAdicionados; - if (listsAdicionados1 != null) - { - count2 = listsAdicionados1.Count > 0; - } - else - { - count2 = false; - } - if (!count2) - { - goto Label0; - } - } - str = string.Concat(str, "


"); - Label0: - str = string.Concat(str, "EXCLUSÃO"); - } - if (this.ListsRemovidos != null) - { - foreach (TupleList listsRemovido in this.ListsRemovidos) - { - foreach (Tuple tuple2 in listsRemovido.get_Tuples()) - { - if (tuple2 == listsRemovido.get_Tuples().First>()) - { - str = string.Concat(str, ""); - if (!this.Mostrar) - { - str = string.Concat(str, ""); - } - str = string.Concat(str, "
DESCRIÇÃOVALOR LOG SELECIONADOVALOR LOG ANTERIOR
"); - } - bool flag5 = tuple2.Item1.Contains("$"); - string[] item21 = new string[] { str, ""; - str = string.Concat(item21); - if (!this.Mostrar) - { - str = string.Concat(str, ""); - } - str = string.Concat(str, "
"; - item21[4] = tuple2.Item1.Replace(" ", " ").Replace("$", ""); - item21[5] = ""; - item21[8] = tuple2.Item2; - item21[9] = "", tuple2.Item3, "
"); - } - if ((object)listsRemovido == (object)this.ListsRemovidos.Last()) - { - continue; - } - str = string.Concat(str, "
"); - } - } - str = string.Concat(str, "
"); - string tempPath = Path.GetTempPath(); - string str1 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (TipoExtrato)0, Gestor.Application.Helpers.Funcoes.GetNetworkTime()); - StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8); - streamWriter.Write(str); - streamWriter.Close(); - Process.Start(str1); - base.RegistrarAcao(string.Format("IMPRIMIU O LOG DE ALTERAÇÕES DE {0} DO ID \"{1}\"", Gestor.Model.Validation.Funcoes.GetDescription(this._tipoTela), this._id), this._id, new TipoTela?(this._tipoTela), string.Format("ID ENTIDADE: {0}\nTIPO: {1}", this._id, Gestor.Model.Validation.Funcoes.GetDescription(this._tipoTela))); - } - - private async void LogParcelas(long documento, List parcelas, int numparcela) - { - base.Loading(true); - List nums = new List(); - nums.AddRange(parcelas); - nums.Add(documento); - this.Logs = new ObservableCollection((IEnumerable)await this._servico.BuscaLogParcelas(nums)); - ObservableCollection observableCollection = new ObservableCollection(); - List list = this.Logs.Where((RegistroLog x) => { - if (x.get_ModeloNovo()) - { - return false; - } - return x.get_EntidadeId() == documento; - }).ToList(); - for (int i = list.Count - 1; i >= 0; i--) - { - ObservableCollection observableCollection1 = new ObservableCollection(); - try - { - for (int j = i; j >= 0 && list[j].get_DataHora() < list[i].get_DataHora().AddSeconds(4); j--) - { - Parcela parcela = JsonConvert.DeserializeObject(this.Logs[j].get_Descricao()); - if (parcela != null && (numparcela == 0 || this.BuscaNumeroParcela(this.Logs[j].get_Descricao()) == numparcela)) - { - observableCollection1.Add(parcela); - } - i = j; - } - } - catch (Exception exception1) - { - try - { - List parcelas1 = JsonConvert.DeserializeObject>(this.Logs[i].get_Descricao()); - if (parcelas1 != null && (numparcela == 0 || this.BuscaNumeroParcela(this.Logs[i].get_Descricao()) == numparcela)) - { - ExtensionMethods.AddRange(observableCollection1, parcelas1); - } - } - catch (Exception exception) - { - RegistroLog item = this.Logs[i]; - string descricao = this.Logs[i].get_Descricao(); - if (descricao == null) - { - descricao = ""; - } - item.set_Descricao(descricao); - observableCollection.Insert(0, this.Logs[i]); - goto Label0; - } - } - ObservableCollection observableCollection2 = observableCollection1; - observableCollection1 = new ObservableCollection( - from x in observableCollection2 - orderby x.get_NumeroParcela() - select x); - if (observableCollection1 != null && observableCollection1.Count != 0 && observableCollection1[0].get_Documento() != null) - { - RegistroLog registroLog = list[i]; - Parcelas parcela1 = new Parcelas(); - parcela1.set_ParcelasList(observableCollection1); - parcela1.set_TipoRecebimento(observableCollection1[0].get_Documento().get_TipoRecebimento()); - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - registroLog.set_Descricao(JsonConvert.SerializeObject(parcela1, jsonSerializerSetting)); - observableCollection.Insert(0, list[i]); - } - Label0: - } - List registroLogs = new List(); - ObservableCollection logs = this.Logs; - List list1 = ( - from x in logs - where x.get_ModeloNovo() - select x).ToList(); - if (numparcela != 0) - { - foreach (RegistroLog registroLog1 in list1) - { - int num = this.BuscaNumeroParcela(registroLog1.get_Descricao()); - if ((num == 0 || num != numparcela) && (numparcela == 0 || parcelas.Count != 1 || registroLog1.get_EntidadeId() == documento)) - { - continue; - } - registroLogs.Add(registroLog1); - } - } - else - { - registroLogs.AddRange(list1); - } - this.Logs = observableCollection; - ExtensionMethods.AddRange(this.Logs, registroLogs); - if (this.Logs.Count <= 0) - { - this.SetListaFiltrada(this.Lists); - } - else - { - this.SelectedLog = this.Logs[0]; - } - base.Loading(false); - } - - public void MostrarCampos() - { - if (this.SelectedLog == null || this.SelectedLog.get_ModeloNovo()) - { - return; - } - this.Mostrar = !this.Mostrar; - this.Lists = this.Lists; - } - - private static int QntEspaco(string str) - { - return Regex.Match(str, "[^\\s]").Index; - } - - private async void Seleciona(TipoTela tela, long id, List parcelas = null, long? parcela = null) - { - base.Loading(true); - this.Logs = new ObservableCollection((IEnumerable)await this._servico.FindByEntityId(tela, id)); - if (tela == 37) - { - ObservableCollection observableCollection = new ObservableCollection(); - ObservableCollection logs = this.Logs; - List list = ( - from x in logs - where !x.get_ModeloNovo() - select x).ToList(); - for (int i = list.Count - 1; i >= 0; i--) - { - ObservableCollection observableCollection1 = new ObservableCollection(); - for (int j = i; j >= 0 && list[j].get_DataHora() < list[i].get_DataHora().AddSeconds(4); j--) - { - observableCollection1.Add(JsonConvert.DeserializeObject(list[j].get_Descricao())); - i = j; - } - ObservableCollection observableCollection2 = observableCollection1; - observableCollection1 = new ObservableCollection( - from x in observableCollection2 - orderby x.get_Id() - select x); - RegistroLog item = list[i]; - VendedorParcelas vendedorParcela = new VendedorParcelas(); - vendedorParcela.set_VendedorParcelasList(observableCollection1); - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - item.set_Descricao(JsonConvert.SerializeObject(vendedorParcela, jsonSerializerSetting)); - observableCollection.Insert(0, list[i]); - } - ObservableCollection logs1 = this.Logs; - List registroLogs = ( - from x in logs1 - where x.get_ModeloNovo() - select x).ToList(); - this.Logs = observableCollection; - ExtensionMethods.AddRange(this.Logs, registroLogs); - } - if (this.Logs.Count <= 0) - { - this.SetListaFiltrada(this.Lists); - } - else - { - this.SelectedLog = this.Logs[0]; - } - base.Loading(false); - } - - public void SetListaFiltrada(List listAtual) - { - List tupleLists; - ObservableCollection> observableCollection; - List.Enumerator enumerator; - ObservableCollection observableCollection1; - ObservableCollection observableCollection2; - ObservableCollection observableCollection3; - if (this.Logs.Count == 0) - { - this.ListsAlterados = null; - this.ListsAdicionados = null; - this.ListsRemovidos = null; - return; - } - if (this.SelectedLog.get_ModeloNovo() && this.SelectedLog.get_Acao() == 1) - { - this.TextAdicoes = "ALTERAÇÕES"; - this.ListsAdicionados = null; - this.ListsRemovidos = null; - this.ListsAlterados = new ObservableCollection(this.Lists); - this.MostrarMensagem = false; - return; - } - if (this.SelectedLog.get_ModeloNovo() && this.SelectedLog.get_Acao() == null) - { - this.TextAdicoes = "INCLUSÕES"; - this.ListsAlterados = null; - this.ListsRemovidos = null; - this.ListsAdicionados = new ObservableCollection(listAtual); - this.MostrarMensagem = false; - return; - } - if (this.SelectedLog.get_ModeloNovo() && this.SelectedLog.get_Acao() == 2) - { - this.TextAdicoes = "EXCLUSÕES"; - this.ListsAlterados = null; - this.ListsAdicionados = null; - this.ListsRemovidos = new ObservableCollection(listAtual); - this.MostrarMensagem = false; - return; - } - if (this.Mostrar || (object)this.Logs.Last() == (object)this.SelectedLog) - { - this.TextAdicoes = ((object)this.Logs.Last() != (object)this.SelectedLog ? "LOG COMPLETO" : "INCLUSÃO"); - this.ListsAlterados = null; - this.ListsAdicionados = new ObservableCollection(listAtual); - this.ListsRemovidos = null; - return; - } - this.TextAdicoes = "INCLUSÃO"; - List tupleLists1 = new List(); - try - { - switch (this._tipoTela) - { - case 1: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 2: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(base.Restricao(14)); - goto case 53; - } - case 3: - { - Item item = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()); - if (item.get_Aeronautico() != null) - { - tupleLists1 = Aeronautico.Log(item); - goto case 53; - } - else if (item.get_Auto() != null) - { - tupleLists1 = Auto.Log(item); - goto case 53; - } - else if (item.get_Granizo() != null) - { - tupleLists1 = Granizo.Log(item); - goto case 53; - } - else if (item.get_Patrimonial() != null) - { - tupleLists1 = Patrimonial.Log(item); - goto case 53; - } - else if (item.get_RiscosDiversos() == null) - { - if (item.get_Vida() == null) - { - goto case 53; - } - tupleLists1 = Vida.Log(item); - goto case 53; - } - else - { - tupleLists1 = RiscosDiversos.Log(item); - goto case 53; - } - } - case 4: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 5: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(base.Restricao(14), base.Restricao(95)); - goto case 53; - } - case 6: - case 8: - case 20: - case 21: - case 23: - case 25: - case 27: - case 32: - case 35: - case 39: - case 40: - case 44: - case 47: - case 49: - case 50: - case 51: - case 53: - { - break; - } - case 7: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 9: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 10: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 11: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 12: - { - Ramo ramo = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()); - List list = ( - from x in Recursos.Coberturas - where x.get_IdRamo() == ramo.get_Id() - orderby x.get_Padrao() descending, x.get_Descricao() - select x).ToList(); - tupleLists1 = ramo.Log(list); - goto case 53; - } - case 13: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 14: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 15: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 16: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 17: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 18: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 19: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 22: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 24: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 26: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 28: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 29: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 30: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 31: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 33: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 34: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 36: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 37: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(base.Restricao(14), base.Restricao(95)); - goto case 53; - } - case 38: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 41: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 42: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 43: - { - List>>>>> tuples = JsonConvert.DeserializeObject>>>>>>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()); - tupleLists = new List(); - foreach (Tuple>>>> tuple in tuples) - { - observableCollection = new ObservableCollection>() - { - new Tuple(string.Concat(tuple.Item1, "$"), "", "") - }; - foreach (Tuple>> item2 in tuple.Item2) - { - observableCollection.Add(new Tuple(string.Concat(" ", item2.Item1, "$"), "", "")); - foreach (Tuple item21 in item2.Item2) - { - observableCollection.Add(new Tuple(string.Concat(" ", item21.Item1), item21.Item2, "")); - } - } - TupleList tupleList = new TupleList(); - tupleList.set_Tuples(observableCollection); - tupleLists.Add(tupleList); - } - enumerator = tupleLists.GetEnumerator(); - try - { - while (enumerator.MoveNext()) - { - tupleLists1.Add(enumerator.Current); - } - goto case 53; - } - finally - { - ((IDisposable)enumerator).Dispose(); - } - break; - } - case 45: - { - List vendedors = JsonConvert.DeserializeObject>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()); - tupleLists = new List(); - observableCollection = new ObservableCollection>() - { - new Tuple("VENDEDORES VINCULADOS$", "", "") - }; - foreach (Vendedor vendedor in vendedors) - { - observableCollection.Add(new Tuple(string.Format(" VENDEDOR {0}", vendedors.IndexOf(vendedor) + 1), vendedor.get_Nome(), "")); - } - TupleList tupleList1 = new TupleList(); - tupleList1.set_Tuples(observableCollection); - tupleLists.Add(tupleList1); - enumerator = tupleLists.GetEnumerator(); - try - { - while (enumerator.MoveNext()) - { - tupleLists1.Add(enumerator.Current); - } - goto case 53; - } - finally - { - ((IDisposable)enumerator).Dispose(); - } - break; - } - case 46: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 48: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 52: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 54: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 55: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - case 56: - { - tupleLists1 = JsonConvert.DeserializeObject(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(); - goto case 53; - } - default: - { - goto case 53; - } - } - } - catch (Exception exception) - { - } - ObservableCollection observableCollection4 = new ObservableCollection(); - foreach (TupleList tupleList2 in listAtual) - { - int num = -1; - if (tupleLists1.Count - 1 < listAtual.IndexOf(tupleList2)) - { - continue; - } - for (int i = 0; i < tupleList2.get_Tuples().Count; i++) - { - Tuple item1 = tupleList2.get_Tuples()[i]; - if (LogViewModel.QntEspaco(item1.Item1) != 0) - { - List strs = new List(); - int num1 = LogViewModel.QntEspaco(item1.Item1); - for (int j = i; j >= 0; j--) - { - if (LogViewModel.QntEspaco(tupleList2.get_Tuples()[j].Item1) <= num1) - { - strs.Insert(0, tupleList2.get_Tuples()[j].Item1); - num1 = LogViewModel.QntEspaco(tupleList2.get_Tuples()[j].Item1); - } - } - bool flag = false; - int num2 = 0; - Label2: - foreach (string str in strs) - { - if (!flag) - { - int num3 = num2; - while (num3 < tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples().Count) - { - if (num3 == tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples().Count - 1 && str != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num3].Item1) - { - flag = true; - goto Label2; - } - else if (str != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num3].Item1) - { - num3++; - } - else - { - num2 = num3; - goto Label2; - } - } - } - else - { - goto Label1; - } - } - Label1: - if (!flag && item1.Item2 != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num2].Item2) - { - if (num < listAtual.IndexOf(tupleList2)) - { - TupleList tupleList3 = new TupleList(); - tupleList3.set_Tuples(new ObservableCollection>()); - observableCollection4.Add(tupleList3); - num = listAtual.IndexOf(tupleList2); - } - int count = observableCollection4.Last().get_Tuples().Count; - int num4 = LogViewModel.QntEspaco(item1.Item1); - for (int k = i - 1; k >= 0; k--) - { - if (LogViewModel.QntEspaco(tupleList2.get_Tuples()[k].Item1) < LogViewModel.QntEspaco(item1.Item1) && LogViewModel.QntEspaco(tupleList2.get_Tuples()[k].Item1) < num4) - { - bool flag1 = false; - int count1 = observableCollection4.Last().get_Tuples().Count - 1; - while (count1 >= 0) - { - if (observableCollection4.Last().get_Tuples()[count1].Item1 != tupleList2.get_Tuples()[k].Item1) - { - count1--; - } - else - { - flag1 = true; - break; - } - } - if (flag1) - { - break; - } - num4 = LogViewModel.QntEspaco(tupleList2.get_Tuples()[k].Item1); - observableCollection4.Last().get_Tuples().Insert(count, new Tuple(tupleList2.get_Tuples()[k].Item1, tupleList2.get_Tuples()[k].Item2, "")); - } - } - observableCollection4.Last().get_Tuples().Add(new Tuple(item1.Item1, item1.Item2, tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[num2].Item2)); - } - } - else if (item1.Item2 != tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[tupleList2.get_Tuples().IndexOf(item1)].Item2) - { - if (num < listAtual.IndexOf(tupleList2)) - { - TupleList tupleList4 = new TupleList(); - tupleList4.set_Tuples(new ObservableCollection>()); - observableCollection4.Add(tupleList4); - num = listAtual.IndexOf(tupleList2); - } - observableCollection4.Last().get_Tuples().Add(new Tuple(item1.Item1, item1.Item2, tupleLists1[listAtual.IndexOf(tupleList2)].get_Tuples()[tupleList2.get_Tuples().IndexOf(item1)].Item2)); - } - } - } - if (observableCollection4.Count == 0) - { - observableCollection1 = null; - } - else - { - observableCollection1 = observableCollection4; - } - this.ListsAlterados = observableCollection1; - observableCollection4 = new ObservableCollection(); - foreach (TupleList tupleList5 in listAtual) - { - int num5 = -1; - if (tupleLists1.Count - 1 < listAtual.IndexOf(tupleList5)) - { - continue; - } - for (int l = 0; l < tupleList5.get_Tuples().Count; l++) - { - Tuple tuple1 = tupleList5.get_Tuples()[l]; - if (LogViewModel.QntEspaco(tuple1.Item1) > 0) - { - List strs1 = new List(); - int num6 = LogViewModel.QntEspaco(tuple1.Item1); - for (int m = l; m >= 0; m--) - { - if (LogViewModel.QntEspaco(tupleList5.get_Tuples()[m].Item1) <= num6) - { - strs1.Insert(0, tupleList5.get_Tuples()[m].Item1); - num6 = LogViewModel.QntEspaco(tupleList5.get_Tuples()[m].Item1); - } - } - bool flag2 = false; - int num7 = 0; - Label4: - foreach (string str1 in strs1) - { - if (!flag2) - { - int num8 = num7; - while (num8 < tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples().Count) - { - if (num8 == tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples().Count - 1 && str1 != tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples()[num8].Item1) - { - flag2 = true; - goto Label4; - } - else if (str1 != tupleLists1[listAtual.IndexOf(tupleList5)].get_Tuples()[num8].Item1) - { - num8++; - } - else - { - num7 = num8; - goto Label4; - } - } - } - else - { - goto Label3; - } - } - Label3: - if (flag2) - { - if (num5 < listAtual.IndexOf(tupleList5)) - { - TupleList tupleList6 = new TupleList(); - tupleList6.set_Tuples(new ObservableCollection>()); - observableCollection4.Add(tupleList6); - num5 = listAtual.IndexOf(tupleList5); - } - int count2 = observableCollection4.Last().get_Tuples().Count; - int num9 = LogViewModel.QntEspaco(tuple1.Item1); - for (int n = l - 1; n >= 0; n--) - { - if (LogViewModel.QntEspaco(tupleList5.get_Tuples()[n].Item1) < LogViewModel.QntEspaco(tuple1.Item1) && LogViewModel.QntEspaco(tupleList5.get_Tuples()[n].Item1) < num9) - { - bool flag3 = false; - int count3 = observableCollection4.Last().get_Tuples().Count - 1; - while (count3 >= 0) - { - if (observableCollection4.Last().get_Tuples()[count3].Item1 != tupleList5.get_Tuples()[n].Item1) - { - count3--; - } - else - { - flag3 = true; - break; - } - } - if (flag3) - { - break; - } - num9 = LogViewModel.QntEspaco(tupleList5.get_Tuples()[n].Item1); - observableCollection4.Last().get_Tuples().Insert(count2, new Tuple(tupleList5.get_Tuples()[n].Item1, tupleList5.get_Tuples()[n].Item2, "")); - } - } - observableCollection4.Last().get_Tuples().Add(new Tuple(tuple1.Item1, tuple1.Item2, "")); - } - } - } - } - if (observableCollection4.Count == 0) - { - observableCollection2 = null; - } - else - { - observableCollection2 = observableCollection4; - } - this.ListsAdicionados = observableCollection2; - observableCollection4 = new ObservableCollection(); - foreach (TupleList tupleList7 in tupleLists1) - { - int num10 = -1; - for (int o = 0; o < tupleList7.get_Tuples().Count; o++) - { - Tuple tuple2 = tupleList7.get_Tuples()[o]; - if (LogViewModel.QntEspaco(tuple2.Item1) > 0) - { - List strs2 = new List(); - int num11 = LogViewModel.QntEspaco(tuple2.Item1); - for (int p = o; p >= 0; p--) - { - if (LogViewModel.QntEspaco(tupleList7.get_Tuples()[p].Item1) <= num11) - { - strs2.Insert(0, tupleList7.get_Tuples()[p].Item1); - num11 = LogViewModel.QntEspaco(tupleList7.get_Tuples()[p].Item1); - } - } - bool flag4 = false; - int num12 = 0; - Label6: - foreach (string str2 in strs2) - { - if (!flag4) - { - if (listAtual.Count - 1 < tupleLists1.IndexOf(tupleList7)) - { - continue; - } - int num13 = num12; - while (num13 < listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples().Count) - { - if (num13 == listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples().Count - 1 && str2 != listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples()[num13].Item1) - { - flag4 = true; - goto Label6; - } - else if (str2 != listAtual[tupleLists1.IndexOf(tupleList7)].get_Tuples()[num13].Item1) - { - num13++; - } - else - { - num12 = num13; - goto Label6; - } - } - } - else - { - goto Label5; - } - } - Label5: - if (flag4) - { - if (num10 < tupleLists1.IndexOf(tupleList7)) - { - TupleList tupleList8 = new TupleList(); - tupleList8.set_Tuples(new ObservableCollection>()); - observableCollection4.Add(tupleList8); - num10 = tupleLists1.IndexOf(tupleList7); - } - int count4 = observableCollection4.Last().get_Tuples().Count; - int num14 = LogViewModel.QntEspaco(tuple2.Item1); - for (int q = o - 1; q >= 0; q--) - { - if (LogViewModel.QntEspaco(tupleList7.get_Tuples()[q].Item1) < LogViewModel.QntEspaco(tuple2.Item1) && LogViewModel.QntEspaco(tupleList7.get_Tuples()[q].Item1) < num14) - { - bool flag5 = false; - int count5 = observableCollection4.Last().get_Tuples().Count - 1; - while (count5 >= 0) - { - if (observableCollection4.Last().get_Tuples()[count5].Item1 != tupleList7.get_Tuples()[q].Item1) - { - count5--; - } - else - { - flag5 = true; - break; - } - } - if (flag5) - { - break; - } - num14 = LogViewModel.QntEspaco(tupleList7.get_Tuples()[q].Item1); - observableCollection4.Last().get_Tuples().Insert(count4, new Tuple(tupleList7.get_Tuples()[q].Item1, tupleList7.get_Tuples()[q].Item2, "")); - } - } - observableCollection4.Last().get_Tuples().Add(new Tuple(tuple2.Item1, "", tuple2.Item2)); - } - } - } - } - if (observableCollection4.Count == 0) - { - observableCollection3 = null; - } - else - { - observableCollection3 = observableCollection4; - } - this.ListsRemovidos = observableCollection3; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/MetaSeguradoraViewModel.cs b/Gestor.Application/ViewModels/Drawer/MetaSeguradoraViewModel.cs deleted file mode 100644 index 71d96c5..0000000 --- a/Gestor.Application/ViewModels/Drawer/MetaSeguradoraViewModel.cs +++ /dev/null @@ -1,258 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class MetaSeguradoraViewModel : BaseSegurosViewModel - { - private readonly MetaSeguradoraServico _servico; - - private readonly Seguradora _selectedSeguradora; - - private MetaSeguradora _selectedMetaSeguradora = new MetaSeguradora(); - - private ObservableCollection _metasSeguradora = new ObservableCollection(); - - private bool _carregando; - - public MetaSeguradora CancelMetaSeguradora; - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public ObservableCollection MetasSeguradora - { - get - { - return this._metasSeguradora; - } - set - { - this._metasSeguradora = value; - base.OnPropertyChanged("MetasSeguradora"); - } - } - - public MetaSeguradora SelectedMetaSeguradora - { - get - { - return this._selectedMetaSeguradora; - } - set - { - long? nullable; - this._selectedMetaSeguradora = value; - this.CancelMetaSeguradora = (value == null || value.get_Id() <= (long)0 ? this.CancelMetaSeguradora : value); - if (value != null) - { - nullable = new long?(value.get_Id()); - } - else - { - nullable = null; - } - base.VerificarEnables(nullable); - base.OnPropertyChanged("SelectedMetaSeguradora"); - } - } - - public MetaSeguradoraViewModel(Seguradora seguradora) - { - this._servico = new MetaSeguradoraServico(); - this.Seleciona(seguradora); - this._selectedSeguradora = seguradora; - } - - public void CancelarAlteracao() - { - this.Carregando = true; - if (this.CancelMetaSeguradora != null && this.MetasSeguradora.Any((MetaSeguradora x) => x.get_Id() == this.CancelMetaSeguradora.get_Id())) - { - DomainBase.Copy(this.MetasSeguradora.First((MetaSeguradora x) => x.get_Id() == this.CancelMetaSeguradora.get_Id()), this.CancelMetaSeguradora); - this.SelectedMetaSeguradora = this.MetasSeguradora.First((MetaSeguradora x) => x.get_Id() == this.CancelMetaSeguradora.get_Id()); - } - base.Alterar(false); - this.Carregando = false; - } - - private async Task CarregarMetas(Seguradora seguradora) - { - List metaSeguradoras = await (new BaseServico()).BuscarMetaSeguradoraAsync(seguradora); - MetaSeguradoraViewModel observableCollection = this; - List metaSeguradoras1 = metaSeguradoras; - IOrderedEnumerable mes = - from x in metaSeguradoras1 - orderby x.get_Mes() - select x; - observableCollection.MetasSeguradora = new ObservableCollection(mes.ThenBy((MetaSeguradora x) => x.get_Valor())); - } - - public async Task Excluir() - { - bool flag; - string nome; - MetaSeguradora metaSeguradora; - if (this.SelectedMetaSeguradora == null || this.SelectedMetaSeguradora.get_Id() == 0) - { - flag = false; - } - else if (await base.ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO", false)) - { - this.Carregando = true; - if (await this._servico.Delete(this.SelectedMetaSeguradora)) - { - MetaSeguradoraViewModel metaSeguradoraViewModel = this; - Seguradora seguradora = this.SelectedMetaSeguradora.get_Seguradora(); - if (seguradora != null) - { - nome = seguradora.get_Nome(); - } - else - { - nome = null; - } - string str = string.Concat("EXCLUIU META DA SEGURADORA \"", nome, "\""); - long id = this.SelectedMetaSeguradora.get_Id(); - TipoTela? nullable = new TipoTela?(31); - object[] objArray = new object[] { this.SelectedMetaSeguradora.get_Id(), this.SelectedMetaSeguradora.get_Valor(), Functions.GetDescription(this.SelectedMetaSeguradora.get_Mes()), this.SelectedMetaSeguradora.get_Ano() }; - metaSeguradoraViewModel.RegistrarAcao(str, id, nullable, string.Format("ID: {0}\nVALOR: {1:C}\nMÊS: {2}\nANO: {3}", objArray)); - int num = this.MetasSeguradora.IndexOf(this.SelectedMetaSeguradora); - this.MetasSeguradora.Remove(this.SelectedMetaSeguradora); - this.MetasSeguradora.Remove(this.SelectedMetaSeguradora); - this.MetasSeguradora = new ObservableCollection(this.MetasSeguradora); - if (this.MetasSeguradora.Count <= 0) - { - this.SelectedMetaSeguradora = new MetaSeguradora(); - base.Alterar(false); - base.EnableMenu = false; - base.EnableAlterar = false; - base.EnableExcluir = false; - } - else - { - MetaSeguradoraViewModel metaSeguradoraViewModel1 = this; - metaSeguradora = (num < this.MetasSeguradora.Count ? this.MetasSeguradora.ElementAt(num) : this.MetasSeguradora.Last()); - metaSeguradoraViewModel1.SelectedMetaSeguradora = metaSeguradora; - } - this.Carregando = false; - flag = true; - } - else - { - this.Carregando = false; - base.Alterar(false); - flag = false; - } - } - else - { - flag = false; - } - return flag; - } - - public void Incluir() - { - DateTime date = Funcoes.GetNetworkTime().Date; - MetaSeguradora metaSeguradora = new MetaSeguradora(); - metaSeguradora.set_Ano((long)date.Year); - metaSeguradora.set_Mes(date.Month); - this.SelectedMetaSeguradora = metaSeguradora; - base.Alterar(true); - } - - public async Task>> Salvar() - { - List> keyValuePairs; - string str; - this.SelectedMetaSeguradora.set_Seguradora(this._selectedSeguradora); - str = (this.SelectedMetaSeguradora.get_Id() == 0 ? "INCLUIU" : "ALTEROU"); - string str1 = str; - MetaSeguradora metaSeguradora = await this._servico.Save(this.SelectedMetaSeguradora); - if (this._servico.Sucesso) - { - string str2 = string.Concat(str1, " META DA SEGURADORA \"", metaSeguradora.get_Seguradora().get_Nome(), "\""); - long id = metaSeguradora.get_Id(); - TipoTela? nullable = new TipoTela?(31); - object[] objArray = new object[] { metaSeguradora.get_Id(), metaSeguradora.get_Valor(), Functions.GetDescription(metaSeguradora.get_Mes()), metaSeguradora.get_Ano() }; - base.RegistrarAcao(str2, id, nullable, string.Format("ID: {0}\nVALOR: {1:C}\nMÊS: {2}\nANO: {3}", objArray)); - if (!this.MetasSeguradora.Any((MetaSeguradora x) => x.get_Id() == metaSeguradora.get_Id())) - { - this.MetasSeguradora.Add(metaSeguradora); - } - else - { - DomainBase.Copy(this.MetasSeguradora.First((MetaSeguradora x) => x.get_Id() == metaSeguradora.get_Id()), metaSeguradora); - } - this.MetasSeguradora = new ObservableCollection(this.MetasSeguradora); - this.SelectedMetaSeguradora = this.MetasSeguradora.First((MetaSeguradora x) => x.get_Id() == metaSeguradora.get_Id()); - base.Alterar(false); - keyValuePairs = null; - } - else - { - keyValuePairs = null; - } - str1 = null; - return keyValuePairs; - } - - private async void Seleciona(Seguradora seguradora) - { - base.Loading(true); - await base.PermissaoTela(31); - await this.SelecionaMetasSeguradora(seguradora); - base.Loading(false); - } - - public void SelecionaMetaSeguradora(MetaSeguradora metaSeguradora) - { - this.SelectedMetaSeguradora = metaSeguradora; - } - - private async Task SelecionaMetasSeguradora(Seguradora seguradora) - { - this.Carregando = true; - await this.CarregarMetas(seguradora); - if (this.MetasSeguradora.Count <= 0) - { - this.SelectedMetaSeguradora = new MetaSeguradora(); - base.Alterar(false); - base.EnableMenu = false; - base.EnableAlterar = false; - base.EnableExcluir = false; - } - else - { - this.SelecionaMetaSeguradora(this.MetasSeguradora.First()); - } - this.Carregando = false; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/MetaVendedorViewModel.cs b/Gestor.Application/ViewModels/Drawer/MetaVendedorViewModel.cs deleted file mode 100644 index 23f8929..0000000 --- a/Gestor.Application/ViewModels/Drawer/MetaVendedorViewModel.cs +++ /dev/null @@ -1,244 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class MetaVendedorViewModel : BaseSegurosViewModel - { - private readonly MetaVendedorServico _servico; - - private readonly Vendedor _selectedVendedor; - - private MetaVendedor _selectedMetaVendedor = new MetaVendedor(); - - private ObservableCollection _metasVendedor = new ObservableCollection(); - - private bool _carregando; - - public MetaVendedor CancelMetaVendedor; - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public ObservableCollection MetasVendedor - { - get - { - return this._metasVendedor; - } - set - { - this._metasVendedor = value; - base.OnPropertyChanged("MetasVendedor"); - } - } - - public MetaVendedor SelectedMetaVendedor - { - get - { - return this._selectedMetaVendedor; - } - set - { - long? nullable; - this._selectedMetaVendedor = value; - this.CancelMetaVendedor = (value == null || value.get_Id() <= (long)0 ? this.CancelMetaVendedor : value); - if (value != null) - { - nullable = new long?(value.get_Id()); - } - else - { - nullable = null; - } - base.VerificarEnables(nullable); - base.OnPropertyChanged("SelectedMetaVendedor"); - } - } - - public MetaVendedorViewModel(Vendedor vendedor) - { - this._servico = new MetaVendedorServico(); - this.Seleciona(vendedor); - this._selectedVendedor = vendedor; - } - - public void CancelarAlteracao() - { - this.Carregando = true; - if (this.CancelMetaVendedor != null && this.MetasVendedor.Any((MetaVendedor x) => x.get_Id() == this.CancelMetaVendedor.get_Id())) - { - DomainBase.Copy(this.MetasVendedor.First((MetaVendedor x) => x.get_Id() == this.CancelMetaVendedor.get_Id()), this.CancelMetaVendedor); - this.SelectedMetaVendedor = this.MetasVendedor.First((MetaVendedor x) => x.get_Id() == this.CancelMetaVendedor.get_Id()); - } - base.Alterar(false); - this.Carregando = false; - } - - private async Task CarregarMetas(Vendedor vendedor) - { - List metaVendedors = await (new BaseServico()).BuscarMetaVendedorAsync(vendedor); - MetaVendedorViewModel observableCollection = this; - List metaVendedors1 = metaVendedors; - IOrderedEnumerable mes = - from x in metaVendedors1 - orderby x.get_Mes() - select x; - observableCollection.MetasVendedor = new ObservableCollection(mes.ThenBy((MetaVendedor x) => x.get_Valor()).ToList()); - } - - public async Task Excluir() - { - bool flag; - string str; - string str1; - if (this.SelectedMetaVendedor == null || this.SelectedMetaVendedor.get_Id() == 0) - { - flag = false; - } - else if (await base.ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO", false)) - { - this.Carregando = true; - str = string.Concat("EXCLUIU META DO VENDEDOR \"", this._selectedVendedor.get_Nome(), "\""); - long id = this.SelectedMetaVendedor.get_Id(); - object[] objArray = new object[] { this.SelectedMetaVendedor.get_Id(), this.SelectedMetaVendedor.get_Valor(), Functions.GetDescription(this.SelectedMetaVendedor.get_Mes()), this.SelectedMetaVendedor.get_Ano() }; - str1 = string.Format("ID: {0}\nVALOR: {1:C}\nMÊS: {2}\nANO: {3}", objArray); - if (await this._servico.Delete(this.SelectedMetaVendedor)) - { - base.RegistrarAcao(str, id, new TipoTela?(30), str1); - await this.CarregarMetas(this._selectedVendedor); - if (this.MetasVendedor.Count <= 0) - { - this.SelectedMetaVendedor = new MetaVendedor(); - base.Alterar(false); - base.EnableMenu = false; - base.EnableAlterar = false; - base.EnableExcluir = false; - } - else - { - this.SelectedMetaVendedor = this.MetasVendedor.First(); - } - this.Carregando = false; - flag = true; - } - else - { - this.Carregando = false; - base.Alterar(false); - flag = false; - } - } - else - { - flag = false; - } - str = null; - str1 = null; - return flag; - } - - public void Incluir() - { - DateTime date = Funcoes.GetNetworkTime().Date; - MetaVendedor metaVendedor = new MetaVendedor(); - metaVendedor.set_Ano((long)date.Year); - metaVendedor.set_Mes(date.Month); - this.SelectedMetaVendedor = metaVendedor; - base.Alterar(true); - } - - public async Task>> Salvar() - { - List> keyValuePairs; - string str; - this.SelectedMetaVendedor.set_Vendedor(this._selectedVendedor); - this._servico.Sucesso = true; - str = (this.SelectedMetaVendedor.get_Id() == 0 ? "INCLUIU" : "ALTEROU"); - string str1 = str; - MetaVendedor metaVendedor = await this._servico.Save(this.SelectedMetaVendedor); - if (this._servico.Sucesso) - { - string str2 = string.Concat(str1, " META DO VENDEDOR \"", metaVendedor.get_Vendedor().get_Nome(), "\""); - long id = metaVendedor.get_Id(); - TipoTela? nullable = new TipoTela?(30); - object[] objArray = new object[] { metaVendedor.get_Id(), metaVendedor.get_Valor(), Functions.GetDescription(metaVendedor.get_Mes()), metaVendedor.get_Ano() }; - base.RegistrarAcao(str2, id, nullable, string.Format("ID: {0}\nVALOR: {1:C}\nMÊS: {2}\nANO: {3}", objArray)); - if (!this.MetasVendedor.Any((MetaVendedor x) => x.get_Id() == metaVendedor.get_Id())) - { - this.MetasVendedor.Add(metaVendedor); - } - else - { - DomainBase.Copy(this.MetasVendedor.First((MetaVendedor x) => x.get_Id() == metaVendedor.get_Id()), metaVendedor); - } - this.MetasVendedor = new ObservableCollection(this.MetasVendedor); - this.SelectedMetaVendedor = this.MetasVendedor.First((MetaVendedor x) => x.get_Id() == metaVendedor.get_Id()); - base.Alterar(false); - keyValuePairs = null; - } - else - { - keyValuePairs = null; - } - str1 = null; - return keyValuePairs; - } - - private async void Seleciona(Vendedor vendedor) - { - base.Loading(true); - await base.PermissaoTela(30); - await this.SelecionaMetasVendedor(vendedor); - base.Loading(false); - } - - private async Task SelecionaMetasVendedor(Vendedor vendedor) - { - this.Carregando = true; - await this.CarregarMetas(vendedor); - if (this.MetasVendedor.Count <= 0) - { - this.SelectedMetaVendedor = new MetaVendedor(); - base.Alterar(false); - base.EnableMenu = false; - } - else - { - this.SelecionaMetaVendedor(this.MetasVendedor.First()); - } - this.Carregando = false; - } - - public void SelecionaMetaVendedor(MetaVendedor metaVendedor) - { - this.SelectedMetaVendedor = metaVendedor; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/PermissaoUsuarioViewModel.cs b/Gestor.Application/ViewModels/Drawer/PermissaoUsuarioViewModel.cs deleted file mode 100644 index 3f8c7ac..0000000 --- a/Gestor.Application/ViewModels/Drawer/PermissaoUsuarioViewModel.cs +++ /dev/null @@ -1,1939 +0,0 @@ -using Gestor.Application.Actions; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -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.Generic; -using Gestor.Model.Domain.Relatorios; -using Gestor.Model.Domain.Seguros; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; - -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 _seguros; - - private ObservableCollection _ferramentas; - - private ObservableCollection _arquivosDigitais; - - private bool _enableAlterarPermiss = true; - - private ObservableCollection _restricoesBisFiltradas; - - private ObservableCollection _restricoesSegurosFiltradas; - - private ObservableCollection _restricoesRelatoriosFiltrados; - - private ObservableCollection _restricoesTotalizacoesRelatoriosFiltrados; - - private ObservableCollection _restricoesCamposRelatoriosFiltrados; - - private ObservableCollection _restricoesFinanceirosFiltradas; - - private ObservableCollection _restricoesFerramentasFiltradas; - - private ObservableCollection _restricoesAjudasFiltrados; - - private List _restricoesBis; - - private List _restricoesSeguros; - - private List _restricoesRelatorios; - - private List _restricoesTotalizacoesRelatorios; - - private List _restricoesCamposRelatorios; - - private List _restricoesFinanceiros; - - private List _restricoesFerramentas; - - private List _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; - - private Gestor.Model.Common.PermissaoAggilizador _selectedPermissao; - - private bool _admUsuario; - - private bool _importarEnabled; - - private bool _carregando; - - private bool _ativarDesativarPermissoesBool = true; - - private bool _ativarDesativarRestricoesBool = true; - - public bool AdmUsuario - { - get - { - return this._admUsuario; - } - set - { - this._admUsuario = value; - this.ImportarEnabled = !value; - this.SelectedUsuario.set_Administrador(value); - if (value && !this.Carregando) - { - this.AtivarDesativarPermissoes(true); - this.AtivarDesativarRestricoes(false); - } - base.OnPropertyChanged("AdmUsuario"); - } - } - - public ObservableCollection ArquivosDigitais - { - get - { - return this._arquivosDigitais; - } - set - { - this._arquivosDigitais = value; - base.OnPropertyChanged("ArquivosDigitais"); - Gestor.Application.Actions.Actions.OcultarTogglesArquivoDigital(); - } - } - - public bool AtivarDesativarPermissoesBool - { - get - { - return this._ativarDesativarPermissoesBool; - } - set - { - this._ativarDesativarPermissoesBool = value; - base.OnPropertyChanged("AtivarDesativarPermissoesBool"); - } - } - - public bool AtivarDesativarRestricoesBool - { - get - { - return this._ativarDesativarRestricoesBool; - } - set - { - this._ativarDesativarRestricoesBool = value; - base.OnPropertyChanged("AtivarDesativarRestricoesBool"); - } - } - - public bool Carregado - { - get; - set; - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.EnableMenu = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public bool EnableAlterarPermiss - { - get - { - return this._enableAlterarPermiss; - } - set - { - this._enableAlterarPermiss = value; - base.OnPropertyChanged("EnableAlterarPermiss"); - } - } - - public bool ExpandedAjudas - { - get - { - return this._expandedAjudas; - } - set - { - this._expandedAjudas = value; - base.OnPropertyChanged("ExpandedAjudas"); - } - } - - public bool ExpandedBis - { - get - { - return this._expandedBis; - } - set - { - this._expandedBis = value; - base.OnPropertyChanged("ExpandedBis"); - } - } - - public bool ExpandedCampos - { - get - { - return this._expandedCampos; - } - set - { - this._expandedCampos = value; - base.OnPropertyChanged("ExpandedCampos"); - } - } - - public bool ExpandedFerramentas - { - get - { - return this._expandedFerramentas; - } - set - { - this._expandedFerramentas = value; - base.OnPropertyChanged("ExpandedFerramentas"); - } - } - - public bool ExpandedFinanceiros - { - get - { - return this._expandedFinanceiros; - } - set - { - this._expandedFinanceiros = value; - base.OnPropertyChanged("ExpandedFinanceiros"); - } - } - - public bool ExpandedRelatorios - { - get - { - return this._expandedRelatorios; - } - set - { - this._expandedRelatorios = value; - base.OnPropertyChanged("ExpandedRelatorios"); - } - } - - public bool ExpandedSeguros - { - get - { - return this._expandedSeguros; - } - set - { - this._expandedSeguros = value; - base.OnPropertyChanged("ExpandedSeguros"); - } - } - - public bool ExpandedTotalizacoes - { - get - { - return this._expandedTotalizacoes; - } - set - { - this._expandedTotalizacoes = value; - base.OnPropertyChanged("ExpandedTotalizacoes"); - } - } - - public ObservableCollection Ferramentas - { - get - { - return this._ferramentas; - } - set - { - this._ferramentas = value; - base.OnPropertyChanged("Ferramentas"); - if (value != null && this.Seguros != null) - { - if (value.All((PermissaoUsuario x) => { - if (x.get_Tela() == 18 && x.get_Consultar() && x.get_Alterar() || x.get_Tela() == 10 && x.get_Consultar() && x.get_Alterar() && x.get_Incluir() || x.get_Tela() == 12 && x.get_Consultar() && x.get_Alterar() || x.get_Tela() == 13 && x.get_Consultar() && x.get_Alterar() && x.get_Incluir()) - { - return true; - } - if (x.get_Tela() == 18 || x.get_Tela() == 10 || x.get_Tela() == 12 || x.get_Tela() == 13 || !x.get_Consultar() || !x.get_Alterar() || !x.get_Incluir()) - { - return false; - } - return x.get_Excluir(); - })) - { - if (this.Seguros.All((PermissaoUsuario x) => { - if (x.get_Tela() == 21 && x.get_Consultar() || x.get_Tela() == 5 && x.get_Alterar() && x.get_Incluir() && x.get_Excluir()) - { - return true; - } - if (x.get_Tela() == 21 || x.get_Tela() == 5 || !x.get_Consultar() || !x.get_Alterar() || !x.get_Incluir()) - { - return false; - } - return x.get_Excluir(); - })) - { - this.AtivarDesativarPermissoesBool = false; - } - } - } - Gestor.Application.Actions.Actions.OcultarTogglesFerramentas(); - } - } - - public bool ImportarEnabled - { - get - { - return this._importarEnabled; - } - set - { - this._importarEnabled = value; - base.OnPropertyChanged("ImportarEnabled"); - } - } - - public List PermissaoAggilizador - { - get - { - return this._permissaoAggilizador; - } - set - { - this._permissaoAggilizador = value; - base.OnPropertyChanged("PermissaoAggilizador"); - } - } - - public List RestricoesAjudas - { - get - { - return this._restricoesAjudas; - } - set - { - this._restricoesAjudas = value; - base.OnPropertyChanged("RestricoesAjudas"); - } - } - - public ObservableCollection RestricoesAjudasFiltrados - { - get - { - return this._restricoesAjudasFiltrados; - } - set - { - this.RestricoesAjudasVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesAjudasFiltrados = new ObservableCollection( - from x in value.ToList() - orderby ValidationHelper.GetDescription(x.get_Tipo()) - select x); - base.OnPropertyChanged("RestricoesAjudasFiltrados"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesAjudasVisibility - { - get - { - return this._restricoesAjudasVisibility; - } - set - { - this._restricoesAjudasVisibility = value; - base.OnPropertyChanged("RestricoesAjudasVisibility"); - } - } - - public List RestricoesBis - { - get - { - return this._restricoesBis; - } - set - { - this._restricoesBis = value; - base.OnPropertyChanged("RestricoesBis"); - } - } - - public ObservableCollection RestricoesBisFiltradas - { - get - { - return this._restricoesBisFiltradas; - } - set - { - this.RestricoesBisVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesBisFiltradas = new ObservableCollection( - from x in value.ToList() - orderby ValidationHelper.GetDescription(x.get_Tipo()) - select x); - base.OnPropertyChanged("RestricoesBisFiltradas"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesBisVisibility - { - get - { - return this._restricoesBisVisibility; - } - set - { - this._restricoesBisVisibility = value; - base.OnPropertyChanged("RestricoesBisVisibility"); - } - } - - public List RestricoesCamposRelatorios - { - get - { - return this._restricoesCamposRelatorios; - } - set - { - this._restricoesCamposRelatorios = value; - base.OnPropertyChanged("RestricoesCamposRelatorios"); - } - } - - public ObservableCollection RestricoesCamposRelatoriosFiltrados - { - get - { - return this._restricoesCamposRelatoriosFiltrados; - } - set - { - this.RestricoesCamposRelatoriosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesCamposRelatoriosFiltrados = new ObservableCollection( - from x in value.ToList() - orderby x.get_Relatorio(), x.get_Campo() - select x); - base.OnPropertyChanged("RestricoesCamposRelatoriosFiltrados"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesCamposRelatoriosVisibility - { - get - { - return this._restricoesCamposRelatoriosVisibility; - } - set - { - this._restricoesCamposRelatoriosVisibility = value; - base.OnPropertyChanged("RestricoesCamposRelatoriosVisibility"); - } - } - - public List RestricoesFerramentas - { - get - { - return this._restricoesFerramentas; - } - set - { - this._restricoesFerramentas = value; - base.OnPropertyChanged("RestricoesFerramentas"); - } - } - - public ObservableCollection RestricoesFerramentasFiltradas - { - get - { - return this._restricoesFerramentasFiltradas; - } - set - { - this.RestricoesFerramentasVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesFerramentasFiltradas = new ObservableCollection( - from x in value.ToList() - orderby ValidationHelper.GetDescription(x.get_Tipo()) - select x); - base.OnPropertyChanged("RestricoesFerramentasFiltradas"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesFerramentasVisibility - { - get - { - return this._restricoesFerramentasVisibility; - } - set - { - this._restricoesFerramentasVisibility = value; - base.OnPropertyChanged("RestricoesFerramentasVisibility"); - } - } - - public List RestricoesFinanceiros - { - get - { - return this._restricoesFinanceiros; - } - set - { - this._restricoesFinanceiros = value; - base.OnPropertyChanged("RestricoesFinanceiros"); - } - } - - public ObservableCollection RestricoesFinanceirosFiltradas - { - get - { - return this._restricoesFinanceirosFiltradas; - } - set - { - this.RestricoesFinanceirosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesFinanceirosFiltradas = new ObservableCollection( - from x in value.ToList() - orderby ValidationHelper.GetDescription(x.get_Tipo()) - select x); - base.OnPropertyChanged("RestricoesFinanceirosFiltradas"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesFinanceirosVisibility - { - get - { - return this._restricoesFinanceirosVisibility; - } - set - { - this._restricoesFinanceirosVisibility = value; - base.OnPropertyChanged("RestricoesFinanceirosVisibility"); - } - } - - public List RestricoesRelatorios - { - get - { - return this._restricoesRelatorios; - } - set - { - this._restricoesRelatorios = value; - base.OnPropertyChanged("RestricoesRelatorios"); - } - } - - public ObservableCollection RestricoesRelatoriosFiltrados - { - get - { - return this._restricoesRelatoriosFiltrados; - } - set - { - this.RestricoesRelatoriosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesRelatoriosFiltrados = new ObservableCollection( - from x in value.ToList() - orderby ValidationHelper.GetDescription(x.get_Tipo()) - select x); - base.OnPropertyChanged("RestricoesRelatoriosFiltrados"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesRelatoriosVisibility - { - get - { - return this._restricoesRelatoriosVisibility; - } - set - { - this._restricoesRelatoriosVisibility = value; - base.OnPropertyChanged("RestricoesRelatoriosVisibility"); - } - } - - public List RestricoesSeguros - { - get - { - return this._restricoesSeguros; - } - set - { - this._restricoesSeguros = value; - base.OnPropertyChanged("RestricoesSeguros"); - } - } - - public ObservableCollection RestricoesSegurosFiltradas - { - get - { - return this._restricoesSegurosFiltradas; - } - set - { - this.RestricoesSegurosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesSegurosFiltradas = new ObservableCollection( - from x in value.ToList() - orderby ValidationHelper.GetDescription(x.get_Tipo()) - select x); - base.OnPropertyChanged("RestricoesSegurosFiltradas"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesSegurosVisibility - { - get - { - return this._restricoesSegurosVisibility; - } - set - { - this._restricoesSegurosVisibility = value; - base.OnPropertyChanged("RestricoesSegurosVisibility"); - } - } - - public List RestricoesTotalizacoesRelatorios - { - get - { - return this._restricoesTotalizacoesRelatorios; - } - set - { - this._restricoesTotalizacoesRelatorios = value; - base.OnPropertyChanged("RestricoesTotalizacoesRelatorios"); - } - } - - public ObservableCollection RestricoesTotalizacoesRelatoriosFiltrados - { - get - { - return this._restricoesTotalizacoesRelatoriosFiltrados; - } - set - { - this.RestricoesTotalizacoesRelatoriosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible); - this._restricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection( - from x in value.ToList() - orderby ValidationHelper.GetDescription(x.get_Tipo()) - select x); - base.OnPropertyChanged("RestricoesTotalizacoesRelatoriosFiltrados"); - this.AtivarDesativarRestricoes(); - } - } - - public Visibility RestricoesTotalizacoesRelatoriosVisibility - { - get - { - return this._restricoesTotalizacoesRelatoriosVisibility; - } - set - { - this._restricoesTotalizacoesRelatoriosVisibility = value; - base.OnPropertyChanged("RestricoesTotalizacoesRelatoriosVisibility"); - } - } - - public ObservableCollection Seguros - { - get - { - return this._seguros; - } - set - { - this._seguros = value; - base.OnPropertyChanged("Seguros"); - if (value != null && this.Ferramentas != null) - { - if (value.All((PermissaoUsuario x) => { - if (x.get_Tela() == 21 && x.get_Consultar() || x.get_Tela() == 5 && x.get_Alterar() && x.get_Incluir() && x.get_Excluir()) - { - return true; - } - if (x.get_Tela() == 21 || x.get_Tela() == 5 || !x.get_Consultar() || !x.get_Alterar() || !x.get_Incluir()) - { - return false; - } - return x.get_Excluir(); - })) - { - if (this.Ferramentas.All((PermissaoUsuario x) => { - if (x.get_Tela() == 18 && x.get_Consultar() && x.get_Alterar() || x.get_Tela() == 10 && x.get_Consultar() && x.get_Alterar() && x.get_Incluir() || x.get_Tela() == 12 && x.get_Consultar() && x.get_Alterar() || x.get_Tela() == 13 && x.get_Consultar() && x.get_Alterar() && x.get_Incluir()) - { - return true; - } - if (x.get_Tela() == 18 || x.get_Tela() == 10 || x.get_Tela() == 12 || x.get_Tela() == 13 || !x.get_Consultar() || !x.get_Alterar() || !x.get_Incluir()) - { - return false; - } - return x.get_Excluir(); - })) - { - this.AtivarDesativarPermissoesBool = false; - } - } - } - Gestor.Application.Actions.Actions.OcultarTogglesSeguros(); - } - } - - public Gestor.Model.Common.PermissaoAggilizador SelectedPermissao - { - get - { - return this._selectedPermissao; - } - set - { - this._selectedPermissao = value; - base.OnPropertyChanged("SelectedPermissao"); - } - } - - public Usuario SelectedUsuario - { - get - { - return this._selectedUsuario; - } - set - { - this._selectedUsuario = value; - base.OnPropertyChanged("SelectedUsuario"); - } - } - - public PermissaoUsuarioViewModel(Usuario usuario) - { - this.SelectedUsuario = usuario; - this._servicoUsuario = new UsuarioServico(); - this.CarregarModulos(usuario); - this.EnableAlterarPermiss = Recursos.Usuario.get_Id() > (long)0; - } - - public void AtivarDesativarPermissoes(bool permiss) - { - Gestor.Model.Common.PermissaoAggilizador permissaoAggilizador; - this.AtivarDesativarPermissoesBool = !permiss; - this.Seguros.ToList().ForEach((PermissaoUsuario x) => { - x.set_Consultar(permiss); - x.set_Incluir(permiss); - x.set_Alterar(permiss); - x.set_Excluir(permiss); - }); - this.Ferramentas.ToList().ForEach((PermissaoUsuario x) => { - x.set_Consultar(permiss); - x.set_Incluir(permiss); - x.set_Alterar(permiss); - x.set_Excluir(permiss); - }); - this.ArquivosDigitais.ToList().ForEach((PermissaoArquivoDigital x) => { - x.set_Consultar(permiss); - x.set_Incluir(permiss); - x.set_Excluir(permiss); - }); - if (permiss) - { - permissaoAggilizador = this.PermissaoAggilizador.FirstOrDefault((Gestor.Model.Common.PermissaoAggilizador x) => x.get_Descricao() == "ADMINISTRADOR"); - } - else - { - permissaoAggilizador = null; - } - this.SelectedPermissao = permissaoAggilizador; - this.Seguros = new ObservableCollection(this.Seguros); - this.Ferramentas = new ObservableCollection(this.Ferramentas); - this.ArquivosDigitais = new ObservableCollection(this.ArquivosDigitais); - } - - public void AtivarDesativarRestricoes(bool restricao) - { - this.AtivarDesativarRestricoesBool = !restricao; - foreach (RestricaoUsuario restricoesBisFiltrada in this.RestricoesBisFiltradas) - { - restricoesBisFiltrada.set_Restricao(restricao); - } - foreach (RestricaoUsuario restricoesSegurosFiltrada in this.RestricoesSegurosFiltradas) - { - restricoesSegurosFiltrada.set_Restricao(restricao); - } - foreach (RestricaoUsuario restricoesRelatoriosFiltrado in this.RestricoesRelatoriosFiltrados) - { - restricoesRelatoriosFiltrado.set_Restricao(restricao); - } - foreach (RestricaoUsuario restricoesTotalizacoesRelatoriosFiltrado in this.RestricoesTotalizacoesRelatoriosFiltrados) - { - restricoesTotalizacoesRelatoriosFiltrado.set_Restricao(restricao); - } - foreach (RestricaoUsuarioCamposRelatorios restricoesCamposRelatoriosFiltrado in this.RestricoesCamposRelatoriosFiltrados) - { - restricoesCamposRelatoriosFiltrado.set_Restricao(restricao); - } - foreach (RestricaoUsuario restricoesFinanceirosFiltrada in this.RestricoesFinanceirosFiltradas) - { - restricoesFinanceirosFiltrada.set_Restricao(restricao); - } - foreach (RestricaoUsuario restricoesFerramentasFiltrada in this.RestricoesFerramentasFiltradas) - { - restricoesFerramentasFiltrada.set_Restricao(restricao); - } - foreach (RestricaoUsuario restricoesAjudasFiltrado in this.RestricoesAjudasFiltrados) - { - restricoesAjudasFiltrado.set_Restricao(restricao); - } - this.RestricoesBisFiltradas = new ObservableCollection(this.RestricoesBisFiltradas); - this.RestricoesSegurosFiltradas = new ObservableCollection(this.RestricoesSegurosFiltradas); - this.RestricoesRelatoriosFiltrados = new ObservableCollection(this.RestricoesRelatoriosFiltrados); - this.RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection(this.RestricoesTotalizacoesRelatoriosFiltrados); - this.RestricoesCamposRelatoriosFiltrados = new ObservableCollection(this.RestricoesCamposRelatoriosFiltrados); - this.RestricoesFinanceirosFiltradas = new ObservableCollection(this.RestricoesFinanceirosFiltradas); - this.RestricoesFerramentasFiltradas = new ObservableCollection(this.RestricoesFerramentasFiltradas); - this.RestricoesAjudasFiltrados = new ObservableCollection(this.RestricoesAjudasFiltrados); - } - - public void AtivarDesativarRestricoes() - { - if (this.RestricoesBisFiltradas != null && this.RestricoesAjudasFiltrados != null && this.RestricoesSegurosFiltradas != null && this.RestricoesRelatoriosFiltrados != null && this.RestricoesFinanceirosFiltradas != null && this.RestricoesFerramentasFiltradas != null && this.RestricoesTotalizacoesRelatoriosFiltrados != null && this.RestricoesCamposRelatoriosFiltrados != null) - { - if (this.RestricoesBisFiltradas.All((RestricaoUsuario x) => x.get_Restricao())) - { - if (this.RestricoesAjudasFiltrados.All((RestricaoUsuario x) => x.get_Restricao())) - { - if (this.RestricoesSegurosFiltradas.All((RestricaoUsuario x) => x.get_Restricao())) - { - if (this.RestricoesRelatoriosFiltrados.All((RestricaoUsuario x) => x.get_Restricao())) - { - if (this.RestricoesFinanceirosFiltradas.All((RestricaoUsuario x) => x.get_Restricao())) - { - if (this.RestricoesFerramentasFiltradas.All((RestricaoUsuario x) => x.get_Restricao())) - { - if (this.RestricoesTotalizacoesRelatoriosFiltrados.All((RestricaoUsuario x) => x.get_Restricao())) - { - if (this.RestricoesCamposRelatoriosFiltrados.All((RestricaoUsuarioCamposRelatorios x) => x.get_Restricao())) - { - this.AtivarDesativarRestricoesBool = false; - } - } - } - } - } - } - } - } - } - } - - private async void CarregarModulos(Usuario usuario) - { - await this.Modulos(usuario); - this.Carregado = true; - } - - public bool CopiarPermissoes(Tuple, Usuario, List, List, List> copiarPermiss) - { - Gestor.Model.Common.PermissaoAggilizador permissaoAggilizador1; - if (copiarPermiss.Item1.Count <= 0) - { - this.Seguros.ToList().ForEach((PermissaoUsuario x) => { - x.set_Consultar(false); - x.set_Incluir(false); - x.set_Alterar(false); - x.set_Excluir(false); - x.set_Usuario(this._selectedUsuario); - }); - this.Ferramentas.ToList().ForEach((PermissaoUsuario x) => { - x.set_Consultar(false); - x.set_Incluir(false); - x.set_Alterar(false); - x.set_Excluir(false); - x.set_Usuario(this._selectedUsuario); - }); - } - else - { - copiarPermiss.Item1.ForEach((PermissaoUsuario x) => { - this.Seguros.ToList().ForEach((PermissaoUsuario y) => { - if (x.get_Tela() != y.get_Tela()) - { - return; - } - y.set_Consultar(x.get_Consultar()); - y.set_Incluir(x.get_Incluir()); - y.set_Alterar(x.get_Alterar()); - y.set_Excluir(x.get_Excluir()); - y.set_Usuario(this._selectedUsuario); - }); - this.Ferramentas.ToList().ForEach((PermissaoUsuario y) => { - if (x.get_Tela() != y.get_Tela()) - { - return; - } - y.set_Consultar(x.get_Consultar()); - y.set_Incluir(x.get_Incluir()); - y.set_Alterar(x.get_Alterar()); - y.set_Excluir(x.get_Excluir()); - y.set_Usuario(this._selectedUsuario); - }); - }); - } - if (copiarPermiss.Item4.Count <= 0) - { - this.ArquivosDigitais.ToList().ForEach((PermissaoArquivoDigital x) => { - x.set_Consultar(false); - x.set_Incluir(false); - x.set_Excluir(false); - x.set_Usuario(this._selectedUsuario); - }); - } - else - { - copiarPermiss.Item4.ForEach((PermissaoArquivoDigital x) => this.ArquivosDigitais.ToList().ForEach((PermissaoArquivoDigital y) => { - if (x.get_Tela() != y.get_Tela()) - { - return; - } - y.set_Consultar(x.get_Consultar()); - y.set_Incluir(x.get_Incluir()); - y.set_Excluir(x.get_Excluir()); - y.set_Usuario(this._selectedUsuario); - })); - } - if (copiarPermiss.Item2.get_PermissaoAggilizador().HasValue) - { - permissaoAggilizador1 = this.PermissaoAggilizador.FirstOrDefault((Gestor.Model.Common.PermissaoAggilizador x) => { - long id = x.get_Id(); - long? permissaoAggilizador = copiarPermiss.Item2.get_PermissaoAggilizador(); - return id == permissaoAggilizador.GetValueOrDefault() & permissaoAggilizador.HasValue; - }); - } - else - { - permissaoAggilizador1 = null; - } - this.SelectedPermissao = permissaoAggilizador1; - copiarPermiss.Item3.ForEach((RestricaoUsuario x) => { - foreach (RestricaoUsuario restricoesBi in this.RestricoesBis) - { - if (restricoesBi.get_Tipo() != x.get_Tipo()) - { - continue; - } - restricoesBi.set_Restricao(x.get_Restricao()); - restricoesBi.set_Usuario(this._selectedUsuario); - } - foreach (RestricaoUsuario restricoesSeguro in this.RestricoesSeguros) - { - if (restricoesSeguro.get_Tipo() != x.get_Tipo()) - { - continue; - } - restricoesSeguro.set_Restricao(x.get_Restricao()); - restricoesSeguro.set_Usuario(this._selectedUsuario); - } - foreach (RestricaoUsuario restricoesRelatorio in this.RestricoesRelatorios) - { - if (restricoesRelatorio.get_Tipo() != x.get_Tipo()) - { - continue; - } - restricoesRelatorio.set_Restricao(x.get_Restricao()); - restricoesRelatorio.set_Usuario(this._selectedUsuario); - } - foreach (RestricaoUsuario restricoesTotalizacoesRelatorio in this.RestricoesTotalizacoesRelatorios) - { - if (restricoesTotalizacoesRelatorio.get_Tipo() != x.get_Tipo()) - { - continue; - } - restricoesTotalizacoesRelatorio.set_Restricao(x.get_Restricao()); - restricoesTotalizacoesRelatorio.set_Usuario(this._selectedUsuario); - } - foreach (RestricaoUsuario restricoesFinanceiro in this.RestricoesFinanceiros) - { - if (restricoesFinanceiro.get_Tipo() != x.get_Tipo()) - { - continue; - } - restricoesFinanceiro.set_Restricao(x.get_Restricao()); - restricoesFinanceiro.set_Usuario(this._selectedUsuario); - } - foreach (RestricaoUsuario restricoesFerramenta in this.RestricoesFerramentas) - { - if (restricoesFerramenta.get_Tipo() != x.get_Tipo()) - { - continue; - } - restricoesFerramenta.set_Restricao(x.get_Restricao()); - restricoesFerramenta.set_Usuario(this._selectedUsuario); - } - foreach (RestricaoUsuario restricoesAjuda in this.RestricoesAjudas) - { - if (restricoesAjuda.get_Tipo() != x.get_Tipo()) - { - continue; - } - restricoesAjuda.set_Restricao(x.get_Restricao()); - restricoesAjuda.set_Usuario(this._selectedUsuario); - } - }); - copiarPermiss.Item5.ForEach((RestricaoUsuarioCamposRelatorios x) => { - foreach (RestricaoUsuarioCamposRelatorios restricoesCamposRelatorio in this.RestricoesCamposRelatorios) - { - if (!(restricoesCamposRelatorio.get_Campo() == x.get_Campo()) || restricoesCamposRelatorio.get_Relatorio() != x.get_Relatorio()) - { - continue; - } - restricoesCamposRelatorio.set_Restricao(x.get_Restricao()); - restricoesCamposRelatorio.set_Usuario(this._selectedUsuario); - } - }); - base.RegistrarAcao(string.Concat("IMPORTOU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"", copiarPermiss.Item2.get_Nome(), "\""), this.SelectedUsuario.get_Id(), new TipoTela?(43), string.Format("ID USUÁRIO: {0}", copiarPermiss.Item2.get_Id())); - return true; - } - - public void DesabilitarArquivoDigital(PermissaoArquivoDigital desabilitar) - { - PermissaoArquivoDigital permissaoArquivoDigital = this.ArquivosDigitais.First((PermissaoArquivoDigital x) => x.get_Tela() == desabilitar.get_Tela()); - if (!permissaoArquivoDigital.get_Incluir() && !permissaoArquivoDigital.get_Excluir()) - { - return; - } - permissaoArquivoDigital.set_Incluir(false); - permissaoArquivoDigital.set_Excluir(false); - this.ArquivosDigitais = new ObservableCollection(this.ArquivosDigitais); - } - - public void DesabilitarConsulta(PermissaoUsuario desabilitar, string source) - { - if (source != "Ferramentas") - { - PermissaoUsuario permissaoUsuario = this.Seguros.First((PermissaoUsuario x) => x.get_Tela() == desabilitar.get_Tela()); - if (!permissaoUsuario.get_Incluir() && !permissaoUsuario.get_Alterar() && !permissaoUsuario.get_Excluir()) - { - return; - } - permissaoUsuario.set_Alterar(false); - permissaoUsuario.set_Incluir(false); - permissaoUsuario.set_Excluir(false); - this.Seguros = new ObservableCollection(this.Seguros); - return; - } - PermissaoUsuario permissaoUsuario1 = this.Ferramentas.First((PermissaoUsuario x) => x.get_Tela() == desabilitar.get_Tela()); - if (!permissaoUsuario1.get_Incluir() && !permissaoUsuario1.get_Alterar() && !permissaoUsuario1.get_Excluir()) - { - return; - } - permissaoUsuario1.set_Alterar(false); - permissaoUsuario1.set_Incluir(false); - permissaoUsuario1.set_Excluir(false); - this.Ferramentas = new ObservableCollection(this.Ferramentas); - } - - public async Task ExportarPermissoes(List usuarios) - { - object obj; - List usuarios1 = usuarios; - foreach (Usuario usuario in - from x in usuarios1 - where x.get_Selecionado() - select x) - { - await this.Salvar(new long?(usuario.get_Id()), false); - } - PermissaoUsuarioViewModel permissaoUsuarioViewModel = this; - string nome = this.SelectedUsuario.get_Nome(); - object count = usuarios.Count; - obj = (usuarios.Count == 1 ? "" : "S"); - string str = string.Format("EXPORTOU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"{0}\" PARA {1} USUÁRIO{2}", nome, count, obj); - long id = this.SelectedUsuario.get_Id(); - TipoTela? nullable = new TipoTela?(43); - List usuarios2 = usuarios; - permissaoUsuarioViewModel.RegistrarAcao(str, id, nullable, string.Concat("IDS E NOMES DOS USUÁRIOS: ", string.Join("\n", - from x in usuarios2 - select string.Format("{0}: \"{1}\"", x.get_Id(), x.get_Nome())))); - return true; - } - - internal async Task> FiltrarRestricoesAjuda(string value) - { - List restricaoUsuarios = await Task.Run>(() => this.FiltrarRestricoesAjudas(value)); - return restricaoUsuarios; - } - - public List FiltrarRestricoesAjudas(string filter) - { - this.RestricoesAjudasFiltrados = (filter == "" ? new ObservableCollection(this.RestricoesAjudas) : new ObservableCollection( - from x in this.RestricoesAjudas - where ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Tipo()).Trim()).ToUpper().Contains(filter.ToUpper()) - select x)); - this.ExpandedAjudas = (this.RestricoesAjudasFiltrados.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesAjudasFiltrados.ToList(); - } - - internal async Task> FiltrarRestricoesBi(string value) - { - List restricaoUsuarios = await Task.Run>(() => this.FiltrarRestricoesBis(value)); - return restricaoUsuarios; - } - - public List FiltrarRestricoesBis(string filter) - { - this.RestricoesBisFiltradas = (filter == "" ? new ObservableCollection(this.RestricoesBis) : new ObservableCollection( - from x in this.RestricoesBis - where ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Tipo()).Trim()).ToUpper().Contains(filter.ToUpper()) - select x)); - this.ExpandedBis = (this.RestricoesBisFiltradas.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesBisFiltradas.ToList(); - } - - internal async Task> FiltrarRestricoesCamposRelatorio(string value) - { - List restricaoUsuarioCamposRelatorios = await Task.Run>(() => this.FiltrarRestricoesCamposRelatorios(value)); - return restricaoUsuarioCamposRelatorios; - } - - public List FiltrarRestricoesCamposRelatorios(string filter) - { - this.RestricoesCamposRelatoriosFiltrados = (filter == "" ? new ObservableCollection(this.RestricoesCamposRelatorios) : new ObservableCollection(this.RestricoesCamposRelatorios.Where((RestricaoUsuarioCamposRelatorios x) => { - if (ValidationHelper.RemoveDiacritics(x.get_Campo().ToUpper().Trim()).Contains(filter.ToUpper())) - { - return true; - } - return ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Relatorio()).Trim()).ToUpper().Contains(filter.ToUpper()); - }))); - this.ExpandedCampos = (this.RestricoesCamposRelatoriosFiltrados.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesCamposRelatoriosFiltrados.ToList(); - } - - internal async Task> FiltrarRestricoesFerramenta(string value) - { - List restricaoUsuarios = await Task.Run>(() => this.FiltrarRestricoesFerramentas(value)); - return restricaoUsuarios; - } - - public List FiltrarRestricoesFerramentas(string filter) - { - this.RestricoesFerramentasFiltradas = (filter == "" ? new ObservableCollection(this.RestricoesFerramentas) : new ObservableCollection( - from x in this.RestricoesFerramentas - where ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Tipo()).Trim()).ToUpper().Contains(filter.ToUpper()) - select x)); - this.ExpandedFerramentas = (this.RestricoesFerramentasFiltradas.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesFerramentasFiltradas.ToList(); - } - - internal async Task> FiltrarRestricoesFinanceiro(string value) - { - List restricaoUsuarios = await Task.Run>(() => this.FiltrarRestricoesFinanceiros(value)); - return restricaoUsuarios; - } - - public List FiltrarRestricoesFinanceiros(string filter) - { - this.RestricoesFinanceirosFiltradas = (filter == "" ? new ObservableCollection(this.RestricoesFinanceiros) : new ObservableCollection( - from x in this.RestricoesFinanceiros - where ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Tipo()).Trim()).ToUpper().Contains(filter.ToUpper()) - select x)); - this.ExpandedFinanceiros = (this.RestricoesFinanceirosFiltradas.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesFinanceirosFiltradas.ToList(); - } - - internal async Task> FiltrarRestricoesRelatorio(string value) - { - List restricaoUsuarios = await Task.Run>(() => this.FiltrarRestricoesRelatorios(value)); - return restricaoUsuarios; - } - - public List FiltrarRestricoesRelatorios(string filter) - { - this.RestricoesRelatoriosFiltrados = (filter == "" ? new ObservableCollection(this.RestricoesRelatorios) : new ObservableCollection( - from x in this.RestricoesRelatorios - where ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Tipo()).Trim()).ToUpper().Contains(filter.ToUpper()) - select x)); - this.ExpandedRelatorios = (this.RestricoesRelatoriosFiltrados.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesRelatoriosFiltrados.ToList(); - } - - internal async Task> FiltrarRestricoesSeguro(string value) - { - List restricaoUsuarios = await Task.Run>(() => this.FiltrarRestricoesSeguros(value)); - return restricaoUsuarios; - } - - public List FiltrarRestricoesSeguros(string filter) - { - this.RestricoesSegurosFiltradas = (filter == "" ? new ObservableCollection(this.RestricoesSeguros) : new ObservableCollection( - from x in this.RestricoesSeguros - where ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Tipo()).Trim()).ToUpper().Contains(filter.ToUpper()) - select x)); - this.ExpandedSeguros = (this.RestricoesSegurosFiltradas.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesSegurosFiltradas.ToList(); - } - - internal async Task> FiltrarRestricoesTotalizacoesRelatorio(string value) - { - List restricaoUsuarios = await Task.Run>(() => this.FiltrarRestricoesTotalizacoesRelatorios(value)); - return restricaoUsuarios; - } - - public List FiltrarRestricoesTotalizacoesRelatorios(string filter) - { - this.RestricoesTotalizacoesRelatoriosFiltrados = (filter == "" ? new ObservableCollection(this.RestricoesTotalizacoesRelatorios) : new ObservableCollection( - from x in this.RestricoesTotalizacoesRelatorios - where ValidationHelper.RemoveDiacritics(ValidationHelper.GetDescription(x.get_Tipo()).Trim()).ToUpper().Contains(filter.ToUpper()) - select x)); - this.ExpandedTotalizacoes = (this.RestricoesTotalizacoesRelatoriosFiltrados.Count <= 0 ? false : filter != ""); - if (filter == "") - { - return null; - } - return this.RestricoesTotalizacoesRelatoriosFiltrados.ToList(); - } - - private async Task> GetPermissoes(Usuario usuario, string modulo) - { - List permissaoUsuarios = new List(); - IEnumerable tipoTelas = Enum.GetValues(typeof(TipoTela)).Cast(); - IEnumerable str = - from v in tipoTelas - select v.ToString(); - List list = ( - from x in str - orderby x - select x).ToList(); - List permissaoUsuarios1 = await this.ServicoPermissUsuario.PermissUsuario(usuario); - list.ForEach((string x) => { - TipoTela tipoTela = (TipoTela)Enum.Parse(typeof(TipoTela), x); - if (!string.Equals(ValidationHelper.GetCategory(tipoTela), modulo, StringComparison.CurrentCultureIgnoreCase)) - { - return; - } - long id = (long)0; - bool consultar = true; - bool incluir = true; - bool alterar = true; - bool excluir = true; - if (permissaoUsuarios1.Count > 0 && permissaoUsuarios1.Any((PermissaoUsuario y) => y.get_Tela() == tipoTela)) - { - id = permissaoUsuarios1.First((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Id(); - consultar = permissaoUsuarios1.First((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Consultar(); - incluir = permissaoUsuarios1.First((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Incluir(); - alterar = permissaoUsuarios1.First((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Alterar(); - excluir = permissaoUsuarios1.First((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Excluir(); - } - PermissaoUsuario permissaoUsuario = new PermissaoUsuario(); - permissaoUsuario.set_Id(id); - permissaoUsuario.set_Tela(tipoTela); - permissaoUsuario.set_Consultar(consultar); - permissaoUsuario.set_Incluir(incluir); - permissaoUsuario.set_Alterar(alterar); - permissaoUsuario.set_Excluir(excluir); - permissaoUsuarios.Add(permissaoUsuario); - }); - List permissaoUsuarios2 = permissaoUsuarios; - list = null; - return permissaoUsuarios2; - } - - private async Task> GetPermissoesArquivoDigital(Usuario usuario) - { - List permissaoArquivoDigitals = new List(); - IEnumerable tipoArquivoDigitals = Enum.GetValues(typeof(TipoArquivoDigital)).Cast(); - IEnumerable str = - from v in tipoArquivoDigitals - select v.ToString(); - List list = ( - from x in str - orderby x - select x).ToList(); - List permissaoArquivoDigitals1 = await this.ServicoPermissArquivoDigital.PermissArquivoDigital(usuario); - list.ForEach((string x) => { - TipoArquivoDigital tipoArquivoDigital = (TipoArquivoDigital)Enum.Parse(typeof(TipoArquivoDigital), x); - long id = (long)0; - bool consultar = true; - bool incluir = true; - bool excluir = true; - if (permissaoArquivoDigitals1.Count > 0 && permissaoArquivoDigitals1.Any((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital)) - { - id = permissaoArquivoDigitals1.First((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital).get_Id(); - consultar = permissaoArquivoDigitals1.First((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital).get_Consultar(); - incluir = permissaoArquivoDigitals1.First((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital).get_Incluir(); - excluir = permissaoArquivoDigitals1.First((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital).get_Excluir(); - } - PermissaoArquivoDigital permissaoArquivoDigital = new PermissaoArquivoDigital(); - permissaoArquivoDigital.set_Id(id); - permissaoArquivoDigital.set_Tela(tipoArquivoDigital); - permissaoArquivoDigital.set_Consultar(consultar); - permissaoArquivoDigital.set_Incluir(incluir); - permissaoArquivoDigital.set_Excluir(excluir); - permissaoArquivoDigitals.Add(permissaoArquivoDigital); - }); - List permissaoArquivoDigitals2 = permissaoArquivoDigitals; - list = null; - return permissaoArquivoDigitals2; - } - - private async Task> GetRestricoes(Usuario usuario, string modulo) - { - List restricaoUsuarios = new List(); - IEnumerable tipoRestricaos = Enum.GetValues(typeof(TipoRestricao)).Cast(); - IEnumerable str = - from v in tipoRestricaos - select v.ToString(); - List list = ( - from x in str - orderby x - select x).ToList(); - List restricaoUsuarios1 = await this.ServicoRestriUsuario.BuscarRestricoes(usuario.get_Id()); - List restricaoUsuarios2 = restricaoUsuarios1; - list.ForEach((string x) => { - TipoRestricao tipoRestricao = (TipoRestricao)Enum.Parse(typeof(TipoRestricao), x); - if (!string.Equals(ValidationHelper.GetCategory(tipoRestricao), modulo, StringComparison.CurrentCultureIgnoreCase)) - { - return; - } - string help = ValidationHelper.GetHelp(tipoRestricao); - long id = (long)0; - bool restricao = false; - if (restricaoUsuarios2.Count > 0 && restricaoUsuarios2.Any((RestricaoUsuario y) => y.get_Tipo() == tipoRestricao)) - { - id = restricaoUsuarios2.First((RestricaoUsuario y) => y.get_Tipo() == tipoRestricao).get_Id(); - restricao = restricaoUsuarios2.First((RestricaoUsuario y) => y.get_Tipo() == tipoRestricao).get_Restricao(); - } - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id(id); - restricaoUsuario.set_Tipo(tipoRestricao); - restricaoUsuario.set_Restricao(restricao); - restricaoUsuario.set_Ajuda(help); - restricaoUsuarios.Add(restricaoUsuario); - }); - List restricaoUsuarios3 = restricaoUsuarios; - list = null; - return restricaoUsuarios3; - } - - private async Task> GetRestricoesCamposRelatorios(Usuario usuario) - { - List restricaoUsuarioCamposRelatorios = new List(); - List parametrosRelatorios = new List(); - foreach (Relatorio relatorio in Enum.GetValues(typeof(Relatorio)).Cast()) - { - switch (relatorio) - { - case 0: - case 1: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 2: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 3: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 4: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 5: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 6: - case 16: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 7: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 8: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 9: - case 10: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 11: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 12: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 13: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 14: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 15: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 17: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 18: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 19: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 20: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 23: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - case 27: - { - parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio(relatorio, new List())); - continue; - } - default: - { - continue; - } - } - } - List restricaoUsuarioCamposRelatorios1 = await this.ServicoRestriUsuario.BuscarRestricoesCamposRelatorios(usuario.get_Id()); - List restricaoUsuarioCamposRelatorios2 = restricaoUsuarioCamposRelatorios1; - parametrosRelatorios.ForEach((ParametrosRelatorio x) => { - long id = (long)0; - bool restricao = false; - if (restricaoUsuarioCamposRelatorios2.Count > 0 && restricaoUsuarioCamposRelatorios2.Any((RestricaoUsuarioCamposRelatorios y) => { - if (y.get_Campo() != x.get_Header()) - { - return false; - } - return y.get_Relatorio() == x.get_Relatorio(); - })) - { - id = restricaoUsuarioCamposRelatorios2.First((RestricaoUsuarioCamposRelatorios y) => { - if (y.get_Campo() != x.get_Header()) - { - return false; - } - return y.get_Relatorio() == x.get_Relatorio(); - }).get_Id(); - restricao = restricaoUsuarioCamposRelatorios2.First((RestricaoUsuarioCamposRelatorios y) => { - if (y.get_Campo() != x.get_Header()) - { - return false; - } - return y.get_Relatorio() == x.get_Relatorio(); - }).get_Restricao(); - } - RestricaoUsuarioCamposRelatorios restricaoUsuarioCamposRelatorio = new RestricaoUsuarioCamposRelatorios(); - restricaoUsuarioCamposRelatorio.set_Id(id); - restricaoUsuarioCamposRelatorio.set_Campo(x.get_Header()); - restricaoUsuarioCamposRelatorio.set_Relatorio(x.get_Relatorio()); - restricaoUsuarioCamposRelatorio.set_Restricao(restricao); - restricaoUsuarioCamposRelatorios.Add(restricaoUsuarioCamposRelatorio); - }); - List restricaoUsuarioCamposRelatorios3 = restricaoUsuarioCamposRelatorios; - parametrosRelatorios = null; - return restricaoUsuarioCamposRelatorios3; - } - - public void HabilitarArquivoDigital(PermissaoArquivoDigital habilitar) - { - PermissaoArquivoDigital permissaoArquivoDigital = this.ArquivosDigitais.First((PermissaoArquivoDigital x) => x.get_Tela() == habilitar.get_Tela()); - if (permissaoArquivoDigital.get_Consultar()) - { - return; - } - permissaoArquivoDigital.set_Consultar(true); - this.ArquivosDigitais = new ObservableCollection(this.ArquivosDigitais); - } - - public void HabilitarConsulta(PermissaoUsuario habilitar, string source) - { - if (source != "Ferramentas") - { - PermissaoUsuario permissaoUsuario = this.Seguros.First((PermissaoUsuario x) => x.get_Tela() == habilitar.get_Tela()); - if (permissaoUsuario.get_Consultar()) - { - return; - } - permissaoUsuario.set_Consultar(true); - this.Seguros = new ObservableCollection(this.Seguros); - return; - } - PermissaoUsuario permissaoUsuario1 = this.Ferramentas.First((PermissaoUsuario x) => x.get_Tela() == habilitar.get_Tela()); - if (permissaoUsuario1.get_Consultar()) - { - return; - } - permissaoUsuario1.set_Consultar(true); - this.Ferramentas = new ObservableCollection(this.Ferramentas); - } - - private async Task Modulos(Usuario usuario) - { - Gestor.Model.Common.PermissaoAggilizador permissaoAggilizador1; - Usuario usuario1 = usuario; - this.Carregando = true; - Usuario usuario2 = await this._servicoUsuario.BuscarUsuarioPorId(usuario1.get_Id()); - usuario1 = usuario2; - this.Seguros = new ObservableCollection(await this.GetPermissoes(usuario1, "seguros")); - this.Ferramentas = new ObservableCollection(await this.GetPermissoes(usuario1, "ferramentas")); - this.ArquivosDigitais = new ObservableCollection(await this.GetPermissoesArquivoDigital(usuario1)); - this.PermissaoAggilizador = new List((IEnumerable)await this._servicoUsuario.BuscarPermissaoAggilizador()); - this.RestricoesBis = await this.GetRestricoes(usuario1, "b.i."); - this.RestricoesBisFiltradas = new ObservableCollection(this.RestricoesBis); - this.RestricoesSeguros = await this.GetRestricoes(usuario1, "seguros"); - this.RestricoesSegurosFiltradas = new ObservableCollection(this.RestricoesSeguros); - this.RestricoesRelatorios = await this.GetRestricoes(usuario1, "relatorios"); - this.RestricoesRelatoriosFiltrados = new ObservableCollection(this.RestricoesRelatorios); - this.RestricoesFinanceiros = await this.GetRestricoes(usuario1, "financeiro"); - this.RestricoesFinanceirosFiltradas = new ObservableCollection(this.RestricoesFinanceiros); - this.RestricoesFerramentas = await this.GetRestricoes(usuario1, "ferramentas"); - this.RestricoesFerramentasFiltradas = new ObservableCollection(this.RestricoesFerramentas); - this.RestricoesAjudas = await this.GetRestricoes(usuario1, "ajuda"); - this.RestricoesAjudasFiltrados = new ObservableCollection(this.RestricoesAjudas); - this.RestricoesTotalizacoesRelatorios = await this.GetRestricoes(usuario1, "totalizacoesRelatorios"); - this.RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection(this.RestricoesTotalizacoesRelatorios); - this.RestricoesCamposRelatorios = await this.GetRestricoesCamposRelatorios(usuario1); - this.RestricoesCamposRelatoriosFiltrados = new ObservableCollection(this.RestricoesCamposRelatorios); - this.Carregando = false; - this.AdmUsuario = usuario1.get_Administrador(); - PermissaoUsuarioViewModel permissaoUsuarioViewModel = this; - if (!usuario1.get_PermissaoAggilizador().HasValue) - { - List permissaoAggilizadors = this.PermissaoAggilizador; - permissaoAggilizador1 = permissaoAggilizadors.FirstOrDefault((Gestor.Model.Common.PermissaoAggilizador x) => x.get_Id() == (long)2); - } - else - { - permissaoAggilizador1 = this.PermissaoAggilizador.FirstOrDefault((Gestor.Model.Common.PermissaoAggilizador x) => { - long id = x.get_Id(); - long? permissaoAggilizador = usuario1.get_PermissaoAggilizador(); - return id == permissaoAggilizador.GetValueOrDefault() & permissaoAggilizador.HasValue; - }); - } - permissaoUsuarioViewModel.SelectedPermissao = permissaoAggilizador1; - } - - public async Task Salvar(long? idUsuario = null, bool registrar = true) - { - bool flag; - bool alterar; - long num; - long id; - List permissaoUsuarios; - List restricaoUsuarioCamposRelatorios; - PermissaoUsuario permissaoUsuario1 = this.ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, 43); - if (permissaoUsuario1 != null) - { - alterar = !permissaoUsuario1.get_Alterar(); - } - else - { - alterar = false; - } - if (!alterar || Recursos.Usuario.get_Administrador()) - { - UsuarioServico usuarioServico = this._servicoUsuario; - long? nullable = idUsuario; - num = (nullable.HasValue ? nullable.GetValueOrDefault() : this._selectedUsuario.get_Id()); - Usuario usuario = await usuarioServico.BuscarUsuarioPorId(num); - List permissaoUsuarios1 = new List(); - List permissaoUsuarios2 = permissaoUsuarios1; - List permissoes = await this.GetPermissoes(usuario, "seguros"); - permissaoUsuarios2.AddRange(permissoes); - permissaoUsuarios2 = null; - permissaoUsuarios2 = permissaoUsuarios1; - permissoes = await this.GetPermissoes(usuario, "ferramentas"); - permissaoUsuarios2.AddRange(permissoes); - permissaoUsuarios2 = null; - List permissaoArquivoDigitals = new List(); - List permissaoArquivoDigitals1 = permissaoArquivoDigitals; - permissaoArquivoDigitals1.AddRange(await this.GetPermissoesArquivoDigital(usuario)); - permissaoArquivoDigitals1 = null; - List list = this.ArquivosDigitais.Select((PermissaoArquivoDigital x) => { - PermissaoArquivoDigital permissaoArquivoDigital = new PermissaoArquivoDigital(); - permissaoArquivoDigital.set_Id((permissaoArquivoDigitals.Count == 0 ? (long)0 : permissaoArquivoDigitals.First((PermissaoArquivoDigital y) => y.get_Tela() == x.get_Tela()).get_Id())); - permissaoArquivoDigital.set_Tela(x.get_Tela()); - permissaoArquivoDigital.set_Consultar(x.get_Consultar()); - permissaoArquivoDigital.set_Incluir(x.get_Incluir()); - permissaoArquivoDigital.set_Excluir(x.get_Excluir()); - permissaoArquivoDigital.set_Usuario(usuario); - return permissaoArquivoDigital; - }).ToList(); - permissaoUsuarios = new List(); - List list1 = this.Seguros.Select((PermissaoUsuario x) => { - PermissaoUsuario permissaoUsuario = new PermissaoUsuario(); - permissaoUsuario.set_Id((permissaoUsuarios1.Count == 0 ? (long)0 : permissaoUsuarios1.First((PermissaoUsuario y) => y.get_Tela() == x.get_Tela()).get_Id())); - permissaoUsuario.set_Tela(x.get_Tela()); - permissaoUsuario.set_Consultar(x.get_Consultar()); - permissaoUsuario.set_Incluir(x.get_Incluir()); - permissaoUsuario.set_Alterar(x.get_Alterar()); - permissaoUsuario.set_Excluir(x.get_Excluir()); - permissaoUsuario.set_Usuario(usuario); - return permissaoUsuario; - }).ToList(); - permissaoUsuarios.AddRange(list1); - list1 = this.Ferramentas.Select((PermissaoUsuario x) => { - PermissaoUsuario permissaoUsuario = new PermissaoUsuario(); - permissaoUsuario.set_Id((permissaoUsuarios1.Count == 0 ? (long)0 : permissaoUsuarios1.First((PermissaoUsuario y) => y.get_Tela() == x.get_Tela()).get_Id())); - permissaoUsuario.set_Tela(x.get_Tela()); - permissaoUsuario.set_Consultar(x.get_Consultar()); - permissaoUsuario.set_Incluir(x.get_Incluir()); - permissaoUsuario.set_Alterar(x.get_Alterar()); - permissaoUsuario.set_Excluir(x.get_Excluir()); - permissaoUsuario.set_Usuario(usuario); - return permissaoUsuario; - }).ToList(); - permissaoUsuarios.AddRange(list1); - Usuario usuario1 = usuario; - Gestor.Model.Common.PermissaoAggilizador selectedPermissao = this.SelectedPermissao; - if (selectedPermissao != null) - { - id = selectedPermissao.get_Id(); - } - else - { - id = (long)0; - } - usuario1.set_PermissaoAggilizador(new long?(id)); - usuario.set_Administrador(this.AdmUsuario); - await this.ServicoPermissArquivoDigital.SavePermiss(list, permissaoArquivoDigitals); - if (this.ServicoPermissArquivoDigital.Sucesso) - { - await this.ServicoPermissUsuario.SavePermiss(permissaoUsuarios, permissaoUsuarios1); - if (this.ServicoPermissUsuario.Sucesso) - { - await this._servicoUsuario.Save(usuario); - if (this._servicoUsuario.Sucesso) - { - if (Recursos.Usuario.get_Id() == this._selectedUsuario.get_Id()) - { - Recursos.Usuario = usuario; - } - List restricaoUsuarios = new List(); - List restricaoUsuarios1 = restricaoUsuarios; - List restricoes = await this.GetRestricoes(usuario, "b.i."); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - restricaoUsuarios1 = restricaoUsuarios; - restricoes = await this.GetRestricoes(usuario, "seguros"); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - restricaoUsuarios1 = restricaoUsuarios; - restricoes = await this.GetRestricoes(usuario, "relatorios"); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - restricaoUsuarios1 = restricaoUsuarios; - restricoes = await this.GetRestricoes(usuario, "financeiro"); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - restricaoUsuarios1 = restricaoUsuarios; - restricoes = await this.GetRestricoes(usuario, "ferramentas"); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - restricaoUsuarios1 = restricaoUsuarios; - restricoes = await this.GetRestricoes(usuario, "ajuda"); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - restricaoUsuarios1 = restricaoUsuarios; - restricoes = await this.GetRestricoes(usuario, "totalizacoesRelatorios"); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - restricaoUsuarios1 = restricaoUsuarios; - restricoes = await this.GetRestricoes(usuario, "camposRelatorios"); - restricaoUsuarios1.AddRange(restricoes); - restricaoUsuarios1 = null; - List restricaoUsuarioCamposRelatorios1 = new List(); - List restricaoUsuarioCamposRelatorios2 = restricaoUsuarioCamposRelatorios1; - restricaoUsuarioCamposRelatorios2.AddRange(await this.GetRestricoesCamposRelatorios(usuario)); - restricaoUsuarioCamposRelatorios2 = null; - List restricaoUsuarios2 = new List(); - restricaoUsuarioCamposRelatorios = new List(); - List list2 = this.RestricoesBis.Select((RestricaoUsuario x) => { - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First((RestricaoUsuario y) => y.get_Tipo() == x.get_Tipo()).get_Id())); - restricaoUsuario.set_Tipo(x.get_Tipo()); - restricaoUsuario.set_Restricao(x.get_Restricao()); - restricaoUsuario.set_Usuario(usuario); - return restricaoUsuario; - }).ToList(); - restricaoUsuarios2.AddRange(list2); - list2 = this.RestricoesSeguros.Select((RestricaoUsuario x) => { - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First((RestricaoUsuario y) => y.get_Tipo() == x.get_Tipo()).get_Id())); - restricaoUsuario.set_Tipo(x.get_Tipo()); - restricaoUsuario.set_Restricao(x.get_Restricao()); - restricaoUsuario.set_Usuario(usuario); - return restricaoUsuario; - }).ToList(); - restricaoUsuarios2.AddRange(list2); - list2 = this.RestricoesRelatorios.Select((RestricaoUsuario x) => { - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First((RestricaoUsuario y) => y.get_Tipo() == x.get_Tipo()).get_Id())); - restricaoUsuario.set_Tipo(x.get_Tipo()); - restricaoUsuario.set_Restricao(x.get_Restricao()); - restricaoUsuario.set_Usuario(usuario); - return restricaoUsuario; - }).ToList(); - restricaoUsuarios2.AddRange(list2); - list2 = this.RestricoesTotalizacoesRelatorios.Select((RestricaoUsuario x) => { - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First((RestricaoUsuario y) => y.get_Tipo() == x.get_Tipo()).get_Id())); - restricaoUsuario.set_Tipo(x.get_Tipo()); - restricaoUsuario.set_Restricao(x.get_Restricao()); - restricaoUsuario.set_Usuario(usuario); - return restricaoUsuario; - }).ToList(); - restricaoUsuarios2.AddRange(list2); - list2 = this.RestricoesFinanceiros.Select((RestricaoUsuario x) => { - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First((RestricaoUsuario y) => y.get_Tipo() == x.get_Tipo()).get_Id())); - restricaoUsuario.set_Tipo(x.get_Tipo()); - restricaoUsuario.set_Restricao(x.get_Restricao()); - restricaoUsuario.set_Usuario(usuario); - return restricaoUsuario; - }).ToList(); - restricaoUsuarios2.AddRange(list2); - list2 = this.RestricoesFerramentas.Select((RestricaoUsuario x) => { - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First((RestricaoUsuario y) => y.get_Tipo() == x.get_Tipo()).get_Id())); - restricaoUsuario.set_Tipo(x.get_Tipo()); - restricaoUsuario.set_Restricao(x.get_Restricao()); - restricaoUsuario.set_Usuario(usuario); - return restricaoUsuario; - }).ToList(); - restricaoUsuarios2.AddRange(list2); - list2 = this.RestricoesAjudas.Select((RestricaoUsuario x) => { - RestricaoUsuario restricaoUsuario = new RestricaoUsuario(); - restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First((RestricaoUsuario y) => y.get_Tipo() == x.get_Tipo()).get_Id())); - restricaoUsuario.set_Tipo(x.get_Tipo()); - restricaoUsuario.set_Restricao(x.get_Restricao()); - restricaoUsuario.set_Usuario(usuario); - return restricaoUsuario; - }).ToList(); - restricaoUsuarios2.AddRange(list2); - List list3 = this.RestricoesCamposRelatorios.Select((RestricaoUsuarioCamposRelatorios x) => { - RestricaoUsuarioCamposRelatorios restricaoUsuarioCamposRelatorio = new RestricaoUsuarioCamposRelatorios(); - restricaoUsuarioCamposRelatorio.set_Id((restricaoUsuarioCamposRelatorios1.Count == 0 ? (long)0 : restricaoUsuarioCamposRelatorios1.First((RestricaoUsuarioCamposRelatorios y) => { - if (y.get_Campo() != x.get_Campo()) - { - return false; - } - return y.get_Relatorio() == x.get_Relatorio(); - }).get_Id())); - restricaoUsuarioCamposRelatorio.set_Campo(x.get_Campo()); - restricaoUsuarioCamposRelatorio.set_Restricao(x.get_Restricao()); - restricaoUsuarioCamposRelatorio.set_Relatorio(x.get_Relatorio()); - restricaoUsuarioCamposRelatorio.set_Usuario(usuario); - return restricaoUsuarioCamposRelatorio; - }).ToList(); - restricaoUsuarioCamposRelatorios.AddRange(list3); - await this.ServicoRestriUsuario.SaveRestri(restricaoUsuarios2, restricaoUsuarios); - if (this.ServicoRestriUsuario.Sucesso) - { - await this.ServicoRestriUsuario.SaveRestriCamposRelatorios(restricaoUsuarioCamposRelatorios, restricaoUsuarioCamposRelatorios1); - if (this.ServicoRestriUsuario.Sucesso) - { - if (registrar) - { - base.RegistrarAcao(string.Concat("ALTEROU PERMISSÕES/RESTRIÇÕES DO USUÁRIO \"", this.SelectedUsuario.get_Nome(), "\""), this.SelectedUsuario.get_Id(), new TipoTela?(43), "ACESSE O LOG DE ALTERAÇÕES NA TELA DE PERMISSÕES/RESTRIÇÕES PARA VER EXATAMENTE O QUE FOI ALTERADO."); - } - flag = true; - } - else - { - flag = false; - } - } - else - { - flag = false; - } - } - else - { - flag = false; - } - } - else - { - flag = false; - } - } - else - { - flag = false; - } - } - else - { - await base.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA ALTERAR PERMISSÕES!", "OK", "", false); - flag = false; - } - permissaoUsuarios = null; - restricaoUsuarioCamposRelatorios = null; - return flag; - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/TarefaDrawerViewModel.cs b/Gestor.Application/ViewModels/Drawer/TarefaDrawerViewModel.cs deleted file mode 100644 index 6a68199..0000000 --- a/Gestor.Application/ViewModels/Drawer/TarefaDrawerViewModel.cs +++ /dev/null @@ -1,1283 +0,0 @@ -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.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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class TarefaDrawerViewModel : BaseTarefaViewModel - { - private bool _enableMenu = true; - - private GridLength _dados = new GridLength(0, GridUnitType.Pixel); - - private GridLength _grid = new GridLength(1, GridUnitType.Star); - - private GridLength _anotacoesLength = new GridLength(0, GridUnitType.Pixel); - - private GridLength _descricaoLength = new GridLength(1, GridUnitType.Star); - - private GridLength _anotacoesInternasLength = new GridLength(0, GridUnitType.Pixel); - - private GridLength _descricaoInternaLength = new GridLength(1, GridUnitType.Star); - - 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 Gestor.Model.Domain.Ferramentas.Tarefa _tarefa = new Gestor.Model.Domain.Ferramentas.Tarefa(); - - private ObservableCollection _tarefasFiltradas = new ObservableCollection(); - - private List _tarefas = new List(); - - private bool _isAnotacoes = true; - - private Gestor.Model.Domain.Ferramentas.Tarefa _selectedTarefa; - - private ObservableCollection _usuarios; - - private ObservableCollection _tiposTarefa; - - private List _telefones; - - private DateTime _dataAgendamento = Funcoes.GetNetworkTime(); - - private DateTime _horaAgendamento = Funcoes.GetNetworkTime(); - - private Usuario _selectedUsuario; - - private TipoDeTarefa _selectedTipoTarefa; - - private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital(); - - private ObservableCollection _arquivosAnexados = new ObservableCollection(); - - private List _arquivosFinais = new List(); - - private bool _inclusaoArquivoDigitalEnable = true; - - public GridLength AnotacoesInternasLength - { - get - { - return this._anotacoesInternasLength; - } - set - { - this._anotacoesInternasLength = value; - base.OnPropertyChanged("AnotacoesInternasLength"); - } - } - - public GridLength AnotacoesLength - { - get - { - return this._anotacoesLength; - } - set - { - this._anotacoesLength = value; - base.OnPropertyChanged("AnotacoesLength"); - } - } - - public ObservableCollection ArquivosAnexados - { - get - { - return this._arquivosAnexados; - } - set - { - this._arquivosAnexados = value; - base.OnPropertyChanged("ArquivosAnexados"); - } - } - - public List ArquivosFinais - { - get - { - return this._arquivosFinais; - } - set - { - this._arquivosFinais = value; - base.OnPropertyChanged("ArquivosFinais"); - } - } - - public bool Carregando - { - get - { - return this._carregando; - } - set - { - this._carregando = value; - base.IsEnabled = !value; - base.OnPropertyChanged("Carregando"); - } - } - - public bool Concluido - { - get - { - return this._concluido; - } - set - { - this._concluido = value; - base.OnPropertyChanged("Concluido"); - } - } - - public GridLength Dados - { - get - { - return this._dados; - } - set - { - this._dados = value; - base.OnPropertyChanged("Dados"); - } - } - - public DateTime DataAgendamento - { - get - { - return this._dataAgendamento; - } - set - { - this._dataAgendamento = value; - if (this.SelectedTarefa != null) - { - this.SelectedTarefa.set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", value, this.SelectedTarefa.get_Agendamento()))); - } - base.OnPropertyChanged("DataAgendamento"); - } - } - - public GridLength DescricaoInternaLength - { - get - { - return this._descricaoInternaLength; - } - set - { - this._descricaoInternaLength = value; - base.OnPropertyChanged("DescricaoInternaLength"); - } - } - - public GridLength DescricaoLength - { - get - { - return this._descricaoLength; - } - set - { - this._descricaoLength = value; - base.OnPropertyChanged("DescricaoLength"); - } - } - - public override bool EnableAlterarTarefa - { - get - { - return this._enableAlterarTarefa; - } - set - { - this._enableAlterarTarefa = this._alterarPermissEnabled & value; - base.OnPropertyChanged("EnableAlterarTarefa"); - } - } - - public GridLength Grid - { - get - { - return this._grid; - } - set - { - this._grid = value; - base.OnPropertyChanged("Grid"); - } - } - - public DateTime HoraAgendamento - { - get - { - return this._horaAgendamento; - } - set - { - this._horaAgendamento = value; - if (this.SelectedTarefa != null) - { - this.SelectedTarefa.set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", this.SelectedTarefa.get_Agendamento(), value))); - } - base.OnPropertyChanged("HoraAgendamento"); - } - } - - public long IdCliente - { - get; - set; - } - - public bool InclusaoArquivoDigitalEnable - { - get - { - return this._inclusaoArquivoDigitalEnable; - } - set - { - this._inclusaoArquivoDigitalEnable = value; - base.OnPropertyChanged("InclusaoArquivoDigitalEnable"); - } - } - - private int Index { get; set; } = 1; - - public bool IsAnotacoes - { - get - { - return this._isAnotacoes; - } - set - { - this._isAnotacoes = value; - base.OnPropertyChanged("IsAnotacoes"); - } - } - - public bool IsSelected - { - get - { - return this._isSelected; - } - set - { - this._isSelected = value; - base.OnPropertyChanged("IsSelected"); - } - } - - public bool IsVisibleDescricao - { - get - { - return this._isVisibleDescricao; - } - set - { - this._isVisibleDescricao = value; - base.OnPropertyChanged("IsVisibleDescricao"); - } - } - - public Gestor.Model.Domain.Common.ArquivoDigital SelectedAnexado - { - get - { - return this._selectedAnexado; - } - set - { - this._selectedAnexado = value; - base.OnPropertyChanged("SelectedAnexado"); - } - } - - public override Gestor.Model.Domain.Ferramentas.Tarefa SelectedTarefa - { - get - { - return this._selectedTarefa; - } - set - { - DateTime agendamento; - DateTime dateTime; - bool status; - ObservableCollection observableCollection; - bool tipoDeTarefa; - TipoDeTarefa tipoDeTarefa1; - long? nullable; - bool usuario; - ObservableCollection observableCollection1; - DateTime networkTime = Funcoes.GetNetworkTime(); - this.IsSelected = value != null; - this._selectedTarefa = value; - Gestor.Model.Domain.Ferramentas.Tarefa tarefa = value; - if (tarefa != null) - { - agendamento = tarefa.get_Agendamento(); - } - else - { - agendamento = networkTime; - } - this.DataAgendamento = agendamento; - Gestor.Model.Domain.Ferramentas.Tarefa tarefa1 = value; - if (tarefa1 != null) - { - dateTime = tarefa1.get_Agendamento(); - } - else - { - dateTime = networkTime; - } - this.HoraAgendamento = dateTime; - this.IsVisibleDescricao = value != null; - Gestor.Model.Domain.Ferramentas.Tarefa tarefa2 = value; - if (tarefa2 != null) - { - status = tarefa2.get_Status() == 2; - } - else - { - status = false; - } - this.Concluido = status; - if (value == null) - { - observableCollection = new ObservableCollection(); - } - else - { - observableCollection = (value.get_Responsaveis() == null ? new ObservableCollection() : new ObservableCollection(value.get_Responsaveis())); - } - base.Responsaveis = observableCollection; - if (!base.Responsaveis.Any()) - { - Gestor.Model.Domain.Ferramentas.Tarefa tarefa3 = value; - if (tarefa3 != null) - { - usuario = tarefa3.get_Usuario(); - } - else - { - usuario = false; - } - if (!usuario) - { - observableCollection1 = new ObservableCollection(); - } - else - { - ResponsavelTarefa[] responsavelTarefaArray = new ResponsavelTarefa[1]; - ResponsavelTarefa responsavelTarefa = new ResponsavelTarefa(); - responsavelTarefa.set_Usuario(value.get_Usuario()); - responsavelTarefaArray[0] = responsavelTarefa; - observableCollection1 = new ObservableCollection(responsavelTarefaArray); - } - base.Responsaveis = observableCollection1; - } - if (value != null && value.get_Id() > (long)0) - { - this.AlterarTamanho(false); - } - if (value != null) - { - this.AnotacoesLength = new GridLength(0, GridUnitType.Pixel); - this.AnotacoesInternasLength = new GridLength(0, GridUnitType.Pixel); - this.DescricaoLength = (string.IsNullOrWhiteSpace(value.get_Descricao()) ? new GridLength(0, GridUnitType.Pixel) : new GridLength(1, GridUnitType.Star)); - this.DescricaoInternaLength = (string.IsNullOrWhiteSpace(value.get_DescricaoInterna()) ? new GridLength(0, GridUnitType.Pixel) : new GridLength(1, GridUnitType.Star)); - } - Gestor.Model.Domain.Ferramentas.Tarefa tarefa4 = value; - if (tarefa4 != null) - { - tipoDeTarefa = tarefa4.get_TipoDeTarefa(); - } - else - { - tipoDeTarefa = false; - } - if (tipoDeTarefa) - { - if (!this.TiposTarefa.All((TipoDeTarefa x) => x.get_Id() != value.get_Id()) || value.get_TipoDeTarefa().get_Ativo()) - { - this.TiposTarefa = new ObservableCollection(( - from x in this.TiposTarefa - where x.get_Ativo() - select x).ToList()); - } - else - { - this.TiposTarefa.Add(value.get_TipoDeTarefa()); - } - } - Gestor.Model.Domain.Ferramentas.Tarefa tarefa5 = value; - if (tarefa5 != null) - { - tipoDeTarefa1 = tarefa5.get_TipoDeTarefa(); - } - else - { - tipoDeTarefa1 = null; - } - this.SelectedTipoTarefa = tipoDeTarefa1; - if (base.EnableIncluir || base.EnableFields || base.EnableButtons) - { - Gestor.Model.Domain.Ferramentas.Tarefa tarefa6 = value; - if (tarefa6 != null) - { - nullable = new long?(tarefa6.get_Id()); - } - else - { - nullable = null; - } - base.VerificarEnables(nullable); - } - base.ValidaPermissaoParaEditarTarefa(); - base.OnPropertyChanged("SelectedTarefa"); - } - } - - public TipoDeTarefa SelectedTipoTarefa - { - get - { - return this._selectedTipoTarefa; - } - set - { - this._selectedTipoTarefa = value; - base.OnPropertyChanged("SelectedTipoTarefa"); - } - } - - public Usuario SelectedUsuario - { - get - { - return this._selectedUsuario; - } - set - { - this._selectedUsuario = value; - base.OnPropertyChanged("SelectedUsuario"); - } - } - - private new TarefaServico Servico - { - get; - } - - public string SubTitulo - { - get - { - return this._subTitulo; - } - set - { - this._subTitulo = value; - base.OnPropertyChanged("SubTitulo"); - } - } - - public Gestor.Model.Domain.Ferramentas.Tarefa Tarefa - { - get - { - return this._tarefa; - } - set - { - this._tarefa = value; - base.OnPropertyChanged("Tarefa"); - } - } - - public List Tarefas - { - get - { - return this._tarefas; - } - set - { - this._tarefas = value; - base.OnPropertyChanged("Tarefas"); - } - } - - public ObservableCollection TarefasFiltradas - { - get - { - return this._tarefasFiltradas; - } - set - { - this._tarefasFiltradas = value; - base.OnPropertyChanged("TarefasFiltradas"); - } - } - - public List Telefones - { - get - { - return this._telefones; - } - set - { - this._telefones = value; - base.OnPropertyChanged("Telefones"); - } - } - - public ObservableCollection TiposTarefa - { - get - { - return this._tiposTarefa; - } - set - { - this._tiposTarefa = value; - base.OnPropertyChanged("TiposTarefa"); - } - } - - public string Titulo - { - get - { - return this._titulo; - } - set - { - this._titulo = value; - base.OnPropertyChanged("Titulo"); - } - } - - public string TituloTarefas - { - get - { - return this._tituloTarefas; - } - set - { - this._tituloTarefas = value; - base.OnPropertyChanged("TituloTarefas"); - } - } - - public ObservableCollection Usuarios - { - get - { - return this._usuarios; - } - set - { - this._usuarios = value; - base.OnPropertyChanged("Usuarios"); - } - } - - public Visibility VisibilityMenu - { - get - { - return this._visibilityMenu; - } - set - { - this._visibilityMenu = value; - base.OnPropertyChanged("VisibilityMenu"); - } - } - - public TarefaDrawerViewModel(Gestor.Model.Domain.Ferramentas.Tarefa tarefa, bool enableMenu) - { - this.Servico = new TarefaServico(); - this.Tarefa = tarefa; - this._enableMenu = enableMenu; - this.CarregarUsuarios(); - this.TiposTarefa = new ObservableCollection(( - from x in Recursos.TiposTarefa - where x.get_Ativo() - select x).ToList()); - DateTime? conclusao = tarefa.get_Conclusao(); - this.SelecionarTarefas(tarefa, new bool?(conclusao.HasValue)); - this.TituloTarefas = (tarefa.get_Conclusao().HasValue ? "TAREFAS CONCLUÍDAS" : "TAREFAS PENDENTES"); - base.EnableMenu = true; - } - - public void AdcionarResponsavel() - { - if (this.SelectedUsuario == null) - { - return; - } - ObservableCollection responsaveis = base.Responsaveis; - ResponsavelTarefa responsavelTarefa = new ResponsavelTarefa(); - responsavelTarefa.set_Usuario(this.SelectedUsuario); - responsavelTarefa.set_IdTarefa(this.SelectedTarefa.get_Id()); - responsaveis.Add(responsavelTarefa); - this.Usuarios.Remove(this.SelectedUsuario); - this.SelectedUsuario = null; - } - - public void AlterarTamanho(bool alterar) - { - if (!alterar) - { - if (this.TituloTarefas.Contains("TODAS")) - { - this.TituloTarefas = "TODAS TAREFAS DO CLIENTE"; - } - else if (this.TituloTarefas.Contains("PENDENTES")) - { - this.TituloTarefas = "TAREFAS PENDENTES"; - } - else if (this.TituloTarefas.Contains("CONCLUÍDAS")) - { - this.TituloTarefas = "TAREFAS CONCLUÍDAS"; - } - } - this.Grid = (alterar ? new GridLength(0, GridUnitType.Star) : new GridLength(1, GridUnitType.Star)); - this.Dados = (alterar ? new GridLength(1, GridUnitType.Star) : new GridLength(360, GridUnitType.Pixel)); - } - - public void AlterarTarefa() - { - string descricao; - string descricaoInterna; - this.CarregarUsuarios(); - if (this.SelectedTarefa == null) - { - return; - } - this.EnableAlterarTarefa = false; - this.AlterarTamanho(true); - this.TituloTarefas = string.Concat(this.TituloTarefas, " (ALTERANDO \"", this.SelectedTarefa.get_Titulo(), "\")"); - base.Alterar(true); - this.AnotacoesLength = new GridLength(1, GridUnitType.Star); - this.AnotacoesInternasLength = new GridLength(1, GridUnitType.Star); - Gestor.Model.Domain.Ferramentas.Tarefa selectedTarefa = this.SelectedTarefa; - if (selectedTarefa != null) - { - descricao = selectedTarefa.get_Descricao(); - } - else - { - descricao = null; - } - this.DescricaoLength = (string.IsNullOrWhiteSpace(descricao) ? new GridLength(0, GridUnitType.Pixel) : new GridLength(1, GridUnitType.Star)); - Gestor.Model.Domain.Ferramentas.Tarefa tarefa = this.SelectedTarefa; - if (tarefa != null) - { - descricaoInterna = tarefa.get_DescricaoInterna(); - } - else - { - descricaoInterna = null; - } - this.DescricaoInternaLength = (string.IsNullOrWhiteSpace(descricaoInterna) ? new GridLength(0, GridUnitType.Pixel) : new GridLength(1, GridUnitType.Star)); - this.TarefasFiltradas = new ObservableCollection() - { - this.SelectedTarefa - }; - base.ListaUsuariosResponsaveis(); - base.Responsaveis.ToList().ForEach((ResponsavelTarefa x) => this.Usuarios.Remove(x.get_Usuario())); - } - - public async void Anexar() - { - this.InclusaoArquivoDigitalEnable = false; - List arquivoDigitals = await base.AddAttachments(this.ArquivosAnexados.ToList(), new List()); - await Task.Run(async () => { - await Task.Delay(200); - this.InclusaoArquivoDigitalEnable = true; - }); - if (arquivoDigitals != null) - { - arquivoDigitals.AddRange(this.ArquivosAnexados); - this.ArquivosAnexados = new ObservableCollection(arquivoDigitals); - } - arquivoDigitals = null; - } - - public async Task Cancelar() - { - long id; - this.CarregarUsuarios(); - this.AlterarTamanho(false); - Gestor.Model.Domain.Ferramentas.Tarefa selectedTarefa = this.SelectedTarefa; - if (selectedTarefa != null) - { - id = selectedTarefa.get_Id(); - } - else - { - id = (long)0; - } - long num = id; - await this.CarregarTarefas(this.Index); - base.Alterar(false); - await base.ValidaPermissaoParaEditarTarefa(); - if (num != 0) - { - this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault((Gestor.Model.Domain.Ferramentas.Tarefa x) => x.get_Id() == num); - } - } - - public async void CarregarInformacoes(Gestor.Model.Domain.Ferramentas.Tarefa tarefa) - { - string str; - string str1; - ClienteServico clienteServico = new ClienteServico(); - TarefaDrawerViewModel tarefaDrawerViewModel = this; - str = (tarefa.get_IdEntidade() != 0 ? "TODAS AS TAREFAS PENDENTES DO CLIENTE" : ""); - tarefaDrawerViewModel.SubTitulo = str; - this.IdCliente = tarefa.get_IdCliente(); - this.Titulo = tarefa.get_Cliente(); - ObservableCollection observableCollection = await clienteServico.BuscarTelefonesAsync(tarefa.get_IdCliente()); - TarefaDrawerViewModel list = this; - ObservableCollection observableCollection1 = observableCollection; - IEnumerable clienteTelefones = - from x in observableCollection1 - where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero()) - select x; - list.Telefones = clienteTelefones.Select((ClienteTelefone x) => { - TelefoneBase telefoneBase = new TelefoneBase(); - telefoneBase.set_Tipo(x.get_Tipo()); - telefoneBase.set_Id(x.get_Id()); - telefoneBase.set_Numero(x.get_Numero()); - telefoneBase.set_Prefixo(x.get_Prefixo()); - return telefoneBase; - }).ToList(); - if (tarefa.get_IdEntidade() != 0) - { - TipoTarefa entidade = tarefa.get_Entidade(); - if (entidade == null) - { - Documento documento = await (new ApoliceServico()).BuscarApoliceAsync(tarefa.get_IdEntidade(), false, false); - this.IdCliente = documento.get_Controle().get_Cliente().get_Id(); - this.Titulo = documento.get_Controle().get_Cliente().get_Nome(); - TarefaDrawerViewModel tarefaDrawerViewModel1 = this; - if (documento.get_Tipo() != 0 || string.IsNullOrWhiteSpace(documento.get_Apolice())) - { - str1 = (documento.get_Tipo() > 0 ? string.Concat("APÓLICE NÚMERO ", documento.get_Apolice(), " ENDOSSO ", documento.get_Endosso()) : string.Concat("PROPOSTA NÚMERO ", documento.get_Proposta())); - } - else - { - str1 = string.Concat("APÓLICE NÚMERO ", documento.get_Apolice()); - } - tarefaDrawerViewModel1.SubTitulo = str1; - observableCollection = await clienteServico.BuscarTelefonesAsync(documento.get_Controle().get_Cliente().get_Id()); - TarefaDrawerViewModel list1 = this; - ObservableCollection observableCollection2 = observableCollection; - IEnumerable clienteTelefones1 = - from x in observableCollection2 - where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero()) - select x; - list1.Telefones = clienteTelefones1.Select((ClienteTelefone x) => { - TelefoneBase telefoneBase = new TelefoneBase(); - telefoneBase.set_Tipo(x.get_Tipo()); - telefoneBase.set_Id(x.get_Id()); - telefoneBase.set_Numero(x.get_Numero()); - telefoneBase.set_Prefixo(x.get_Prefixo()); - return telefoneBase; - }).ToList(); - } - else if (entidade == 4) - { - Sinistro sinistro = await (new SinistroServico()).BuscarSinistro(tarefa.get_IdEntidade()); - if (sinistro != null) - { - this.IdCliente = sinistro.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente().get_Id(); - this.Titulo = sinistro.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente().get_Nome(); - this.SubTitulo = string.Concat("SINISTRO ", sinistro.get_Numero(), " ITEM ", sinistro.get_ItemSinistrado()); - observableCollection = await clienteServico.BuscarTelefonesAsync(this.IdCliente); - TarefaDrawerViewModel list2 = this; - ObservableCollection observableCollection3 = observableCollection; - IEnumerable clienteTelefones2 = - from x in observableCollection3 - where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero()) - select x; - list2.Telefones = clienteTelefones2.Select((ClienteTelefone x) => { - TelefoneBase telefoneBase = new TelefoneBase(); - telefoneBase.set_Tipo(x.get_Tipo()); - telefoneBase.set_Id(x.get_Id()); - telefoneBase.set_Numero(x.get_Numero()); - telefoneBase.set_Prefixo(x.get_Prefixo()); - return telefoneBase; - }).ToList(); - } - else - { - clienteServico = null; - return; - } - } - } - clienteServico = null; - } - - public async Task CarregarTarefas(int index) - { - List tarefas; - Gestor.Model.Domain.Ferramentas.Tarefa tarefa; - if (this.Tarefa.get_IdEntidade() != 0) - { - this.Carregando = true; - Gestor.Model.Domain.Ferramentas.Tarefa tarefa1 = new Gestor.Model.Domain.Ferramentas.Tarefa(); - tarefa1.set_Cliente(this.Tarefa.get_Cliente()); - tarefa1.set_IdCliente(this.Tarefa.get_IdCliente()); - tarefa1.set_Entidade(this.Tarefa.get_Entidade()); - tarefa1.set_IdEntidade(this.Tarefa.get_IdEntidade()); - Gestor.Model.Domain.Ferramentas.Tarefa tarefa2 = tarefa1; - this.Index = index; - int num = index; - if (num == 1) - { - this.CarregarInformacoes(tarefa2); - tarefas = await this.Servico.BuscarTarefas(this.Tarefa.get_Entidade(), this.Tarefa.get_IdEntidade(), new bool?(false)); - } - else if (num == 2) - { - tarefa2.set_Entidade(2); - this.CarregarInformacoes(tarefa2); - tarefas = await this.Servico.BuscarTarefasCliente(this.Tarefa.get_IdCliente()); - } - else - { - this.CarregarInformacoes(tarefa2); - tarefas = await this.Servico.BuscarTarefas(this.Tarefa.get_Entidade(), this.Tarefa.get_IdEntidade(), new bool?(true)); - } - TarefaDrawerViewModel list = this; - List tarefas1 = tarefas; - list.Tarefas = ( - from x in tarefas1 - orderby x.get_Agendamento() descending - select x).ToList(); - this.TarefasFiltradas = new ObservableCollection(this.Tarefas); - TarefaDrawerViewModel tarefaDrawerViewModel = this; - if (this.TarefasFiltradas == null || this.TarefasFiltradas.Count == 0) - { - tarefa = null; - } - else - { - tarefa = (tarefa2.get_Id() != 0 ? this.TarefasFiltradas.FirstOrDefault((Gestor.Model.Domain.Ferramentas.Tarefa x) => x.get_Id() == tarefa2.get_Id()) : this.TarefasFiltradas.First()); - } - tarefaDrawerViewModel.SelectedTarefa = tarefa; - this.Carregando = false; - } - } - - public async Task CarregarTarefas(Gestor.Model.Domain.Ferramentas.Tarefa tarefa, bool? concluido) - { - Gestor.Model.Domain.Ferramentas.Tarefa tarefa1; - this.Carregando = true; - if (tarefa.get_IdEntidade() != 0) - { - List tarefas = await this.Servico.BuscarTarefas(tarefa.get_Entidade(), tarefa.get_IdEntidade(), concluido); - TarefaDrawerViewModel list = this; - List tarefas1 = tarefas; - list.Tarefas = ( - from x in tarefas1 - orderby x.get_Agendamento() - select x).ToList(); - this.TarefasFiltradas = new ObservableCollection(this.Tarefas); - TarefaDrawerViewModel tarefaDrawerViewModel = this; - if (this.TarefasFiltradas == null || this.TarefasFiltradas.Count == 0) - { - tarefa1 = null; - } - else - { - tarefa1 = (tarefa.get_Id() != 0 ? this.TarefasFiltradas.FirstOrDefault((Gestor.Model.Domain.Ferramentas.Tarefa x) => x.get_Id() == tarefa.get_Id()) : this.TarefasFiltradas.First()); - } - tarefaDrawerViewModel.SelectedTarefa = tarefa1; - } - else if (tarefa.get_Id() > (long)0) - { - this.SelectedTarefa = await this.Servico.BuscarTarefa(tarefa.get_Id()); - } - this.Carregando = false; - } - - private void CarregarUsuarios() - { - this.Usuarios = new ObservableCollection(Recursos.Usuarios.Where((Usuario x) => { - if (!Recursos.Configuracoes.Any((ConfiguracaoSistema c) => c.get_Configuracao() == 36) && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa() || x.get_Excluido()) - { - return false; - } - long? permissaoAggilizador = x.get_PermissaoAggilizador(); - long num = (long)4; - return !(permissaoAggilizador.GetValueOrDefault() == num & permissaoAggilizador.HasValue); - }).OrderBy((Usuario x) => x.get_Nome()).ToList()); - } - - public void Delete(Gestor.Model.Domain.Common.ArquivoDigital arquivo) - { - if (this.SelectedAnexado == null) - { - return; - } - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = this.ArquivosAnexados.First((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao()); - this.ArquivosAnexados.Remove(arquivoDigital); - this.ArquivosAnexados = new ObservableCollection(this.ArquivosAnexados); - } - - public async void Editar(IndiceArquivoDigital arquivo) - { - if (arquivo != null && arquivo.get_IdArquivoDigital() != 0) - { - await this.ArquivoDigitalServico.Save(arquivo); - } - } - - public async Task Excluir(Gestor.Model.Domain.Ferramentas.Tarefa item) - { - bool flag; - string titulo; - if (this.VisibilityMenu != Visibility.Collapsed) - { - string[] strArrays = new string[] { "DESEJA REALMENTE EXCLUIR A TAREFA ", item.get_Titulo(), "?", Environment.NewLine, "ESSE PROCEDIMENTO É IRREVERSÍVEL" }; - if (await base.ShowMessage(string.Concat(strArrays), "SIM", "NÃO", false)) - { - titulo = item.get_Titulo(); - long id = item.get_Id(); - if (await this.Servico.Excluir(item.get_Id())) - { - base.RegistrarAcao("EXCLUIU TAREFA", item.get_Id(), new TipoTela?(38), string.Format("TAREFA \"{0}\", ID: {1}", titulo, id)); - await this.CarregarTarefas(this.Index); - base.Alterar(false); - flag = true; - } - else - { - base.Alterar(false); - flag = true; - } - } - else - { - flag = false; - } - } - else - { - await base.ShowMessage("NÃO É POSSÍVEL EXCLUIR TAREFA PELO RELATÓRIO!", "OK", "", false); - flag = false; - } - titulo = null; - return flag; - } - - public string GerarHtml() - { - string nome; - string str = " TAREFA
"; - str = string.Concat(str, "
"); - str = string.Concat(str, "

"); - str = string.Concat(str, "TAREFA


"); - str = string.Concat(str, ""); - int num = 0; - string[] cliente = new string[] { str, ""; - str = string.Concat(cliente); - string[] referencia = new string[] { str, ""; - str = string.Concat(referencia); - string[] titulo = new string[] { str, ""; - str = string.Concat(titulo); - string[] strArrays = new string[] { str, ""; - str = string.Concat(strArrays); - string[] nome1 = new string[] { str, ""; - str = string.Concat(nome1); - string[] description = new string[] { str, ""; - str = string.Concat(description); - string[] strArrays1 = new string[] { str, ""; - str = string.Concat(strArrays1); - str = string.Concat(str, "

CLIENTE: "; - cliente[4] = this.SelectedTarefa.get_Cliente(); - cliente[5] = "

REFERÊNCIA: "; - referencia[4] = this.SelectedTarefa.get_Referencia(); - referencia[5] = "

TÍTULO: "; - titulo[4] = this.SelectedTarefa.get_Titulo(); - titulo[5] = "

AGENDAMENTO: "; - DateTime agendamento = this.SelectedTarefa.get_Agendamento(); - strArrays[4] = agendamento.ToString(); - strArrays[5] = "

RESPONSÁVEL PRINCIPAL: "; - nome1[4] = this.SelectedTarefa.get_Usuario().get_Nome(); - nome1[5] = "

STATUS: "; - description[4] = Gestor.Common.Validation.ValidationHelper.GetDescription(this.SelectedTarefa.get_Status()); - description[5] = "

TIPO DE TAREFA: "; - TipoDeTarefa selectedTipoTarefa = this.SelectedTipoTarefa; - if (selectedTipoTarefa != null) - { - nome = selectedTipoTarefa.get_Nome(); - } - else - { - nome = null; - } - strArrays1[4] = nome; - strArrays1[5] = "

"); - if (base.Responsaveis != null && base.Responsaveis.Count > 0) - { - str = string.Concat(str, "

RESPONSÁVEIS VINCULADOS

"); - str = string.Concat(str, "
"); - str = string.Concat(str, ""); - List strs = new List(); - foreach (ResponsavelTarefa responsavei in base.Responsaveis) - { - strs.Add(responsavei.get_Usuario().get_Nome().Trim().ToUpper()); - } - str = string.Concat(str, ""); - str = string.Concat(str, "

", string.Join(", ", strs), "

"); - str = string.Concat(str, "

"); - } - str = string.Concat(str, "

"); - if (this.SelectedTarefa.get_Descricao() != null) - { - str = string.Concat(str, "

ANOTAÇÕES

"); - str = string.Concat(str, "
"); - str = string.Concat(str, ""); - str = string.Concat(str, ""); - str = string.Concat(str, "

", this.SelectedTarefa.get_Descricao().Replace("", "").Replace("", ""), "

"); - str = string.Concat(str, "

"); - } - str = string.Concat(str, "
"); - return str; - } - - public async Task Incluir() - { - TarefaDrawerViewModel observableCollection = this; - observableCollection.CarregarUsuarios(); - observableCollection.Responsaveis = new ObservableCollection(); - TarefaDrawerViewModel tarefaDrawerViewModel = observableCollection; - Gestor.Model.Domain.Ferramentas.Tarefa tarefa = new Gestor.Model.Domain.Ferramentas.Tarefa(); - tarefa.set_IdCliente(observableCollection.IdCliente); - tarefa.set_Cliente(observableCollection.Titulo); - tarefa.set_Referencia(observableCollection.SubTitulo); - tarefa.set_Entidade(observableCollection.Tarefa.get_Entidade()); - tarefa.set_IdEntidade(observableCollection.Tarefa.get_IdEntidade()); - tarefa.set_Trilha(observableCollection.Tarefa.get_Trilha()); - tarefa.set_Status(0); - tarefa.set_Agendamento(Funcoes.GetNetworkTime().AddHours(1)); - tarefa.set_UsuarioCadastro(Recursos.Usuario); - ObservableCollection usuarios = observableCollection.Usuarios; - tarefa.set_Usuario(usuarios.FirstOrDefault((Usuario x) => x.get_Id() == Recursos.Usuario.get_Id())); - tarefa.set_Restrito(new bool?(false)); - tarefa.set_Responsaveis(observableCollection.Responsaveis.ToList()); - tarefaDrawerViewModel.SelectedTarefa = tarefa; - observableCollection.ArquivosFinais = new List(); - observableCollection.AlterarTamanho(true); - observableCollection.TituloTarefas = string.Concat(observableCollection.TituloTarefas, " (INCLUINDO)"); - observableCollection.Alterar(true); - observableCollection.AnotacoesLength = new GridLength(1, GridUnitType.Star); - observableCollection.AnotacoesInternasLength = new GridLength(1, GridUnitType.Star); - observableCollection.DescricaoLength = new GridLength(0, GridUnitType.Pixel); - observableCollection.DescricaoInternaLength = new GridLength(0, GridUnitType.Pixel); - observableCollection.EnableAlterarTarefa = false; - } - - public void LimparAnexos() - { - this.ArquivosAnexados = new ObservableCollection(); - } - - public void Print() - { - string str = this.GerarHtml(); - string tempPath = Path.GetTempPath(); - string str1 = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, (TipoTela)38, Funcoes.GetNetworkTime()); - StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8); - streamWriter.Write(str); - streamWriter.Close(); - Process.Start(str1); - base.RegistrarAcao("IMPRIMIU A TAREFA", this.SelectedTarefa.get_Id(), new TipoTela?(38), string.Format("TAREFA \"{0}\", ID: {1}", this.SelectedTarefa.get_Titulo(), this.SelectedTarefa.get_Id())); - } - - public async Task>> Salvar(string anotacoes, string anotacoesInternas) - { - List> keyValuePairs; - Usuario usuario; - DateTime networkTime = Funcoes.GetNetworkTime(); - List configuracoes = Recursos.Configuracoes; - if (configuracoes.All((ConfiguracaoSistema x) => x.get_Configuracao() != 45) && this.SelectedTarefa.get_Status() != 2 && this.SelectedTarefa.get_Agendamento() < networkTime) - { - this.SelectedTarefa.set_Agendamento(networkTime); - } - if (this.SelectedTarefa.get_Status() == 2) - { - this.SelectedTarefa.set_Conclusao(new DateTime?(networkTime)); - } - if (this.SelectedTarefa.get_Status() == null) - { - this.SelectedTarefa.set_Conclusao(null); - } - this.SelectedTarefa.set_Responsaveis(base.Responsaveis.ToList()); - Gestor.Model.Domain.Ferramentas.Tarefa selectedTarefa = this.SelectedTarefa; - ResponsavelTarefa responsavelTarefa = base.Responsaveis.FirstOrDefault(); - if (responsavelTarefa != null) - { - usuario = responsavelTarefa.get_Usuario(); - } - else - { - usuario = null; - } - selectedTarefa.set_Usuario(usuario); - Gestor.Model.Domain.Ferramentas.Tarefa tarefa = this.SelectedTarefa; - List configuracaoSistemas = Recursos.Configuracoes; - tarefa.set_AgendamentoRetroativo(configuracaoSistemas.Any((ConfiguracaoSistema x) => x.get_Configuracao() == 45)); - List> keyValuePairs1 = this.SelectedTarefa.Validate(); - if (this.SelectedTarefa.get_Descricao() == null && string.IsNullOrWhiteSpace(anotacoes) && string.IsNullOrWhiteSpace(anotacoesInternas)) - { - keyValuePairs1.Add(new KeyValuePair("ANOTAÇÕES", "OBRIGATÓRIO")); - } - if (keyValuePairs1.Count <= 0) - { - if (!string.IsNullOrWhiteSpace(anotacoes)) - { - this.SelectedTarefa.set_Anotacoes(Funcoes.AdicionarLog(this.SelectedTarefa.get_Anotacoes())); - this.SelectedTarefa.set_Descricao(string.Concat(this.SelectedTarefa.get_Anotacoes(), "

", this.SelectedTarefa.get_Descricao(), "

")); - } - if (!string.IsNullOrWhiteSpace(anotacoesInternas)) - { - this.SelectedTarefa.set_AnotacoesInternas(Funcoes.AdicionarLog(this.SelectedTarefa.get_AnotacoesInternas())); - this.SelectedTarefa.set_DescricaoInterna(string.Concat(this.SelectedTarefa.get_AnotacoesInternas(), "

", this.SelectedTarefa.get_DescricaoInterna(), "

")); - } - this.SelectedTarefa.set_TipoDeTarefa(this.SelectedTipoTarefa); - bool id = this.SelectedTarefa.get_Id() == (long)0; - this.SelectedTarefa = await this.Servico.Salvar(this.SelectedTarefa); - string str = (id ? "INCLUIU" : "ALTEROU"); - base.RegistrarAcao(string.Concat(str, " TAREFA"), this.SelectedTarefa.get_Id(), new TipoTela?(38), string.Format("TAREFA \"{0}\", ID: {1}", this.SelectedTarefa.get_Titulo(), this.SelectedTarefa.get_Id())); - if (id) - { - foreach (Gestor.Model.Domain.Common.ArquivoDigital arquivosFinai in this.ArquivosFinais) - { - arquivosFinai.set_IdTarefa(this.SelectedTarefa.get_Id()); - } - await this.ArquivoDigitalServico.Insert(this.ArquivosFinais); - } - if (this.Servico.Sucesso) - { - long num = this.SelectedTarefa.get_Id(); - await this.CarregarTarefas(this.Index); - this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault((Gestor.Model.Domain.Ferramentas.Tarefa x) => x.get_Id() == num); - keyValuePairs = null; - } - else - { - keyValuePairs = null; - } - } - else - { - keyValuePairs = keyValuePairs1; - } - return keyValuePairs; - } - - public void SalvarAnexos() - { - this.ArquivosFinais = this.ArquivosAnexados.ToList(); - } - - public async void SelecionarTarefas(Gestor.Model.Domain.Ferramentas.Tarefa tarefa, bool? concluido) - { - await base.PermissaoTela(38); - this.CarregarInformacoes(tarefa); - await this.CarregarTarefas(tarefa, concluido); - if (tarefa.get_Id() != 0 && !this._enableMenu) - { - this.VisibilityMenu = Visibility.Collapsed; - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs b/Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs deleted file mode 100644 index df49b81..0000000 --- a/Gestor.Application/ViewModels/Drawer/ValoresApoliceViewModel.cs +++ /dev/null @@ -1,345 +0,0 @@ -using Gestor.Application.ViewModels.Generic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Seguros; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Windows; - -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 _pagamentos; - - public string ApoliceDescricao - { - get - { - return this._apoliceDescricao; - } - set - { - this._apoliceDescricao = value; - base.OnPropertyChanged("ApoliceDescricao"); - } - } - - public string ApoliceLabel - { - get - { - return this._apoliceLabel; - } - set - { - this._apoliceLabel = value; - base.OnPropertyChanged("ApoliceLabel"); - } - } - - public Visibility IsVisibleEspecial - { - get - { - return this._isVisibleEspecial; - } - set - { - this._isVisibleEspecial = value; - base.OnPropertyChanged("IsVisibleEspecial"); - } - } - - public Visibility IsVisibleVendedores - { - get - { - return this._isVisibleVendedores; - } - set - { - this._isVisibleVendedores = value; - base.OnPropertyChanged("IsVisibleVendedores"); - } - } - - public decimal Paga - { - get - { - return this._paga; - } - set - { - this._paga = value; - base.OnPropertyChanged("Paga"); - } - } - - public decimal PagaEspecial - { - get - { - return this._pagaEspecial; - } - set - { - this._pagaEspecial = value; - base.OnPropertyChanged("PagaEspecial"); - } - } - - public ObservableCollection Pagamentos - { - get - { - return this._pagamentos; - } - set - { - this._pagamentos = value; - base.OnPropertyChanged("Pagamentos"); - } - } - - public decimal Pendente - { - get - { - return this._pendente; - } - set - { - this._pendente = value; - base.OnPropertyChanged("Pendente"); - } - } - - public decimal Prevista - { - get - { - return this._prevista; - } - set - { - this._prevista = value; - base.OnPropertyChanged("Prevista"); - } - } - - public decimal Recebida - { - get - { - return this._recebida; - } - set - { - this._recebida = value; - base.OnPropertyChanged("Recebida"); - } - } - - public decimal RecebidaEspecial - { - get - { - return this._recebidaEspecial; - } - set - { - this._recebidaEspecial = value; - base.OnPropertyChanged("RecebidaEspecial"); - } - } - - public decimal Repasse - { - get - { - return this._repasse; - } - set - { - this._repasse = value; - base.OnPropertyChanged("Repasse"); - } - } - - public decimal RepasseEspecial - { - get - { - return this._repasseEspecial; - } - set - { - this._repasseEspecial = value; - base.OnPropertyChanged("RepasseEspecial"); - } - } - - public Documento SelectedDocumento - { - get - { - return this._selectedDocumento; - } - set - { - this._selectedDocumento = value; - base.OnPropertyChanged("SelectedDocumento"); - } - } - - public ValoresApoliceViewModel(Documento documento) - { - base.EnableMenu = true; - this.Seleciona(documento); - } - - private void CalculaComissao() - { - if (this.SelectedDocumento.get_TipoRecebimento().GetValueOrDefault() != 1) - { - this.Prevista = ( - from x in this.SelectedDocumento.get_Parcelas() - where x.get_SubTipo() == 1 - select x).Sum((Parcela x) => x.get_ValorLiquidoFatura() * (x.get_Comissao() < decimal.One ? x.get_Comissao() : (x.get_Comissao() > new decimal(100) ? decimal.One : x.get_Comissao() * new decimal(1, 0, 0, false, 2)))); - } - else - { - decimal num = (this.SelectedDocumento.get_AdicionalComiss() ? this.SelectedDocumento.get_PremioLiquido() + this.SelectedDocumento.get_PremioAdicional() : this.SelectedDocumento.get_PremioLiquido()); - decimal comissao = this.SelectedDocumento.get_Comissao() * new decimal(1, 0, 0, false, 2); - this.Prevista = num * comissao; - } - this.Recebida = ( - from x in this.SelectedDocumento.get_Parcelas() - where x.get_SubTipo() == 1 - select x).Sum((Parcela x) => x.get_ValorComissao()); - this.Pendente = this.Prevista - this.Recebida; - this.Repasse = ( - from x in this.SelectedDocumento.get_Pagamentos() - where x.get_Parcela().get_SubTipo() == 1 - select x).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - this.Paga = this.SelectedDocumento.get_Pagamentos().Where((VendedorParcela x) => { - if (x.get_Parcela().get_SubTipo() != 1) - { - return false; - } - return x.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - } - - private void CalculaEspecial() - { - if (this.SelectedDocumento.get_Parcelas().All((Parcela x) => x.get_SubTipo() == 1)) - { - this.IsVisibleEspecial = Visibility.Collapsed; - return; - } - this.RecebidaEspecial = ( - from x in this.SelectedDocumento.get_Parcelas() - where x.get_SubTipo() != 1 - select x).Sum((Parcela x) => x.get_ValorComissao()); - this.RepasseEspecial = ( - from x in this.SelectedDocumento.get_Pagamentos() - where x.get_Parcela().get_SubTipo() != 1 - select x).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - this.PagaEspecial = this.SelectedDocumento.get_Pagamentos().Where((VendedorParcela x) => { - if (x.get_Parcela().get_SubTipo() == 1) - { - return false; - } - return x.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - } - - private void CalculaRepasse() - { - if (this.SelectedDocumento.get_Pagamentos().All((VendedorParcela x) => x.get_Vendedor().get_Corretora())) - { - this.IsVisibleVendedores = Visibility.Collapsed; - return; - } - List list = ( - from x in this.SelectedDocumento.get_Pagamentos() - where !x.get_Vendedor().get_Corretora() - group x by x.get_Vendedor().get_Id()).Select, VendedorParcela>((IGrouping x) => { - VendedorParcela vendedorParcela = new VendedorParcela(); - vendedorParcela.set_Repasse(x.First().get_Repasse()); - vendedorParcela.set_Documento(this.SelectedDocumento); - vendedorParcela.set_ValorTotal(x.First().get_ValorTotal()); - vendedorParcela.set_Vendedor(x.First().get_Vendedor()); - vendedorParcela.set_ValorTotalPago(x.Where((VendedorParcela y) => { - if (y.get_Parcela().get_SubTipo() != 1) - { - return false; - } - return y.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela y) => y.get_ValorRepasse())); - vendedorParcela.set_ValorRepasseB(( - from y in x - where y.get_Parcela().get_SubTipo() != 1 - select y).Sum((VendedorParcela y) => y.get_ValorRepasse())); - vendedorParcela.set_ValorRepasse(x.Where((VendedorParcela y) => { - if (y.get_Parcela().get_SubTipo() == 1) - { - return false; - } - return y.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela y) => y.get_ValorRepasse())); - decimal? porcentagemRepasse = x.First().get_PorcentagemRepasse(); - vendedorParcela.set_PorcentagemRepasse((porcentagemRepasse.HasValue ? new decimal?(porcentagemRepasse.GetValueOrDefault() / 100) : null)); - vendedorParcela.set_TipoVendedor(x.First().get_TipoVendedor()); - return vendedorParcela; - }).ToList(); - this.Pagamentos = new ObservableCollection(list); - } - - public void Seleciona(Documento documento) - { - this.SelectedDocumento = documento; - if (this.SelectedDocumento.get_Tipo() != 1) - { - this.ApoliceLabel = (!this.SelectedDocumento.get_Emissao().HasValue ? string.Concat("VALORES DA PROPOSTA ", this.SelectedDocumento.get_Proposta()) : string.Concat("VALORES DA APÓLICE ", this.SelectedDocumento.get_Apolice())); - this.ApoliceDescricao = (!this.SelectedDocumento.get_Emissao().HasValue ? string.Concat("VALORES BASEADOS NA PROPOSTA ", this.SelectedDocumento.get_Proposta(), " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.") : string.Concat("VALORES BASEADOS NA APÓLICE ", this.SelectedDocumento.get_Apolice(), " ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.")); - } - this.CalculaComissao(); - this.CalculaEspecial(); - this.CalculaRepasse(); - base.RegistrarAcao(string.Format("CONSULTOU MAIS INFORMAÇÕES DOS VALORES DO DOCUMENTO DE ID {0}", documento.get_Id()), documento.get_Id(), new TipoTela?(21), null); - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/ValoresParcelaViewModel.cs b/Gestor.Application/ViewModels/Drawer/ValoresParcelaViewModel.cs deleted file mode 100644 index 867e88d..0000000 --- a/Gestor.Application/ViewModels/Drawer/ValoresParcelaViewModel.cs +++ /dev/null @@ -1,583 +0,0 @@ -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; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; - -namespace Gestor.Application.ViewModels.Drawer -{ - public class ValoresParcelaViewModel : BaseSegurosViewModel - { - private ParcelaPendente _pendecia; - - private Visibility _isVisiblePendencia = Visibility.Collapsed; - - 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.Collapsed; - - private ObservableCollection _pagamentos; - - public string ApoliceDescricao - { - get - { - return this._apoliceDescricao; - } - set - { - this._apoliceDescricao = value; - base.OnPropertyChanged("ApoliceDescricao"); - } - } - - public string ApoliceLabel - { - get - { - return this._apoliceLabel; - } - set - { - this._apoliceLabel = value; - base.OnPropertyChanged("ApoliceLabel"); - } - } - - public decimal Ir - { - get - { - return this._ir; - } - set - { - this._ir = value; - base.OnPropertyChanged("Ir"); - } - } - - public decimal Iss - { - get - { - return this._iss; - } - set - { - this._iss = value; - base.OnPropertyChanged("Iss"); - } - } - - public Visibility IsVisibleFatura - { - get - { - return this._isVisibleFatura; - } - set - { - this._isVisibleFatura = value; - base.OnPropertyChanged("IsVisibleFatura"); - } - } - - public Visibility IsVisiblePendencia - { - get - { - return this._isVisiblePendencia; - } - set - { - this._isVisiblePendencia = value; - base.OnPropertyChanged("IsVisiblePendencia"); - } - } - - public Visibility IsVisibleStatusParc - { - get - { - return this._isVisiblestatusparc; - } - set - { - this._isVisiblestatusparc = value; - base.OnPropertyChanged("IsVisibleStatusParc"); - } - } - - public Visibility IsVisibleVendedores - { - get - { - return this._isVisibleVendedores; - } - set - { - this._isVisibleVendedores = value; - base.OnPropertyChanged("IsVisibleVendedores"); - } - } - - public decimal Paga - { - get - { - return this._paga; - } - set - { - this._paga = value; - base.OnPropertyChanged("Paga"); - } - } - - public decimal PagaEspecial - { - get - { - return this._pagaEspecial; - } - set - { - this._pagaEspecial = value; - base.OnPropertyChanged("PagaEspecial"); - } - } - - public ObservableCollection Pagamentos - { - get - { - return this._pagamentos; - } - set - { - this._pagamentos = value; - base.OnPropertyChanged("Pagamentos"); - } - } - - public ParcelaPendente Pendecia - { - get - { - return this._pendecia; - } - set - { - this._pendecia = value; - this.IsVisiblePendencia = (value == null ? Visibility.Collapsed : Visibility.Visible); - base.OnPropertyChanged("Pendecia"); - } - } - - public decimal Pendente - { - get - { - return this._pendente; - } - set - { - if (value >= new decimal(1, 0, 0, false, 2)) - { - this._pendente = value; - } - else - { - this._pendente = new decimal(); - } - base.OnPropertyChanged("Pendente"); - } - } - - public decimal Prevista - { - get - { - return this._prevista; - } - set - { - this._prevista = value; - base.OnPropertyChanged("Prevista"); - } - } - - public decimal Recebida - { - get - { - return this._recebida; - } - set - { - this._recebida = value; - base.OnPropertyChanged("Recebida"); - } - } - - public decimal RecebidaEspecial - { - get - { - return this._recebidaEspecial; - } - set - { - this._recebidaEspecial = value; - base.OnPropertyChanged("RecebidaEspecial"); - } - } - - public decimal RecebidaLiquida - { - get - { - return this._recebidaLiquida; - } - set - { - this._recebidaLiquida = value; - base.OnPropertyChanged("RecebidaLiquida"); - } - } - - public decimal Repasse - { - get - { - return this._repasse; - } - set - { - this._repasse = value; - base.OnPropertyChanged("Repasse"); - } - } - - public decimal RepasseEspecial - { - get - { - return this._repasseEspecial; - } - set - { - this._repasseEspecial = value; - base.OnPropertyChanged("RepasseEspecial"); - } - } - - public string RepassePago - { - get - { - return this._repassePago; - } - set - { - this._repassePago = value; - base.OnPropertyChanged("RepassePago"); - } - } - - public Parcela SelectedParcela - { - get - { - return this._selectedParcela; - } - set - { - this._selectedParcela = value; - base.OnPropertyChanged("SelectedParcela"); - } - } - - public string StatusBaixa - { - get - { - return this._statusBaixa; - } - set - { - this._statusBaixa = value; - base.OnPropertyChanged("StatusBaixa"); - } - } - - public string StatusParc - { - get - { - return this._statusParc; - } - set - { - this._statusParc = value; - base.OnPropertyChanged("StatusParc"); - } - } - - public ValoresParcelaViewModel(Parcela parcela, Documento documento) - { - this.Seleciona(parcela, documento); - } - - private async void BuscarPendencia() - { - this.Pendecia = await (new BaseServico()).BuscarParcelaPendente(this.SelectedParcela.get_IdParcelaPendente()); - } - - private void CalculaComissao(Documento documento) - { - decimal valor; - if (this.SelectedParcela.get_SubTipo() != 1) - { - valor = this.SelectedParcela.get_Valor(); - } - else if (documento.get_NumeroParcelas() == decimal.Zero) - { - valor = decimal.Zero; - } - else - { - valor = (documento.get_AdicionalComiss() ? (documento.get_PremioLiquido() + documento.get_PremioAdicional()) / documento.get_NumeroParcelas() : documento.get_PremioLiquido() / documento.get_NumeroParcelas()); - } - decimal num = valor; - this.Prevista = (this.SelectedParcela.get_ValorLiquidoFatura() != decimal.Zero ? (this.SelectedParcela.get_ValorLiquidoFatura() * this.SelectedParcela.get_Comissao()) * new decimal(1, 0, 0, false, 2) : (num * this.SelectedParcela.get_Comissao()) * new decimal(1, 0, 0, false, 2)); - this.Recebida = this.SelectedParcela.get_ValorComissao(); - this.Pendente = this.Prevista - this.Recebida; - this.Repasse = this.SelectedParcela.get_Vendedores().Where((VendedorParcela x) => { - if (this.SelectedParcela.get_SubTipo() == 1) - { - return x.get_Parcela().get_SubTipo() == 1; - } - return x.get_Parcela().get_SubTipo() != 1; - }).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - this.Paga = this.SelectedParcela.get_Vendedores().Where((VendedorParcela x) => { - if (this.SelectedParcela.get_SubTipo() == 1) - { - return x.get_Parcela().get_SubTipo() == 1; - } - if (x.get_Parcela().get_SubTipo() == 1) - { - return false; - } - return x.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault()); - this.Ir = this.SelectedParcela.get_Irr(); - this.Iss = this.SelectedParcela.get_Iss(); - this.RecebidaLiquida = this.SelectedParcela.get_ValorComDesconto(); - } - - private void CalculaRepasse() - { - if (this.SelectedParcela.get_Vendedores().All((VendedorParcela x) => x.get_Vendedor().get_Corretora())) - { - this.IsVisibleVendedores = Visibility.Collapsed; - return; - } - List list = ( - from x in this.SelectedParcela.get_Vendedores() - where !x.get_Vendedor().get_Corretora() - group x by x.get_Vendedor().get_Id()).Select, VendedorParcela>((IGrouping x) => { - VendedorParcela vendedorParcela = new VendedorParcela(); - vendedorParcela.set_Repasse(x.First().get_Repasse()); - vendedorParcela.set_Documento(this.SelectedParcela.get_Documento()); - vendedorParcela.set_ValorTotal(x.First().get_ValorTotal()); - vendedorParcela.set_Vendedor(x.First().get_Vendedor()); - vendedorParcela.set_ValorTotalPago(x.Where((VendedorParcela y) => { - if (y.get_Parcela().get_SubTipo() != 1) - { - return false; - } - return y.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela y) => y.get_ValorRepasse())); - vendedorParcela.set_ValorRepasseB(( - from y in x - where y.get_Parcela().get_SubTipo() != 1 - select y).Sum((VendedorParcela y) => y.get_ValorRepasse())); - vendedorParcela.set_ValorRepasse(x.Where((VendedorParcela y) => { - if (y.get_Parcela().get_SubTipo() == 1) - { - return false; - } - return y.get_DataPrePagamento().HasValue; - }).Sum((VendedorParcela y) => y.get_ValorRepasse())); - decimal? porcentagemRepasse = x.First().get_PorcentagemRepasse(); - vendedorParcela.set_PorcentagemRepasse((porcentagemRepasse.HasValue ? new decimal?(porcentagemRepasse.GetValueOrDefault() / 100) : null)); - vendedorParcela.set_TipoVendedor(x.First().get_TipoVendedor()); - return vendedorParcela; - }).ToList(); - this.Pagamentos = new ObservableCollection(list); - } - - public async void Seleciona(Parcela parcela, Documento documento) - { - StatusPagamento? statusPagamento; - Visibility visibility; - string str; - string str1; - this.SelectedParcela = parcela; - ValoresParcelaViewModel valoresParcelaViewModel = this; - visibility = (this.SelectedParcela.get_Documento().get_TipoRecebimento().GetValueOrDefault() == 2 ? Visibility.Visible : Visibility.Collapsed); - valoresParcelaViewModel.IsVisibleFatura = visibility; - this.ApoliceLabel = string.Format("VALORES DA PARCELA {0} VENCIMENTO {1:d}", this.SelectedParcela.get_NumeroParcela(), parcela.get_Vencimento()); - this.ApoliceDescricao = string.Format("VALORES BASEADOS NA PARCELA {0} ATÉ O MOMENTO, OS VALORES PODEM SER DIFERENTES EM CASO DE ALTERAÇÕES POR OUTROS USUÁRIOS.", this.SelectedParcela.get_NumeroParcela()); - this.StatusBaixa = "PENDENTE"; - this.RepassePago = "REPASSE A SER PAGO"; - if (this.SelectedParcela.get_DataRecebimento().HasValue) - { - ValoresParcelaViewModel valoresParcelaViewModel1 = this; - if (this.SelectedParcela.get_Documento().get_TipoRecebimento().GetValueOrDefault() == 2) - { - str = "BAIXA MANUAL"; - } - else - { - str = (this.SelectedParcela.get_ValorRealizado() == decimal.Zero ? "BAIXA ESGOTAMENTO" : "BAIXA MANUAL"); - } - valoresParcelaViewModel1.StatusBaixa = str; - DetalheExtrato detalheExtrato = await (new ServicoExtrato()).FindByParcelaId(this.SelectedParcela.get_Id()); - if (detalheExtrato != null) - { - StatusParcela? status = detalheExtrato.get_Status(); - if (status.HasValue) - { - StatusParcela valueOrDefault = status.GetValueOrDefault(); - if (valueOrDefault != 1) - { - if (valueOrDefault != 5) - { - switch (valueOrDefault) - { - case 10: - case 13: - { - goto Label1; - } - case 11: - { - this.CalculaComissao(documento); - this.CalculaRepasse(); - if (this.SelectedParcela.get_IdParcelaPendente() > (long)0) - { - statusPagamento = this.SelectedParcela.get_StatusPagamento(); - if (statusPagamento.GetValueOrDefault() != 0 | !statusPagamento.HasValue) - { - this.BuscarPendencia(); - } - } - return; - } - case 12: - { - break; - } - default: - { - this.CalculaComissao(documento); - this.CalculaRepasse(); - if (this.SelectedParcela.get_IdParcelaPendente() > (long)0) - { - statusPagamento = this.SelectedParcela.get_StatusPagamento(); - if (statusPagamento.GetValueOrDefault() != 0 | !statusPagamento.HasValue) - { - this.BuscarPendencia(); - } - } - return; - } - } - } - this.RepassePago = "REPASSE PAGO"; - this.StatusBaixa = "BAIXA MANUAL"; - this.CalculaComissao(documento); - this.CalculaRepasse(); - if (this.SelectedParcela.get_IdParcelaPendente() > (long)0) - { - statusPagamento = this.SelectedParcela.get_StatusPagamento(); - if (statusPagamento.GetValueOrDefault() != 0 | !statusPagamento.HasValue) - { - this.BuscarPendencia(); - } - } - return; - } - Label1: - this.IsVisibleStatusParc = Visibility.Visible; - this.StatusParc = ValidationHelper.GetDescription(detalheExtrato.get_Status()); - this.RepassePago = "REPASSE PAGO"; - ValoresParcelaViewModel valoresParcelaViewModel2 = this; - str1 = (this.SelectedParcela.get_ValorRealizado() == decimal.Zero ? "BAIXA AUTOMATICA ESGOTAMENTO" : "BAIXA AUTOMATICA"); - valoresParcelaViewModel2.StatusBaixa = str1; - } - } - } - this.CalculaComissao(documento); - this.CalculaRepasse(); - if (this.SelectedParcela.get_IdParcelaPendente() > (long)0) - { - statusPagamento = this.SelectedParcela.get_StatusPagamento(); - if (statusPagamento.GetValueOrDefault() != 0 | !statusPagamento.HasValue) - { - this.BuscarPendencia(); - } - } - } - } -} \ No newline at end of file diff --git a/Gestor.Application/ViewModels/Drawer/VinculoVendedorViewModel.cs b/Gestor.Application/ViewModels/Drawer/VinculoVendedorViewModel.cs deleted file mode 100644 index bba206b..0000000 --- a/Gestor.Application/ViewModels/Drawer/VinculoVendedorViewModel.cs +++ /dev/null @@ -1,307 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.Servicos.Ferramentas; -using Gestor.Application.Servicos.Generic; -using Gestor.Application.ViewModels; -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; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -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 _vinculado; - - private List _vinculadoFiltro; - - private List _vendedor; - - private List _vendedorFiltro; - - public bool EnableAlterarVinculo - { - get - { - return this._enableAlterarVinculo; - } - set - { - this._enableAlterarVinculo = value; - base.OnPropertyChanged("EnableAlterarVinculo"); - } - } - - public bool IsVisibleVendedor - { - get - { - return this._isVisibleVendedor; - } - set - { - this._isVisibleVendedor = value; - base.OnPropertyChanged("IsVisibleVendedor"); - } - } - - public bool IsVisibleVinculado - { - get - { - return this._isVisibleVinculado; - } - set - { - this._isVisibleVinculado = value; - base.OnPropertyChanged("IsVisibleVinculado"); - } - } - - public List Vendedor - { - get - { - return this._vendedor; - } - set - { - this._vendedor = value; - this.IsVisibleVendedor = (value == null ? false : value.Count > 0); - base.OnPropertyChanged("Vendedor"); - } - } - - public List VendedorFiltro - { - get - { - return this._vendedorFiltro; - } - set - { - this._vendedorFiltro = value; - base.OnPropertyChanged("VendedorFiltro"); - } - } - - public List Vinculado - { - get - { - return this._vinculado; - } - set - { - this._vinculado = value; - this.IsVisibleVinculado = (value == null ? false : value.Count > 0); - base.OnPropertyChanged("Vinculado"); - } - } - - public List VinculadoFiltro - { - get - { - return this._vinculadoFiltro; - } - set - { - this._vinculadoFiltro = value; - base.OnPropertyChanged("VinculadoFiltro"); - } - } - - public VinculoVendedorViewModel(Usuario usuario) - { - this.SelectedUsuario = usuario; - this._servicoVendedorUsuario = new VendedorUsuarioServico(); - this._servicoVendedor = new VendedorServico(); - this.Load(usuario); - this.EnableAlterarVinculo = Recursos.Usuario.get_Id() > (long)0; - base.EnableMenu = true; - } - - private async Task AwaitLoad(Usuario usuario) - { - this.Vinculado = await this.GetVinculo(usuario); - this.Vendedor = await this.GetVendedor(usuario); - this.VinculadoFiltro = this.Vinculado; - this.VendedorFiltro = this.Vendedor; - } - - internal async Task BuscarVinculoVendedor(string value) - { - await Task.Run(() => this.FiltrarVinculoVendedor(value)); - } - - internal void FiltrarVinculoVendedor(string filter) - { - this.Vinculado = (string.IsNullOrEmpty(filter) ? this.VinculadoFiltro : new List( - from x in this.VinculadoFiltro - where Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Vendedor().get_Nome().ToUpper().Trim()).Contains(filter.ToUpper()) - select x)); - this.Vendedor = (string.IsNullOrEmpty(filter) ? this.VendedorFiltro : new List( - from x in this.VendedorFiltro - where Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Vendedor().get_Nome().ToUpper().Trim()).Contains(filter.ToUpper()) - select x)); - } - - private async Task> GetVendedor(Usuario usuario) - { - List list; - List vinculoVendedors; - List vendedors = await this._servicoVendedor.BuscarVendedoresAtivosAsync(); - if (vendedors != null) - { - list = ( - from x in vendedors - where x.get_IdEmpresa() == usuario.get_IdEmpresa() - select x).ToList(); - } - else - { - list = null; - } - vendedors = list; - if (vendedors == null || vendedors.Count == 0) - { - vinculoVendedors = null; - } - else - { - IEnumerable vendedors1 = - from vendedor in vendedors - where this.Vinculado.All((VinculoVendedor x) => x.get_Vendedor().get_Id() != vendedor.get_Id()) - select vendedor; - vinculoVendedors = vendedors1.Select((Gestor.Model.Domain.Seguros.Vendedor vendedor) => { - VinculoVendedor vinculoVendedor = new VinculoVendedor(); - vinculoVendedor.set_Id((long)0); - vinculoVendedor.set_Vendedor(vendedor); - vinculoVendedor.set_Vinculado(false); - return vinculoVendedor; - }).ToList(); - } - List vinculoVendedors1 = vinculoVendedors; - return vinculoVendedors1; - } - - private async Task> GetVinculo(Usuario usuario) - { - List vinculoVendedors = new List(); - await this._servicoVendedorUsuario.FindByVinculo(usuario).ForEach((VendedorUsuario x) => { - VinculoVendedor vinculoVendedor = new VinculoVendedor(); - vinculoVendedor.set_Id(x.get_Id()); - vinculoVendedor.set_Vendedor(x.get_Vendedor()); - vinculoVendedor.set_Vinculado(true); - vinculoVendedors.Add(vinculoVendedor); - }); - List vinculoVendedors1 = vinculoVendedors; - return vinculoVendedors1; - } - - private async void Load(Usuario usuario) - { - await this.AwaitLoad(usuario); - } - - public async Task Salvar() - { - string str; - List vinculado = this.Vinculado; - List list = ( - from x in vinculado - where !x.get_Vinculado() - select x).Select((VinculoVendedor x) => { - VendedorUsuario vendedorUsuario = new VendedorUsuario(); - vendedorUsuario.set_Id(x.get_Id()); - vendedorUsuario.set_Vendedor(x.get_Vendedor()); - vendedorUsuario.set_Usuario(this.SelectedUsuario); - return vendedorUsuario; - }).ToList(); - if (list.Count > 0) - { - if (!await this._servicoVendedorUsuario.Delete(list)) - { - return; - } - } - List vendedor = this.Vendedor; - List vendedorUsuarios = ( - from x in vendedor - where x.get_Vinculado() - select x).Select((VinculoVendedor x) => { - VendedorUsuario vendedorUsuario = new VendedorUsuario(); - vendedorUsuario.set_Id(x.get_Id()); - vendedorUsuario.set_Vendedor(x.get_Vendedor()); - vendedorUsuario.set_Usuario(this.SelectedUsuario); - return vendedorUsuario; - }).ToList(); - if (vendedorUsuarios.Count > 0) - { - await this._servicoVendedorUsuario.SaveOrUpdate(vendedorUsuarios); - } - await this.AwaitLoad(this.SelectedUsuario); - using (UnitOfWork commited = Instancia.Commited) - { - IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); - RegistroLog registroLog = new RegistroLog(); - registroLog.set_Acao(0); - registroLog.set_Usuario(Recursos.Usuario); - registroLog.set_DataHora(Funcoes.GetNetworkTime()); - List vinculoVendedors = this.Vinculado; - List vendedors = ( - from x in vinculoVendedors - select x.get_Vendedor()).ToList(); - JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings(); - jsonSerializerSetting.set_ReferenceLoopHandling(1); - registroLog.set_Descricao(JsonConvert.SerializeObject(vendedors, jsonSerializerSetting)); - registroLog.set_EntidadeId(this.SelectedUsuario.get_Id()); - registroLog.set_Tela(45); - registroLog.set_Versao(LoginViewModel.VersaoAtual); - registroLog.set_NomeMaquina(Environment.MachineName); - registroLog.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList = hostEntry.AddressList; - IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork); - if (pAddress != null) - { - str = pAddress.ToString(); - } - else - { - str = null; - } - registroLog.set_Ip(str); - this._servicoVendedorUsuario.SaveLog(registroLog, commited); - commited.Commit(); - } - base.RegistrarAcao(string.Concat("ALTEROU VÍNCULOS DE VENDEDOR DO USUÁRIO \"", this.SelectedUsuario.get_Nome(), "\""), this.SelectedUsuario.get_Id(), new TipoTela?(45), string.Format("ID: {0}\n\nACESSE O LOG DE ALTERAÇÕES NA TELA DE VÍNCULO DE VENDEDOR PARA VER EXATAMENTE O QUE FOI ALTERADO.", this.SelectedUsuario.get_Id())); - } - } -} \ No newline at end of file -- cgit v1.2.3