diff options
Diffstat (limited to 'Gestor.Application/ViewModels/Drawer')
22 files changed, 0 insertions, 16794 deletions
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<Gestor.Model.Domain.Seguros.Adiantamento> _adiantamento = new ObservableCollection<Gestor.Model.Domain.Seguros.Adiantamento>();
-
- 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<Gestor.Model.Domain.Seguros.Adiantamento> 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>((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == this.CancelAdiantamento.get_Id()))
- {
- DomainBase.Copy<Gestor.Model.Domain.Seguros.Adiantamento, Gestor.Model.Domain.Seguros.Adiantamento>(this.Adiantamento.First<Gestor.Model.Domain.Seguros.Adiantamento>((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>((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<Gestor.Model.Domain.Seguros.Adiantamento>(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<Gestor.Model.Domain.Seguros.Adiantamento>();
- this.LogEnabled = true;
- }
- this.Carregando = false;
- }
-
- public async Task<bool> 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<Gestor.Model.Domain.Seguros.Adiantamento>(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<Gestor.Model.Domain.Seguros.Adiantamento>(num) : this.Adiantamento.Last<Gestor.Model.Domain.Seguros.Adiantamento>());
- 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<Gestor.Model.Domain.Seguros.Adiantamento>(num) : this.Adiantamento.Last<Gestor.Model.Domain.Seguros.Adiantamento>());
- 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<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> 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>((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == adiantamento.get_Id()))
- {
- this.Adiantamento.Add(adiantamento);
- }
- else
- {
- DomainBase.Copy<Gestor.Model.Domain.Seguros.Adiantamento, Gestor.Model.Domain.Seguros.Adiantamento>(this.Adiantamento.First<Gestor.Model.Domain.Seguros.Adiantamento>((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Id() == adiantamento.get_Id()), adiantamento);
- }
- this.Adiantamento = new ObservableCollection<Gestor.Model.Domain.Seguros.Adiantamento>(this.Adiantamento);
- this.SelectedAdiantamento = this.Adiantamento.First<Gestor.Model.Domain.Seguros.Adiantamento>((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<KeyValuePair<string, string>>()
- {
- new KeyValuePair<string, string>("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<Gestor.Model.Domain.Seguros.Adiantamento> adiantamentos = await (new BaseServico()).BuscarAdiantamentoAsync(vendedor);
- IOrderedEnumerable<Gestor.Model.Domain.Seguros.Adiantamento> pago =
- from x in adiantamentos
- orderby x.get_Pago()
- select x;
- List<Gestor.Model.Domain.Seguros.Adiantamento> list = pago.ThenBy<Gestor.Model.Domain.Seguros.Adiantamento, decimal>((Gestor.Model.Domain.Seguros.Adiantamento x) => x.get_Valor()).ToList<Gestor.Model.Domain.Seguros.Adiantamento>();
- this.Adiantamento = new ObservableCollection<Gestor.Model.Domain.Seguros.Adiantamento>(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<Gestor.Model.Domain.Seguros.Adiantamento>());
- 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<AgendaTelefone> _telefones = new ObservableCollection<AgendaTelefone>();
-
- private ObservableCollection<AgendaEmail> _emails = new ObservableCollection<AgendaEmail>();
-
- private long _ultimoId;
-
- public Agenda CancelAgenda;
-
- private ObservableCollection<Agenda> _agendasFiltradas = new ObservableCollection<Agenda>();
-
- private bool _carregando;
-
- public List<Agenda> Agendas
- {
- get;
- set;
- }
-
- public ObservableCollection<Agenda> 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<AgendaEmail> 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<AgendaTelefone> 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<Agenda, Agenda>(this.Agendas.First<Agenda>((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id()), this.CancelAgenda);
- if (this.AgendasFiltradas.Count <= 0 || !this.AgendasFiltradas.Any<Agenda>((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id()))
- {
- this.AgendasFiltradas.Add(this.CancelAgenda);
- }
- else
- {
- DomainBase.Copy<Agenda, Agenda>(this.AgendasFiltradas.First<Agenda>((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id()), this.CancelAgenda);
- }
- this.AgendasFiltradas = new ObservableCollection<Agenda>(this.AgendasFiltradas);
- this.SelectedAgenda = this.AgendasFiltradas.First<Agenda>((Agenda x) => x.get_Id() == this.CancelAgenda.get_Id());
- }
- else if (this.AgendasFiltradas.Count <= 0 || !this.AgendasFiltradas.Any<Agenda>((Agenda x) => x.get_Id() == this._ultimoId))
- {
- if (this.Agendas.Count <= 0 || !this.Agendas.Any<Agenda>((Agenda x) => x.get_Id() == this._ultimoId))
- {
- this.SelectedAgenda = new Agenda();
- ObservableCollection<AgendaTelefone> observableCollection = new ObservableCollection<AgendaTelefone>();
- AgendaTelefone agendaTelefone = new AgendaTelefone();
- agendaTelefone.set_Agenda(this.SelectedAgenda);
- agendaTelefone.set_Tipo(new TipoTelefone?(1));
- observableCollection.Add(agendaTelefone);
- this.Telefones = observableCollection;
- ObservableCollection<AgendaEmail> observableCollection1 = new ObservableCollection<AgendaEmail>();
- 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>((Agenda x) => x.get_Id() == this._ultimoId));
- this.SelectedAgenda = this.AgendasFiltradas.First<Agenda>((Agenda x) => x.get_Id() == this._ultimoId);
- }
- else
- {
- this.SelectedAgenda = this.AgendasFiltradas.First<Agenda>((Agenda x) => x.get_Id() == this._ultimoId);
- }
- base.Alterar(false);
- this.Carregando = false;
- }
-
- public async Task<bool> 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<Agenda>(this.AgendasFiltradas);
- if (this.AgendasFiltradas.Count <= 0)
- {
- this.SelectedAgenda = new Agenda();
- this.Telefones = new ObservableCollection<AgendaTelefone>();
- this.Emails = new ObservableCollection<AgendaEmail>();
- base.Alterar(false);
- }
- else if (num >= this.AgendasFiltradas.Count)
- {
- await this.SelecionaAgenda(this.AgendasFiltradas.Last<Agenda>());
- }
- else
- {
- await this.SelecionaAgenda(this.AgendasFiltradas.ElementAt<Agenda>(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<List<Agenda>> Filtrar(string value)
- {
- List<Agenda> agendas = await Task.Run<List<Agenda>>(() => this.FiltrarAgenda(value));
- return agendas;
- }
-
- public List<Agenda> FiltrarAgenda(string filter)
- {
- this.AgendasFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Agenda>(this.Agendas) : new ObservableCollection<Agenda>(
- 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<Agenda>();
- }
-
- public void Incluir()
- {
- if (this.SelectedAgenda != null)
- {
- this._ultimoId = this.SelectedAgenda.get_Id();
- }
- this.SelectedAgenda = new Agenda();
- ObservableCollection<AgendaTelefone> observableCollection = new ObservableCollection<AgendaTelefone>();
- AgendaTelefone agendaTelefone = new AgendaTelefone();
- agendaTelefone.set_Agenda(this.SelectedAgenda);
- agendaTelefone.set_Tipo(new TipoTelefone?(1));
- observableCollection.Add(agendaTelefone);
- this.Telefones = observableCollection;
- ObservableCollection<AgendaEmail> observableCollection1 = new ObservableCollection<AgendaEmail>();
- 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 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 agendaTelefone = new AgendaTelefone();
- agendaTelefone.set_Agenda(this.SelectedAgenda);
- agendaTelefone.set_Tipo(new TipoTelefone?(1));
- this.Telefones.Add(agendaTelefone);
- base.OnPropertyChanged("IncluirTelefone");
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- int num;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedAgenda.Validate();
- ObservableCollection<AgendaTelefone> telefones = this.Telefones;
- List<AgendaTelefone> list = (
- from x in telefones
- where !string.IsNullOrEmpty(x.get_Numero())
- select x).ToList<AgendaTelefone>();
- ObservableCollection<AgendaEmail> emails = this.Emails;
- List<AgendaEmail> agendaEmails = (
- from x in emails
- where !string.IsNullOrEmpty(x.get_Email())
- select x).ToList<AgendaEmail>();
- 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<AgendaTelefone>(list));
- this.SelectedAgenda.set_Emails(new ObservableCollection<AgendaEmail>(agendaEmails));
- if (this.SelectedAgenda.get_Id() != 0)
- {
- this.SelectedAgenda = await this._servico.Save(this.SelectedAgenda);
- if (this._servico.Sucesso)
- {
- this.Telefones = new ObservableCollection<AgendaTelefone>(this.SelectedAgenda.get_Telefones());
- this.Emails = new ObservableCollection<AgendaEmail>(this.SelectedAgenda.get_Emails());
- DomainBase.Copy<Agenda, Agenda>(this.Agendas.First<Agenda>((Agenda x) => x.get_Id() == this.SelectedAgenda.get_Id()), this.SelectedAgenda);
- if (this.AgendasFiltradas.Count <= 0 || !this.AgendasFiltradas.Any<Agenda>((Agenda x) => x.get_Id() == this.SelectedAgenda.get_Id()))
- {
- this.AgendasFiltradas.Add(this.SelectedAgenda);
- }
- else
- {
- DomainBase.Copy<Agenda, Agenda>(this.AgendasFiltradas.First<Agenda>((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<AgendaTelefone>(this.SelectedAgenda.get_Telefones());
- this.Emails = new ObservableCollection<AgendaEmail>(this.SelectedAgenda.get_Emails());
- this.Agendas.Add(this.SelectedAgenda);
- ObservableCollection<Agenda> agendasFiltradas = this.AgendasFiltradas;
- num = (this._ultimoId == 0 ? 0 : this.AgendasFiltradas.IndexOf(this.AgendasFiltradas.First<Agenda>((Agenda x) => x.get_Id() == this._ultimoId)));
- agendasFiltradas.Insert(num, this.SelectedAgenda);
- }
- else
- {
- keyValuePairs = null;
- return keyValuePairs;
- }
- }
- this.AgendasFiltradas = new ObservableCollection<Agenda>(this.AgendasFiltradas);
- this.SelectedAgenda = this.AgendasFiltradas.First<Agenda>((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<Agenda>() : this.AgendasFiltradas.FirstOrDefault<Agenda>((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<Agenda> agendas = await (new BaseServico()).BuscarAgendasAsync();
- AgendaViewModel list = this;
- List<Agenda> agendas1 = agendas;
- list.Agendas = (
- from x in agendas1
- orderby x.get_Nome()
- select x).ToList<Agenda>();
- this.AgendasFiltradas = new ObservableCollection<Agenda>(this.Agendas);
- AgendaViewModel agendaViewModel = this;
- agenda = (this.AgendasFiltradas.Count > 0 ? this.AgendasFiltradas.First<Agenda>() : 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<string> _status;
-
- private string _webbody;
-
- private Visibility _envioEmailVisibility = Visibility.Collapsed;
-
- private Visibility _atendimentoVisibility;
-
- private ObservableCollection<Atendimento> _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<Gestor.Model.Domain.Common.ArquivoDigital> _arquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>();
-
- private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital();
-
- private string _head;
-
- public ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> 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<Atendimento> 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<string> 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<Gestor.Model.Domain.Common.ArquivoDigital> arquivoDigitals = await base.AddAttachments(new List<Gestor.Model.Domain.Common.ArquivoDigital>(), new List<Gestor.Model.Domain.Common.ArquivoDigital>());
- if (arquivoDigitals != null)
- {
- arquivoDigitals.AddRange(this.ArquivosAnexados);
- this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(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>((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao());
- this.ArquivosAnexados.Remove(arquivoDigital);
- this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(this.ArquivosAnexados);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Enviar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- object obj;
- try
- {
- List<KeyValuePair<string, string>> 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}<hr><p><b>ID Acesso:</b> {1}<br><b>Senha Acesso:</b> {2}</p><p>VERSÃO DO SISTEMA: {3}<br />USUÁRIO SISTEMA:{4} {5}</p><p>{6}</p>", corpo);
- CustomerAttendance customerAttendance = new CustomerAttendance();
- customerAttendance.set_CustomerData(customerDatum1);
- customerAttendance.set_Subject(this.Assunto);
- customerAttendance.set_Body(str);
- ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> arquivosAnexados = this.ArquivosAnexados;
- customerAttendance.set_Attachments(arquivosAnexados.Select<Gestor.Model.Domain.Common.ArquivoDigital, Attachment>((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<Attachment>());
- this.LimparComponentes();
- this.SelecionaAtendimento();
- if (await Connection.Post<CustomerAttendance>("Attendance/Send", customerAttendance) == null)
- {
- obj = null;
- }
- else
- {
- obj = new List<KeyValuePair<string, string>>();
- ((List<KeyValuePair<string, string>>)obj).Add(new KeyValuePair<string, string>("fail", ""));
- }
- keyValuePairs = (List<KeyValuePair<string, string>>)obj;
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- }
- catch (Exception exception)
- {
- keyValuePairs = new List<KeyValuePair<string, string>>()
- {
- new KeyValuePair<string, string>("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<Gestor.Model.API.HorarioAtendimento>("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<Gestor.Model.Domain.Common.ArquivoDigital>();
- }
-
- private void LoadCombo()
- {
- this.Status = new List<string>()
- {
- "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<KeyValuePair<string, string>> Validate()
- {
- List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
- if (string.IsNullOrWhiteSpace(this.Nome))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Nome", Messages.get_Obrigatorio(), true);
- }
- if (string.IsNullOrWhiteSpace(this.Ddd))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Ddd", Messages.get_Obrigatorio(), true);
- }
- else if (!ValidationHelper.ValidacaoPrefixo(this.Ddd))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Ddd", Messages.get_Invalido(), true);
- }
- if (string.IsNullOrWhiteSpace(this.Telefone))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Telefone", Messages.get_Obrigatorio(), true);
- }
- else if (!ValidationHelper.ValidacaoTelefone(this.Telefone))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Telefone", Messages.get_Invalido(), true);
- }
- if (string.IsNullOrWhiteSpace(this.Email))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Email", Messages.get_Obrigatorio(), true);
- }
- else if (!ValidationHelper.ValidacaoEmail(this.Email))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Email", Messages.get_Invalido(), true);
- }
- if (string.IsNullOrWhiteSpace(this.Corpo))
- {
- ValidationHelper.AddValue<string, string>(keyValuePairs, "Corpo", Messages.get_Obrigatorio(), true);
- }
- if (string.IsNullOrWhiteSpace(this.Assunto))
- {
- ValidationHelper.AddValue<string, string>(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<Boleto> _boletos;
-
- private string _boletoDisponivel;
-
- private List<string> _status;
-
- public string BoletoDisponivel
- {
- get
- {
- return this._boletoDisponivel;
- }
- set
- {
- this._boletoDisponivel = value;
- base.OnPropertyChanged("BoletoDisponivel");
- }
- }
-
- public List<Boleto> 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<string> 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<string>()
- {
- "PENDENTES",
- "BAIXADOS"
- };
- }
-
- public async void WorkOnSelectedStatus(string value)
- {
- List<Boleto> list;
- this.Carregando = true;
- this.Boletos = new List<Boleto>();
- List<Boleto> boletos = await this._ajudaServico.BuscarBoletosNotas(value);
- BoletosNotasViewModel boletosNotasViewModel = this;
- if (value == "BAIXADOS")
- {
- List<Boleto> boletos1 = boletos;
- IEnumerable<Boleto> hasValue =
- from x in boletos1
- where x.Pagamento.HasValue
- select x;
- list = (
- from x in hasValue
- orderby x.Pagamento descending
- select x).ToList<Boleto>();
- }
- 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<Licenca> _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<Licenca> 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<Gestor.Application.Model.Ajuda.Instalacao> _agger;
-
- private ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> _aggerFiltrado;
-
- private List<Gestor.Application.Model.Ajuda.Instalacao> _aggilizador;
-
- public List<Gestor.Application.Model.Ajuda.Instalacao> Agger
- {
- get
- {
- return this._agger;
- }
- set
- {
- this._agger = value;
- base.OnPropertyChanged("Agger");
- }
- }
-
- public ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> AggerFiltrado
- {
- get
- {
- return this._aggerFiltrado;
- }
- set
- {
- this._aggerFiltrado = value;
- base.OnPropertyChanged("AggerFiltrado");
- }
- }
-
- public List<Gestor.Application.Model.Ajuda.Instalacao> 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<object> InstalacaoItemFilter
- {
- get
- {
- AutoCompleteFilterPredicate<object> u003cu003e9_370 = InstalacaoViewModel.u003cu003ec.u003cu003e9__37_0;
- if (u003cu003e9_370 == null)
- {
- u003cu003e9_370 = new AutoCompleteFilterPredicate<object>(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<List<Gestor.Application.Model.Ajuda.Instalacao>> Filtrar(string value)
- {
- List<Gestor.Application.Model.Ajuda.Instalacao> instalacaos = await Task.Run<List<Gestor.Application.Model.Ajuda.Instalacao>>(() => this.FiltrarInstalacao(value));
- return instalacaos;
- }
-
- public List<Gestor.Application.Model.Ajuda.Instalacao> FiltrarInstalacao(string filter)
- {
- this.AggerFiltrado = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao>(this.Agger) : new ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao>(this.Agger.Where<Gestor.Application.Model.Ajuda.Instalacao>((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<Gestor.Application.Model.Ajuda.Instalacao>();
- }
-
- private async void LoadInstalacoes()
- {
- int? nullable;
- List<Gestor.Application.Model.Ajuda.Instalacao> instalacaos;
- int? nullable1;
- int? nullable2;
- string str;
- this.Carregando = true;
- ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> observableCollection = await this._ajudaServico.BuscarLicencas();
- InstalacaoViewModel list = this;
- ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> observableCollection1 = observableCollection;
- list.Agger = (
- from x in observableCollection1
- where !string.IsNullOrEmpty(x.IdGerenciador)
- select x).ToList<Gestor.Application.Model.Ajuda.Instalacao>();
- this.AggerFiltrado = new ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao>(this.Agger);
- InstalacaoViewModel instalacaoViewModel = this;
- List<Licenca> produtos = LicenseHelper.Produtos;
- if (produtos.Any<Licenca>((Licenca x) => x.get_Produto() == 81))
- {
- instalacaos = new List<Gestor.Application.Model.Ajuda.Instalacao>();
- }
- else
- {
- ObservableCollection<Gestor.Application.Model.Ajuda.Instalacao> observableCollection2 = observableCollection;
- instalacaos = (
- from x in observableCollection2
- where !string.IsNullOrEmpty(x.IdAggilizador)
- select x).ToList<Gestor.Application.Model.Ajuda.Instalacao>();
- }
- instalacaoViewModel.Aggilizador = instalacaos;
- InstalacaoViewModel instalacaoViewModel1 = this;
- object count = this.Agger.Count;
- List<Licenca> licencas = LicenseHelper.Produtos;
- Licenca licenca = licencas.FirstOrDefault<Licenca>((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<Licenca> produtos1 = LicenseHelper.Produtos;
- Licenca licenca1 = produtos1.FirstOrDefault<Licenca>((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<ClienteTelefone> _telefones = new ObservableCollection<ClienteTelefone>();
-
- private ObservableCollection<IndiceArquivoDigital> _arquivos = new ObservableCollection<IndiceArquivoDigital>();
-
- private ObservableCollection<IndiceArquivoDigital> _arquivosTela = new ObservableCollection<IndiceArquivoDigital>();
-
- private IndiceArquivoDigital _selectedArquivo = new IndiceArquivoDigital();
-
- private ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> _arquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>();
-
- private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital();
-
- private string _titulo = "";
-
- private ObservableCollection<ClienteEmail> _emails = new ObservableCollection<ClienteEmail>();
-
- private string _assunto;
-
- private string _corpo;
-
- private string _nome;
-
- private string _documento;
-
- private string _email;
-
- private string _licencas;
-
- private string _assinadorKey;
-
- 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<IndiceArquivoDigital> Arquivos
- {
- get
- {
- return this._arquivos;
- }
- set
- {
- this._arquivos = value;
- this.ArquivosTela = value;
- base.OnPropertyChanged("Arquivos");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> ArquivosAnexados
- {
- get
- {
- return this._arquivosAnexados;
- }
- set
- {
- this._arquivosAnexados = value;
- this.IsVisibleSalvar = (value == null ? false : value.Count > 0);
- base.OnPropertyChanged("ArquivosAnexados");
- }
- }
-
- public ObservableCollection<IndiceArquivoDigital> 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<ClienteEmail> 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<ClienteTelefone> 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<IndiceArquivoDigital> arquivos = this.Arquivos;
- List<Gestor.Model.Domain.Common.ArquivoDigital> list = arquivos.Select<IndiceArquivoDigital, Gestor.Model.Domain.Common.ArquivoDigital>((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<Gestor.Model.Domain.Common.ArquivoDigital>();
- List<Gestor.Model.Domain.Common.ArquivoDigital> arquivoDigitals = await base.AddAttachments(this.ArquivosAnexados.ToList<Gestor.Model.Domain.Common.ArquivoDigital>(), list);
- if (arquivoDigitals != null)
- {
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (!configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 47))
- {
- arquivoDigitals = await base.ShowDialogAnexar(arquivoDigitals, false);
- if (arquivoDigitals == null)
- {
- return;
- }
- }
- arquivoDigitals.AddRange(this.ArquivosAnexados);
- this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(arquivoDigitals);
- }
- }
-
- public async Task<ArquivoParaAssinaturaAssinador> 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<bool> BaixarTodos()
- {
- bool flag;
- if (this.Arquivos == null || this.Arquivos.Count == 0)
- {
- flag = false;
- }
- else
- {
- flag = await base.DownloadAll(this.Arquivos.ToList<IndiceArquivoDigital>(), 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<IndiceArquivoDigital> indiceArquivoDigitals = await this.ArquivoDigitalServico.BuscarPorTipo(this.Filtro.get_Tipo(), this.Filtro.get_Id());
- if (this.AdDocumento)
- {
- List<IndiceArquivoDigital> indiceArquivoDigitals1 = indiceArquivoDigitals;
- List<IndiceArquivoDigital> indiceArquivoDigitals2 = await this.ArquivoDigitalServico.BuscarPorTipo(2, this.Filtro.get_IdApolice());
- indiceArquivoDigitals1.AddRange(indiceArquivoDigitals2);
- indiceArquivoDigitals1 = null;
- }
- ArquivoDigitalViewModel observableCollection = this;
- List<IndiceArquivoDigital> indiceArquivoDigitals3 = indiceArquivoDigitals;
- observableCollection.Arquivos = new ObservableCollection<IndiceArquivoDigital>(
- 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<IndiceArquivoDigital> indiceArquivoDigitals4 = indiceArquivoDigitals;
- indiceArquivoDigitals4.ForEach((IndiceArquivoDigital x) => x.set_NaoExcluir(true));
- ObservableCollection<IndiceArquivoDigital> arquivos = this.Arquivos;
- List<IndiceArquivoDigital> indiceArquivoDigitals5 = indiceArquivoDigitals;
- ExtensionMethods.AddRange<IndiceArquivoDigital>(arquivos, new ObservableCollection<IndiceArquivoDigital>(
- 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<ClienteEmail> 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<ClienteEmail>();
- 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<ClienteEmail>();
- 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<ClienteTelefone> observableCollection2 = new ObservableCollection<ClienteTelefone>();
- 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<ClienteTelefone> observableCollection3 = new ObservableCollection<ClienteTelefone>();
- 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<ClienteTelefone> observableCollection4 = new ObservableCollection<ClienteTelefone>();
- 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<Licenca> produtos = LicenseHelper.Produtos;
- if (produtos.Any<Licenca>((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<Uri> 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<string>("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>((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao());
- this.ArquivosAnexados.Remove(arquivoDigital);
- this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(this.ArquivosAnexados);
- }
-
- public async void Editar(IndiceArquivoDigital arquivo)
- {
- if (arquivo != null && arquivo.get_IdArquivoDigital() != 0)
- {
- await this.ArquivoDigitalServico.Save(arquivo);
- }
- }
-
- public async Task<bool> EnviarParaAssinatura()
- {
- bool flag;
- object obj;
- ObservableCollection<IndiceArquivoDigital> arquivosTela = this.ArquivosTela;
- if (!arquivosTela.Any<IndiceArquivoDigital>((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<IndiceArquivoDigital> arquivos = this.Arquivos;
- if (num1 >= arquivos.Count<IndiceArquivoDigital>((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<IndiceArquivoDigital> observableCollection = this.ArquivosTela;
- int num3 = (
- from x in observableCollection
- where x.get_Assinar()
- select x).Count<IndiceArquivoDigital>();
- ObservableCollection<IndiceArquivoDigital> 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<IndiceArquivoDigital>(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<Gestor.Model.Domain.Common.ArquivoDigital>();
- }
-
- public async Task<MalaDireta> PrepararEnvio()
- {
- MalaDireta malaDiretum;
- Item item;
- string str;
- Item item1;
- string str1;
- MalaDireta malaDiretum1;
- Gestor.Model.Domain.Seguros.Documento parente;
- Parcela parcela;
- ObservableCollection<IndiceArquivoDigital> arquivos = this.Arquivos;
- if (arquivos.Any<IndiceArquivoDigital>((IndiceArquivoDigital x) => x.get_Selecionado()))
- {
- MalaDireta malaDiretum2 = new MalaDireta();
- malaDiretum2.set_Cliente(this.SelectedCliente);
- ObservableCollection<IndiceArquivoDigital> observableCollection = this.Arquivos;
- malaDiretum2.set_ArquivoDigital((
- from x in observableCollection
- where x.get_Selecionado()
- select x).ToList<IndiceArquivoDigital>());
- malaDiretum1 = malaDiretum2;
- TipoArquivoDigital tipo = this.Filtro.get_Tipo();
- switch (tipo)
- {
- case 2:
- {
- parente = (Gestor.Model.Domain.Seguros.Documento)this.Filtro.get_Parente();
- List<Item> 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<Item>();
- }
- 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<Item> 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<Item>();
- }
- 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<Gestor.Model.Domain.Common.ArquivoDigital> list = this.ArquivosAnexados.ToList<Gestor.Model.Domain.Common.ArquivoDigital>();
- if (await base.SalvarAttachments(list, this.Filtro.get_Tipo(), this.Filtro.get_Id()))
- {
- await this.CarregaArquivos();
- this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>();
- 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<Expedicao> _expedicoes = new ObservableCollection<Expedicao>();
-
- public bool Carregando
- {
- get
- {
- return this._carregando;
- }
- set
- {
- this._carregando = value;
- base.EnableMenu = !value;
- base.OnPropertyChanged("Carregando");
- }
- }
-
- public ObservableCollection<Expedicao> 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<Expedicao>());
- }
- else
- {
- expedicao = this.Expedicoes.FirstOrDefault<Expedicao>((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<Expedicao>(await this._servico.BuscarExpedicoes(documento));
- }
-
- public async Task<bool> 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<Expedicao>(num) : this.Expedicoes.Last<Expedicao>());
- 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<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> 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>((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<Expedicao>();
- }
- 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<Documento> _documentos;
-
- private List<Prospeccao> _prospeccoes;
-
- private List<Cliente> _clientes;
-
- private bool _tipoExtratoEnabled = true;
-
- private bool _extratoResumido;
-
- private bool _segurosVigentes;
-
- private Visibility _clientePorPaginaVisibility;
-
- private bool _clientePorPagina;
-
- private bool _extratoPorPagina;
-
- private bool _clientePorPaginaEnabled = true;
-
- private bool _obsCliente;
-
- private bool _comissaoDocumento;
-
- private bool _premioParcela;
-
- private bool _obsApolice;
-
- private bool _beneficiariosItens;
-
- private bool _selecionarItens;
-
- private bool _endossos;
-
- private bool _somenteEndosso;
-
- private Visibility _selecionarItensVisibility;
-
- private Visibility _endossoVisibility;
-
- private Visibility _obsDocVisibility;
-
- private Visibility _segurosVigentesVisibility;
-
- private bool _obsItem;
-
- private bool _separarPagina;
-
- private bool _perfilCondutor;
-
- private bool _obsClienteEnabled = true;
-
- private bool _comissaoDocumentoEnabled;
-
- private bool _obsApoliceEnabled;
-
- private bool _beneficiariosItensEnabled;
-
- private bool _obsItemEnabled;
-
- private bool _separarPaginaEnabled;
-
- private bool _coberturasEnabled;
-
- private bool _coberturas;
-
- private bool _perfilCondutorEnabled;
-
- private bool _endossoEnabled;
-
- private bool _esconderResumido;
-
- private bool _clienteVisibility;
-
- private bool _documentoVisibility;
-
- private bool _itemVisibility;
-
- private bool _perfilVisibility;
-
- private TipoExtrato _selectedTipoExtrato;
-
- private bool _carregando;
-
- private List<Item> _itensSelecionados;
-
- internal Relatorio? TipoDeRelatorio;
-
- public 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<Cliente> 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<Documento> 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<Prospeccao> 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<Item>();
- }
- 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<Item> items;
- int numeroParcela;
- DateTime? clienteDesde;
- EstadoCivil? estadoCivil;
- Sexo? sexo;
- TipoTelefone? nullable;
- TipoTelefone tipoTelefone;
- decimal premioLiquido;
- List<ControleSinistro> 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<Item> list;
- Item item = null;
- Item item1;
- string str370;
- string str371 = "";
- if (this.Clientes != null && this.Documentos == null)
- {
- str371 = string.Concat(str371, "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title>");
- str367 = (this.ExtratoResumido ? " RESUMIDO" : "");
- str370 = string.Concat("EXTRATO", str367, " DO CLIENTE");
- str371 = string.Concat(str371, str370);
- str371 = string.Concat(str371, "</title></head><body bgcolor='#FFFFFF'><div align='center'>");
- str371 = string.Concat(str371, "<style> td > p { margin: 2px; }</style>");
- 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 ? "" : "<div style='page-break-before:always;'>"));
- str371 = string.Concat(str371, "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>");
- str370 = string.Concat("EXTRATO", (this.ExtratoResumido ? " RESUMIDO" : ""), " DO CLIENTE: ", x.get_Nome());
- str371 = string.Concat(str371, str370, "</h4></td></table><br>");
- 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, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "' ", (pessoaFisica ? "" : "colspan='1'"), "><p align='left'><b>CLIENTE: </b>", x.get_Nome(), "</p></td><td width='222' bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "' ", (pessoaFisica ? "" : "colspan='2'"), "><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>", x.get_Documento(), "</p></td><td width='222' bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "' ", (pessoaFisica ? "" : "colspan='3'"), "><p align='left'><b>", str9, ": </b>", null, null };
- DateTime? nascimento = x.get_Nascimento();
- strArrays[20] = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null);
- strArrays[21] = "</p></td>";
- cSu0024u003cu003e8_locals1.html = string.Concat(strArrays);
- if (!pessoaFisica)
- {
- num++;
- }
- else
- {
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable = variable9;
- string[] cSu0024u003cu003e8_locals11 = new string[] { str371, "<td width='222' bgcolor='", null, null, null, null };
- int num1 = num;
- num = num1 + 1;
- cSu0024u003cu003e8_locals11[2] = (num1 % 2 == 0 ? "WhiteSmoke" : "White");
- cSu0024u003cu003e8_locals11[3] = "'><p align='left'><b>FALECIDO: </b>";
- cSu0024u003cu003e8_locals11[4] = (x.get_Falecido() ? "SIM" : "NÃO");
- cSu0024u003cu003e8_locals11[5] = "</p></td>";
- variable.html = string.Concat(cSu0024u003cu003e8_locals11);
- }
- str371 = string.Concat(str371, "</tr>");
- if (x.get_Atividade() != null)
- {
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable1 = variable9;
- string[] nome = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- nome[2] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- nome[3] = "' colspan='6'><p align='left'><b>RAMO DE ATIVIDADE: </b>";
- nome[4] = x.get_Atividade().get_Nome();
- nome[5] = "</p></td></tr>";
- variable1.html = string.Concat(nome);
- if (!pessoaFisica)
- {
- num++;
- }
- }
- if (this.SelectedTipoExtrato != 2)
- {
- str371 = string.Concat(str371, "<tr>");
- if (pessoaFisica)
- {
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals12 = variable9;
- string[] strArrays1 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null, null, null };
- strArrays1[2] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays1[3] = "'><p align='left'><b>ESTADO CIVIL: </b>";
- strArrays1[4] = (x.get_EstadoCivil().HasValue ? x.get_EstadoCivil().ToString().ToUpper() : "-");
- strArrays1[5] = "</p></td><td bgcolor='";
- strArrays1[6] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays1[7] = "'><p align='left'><b>SEXO: </b>";
- strArrays1[8] = (x.get_Sexo().HasValue ? x.get_Sexo().ToString().ToUpper() : "-");
- strArrays1[9] = "</p></td>";
- cSu0024u003cu003e8_locals12.html = string.Concat(strArrays1);
- }
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable2 = variable9;
- string[] strArrays2 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null };
- int num2 = num;
- num = num2 + 1;
- strArrays2[2] = (num2 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays2[3] = "' ";
- strArrays2[4] = (pessoaFisica ? "colspan='2'" : "colspan='4'");
- strArrays2[5] = "><p align='left'><b>CLIENTE DESDE: </b>";
- nascimento = x.get_ClienteDesde();
- if (nascimento.HasValue)
- {
- nascimento = x.get_ClienteDesde();
- str8 = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null);
- }
- else
- {
- str8 = "-";
- }
- strArrays2[6] = str8;
- strArrays2[7] = "</p></td></tr>";
- variable2.html = string.Concat(strArrays2);
- }
- if (pessoaFisica)
- {
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals13 = variable9;
- string[] strArrays3 = new string[] { str371, "<tr><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left' x-ms-format-detection='none'><b>HABILITAÇÃO: </b>", (!string.IsNullOrWhiteSpace(x.get_Habilitacao()) ? x.get_Habilitacao() : "-"), "</p></td><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left' x-ms-format-detection='none'><b>CATEGORIA: </b>", (!string.IsNullOrWhiteSpace(x.get_CategoriaHabilitacao()) ? x.get_CategoriaHabilitacao() : "-"), "</p></td><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left' x-ms-format-detection='none'><b>1ª HAB.: </b>", 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] = "</p></td><td bgcolor='";
- int num3 = num;
- num = num3 + 1;
- strArrays3[14] = (num3 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays3[15] = "'><p align='left' x-ms-format-detection='none'><b>VENCIMENTO: </b>";
- 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] = "</p></td></tr>";
- cSu0024u003cu003e8_locals13.html = string.Concat(strArrays3);
- }
- if (!string.IsNullOrWhiteSpace(x.get_Identidade()))
- {
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable3 = variable9;
- string[] cSu0024u003cu003e8_locals14 = new string[] { str371, "<tr><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left' x-ms-format-detection='none'><b>RG: </b>", (!string.IsNullOrWhiteSpace(x.get_Identidade()) ? x.get_Identidade() : "-"), "</p></td><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left'><b>ORGÃO EMISSOR: </b>", (!string.IsNullOrWhiteSpace(x.get_Emissor()) ? x.get_Emissor() : "-"), "</p></td><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left'><b>ESTADO EMISSOR: </b>", (!string.IsNullOrWhiteSpace(x.get_EstadoEmissor()) ? x.get_EstadoEmissor() : "-"), "</p></td><td bgcolor='", null, null, null, null };
- int num4 = num;
- num = num4 + 1;
- cSu0024u003cu003e8_locals14[14] = (num4 % 2 == 0 ? "WhiteSmoke" : "White");
- cSu0024u003cu003e8_locals14[15] = "'><p align='left'><b>EXPEDIÇÃO: </b>";
- 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] = "</p></td></tr>";
- variable3.html = string.Concat(cSu0024u003cu003e8_locals14);
- }
- if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido)
- {
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable4 = variable9;
- string[] strArrays4 = new string[] { str371, "<tr><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left'><b>BANCO: </b>", (x.get_Banco() != null ? x.get_Banco().get_Nome() : "-"), "</p></td><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>", (!string.IsNullOrWhiteSpace(x.get_Agencia()) ? x.get_Agencia() : "-"), "</p></td><td bgcolor='", (num % 2 == 0 ? "WhiteSmoke" : "White"), "'><p align='left' x-ms-format-detection='none'><b>CONTA: </b>", (!string.IsNullOrWhiteSpace(x.get_Conta()) ? x.get_Conta() : "-"), "</p></td><td bgcolor='", null, null, null, null };
- int num5 = num;
- num = num5 + 1;
- strArrays4[14] = (num5 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays4[15] = "'><p align='left' x-ms-format-detection='none'><b>TIPO: </b>";
- strArrays4[16] = (!string.IsNullOrWhiteSpace(x.get_TipoConta()) ? x.get_TipoConta() : "-");
- strArrays4[17] = "</p></td></tr>";
- variable4.html = string.Concat(strArrays4);
- }
- if ((x.get_Telefones() != null || x.get_Emails() != null) && this.SelectedTipoExtrato != 2)
- {
- str371 = string.Concat(str371, "<tr>");
- if (x.get_Telefones() != null)
- {
- string str10 = "";
- foreach (ClienteTelefone telefone in x.get_Telefones())
- {
- string[] prefixo = new string[] { str10, "<br>", 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, "<td bgcolor='", null, null, null, null };
- strArrays5[2] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays5[3] = "' colspan='2'><p align='left'><b>CONTATOS: </b>";
- strArrays5[4] = str10;
- strArrays5[5] = "</p></td>";
- 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, "<br>", email.get_Email());
- }
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable5 = variable9;
- string[] cSu0024u003cu003e8_locals16 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- cSu0024u003cu003e8_locals16[2] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- cSu0024u003cu003e8_locals16[3] = "' colspan='2'><p align='left'><b>EMAILS: </b>";
- cSu0024u003cu003e8_locals16[4] = str11;
- cSu0024u003cu003e8_locals16[5] = "</p></td>";
- variable5.html = string.Concat(cSu0024u003cu003e8_locals16);
- }
- num++;
- str371 = string.Concat(str371, "</tr>");
- }
- if (x.get_Enderecos() != null && this.SelectedTipoExtrato != 2)
- {
- string str12 = "";
- foreach (ClienteEndereco endereco in x.get_Enderecos())
- {
- string[] bairro = new string[] { str12, "<br>", 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, "<tr><td bgcolor='", null, null, null, null };
- int num6 = num;
- num = num6 + 1;
- strArrays6[2] = (num6 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays6[3] = "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>";
- strArrays6[4] = str12;
- strArrays6[5] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null };
- int num7 = num;
- num = num7 + 1;
- nome1[2] = (num7 % 2 == 0 ? "WhiteSmoke" : "White");
- nome1[3] = "' colspan='6'><p align='left'><b>PROFISSÃO: </b>";
- nome1[4] = x.get_Profissao().get_Nome();
- nome1[5] = "</p></td></tr>";
- 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] = "<br>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()) ? "<br>" : "");
- 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()) ? "<br>" : "");
- 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] = "<br>";
- str13 = string.Concat(nome2);
- }
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 variable7 = variable9;
- string[] strArrays7 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- int num8 = num;
- num = num8 + 1;
- strArrays7[2] = (num8 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays7[3] = "' colspan='6'><p align='left'><b>MAIS CONTATOS: </b>";
- strArrays7[4] = str13;
- strArrays7[5] = "</p></td></tr>";
- 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("<br>", x.get_Observacao().Replace("\r\n", "<br>")));
- ExtratosViewModel.u003cu003ec__DisplayClass170_0 cSu0024u003cu003e8_locals18 = variable9;
- string[] observacao = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- int num9 = num;
- num = num9 + 1;
- observacao[2] = (num9 % 2 == 0 ? "WhiteSmoke" : "White");
- observacao[3] = "' colspan='6'><p align='left' x-ms-format-detection='none'><b>OBSERVAÇÕES: </b>";
- observacao[4] = x.get_Observacao();
- observacao[5] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null };
- pasta[2] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- pasta[3] = "' colspan='6'><p align='left' x-ms-format-detection='none'><b>PASTA: </b>";
- pasta[4] = x.get_Pasta();
- pasta[5] = "</p></td></tr>";
- variable8.html = string.Concat(pasta);
- }
- str371 = string.Concat(str371, "</font></table>");
- str371 = string.Concat(str371, (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "</div>"));
- }
- });
- DateTime networkTime = Funcoes.GetNetworkTime();
- string[] strArrays8 = new string[] { str371, "<br><font face='Verdana' size='1'><br>", Recursos.Usuario.get_Nome(), " - ", null, null };
- date = networkTime.Date;
- strArrays8[4] = date.ToShortDateString();
- strArrays8[5] = "</font></div><script src='https://code.jquery.com/jquery-3.3.1.slim.min.js' integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo' crossorigin='anonymous'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js' integrity='sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1' crossorigin='anonymous'></script><script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous'></script></body></html>";
- 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<Cliente> 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 = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title>";
- 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, "</title></head><body bgcolor='#FFFFFF'><div align='center'>");
- List<long> nums = new List<long>();
- if (this.Documentos != null && this.Documentos.Count > 0)
- {
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- bool flag = configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 42);
- foreach (Documento documento1 in this.Documentos)
- {
- Documento documento2 = documento1;
- ObservableCollection<Parcela> 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<ClienteEndereco> 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<ClienteEmail> 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<ClienteTelefone> 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<MaisContato> 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<Item> items1 = new List<Item>();
- items = (!this.Endossos ? await (new ItemServico()).BuscarItens(documento3.get_Controle().get_Id(), 0).ToList<Item>() : await (new ItemServico()).BuscarItens(documento3.get_Id(), 2).ToList<Item>());
- List<Item> items2 = items;
- if (this._itensSelecionados == null || this._itensSelecionados.Count <= 0)
- {
- items1.AddRange(items2);
- }
- else
- {
- items2.ForEach((Item x) => {
- if (this._itensSelecionados.Any<Item>((Item y) => y.get_Id() == x.get_Id()))
- {
- items1.Add(x);
- }
- });
- }
- List<Perfil> perfils = await (new PerfilServico()).BuscarPerfis(documento3.get_Controle().get_Id());
- long num12 = (long)0;
- num10 = 0;
- if (!flag1)
- {
- string str374 = str371;
- str363 = (this.ExtratoPorPagina ? "<div style='page-break-before:always;'>" : "");
- 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 ? "" : "<div style='page-break-before:always;'>");
- str371 = string.Concat(str375, str40);
- str371 = string.Concat(str371, "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>");
- 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, "</h4></td></table><br>");
- str371 = string.Concat(str371, "<style>td > p {margin: 2px;}</style>");
- if (!this.ExtratoResumido)
- {
- if ((!this.Endossos || !this.SomenteEndossos) && !nums.Any<long>((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] = "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='";
- documento4[2] = (flag2 ? "222" : "2500");
- documento4[3] = "' bgcolor='";
- str177 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- documento4[4] = str177;
- documento4[5] = "' ";
- documento4[6] = (flag2 ? "" : "colspan='2'");
- documento4[7] = "><p align='left'><b>CLIENTE: </b>";
- documento4[8] = documento3.get_Controle().get_Cliente().get_Nome();
- documento4[9] = "</p></td><td width='";
- documento4[10] = (flag2 ? "222" : "200");
- documento4[11] = "' bgcolor='";
- str178 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- documento4[12] = str178;
- documento4[13] = "'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>";
- documento4[14] = documento3.get_Controle().get_Cliente().get_Documento();
- documento4[15] = "</p></td><td width='";
- documento4[16] = (flag2 ? "222" : "300");
- documento4[17] = "' bgcolor='";
- str179 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- documento4[18] = str179;
- documento4[19] = "'><p align='left'><b>";
- documento4[20] = str376;
- documento4[21] = ": </b>";
- clienteDesde = documento3.get_Controle().get_Cliente().get_Nascimento();
- if (clienteDesde.HasValue)
- {
- shortDateString8 = clienteDesde.GetValueOrDefault().ToShortDateString();
- }
- else
- {
- shortDateString8 = null;
- }
- documento4[22] = shortDateString8;
- documento4[23] = "</p></td>";
- str371 = string.Concat(documento4);
- if (!flag2)
- {
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- }
- else
- {
- string[] strArrays9 = new string[] { str371, "<td width='222' bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str238 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays9[2] = str238;
- strArrays9[3] = "'><p align='left'><b>FALECIDO: </b>";
- str239 = (documento3.get_Controle().get_Cliente().get_Falecido() ? "SIM" : "NÃO");
- strArrays9[4] = str239;
- strArrays9[5] = "</p></td>";
- str371 = string.Concat(strArrays9);
- }
- str371 = string.Concat(str371, "</tr>");
- if (documento3.get_Controle().get_Cliente().get_Atividade() != null)
- {
- string[] strArrays10 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str237 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays10[2] = str237;
- strArrays10[3] = "' ";
- strArrays10[4] = (flag2 ? "" : "colspan='4'");
- strArrays10[5] = "><p align='left'><b>RAMO DE ATIVIDADE: </b>";
- strArrays10[6] = documento3.get_Controle().get_Cliente().get_Atividade().get_Nome();
- strArrays10[7] = "</p></td></tr>";
- str371 = string.Concat(strArrays10);
- }
- if (this.SelectedTipoExtrato != 2)
- {
- string[] strArrays11 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- str231 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays11[2] = str231;
- strArrays11[3] = "' ";
- strArrays11[4] = (flag2 ? "" : "colspan='4'");
- strArrays11[5] = ">";
- str371 = string.Concat(strArrays11);
- if (flag2)
- {
- string[] strArrays12 = new string[] { str371, "<b>ESTADO CIVIL: </b>", 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] = "</p></td><td bgcolor='";
- str234 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays12[4] = str234;
- strArrays12[5] = "'><p align='left'><b>SEXO: </b>";
- 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] = "</p></td><td bgcolor='";
- str236 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays12[8] = str236;
- strArrays12[9] = "'><p align='left'>";
- 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, "<p align='left'><b>CLIENTE DESDE: </b>", shortDateString13, "</p></td>");
- if (documento3.get_Controle().get_Cliente().get_Profissao() == null || this.SelectedTipoExtrato == 2)
- {
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- }
- else
- {
- string[] strArrays13 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str232 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays13[2] = str232;
- strArrays13[3] = "' > <p align='left'><b>PROFISSÃO: </b>";
- strArrays13[4] = documento3.get_Controle().get_Cliente().get_Profissao().get_Nome();
- strArrays13[5] = "</p></td>";
- str371 = string.Concat(strArrays13);
- }
- str371 = string.Concat(str371, "</tr>");
- }
- if (flag2)
- {
- string[] strArrays14 = new string[18];
- strArrays14[0] = str371;
- strArrays14[1] = "<tr><td bgcolor='";
- str225 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays14[2] = str225;
- strArrays14[3] = "'><p align='left' x-ms-format-detection='none'><b>HABILITAÇÃO: </b>";
- str226 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Habilitacao()) ? documento3.get_Controle().get_Cliente().get_Habilitacao() : "-");
- strArrays14[4] = str226;
- strArrays14[5] = "</p></td><td bgcolor='";
- str227 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays14[6] = str227;
- strArrays14[7] = "'><p align='left' x-ms-format-detection='none'><b>CATEGORIA: </b>";
- str228 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_CategoriaHabilitacao()) ? documento3.get_Controle().get_Cliente().get_CategoriaHabilitacao() : "-");
- strArrays14[8] = str228;
- strArrays14[9] = "</p></td><td bgcolor='";
- str229 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays14[10] = str229;
- strArrays14[11] = "'><p align='left' x-ms-format-detection='none'><b>1ª HAB.: </b>";
- 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] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str230 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays14[14] = str230;
- strArrays14[15] = "'><p align='left' x-ms-format-detection='none'><b>VENCIMENTO: </b>";
- 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] = "</p></td></tr>";
- str371 = string.Concat(strArrays14);
- }
- if (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()))
- {
- string[] strArrays15 = new string[18];
- strArrays15[0] = str371;
- strArrays15[1] = "<tr><td bgcolor='";
- str218 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays15[2] = str218;
- strArrays15[3] = "'><p align='left' x-ms-format-detection='none'><b>RG: </b>";
- str219 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-");
- strArrays15[4] = str219;
- strArrays15[5] = "</p></td><td bgcolor='";
- str220 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays15[6] = str220;
- strArrays15[7] = "'><p align='left'><b>ORGÃO EMISSOR: </b>";
- str221 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Emissor()) ? documento3.get_Controle().get_Cliente().get_Emissor() : "-");
- strArrays15[8] = str221;
- strArrays15[9] = "</p></td><td bgcolor='";
- str222 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays15[10] = str222;
- strArrays15[11] = "'><p align='left'><b>ESTADO EMISSOR: </b>";
- str223 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_EstadoEmissor()) ? documento3.get_Controle().get_Cliente().get_EstadoEmissor() : "-");
- strArrays15[12] = str223;
- strArrays15[13] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str224 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays15[14] = str224;
- strArrays15[15] = "'><p align='left'><b>EXPEDIÇÃO: </b>";
- 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] = "</p></td></tr>";
- str371 = string.Concat(strArrays15);
- }
- if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido)
- {
- string[] strArrays16 = new string[18];
- strArrays16[0] = str371;
- strArrays16[1] = "<tr><td bgcolor='";
- str210 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays16[2] = str210;
- strArrays16[3] = "'><p align='left'><b>BANCO: </b>";
- str211 = (documento3.get_Controle().get_Cliente().get_Banco() != null ? documento3.get_Controle().get_Cliente().get_Banco().get_Nome() : "-");
- strArrays16[4] = str211;
- strArrays16[5] = "</p></td><td bgcolor='";
- str212 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays16[6] = str212;
- strArrays16[7] = "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>";
- str213 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Agencia()) ? documento3.get_Controle().get_Cliente().get_Agencia() : "-");
- strArrays16[8] = str213;
- strArrays16[9] = "</p></td><td bgcolor='";
- str214 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays16[10] = str214;
- strArrays16[11] = "'><p align='left' x-ms-format-detection='none'><b>CONTA: </b>";
- str215 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Conta()) ? documento3.get_Controle().get_Cliente().get_Conta() : "-");
- strArrays16[12] = str215;
- strArrays16[13] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str216 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays16[14] = str216;
- strArrays16[15] = "'><p align='left' x-ms-format-detection='none'><b>TIPO: </b>";
- str217 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_TipoConta()) ? documento3.get_Controle().get_Cliente().get_TipoConta() : "-");
- strArrays16[16] = str217;
- strArrays16[17] = "</p></td></tr>";
- 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, "<tr>");
- 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, "<br>", 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, "<td bgcolor='", null, null, null, null };
- str209 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays17[2] = str209;
- strArrays17[3] = "' colspan='2'><p align='left'><b>CONTATOS: </b>";
- strArrays17[4] = str378;
- strArrays17[5] = "</p></td>";
- 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, "<br>", clienteEmail.get_Email());
- }
- string[] strArrays18 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str207 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays18[2] = str207;
- strArrays18[3] = "' colspan='2'><p align='left'><b>EMAILS: </b>";
- strArrays18[4] = str379;
- strArrays18[5] = "</p></td>";
- 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, "<br>", 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, "<td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str206 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays19[2] = str206;
- strArrays19[3] = "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>";
- strArrays19[4] = str380;
- strArrays19[5] = "</p></td>";
- str371 = string.Concat(strArrays19);
- }
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str371 = string.Concat(str371, "</tr>");
- }
- 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, "<br>", 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, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str204 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays20[2] = str204;
- strArrays20[3] = "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>";
- strArrays20[4] = str381;
- strArrays20[5] = "</p></td></tr>";
- 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] = "<br>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()) ? "<br>" : "");
- 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()) ? "<br>" : "");
- 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] = "<br>";
- str382 = string.Concat(strArrays21);
- }
- string[] strArrays22 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str202 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays22[2] = str202;
- strArrays22[3] = "' colspan='6'><p align='left'><b>MAIS CONTATOS: </b>";
- strArrays22[4] = str382;
- strArrays22[5] = "</p></td></tr>";
- 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, "<br>", 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, "<td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str184 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays23[2] = str184;
- strArrays23[3] = "' colspan='6'><p align='left'><b>ENDEREÇOS: </b>";
- strArrays23[4] = str383;
- strArrays23[5] = "</p></td>";
- 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("<br>", documento3.get_Controle().get_Cliente().get_Observacao().Replace("\r\n", "<br>")));
- string[] strArrays24 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str182 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays24[2] = str182;
- strArrays24[3] = "' colspan='6'><p align='left' x-ms-format-detection='none'><b>OBSERVAÇÕES: </b>";
- strArrays24[4] = documento3.get_Controle().get_Cliente().get_Observacao();
- strArrays24[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays24);
- }
- if (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Pasta()) && this.SelectedTipoExtrato != 2 && !this.ExtratoResumido)
- {
- string[] strArrays25 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- str181 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays25[2] = str181;
- strArrays25[3] = "' colspan='6'><p align='left' x-ms-format-detection='none'><b>PASTA: </b>";
- strArrays25[4] = documento3.get_Controle().get_Cliente().get_Pasta();
- strArrays25[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays25);
- }
- str371 = string.Concat(str371, "</font></table>");
- if (!flag1)
- {
- string str384 = str371;
- str180 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "</div>");
- str371 = string.Concat(str384, str180);
- }
- }
- else
- {
- string[] documento5 = new string[14];
- documento5[0] = str371;
- documento5[1] = "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='";
- str42 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- documento5[2] = str42;
- documento5[3] = "'><p align='left'><b>CLIENTE: </b>";
- documento5[4] = documento3.get_Controle().get_Cliente().get_Nome();
- documento5[5] = "</p></td><td bgcolor='";
- str43 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- documento5[6] = str43;
- documento5[7] = "'><p align='left' x-ms-format-detection='none'><b>RG: </b>";
- str44 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-");
- documento5[8] = str44;
- documento5[9] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str45 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- documento5[10] = str45;
- documento5[11] = "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>";
- documento5[12] = documento3.get_Controle().get_Cliente().get_Documento();
- documento5[13] = "</p></td></tr></font></table>";
- str371 = string.Concat(documento5);
- }
- if (this.SelectedTipoExtrato != null)
- {
- num10 = 0;
- string[] shortDateString18 = new string[58];
- shortDateString18[0] = str371;
- shortDateString18[1] = "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='";
- str46 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[2] = str46;
- shortDateString18[3] = "'><p align='left'><b>RAMO: </b>";
- shortDateString18[4] = documento3.get_Controle().get_Ramo().get_Nome();
- shortDateString18[5] = "</p></td><td bgcolor='";
- str47 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[6] = str47;
- shortDateString18[7] = "'><p align='left' x-ms-format-detection='none'><b>VIGÊNCIA INICIAL: </b>";
- date = documento3.get_Vigencia1();
- shortDateString18[8] = date.ToShortDateString();
- shortDateString18[9] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str48 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[10] = str48;
- shortDateString18[11] = "'><p align='left'><b>VIGÊNCIA FINAL: </b>";
- 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] = "</p></td></tr><tr><td bgcolor='";
- str49 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[14] = str49;
- shortDateString18[15] = "' colspan='2'><p align='left'><b>CONTRATO: </b>";
- str50 = (string.IsNullOrWhiteSpace(documento3.get_Apolice()) ? "-" : documento3.get_Apolice());
- shortDateString18[16] = str50;
- shortDateString18[17] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str51 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[18] = str51;
- shortDateString18[19] = "'><p align='left'><b>POSSUI ENDOSSO? </b>";
- str52 = (documento3.get_TemEndosso() ? "SIM" : "NÃO");
- shortDateString18[20] = str52;
- shortDateString18[21] = "</p></td></tr><tr><td bgcolor='";
- str53 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[22] = str53;
- shortDateString18[23] = "' colspan='2'><p align='left' x-ms-format-detection='none'><b>ADITAMENTO: </b>";
- if (string.IsNullOrWhiteSpace(documento3.get_Endosso()))
- {
- if (flag)
- {
- IList<Documento> documentos = documento3.get_Controle().get_Documentos();
- if (documentos.Where<Documento>((Documento x) => {
- if (x.get_Excluido())
- {
- return false;
- }
- return x.get_Ordem() != 0;
- }).ToList<Documento>().Count <= 0)
- {
- goto Label2;
- }
- IList<Documento> documentos1 = documento3.get_Controle().get_Documentos();
- endosso = documentos1.Last<Documento>((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] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str54 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[26] = str54;
- shortDateString18[27] = "'><p align='left'><b>APÓLICE ANTERIOR: </b>";
- str55 = (string.IsNullOrWhiteSpace(documento3.get_ApoliceAnterior()) ? "-" : documento3.get_ApoliceAnterior());
- shortDateString18[28] = str55;
- shortDateString18[29] = "</p></td></tr><tr><td bgcolor='";
- str56 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[30] = str56;
- shortDateString18[31] = "'><p align='left'><b>BANCO: </b>";
- str57 = (documento3.get_Banco() == null ? "-" : documento3.get_Banco().get_Nome());
- shortDateString18[32] = str57;
- shortDateString18[33] = "</p></td><td bgcolor='";
- str58 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[34] = str58;
- shortDateString18[35] = "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>";
- str59 = (string.IsNullOrWhiteSpace(documento3.get_Agencia()) ? "-" : documento3.get_Agencia());
- shortDateString18[36] = str59;
- shortDateString18[37] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str60 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[38] = str60;
- shortDateString18[39] = "'><p align='left'><b>CONTA: </b>";
- str61 = (string.IsNullOrWhiteSpace(documento3.get_Conta()) ? "-" : documento3.get_Conta());
- shortDateString18[40] = str61;
- shortDateString18[41] = "</p></td></tr><td bgcolor='";
- str62 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[42] = str62;
- shortDateString18[43] = "'><p align='left' x-ms-format-detection='none'><b>NUMERO CARTÃO: </b>";
- str63 = (string.IsNullOrWhiteSpace(documento3.get_NumeroCartao()) ? "-" : documento3.get_NumeroCartao());
- shortDateString18[44] = str63;
- shortDateString18[45] = "</p></td><td bgcolor='";
- str64 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[46] = str64;
- shortDateString18[47] = "'><p align='left'><b>VENCIMENTO: </b>";
- str65 = (string.IsNullOrWhiteSpace(documento3.get_VencimentoCartao()) ? "-" : documento3.get_VencimentoCartao());
- shortDateString18[48] = str65;
- shortDateString18[49] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str66 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[50] = str66;
- shortDateString18[51] = "'><p align='left'><b>BANDEIRA: </b>";
- str67 = (!documento3.get_Bandeira().HasValue ? "-" : ValidationHelper.GetDescription(documento3.get_Bandeira()));
- shortDateString18[52] = str67;
- shortDateString18[53] = "</p></td></tr><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str68 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString18[54] = str68;
- shortDateString18[55] = "' colspan='3'><p align='left' x-ms-format-detection='none'><b>TITULAR/PROPONENTE: </b>";
- str69 = (string.IsNullOrWhiteSpace(documento3.get_NomeProponente()) ? "-" : documento3.get_NomeProponente());
- shortDateString18[56] = str69;
- shortDateString18[57] = "</p></td></tr>";
- 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, "<td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str172 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays26[2] = str172;
- strArrays26[3] = "' colspan='3'><p align='left'><b>COMISSÃO: </b>";
- strArrays26[4] = string.Format("{0}%", documento3.get_Comissao());
- strArrays26[5] = "</p></td>";
- str371 = string.Concat(strArrays26);
- }
- else
- {
- string[] description5 = new string[14];
- description5[0] = str371;
- description5[1] = "<td bgcolor='";
- str173 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description5[2] = str173;
- description5[3] = "'><p align='left'><b>NEGÓCIO CORRETORA: </b>";
- description5[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora());
- description5[5] = "</p></td><td bgcolor='";
- str174 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description5[6] = str174;
- description5[7] = "'><p align='left'><b>STATUS DO SEGURO: </b>";
- description5[8] = ValidationHelper.GetDescription(documento3.get_Situacao());
- description5[9] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str175 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description5[10] = str175;
- description5[11] = "'><p align='left'><b>COMISSÃO: </b>";
- description5[12] = string.Format("{0}%", documento3.get_Comissao());
- description5[13] = "</p></td>";
- str371 = string.Concat(description5);
- }
- }
- else if (this.SelectedTipoExtrato != 2)
- {
- string[] description6 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null, null, null };
- str170 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description6[2] = str170;
- description6[3] = "'><p align='left'><b>NEGÓCIO CORRETORA: </b>";
- description6[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora());
- description6[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str171 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description6[6] = str171;
- description6[7] = "' colspan='2'><p align='left'><b>STATUS DO SEGURO: </b>";
- description6[8] = ValidationHelper.GetDescription(documento3.get_Situacao());
- description6[9] = "</p></td>";
- str371 = string.Concat(description6);
- }
- string[] strArrays27 = new string[14];
- strArrays27[0] = str371;
- strArrays27[1] = "</tr><tr><td bgcolor='";
- str70 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays27[2] = str70;
- strArrays27[3] = "'><p align='left'><b>VENDEDOR: </b>";
- str71 = (documento3.get_VendedorPrincipal() == null ? "-" : documento3.get_VendedorPrincipal().get_Nome());
- strArrays27[4] = str71;
- strArrays27[5] = "</p></td><td bgcolor='";
- str72 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays27[6] = str72;
- strArrays27[7] = "'><p align='left'><b>REMESSA: </b>";
- 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] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str73 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays27[10] = str73;
- strArrays27[11] = "'><p align='left'><b>EMISSÃO: </b>";
- 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] = "</p></td></tr>";
- str371 = string.Concat(strArrays27);
- if (this.SelectedTipoExtrato != 2 && !this.ExtratoResumido)
- {
- str371 = string.Concat(str371, "<tr>");
- 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, "<td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str168 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays28[2] = str168;
- strArrays28[3] = "' colspan='3'><p align='left'><b>ESTIPULANTE(S): </b>";
- str169 = (string.IsNullOrWhiteSpace(str385) ? "-" : str385);
- strArrays28[4] = str169;
- strArrays28[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays28);
- }
- if (this.SelectedTipoExtrato == 2)
- {
- string[] strArrays29 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str74 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays29[2] = str74;
- strArrays29[3] = "' colspan='3'><p align='left'><b>SEGURADORA: </b>";
- strArrays29[4] = documento3.get_Controle().get_Seguradora().get_Nome();
- strArrays29[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays29);
- }
- else
- {
- string[] strArrays30 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null, null, null, null, null };
- str164 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays30[2] = str164;
- strArrays30[3] = "' colspan='2'><p align='left'><b>SEGURADORA: </b>";
- strArrays30[4] = documento3.get_Controle().get_Seguradora().get_Nome();
- strArrays30[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str165 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays30[6] = str165;
- strArrays30[7] = "'><p align='left'><b>APÓLICE SINISTRADA: </b>";
- str166 = (documento3.get_Sinistro() ? "SIM" : "NÃO");
- strArrays30[8] = str166;
- strArrays30[9] = "</p></td></tr>";
- str371 = string.Concat(strArrays30);
- if (documento3.get_Controle().get_SeguradoraAnterior() != null && !this.ExtratoResumido)
- {
- string[] strArrays31 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str167 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays31[2] = str167;
- strArrays31[3] = "' colspan='3'><p align='left'><b>SEGURADORA ANTERIOR: </b>";
- strArrays31[4] = documento3.get_Controle().get_SeguradoraAnterior().get_Nome();
- strArrays31[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays31);
- }
- }
- str371 = string.Concat(str371, "</font></table>");
- if (!this.ExtratoResumido && (this.PremioParcela || this.ObsApoliceEnabled))
- {
- str371 = string.Concat(str371, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>");
- if (this.PremioParcela)
- {
- string[] strArrays32 = new string[24];
- strArrays32[0] = str371;
- strArrays32[1] = "<tr><td bgcolor='";
- str158 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays32[2] = str158;
- strArrays32[3] = "'><p align='left'><b>PRÊMIO LÍQUIDO: </b><br/>";
- premioLiquido = documento3.get_PremioLiquido();
- strArrays32[4] = premioLiquido.ToString("c");
- strArrays32[5] = "</p></td><td bgcolor='";
- str159 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays32[6] = str159;
- strArrays32[7] = "'><p align='left'><b>ADICIONAL: </b><br/>";
- premioLiquido = documento3.get_PremioAdicional();
- strArrays32[8] = premioLiquido.ToString("c");
- strArrays32[9] = "</p></td><td bgcolor='";
- str160 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays32[10] = str160;
- strArrays32[11] = "'><p align='left'><b>CUSTO APÓLICE: </b><br/>";
- premioLiquido = documento3.get_Custo();
- strArrays32[12] = premioLiquido.ToString("c");
- strArrays32[13] = "</p></td><td bgcolor='";
- str161 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays32[14] = str161;
- strArrays32[15] = "'><p align='left'><b>I.O.F.: </b><br/>";
- premioLiquido = documento3.get_Iof();
- strArrays32[16] = premioLiquido.ToString("c");
- strArrays32[17] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str162 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays32[18] = str162;
- strArrays32[19] = "'";
- str163 = (!this.ComissaoDocumento || !this.ComissaoDocumentoEnabled ? " colspan='2'" : "");
- strArrays32[20] = str163;
- strArrays32[21] = "><p align='left'><b>PRÊMIO TOTAL: </b><br/>";
- premioLiquido = documento3.get_PremioTotal();
- strArrays32[22] = premioLiquido.ToString("c");
- strArrays32[23] = "</p></td>";
- str371 = string.Concat(strArrays32);
- str371 = string.Concat(str371, "</tr>");
- str371 = string.Concat(str371, "</font></table><br>");
- ObservableCollection<Parcela> parcelas = documento3.get_Parcelas();
- if (parcelas != null)
- {
- count = parcelas.Count > 0;
- }
- else
- {
- count = false;
- }
- if (count)
- {
- str371 = string.Concat(str371, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>PARCELA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>VENCIMENTO</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>VALOR</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>FORMA DE PAGAMENTO</div></b></p></td></tr>");
- foreach (Parcela parcela in documento3.get_Parcelas())
- {
- string[] description7 = new string[] { str371, "<tr><td bgcolor='White'><p align='left'><div align='center'>", null, null, null, null, null, null, null, null };
- numeroParcela = parcela.get_NumeroParcela();
- description7[2] = numeroParcela.ToString();
- description7[3] = "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>";
- date = parcela.get_Vencimento();
- description7[4] = date.ToShortDateString();
- description7[5] = "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>";
- description7[6] = string.Format("{0:c}", parcela.get_Valor());
- description7[7] = "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>";
- description7[8] = ValidationHelper.GetDescription(documento3.get_FormaPagamento());
- description7[9] = "</div></p></td></tr>";
- str371 = string.Concat(description7);
- }
- }
- }
- if (this.ObsApolice && this.ObsApoliceEnabled)
- {
- string[] strArrays33 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- str156 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays33[2] = str156;
- strArrays33[3] = "' colspan='6'><p align='left' x-ms-format-detection='none'><b>OBSERVAÇÕES: </b>";
- str157 = (string.IsNullOrWhiteSpace(documento3.get_Observacao()) ? "-" : documento3.get_Observacao());
- strArrays33[4] = str157;
- strArrays33[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays33);
- }
- str371 = string.Concat(str371, "</font></table>");
- }
- if (this.PerfilCondutor && this.PerfilVisibility && documento3.get_Controle().get_Ramo().get_Id() == (long)5 && this.PerfilCondutorEnabled)
- {
- List<Perfil> list1 = perfils.ToList<Perfil>();
- foreach (Perfil perfil in list1)
- {
- num10 = 0;
- if (string.IsNullOrEmpty(perfil.get_Nome()))
- {
- continue;
- }
- string[] description8 = new string[92];
- description8[0] = str371;
- description8[1] = "<hr style='width:999; border-top: 2px solid #ccc'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='";
- str115 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[2] = str115;
- description8[3] = "'><p align='left'><b>";
- description8[4] = string.Format("CONDUTOR {0}: ", list1.IndexOf(perfil) + 1);
- description8[5] = "</b>";
- description8[6] = perfil.get_Nome();
- description8[7] = "</p></td><td width='222' bgcolor='";
- str116 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[8] = str116;
- description8[9] = "'><p align='left' x-ms-format-detection='none'><b>CPF: </b>";
- str117 = (string.IsNullOrWhiteSpace(perfil.get_Cpf()) ? "-" : perfil.get_Cpf());
- description8[10] = str117;
- description8[11] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str118 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description8[12] = str118;
- description8[13] = "'><p align='left'><b>NASCIMENTO: </b>";
- 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] = "</p></td></tr><tr><td width='333' bgcolor='";
- str119 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[16] = str119;
- description8[17] = "'><p align='left'><b>ESTADO CIVIL: </b>";
- str120 = (!perfil.get_EstadoCivil().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_EstadoCivil()));
- description8[18] = str120;
- description8[19] = "</p></td><td width='222' bgcolor='";
- str121 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[20] = str121;
- description8[21] = "'><p align='left'><b>SEXO: </b>";
- str122 = (!perfil.get_Sexo().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_Sexo()));
- description8[22] = str122;
- description8[23] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str123 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description8[24] = str123;
- description8[25] = "'><p align='left'><b>RELAÇÃO SEGURADO/CONDUTOR: </b>";
- description8[26] = ValidationHelper.GetDescription(perfil.get_Relacao());
- description8[27] = "</p></td></tr><tr><td width='333' bgcolor='";
- str124 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[28] = str124;
- description8[29] = "'><p align='left'><b>HABILITAÇÃO: </b>";
- str125 = (string.IsNullOrWhiteSpace(perfil.get_Habilitacao()) ? "-" : perfil.get_Habilitacao());
- description8[30] = str125;
- description8[31] = "</p></td><td width='222' bgcolor='";
- str126 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[32] = str126;
- description8[33] = "'><p align='left'><b>TEMPO DE HABILITAÇÃO: </b>";
- str127 = (!perfil.get_TempoHabilitacao().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_TempoHabilitacao()));
- description8[34] = str127;
- description8[35] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str128 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description8[36] = str128;
- description8[37] = "'><p align='left'><b>QUATIDADE DE VEÍCULOS: </b>";
- if (!perfil.get_VeiculoResidencia().HasValue)
- {
- str129 = "-";
- }
- else
- {
- numeroParcela = perfil.get_VeiculoResidencia().Value;
- str129 = numeroParcela.ToString();
- }
- description8[38] = str129;
- description8[39] = "</p></td></tr><tr><td width='333' bgcolor='";
- str130 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[40] = str130;
- description8[41] = "'><p align='left'><b>GARAGEM NA RESIDÊNCIA: </b>";
- str131 = (!perfil.get_GaragemResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemResidencia()));
- description8[42] = str131;
- description8[43] = "</p></td><td width='222' bgcolor='";
- str132 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[44] = str132;
- description8[45] = "'><p align='left'><b>GARAGEM NO TRABALHO: </b>";
- str133 = (!perfil.get_GaragemTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemTrabalho()));
- description8[46] = str133;
- description8[47] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str134 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description8[48] = str134;
- description8[49] = "'><p align='left'><b>GARAGEM NO ESTUDO: </b>";
- str135 = (!perfil.get_GaragemEstudo().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_GaragemEstudo()));
- description8[50] = str135;
- description8[51] = "</p></td></tr><tr><td width='333' bgcolor='";
- str136 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[52] = str136;
- description8[53] = "'><p align='left'><b>TIPO DE RESIDÊNCIA: </b>";
- str137 = (!perfil.get_TipoResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_TipoResidencia()));
- description8[54] = str137;
- description8[55] = "</p></td><td width='222' bgcolor='";
- str138 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[56] = str138;
- description8[57] = "'><p align='left'><b>QUILOMETRAGEM MENSAL: </b>";
- str139 = (string.IsNullOrWhiteSpace(perfil.get_KmMensal()) ? "-" : perfil.get_KmMensal());
- description8[58] = str139;
- description8[59] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str140 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description8[60] = str140;
- description8[61] = "'><p align='left'><b>DISTÂNCIA ATÉ O TRABALHO: </b>";
- str141 = (!perfil.get_DistanciaResidenciaTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_DistanciaResidenciaTrabalho()));
- description8[62] = str141;
- description8[63] = "</p></td></tr><tr><td width='333' bgcolor='";
- str142 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[64] = str142;
- description8[65] = "'><p align='left'><b>USO PROFISSIONAL: </b>";
- str143 = (!perfil.get_UsoProfissional().HasValue || !perfil.get_UsoProfissional().Value ? "NÃO" : "SIM");
- description8[66] = str143;
- description8[67] = "</p></td><td width='222' bgcolor='";
- str144 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[68] = str144;
- description8[69] = "'><p align='left'><b>USO POR DEPENDENTES: </b>";
- str145 = (!perfil.get_UsoDependentes().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_UsoDependentes()));
- description8[70] = str145;
- description8[71] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str146 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description8[72] = str146;
- description8[73] = "'><p align='left'><b>OCUPAÇÃO: </b>";
- str147 = (!perfil.get_Ocupacao().HasValue ? "-" : ValidationHelper.GetDescription(perfil.get_Ocupacao()));
- description8[74] = str147;
- description8[75] = "</p></td></tr><tr><td width='333' bgcolor='";
- str148 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[76] = str148;
- description8[77] = "'><p align='left'><b>SEGURO VIDA: </b>";
- str149 = (!perfil.get_SeguroVida().HasValue || !perfil.get_SeguroVida().Value ? "NÃO" : "SIM");
- description8[78] = str149;
- description8[79] = "</p></td><td width='222' bgcolor='";
- str150 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[80] = str150;
- description8[81] = "'><p align='left'><b>ISENÇÃO DE IMPOSTOS: </b>";
- str151 = (!perfil.get_Isencao().HasValue || !perfil.get_Isencao().Value ? "NÃO" : "SIM");
- description8[82] = str151;
- description8[83] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str152 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description8[84] = str152;
- description8[85] = "'><p align='left'><b>ANTIFURTO: </b>";
- str153 = (perfil.get_AntiFurto().HasValue ? ValidationHelper.GetDescription(perfil.get_AntiFurto()) : "");
- description8[86] = str153;
- description8[87] = "</p></td></tr><tr><td bgcolor='";
- str154 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description8[88] = str154;
- description8[89] = "' colspan='3'><p align='left'><b>COBERTURA ESTENDIDA PARA RESIDENTES HABILITADOS: </b>";
- str155 = (!perfil.get_EstenderCobertura().HasValue || !perfil.get_EstenderCobertura().Value ? "NÃO" : "SIM");
- description8[90] = str155;
- description8[91] = "</p></td></tr></font></table>";
- str371 = string.Concat(description8);
- }
- }
- list = items1.ToList<Item>();
- 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 ? "" : "<div style='page-break-before:always;'>");
- str371 = string.Concat(str386, str75);
- string str387 = str371;
- str76 = (this.SelectedTipoExtrato != 2 || list.IndexOf(item) == 0 ? "<br>" : "");
- str371 = string.Concat(str387, str76);
- str371 = string.Concat(str371, "<table border='1' bordercolor='#ededed' width='999'>");
- str371 = string.Concat(str371, "<style> td > p { margin: 2px; }</style>");
- str371 = string.Concat(str371, "<font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr>");
- 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] = "<td bgcolor='";
- str77 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- numero1[2] = str77;
- numero1[3] = "' colspan='4'><p align='left'><b>";
- numero1[4] = string.Format("ITEM {0}: ", item.get_Ordem());
- numero1[5] = "</b>";
- 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] = "</p></td>";
- str371 = string.Concat(numero1);
- }
- else
- {
- string[] descricao2 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null };
- str114 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- descricao2[2] = str114;
- descricao2[3] = "' colspan='3'><p align='left'><b>";
- descricao2[4] = string.Format("ITEM {0}: ", item.get_Ordem());
- descricao2[5] = "</b>";
- descricao2[6] = item.get_Descricao();
- descricao2[7] = "</p></td>";
- str371 = string.Concat(descricao2);
- }
- Label9:
- if (item.get_Sinistros().Count > 0)
- {
- Item item2 = item;
- if (item2 != null)
- {
- IList<ControleSinistro> sinistros = item2.get_Sinistros();
- if (sinistros != null)
- {
- ControleSinistro controleSinistro = sinistros.LastOrDefault<ControleSinistro>();
- if (controleSinistro != null)
- {
- List<Sinistro> sinistros1 = controleSinistro.get_Sinistros();
- if (sinistros1 != null)
- {
- Sinistro sinistro = sinistros1.LastOrDefault<Sinistro>();
- 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] = "</tr><td bgcolor='";
- numeroParcela = num10 + 1;
- num10 = numeroParcela;
- str107 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays34[2] = str107;
- strArrays34[3] = "'><p align='left'><b>SINISTRO STATUS: </b>";
- Item item3 = item;
- if (item3 != null)
- {
- IList<ControleSinistro> controleSinistros1 = item3.get_Sinistros();
- if (controleSinistros1 != null)
- {
- ControleSinistro controleSinistro1 = controleSinistros1.LastOrDefault<ControleSinistro>();
- if (controleSinistro1 != null)
- {
- List<Sinistro> sinistros2 = controleSinistro1.get_Sinistros();
- if (sinistros2 != null)
- {
- Sinistro sinistro1 = sinistros2.LastOrDefault<Sinistro>();
- 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] = "</p></td><td bgcolor='";
- str108 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays34[6] = str108;
- strArrays34[7] = "'><p align='left'><b>DATA: </b>";
- strArrays34[8] = str388;
- strArrays34[9] = "</p></td><td bgcolor='";
- str109 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays34[10] = str109;
- strArrays34[11] = "'><p align='left'><b>VALOR: </b>";
- Item item4 = item;
- if (item4 != null)
- {
- IList<ControleSinistro> controleSinistros2 = item4.get_Sinistros();
- if (controleSinistros2 != null)
- {
- ControleSinistro controleSinistro2 = controleSinistros2.LastOrDefault<ControleSinistro>();
- if (controleSinistro2 != null)
- {
- List<Sinistro> sinistros3 = controleSinistro2.get_Sinistros();
- if (sinistros3 != null)
- {
- Sinistro sinistro2 = sinistros3.LastOrDefault<Sinistro>();
- if (sinistro2 != null)
- {
- currency = ValidationHelper.ToCurrency<decimal>(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] = "</p></td><td bgcolor='";
- str110 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays34[14] = str110;
- strArrays34[15] = "' colspan='3'><p align='left'><b>QTDE SINISTRO(S): </b>";
- numeroParcela = item.get_Sinistros().Count;
- strArrays34[16] = numeroParcela.ToString();
- strArrays34[17] = "</p></td>";
- str371 = string.Concat(strArrays34);
- }
- str371 = string.Concat(str371, "</tr>");
- if (this.SelectedTipoExtrato != 2)
- {
- string[] strArrays35 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null, null, null, null, null };
- numeroParcela = num10 + 1;
- num10 = numeroParcela;
- str80 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays35[2] = str80;
- strArrays35[3] = "' colspan='3'><p align='left'><b>STATUS: </b>";
- str81 = (string.IsNullOrWhiteSpace(item.get_Status()) ? item.get_StatusInclusao() : item.get_Status());
- strArrays35[4] = str81;
- strArrays35[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str82 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays35[6] = str82;
- strArrays35[7] = "'><p align='left'><b>ATIVO: </b>";
- str83 = (!item.get_Substituido().HasValue ? "SIM" : "NÃO");
- strArrays35[8] = str83;
- strArrays35[9] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null, null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str84 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays36[2] = str84;
- strArrays36[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str85 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Item().get_Observacao()) ? "-" : item.get_Patrimonial().get_Item().get_Observacao());
- strArrays36[4] = str85;
- strArrays36[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str86 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays36[6] = str86;
- strArrays36[7] = "' colspan='3'><p align='left'><b>BENS E INFORMAÇÕES: </b>";
- str87 = (string.IsNullOrWhiteSpace(item.get_Patrimonial().get_Bens()) ? "-" : item.get_Patrimonial().get_Bens());
- strArrays36[8] = str87;
- strArrays36[9] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null };
- str88 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays37[2] = str88;
- strArrays37[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str89 = (string.IsNullOrWhiteSpace(item.get_RiscosDiversos().get_Observacao()) ? "-" : item.get_RiscosDiversos().get_Observacao());
- strArrays37[4] = str89;
- strArrays37[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays37);
- break;
- }
- case 4:
- case 36:
- {
- if (this.ObsItem && this.ObsItemEnabled)
- {
- string[] strArrays38 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str100 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays38[2] = str100;
- strArrays38[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str101 = (string.IsNullOrWhiteSpace(item.get_Auto().get_Observacao()) ? "-" : item.get_Auto().get_Observacao());
- strArrays38[4] = str101;
- strArrays38[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays38);
- }
- string[] strArrays39 = new string[30];
- strArrays39[0] = str371;
- strArrays39[1] = "<tr><td bgcolor='";
- str90 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays39[2] = str90;
- strArrays39[3] = "' colspan='3'><p align='left'><b>COBERTURA PADRÃO: </b>";
- tipoCobertura = item.get_Auto().get_TipoCobertura();
- if (tipoCobertura.HasValue)
- {
- description = ValidationHelper.GetDescription(tipoCobertura.GetValueOrDefault());
- }
- else
- {
- description = null;
- }
- strArrays39[4] = description;
- strArrays39[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str91 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays39[6] = str91;
- strArrays39[7] = "'><p align='left'><b>BÔNUS: </b>";
- bonus = item.get_Auto().get_Bonus();
- strArrays39[8] = bonus.ToString();
- strArrays39[9] = "</p></td></tr><tr><td bgcolor='";
- str92 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays39[10] = str92;
- strArrays39[11] = "'colspan='2'><p align='left'><b>REGIÃO DE CIRCULAÇÃO: </b>";
- str93 = (string.IsNullOrWhiteSpace(item.get_Auto().get_RegiaoCirculacao()) ? "-" : item.get_Auto().get_RegiaoCirculacao());
- strArrays39[12] = str93;
- strArrays39[13] = "</p></td><td bgcolor='";
- str94 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays39[14] = str94;
- strArrays39[15] = "'><p align='left'><b>TABELA DE REFERÊNCIA: </b>";
- tabelaReferencia = item.get_Auto().get_TabelaReferencia();
- if (tabelaReferencia.HasValue)
- {
- description1 = ValidationHelper.GetDescription(tabelaReferencia.GetValueOrDefault());
- }
- else
- {
- description1 = null;
- }
- strArrays39[16] = description1;
- strArrays39[17] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str95 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays39[18] = str95;
- strArrays39[19] = "'><p align='left'><b>% DE REFERÊNCIA: </b>";
- strArrays39[20] = string.Format("{0}%", item.get_Auto().get_PorcentagemReferencia());
- strArrays39[21] = "</p></td></tr><tr><td bgcolor='";
- str96 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays39[22] = str96;
- strArrays39[23] = "' colspan='3'><p align='left'><b>CÓDIGO FIPE: </b>";
- str97 = (string.IsNullOrWhiteSpace(item.get_Auto().get_Fipe()) ? "-" : item.get_Auto().get_Fipe());
- strArrays39[24] = str97;
- strArrays39[25] = "</p></td><td bgcolor='";
- str98 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays39[26] = str98;
- strArrays39[27] = "'><p align='left'><b>COR DO VEÍCULO: </b>";
- str99 = (!item.get_Auto().get_Cor().HasValue ? "-" : ValidationHelper.GetDescription(item.get_Auto().get_Cor()));
- strArrays39[28] = str99;
- strArrays39[29] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", str102, "' colspan='3'><p align='left'><b>BENEFICIÁRIOS: </b>");
- 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, "</p></td></tr>");
- 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, "<tr><td bgcolor='", null, null, null, null };
- str103 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays40[2] = str103;
- strArrays40[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str104 = (string.IsNullOrWhiteSpace(item.get_Aeronautico().get_Observacao()) ? "-" : item.get_Aeronautico().get_Observacao());
- strArrays40[4] = str104;
- strArrays40[5] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null };
- str105 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays41[2] = str105;
- strArrays41[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str106 = (string.IsNullOrWhiteSpace(item.get_Granizo().get_Observacao()) ? "-" : item.get_Granizo().get_Observacao());
- strArrays41[4] = str106;
- strArrays41[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays41);
- break;
- }
- }
- }
- else
- {
- }
- }
- str371 = string.Concat(str371, "</font></table>");
- if (this.SelectedTipoExtrato != 2)
- {
- ObservableCollection<Cobertura> observableCollection5 = await (new ItemServico()).BuscarCoberturasPorItemAsync(item.get_Id());
- if (observableCollection5.Count > 0 && this.Coberturas)
- {
- str371 = string.Concat(str371, "<br><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>COBERTURA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>FRANQUIA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>L.M.I.</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='center'>PRÊMIO</div></b></p></td></tr>");
- foreach (Cobertura cobertura in observableCollection5)
- {
- string[] strArrays42 = new string[] { str371, "<tr><td bgcolor='White'><p align='left'><div align='center'>", cobertura.get_Observacao(), "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>", string.Format("{0:c}", cobertura.get_Franquia()), "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>", string.Format("{0:c}", cobertura.get_Lmi()), "</div></p></td><td bgcolor='White'><p align='left'><div align='center'>", string.Format("{0:c}", cobertura.get_Premio()), "</div></p></td></tr>" };
- str371 = string.Concat(strArrays42);
- }
- str371 = string.Concat(str371, "</font></table>");
- }
- string str391 = str371;
- str79 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "</div>");
- str371 = string.Concat(str391, str79);
- }
- if (this.SelectedTipoExtrato != 2)
- {
- num10 = 0;
- }
- }
- }
- else
- {
- str371 = string.Concat(str371, "<br><p align='center'><b>ESTA APÓLICE NÃO POSSUI ITENS</b></p>");
- }
- list = null;
- }
- else
- {
- variable9 = null;
- return;
- }
- }
- else
- {
- bool flag3 = documento3.get_Controle().get_Cliente().get_PessoaFisica();
- if ((!this.Endossos || !this.SomenteEndossos) && !nums.Any<long>((long x) => x == this.documento.get_Controle().get_Id()))
- {
- string[] strArrays43 = new string[] { str371, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='", null, null, null, null, null, null };
- str332 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays43[2] = str332;
- strArrays43[3] = "' ";
- strArrays43[4] = (flag3 ? "" : "colspan='2'");
- strArrays43[5] = "><p align='left'><b>CLIENTE: </b>";
- strArrays43[6] = documento3.get_Controle().get_Cliente().get_Nome();
- strArrays43[7] = "</p></td>";
- str371 = string.Concat(strArrays43);
- if (flag3)
- {
- string[] strArrays44 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str357 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays44[2] = str357;
- strArrays44[3] = "'><p align='left' x-ms-format-detection='none'><b>RG: </b>";
- str358 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-");
- strArrays44[4] = str358;
- strArrays44[5] = "</p></td>";
- str371 = string.Concat(strArrays44);
- }
- string[] documento7 = new string[] { str371, "<td width='222' bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str333 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- documento7[2] = str333;
- documento7[3] = "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>";
- documento7[4] = documento3.get_Controle().get_Cliente().get_Documento();
- documento7[5] = "</p></td></tr>";
- 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, "<tr><td width='222' bgcolor='", null, null, null, null, null, null, null, null };
- str352 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays45[2] = str352;
- strArrays45[3] = "' ";
- strArrays45[4] = (flag3 ? "" : "colspan='2'");
- strArrays45[5] = "><p align='left'><b>";
- strArrays45[6] = str392;
- strArrays45[7] = ": ";
- clienteDesde = documento3.get_Controle().get_Cliente().get_Nascimento();
- if (clienteDesde.HasValue)
- {
- shortDateString17 = clienteDesde.GetValueOrDefault().ToShortDateString();
- }
- else
- {
- shortDateString17 = null;
- }
- strArrays45[8] = shortDateString17;
- strArrays45[9] = "</b></p>";
- str371 = string.Concat(strArrays45);
- if (!flag3)
- {
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- }
- else
- {
- string[] strArrays46 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null, null, null };
- str353 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays46[2] = str353;
- strArrays46[3] = "'colspan='2'><p align='left'><b>ESTADO CIVIL: </b>";
- 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] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str355 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays46[6] = str355;
- strArrays46[7] = "' colspan='2'><p align='left'><b>SEXO: </b>";
- 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] = "</p></td></td></tr>";
- str371 = string.Concat(strArrays46);
- }
- }
- if (this.SelectedTipoExtrato != 2)
- {
- string[] strArrays47 = new string[18];
- strArrays47[0] = str371;
- strArrays47[1] = "<tr><td bgcolor='";
- str343 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays47[2] = str343;
- strArrays47[3] = "'><p align='left'><b>BANCO: </b>";
- str344 = (documento3.get_Controle().get_Cliente().get_Banco() != null ? documento3.get_Controle().get_Cliente().get_Banco().get_Nome() : "-");
- strArrays47[4] = str344;
- strArrays47[5] = "</p></td><td bgcolor='";
- str345 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays47[6] = str345;
- strArrays47[7] = "'><p align='left' x-ms-format-detection='none'><b>AGÊNCIA: </b>";
- str346 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Agencia()) ? documento3.get_Controle().get_Cliente().get_Agencia() : "-");
- strArrays47[8] = str346;
- strArrays47[9] = "</p></td><td bgcolor='";
- str347 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays47[10] = str347;
- strArrays47[11] = "'><p align='left' x-ms-format-detection='none'><b>CONTA: </b>";
- str348 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Conta()) ? documento3.get_Controle().get_Cliente().get_Conta() : "-");
- strArrays47[12] = str348;
- strArrays47[13] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str349 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays47[14] = str349;
- strArrays47[15] = "'><p align='left' x-ms-format-detection='none'><b>TIPO: </b>";
- str350 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_TipoConta()) ? documento3.get_Controle().get_Cliente().get_TipoConta() : "-");
- strArrays47[16] = str350;
- strArrays47[17] = "</p></td></tr>";
- str371 = string.Concat(strArrays47);
- }
- if (this.SelectedTipoExtrato != 2)
- {
- str371 = string.Concat(str371, "<tr>");
- 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, "<br>", 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, "<td bgcolor='", null, null, null, null };
- str335 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays48[2] = str335;
- strArrays48[3] = "' ><p align='left'><b>CONTATOS: </b>";
- str336 = (string.IsNullOrEmpty(str393) ? "-" : str393);
- strArrays48[4] = str336;
- strArrays48[5] = "</p></td>";
- 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, "<br>", clienteEmail1.get_Email());
- }
- }
- string[] strArrays49 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str337 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays49[2] = str337;
- strArrays49[3] = "'><p align='left'><b>EMAILS: </b>";
- str338 = (string.IsNullOrEmpty(str394) ? "-" : str394);
- strArrays49[4] = str338;
- strArrays49[5] = "</p></td>";
- 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, "<br>", 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, "<td bgcolor='", null, null, null, null };
- str339 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays50[2] = str339;
- strArrays50[3] = "' colspan='2'><p align='left'><b>ENDEREÇOS: </b>";
- str340 = (string.IsNullOrEmpty(str395) ? "-" : str395);
- strArrays50[4] = str340;
- strArrays50[5] = "</p></td>";
- str371 = string.Concat(strArrays50);
- str371 = string.Concat(str371, "</tr>");
- }
- str371 = string.Concat(str371, "</font></table>");
- string str396 = str371;
- str334 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "</div>");
- str371 = string.Concat(str396, str334);
- }
- else
- {
- string[] documento8 = new string[14];
- documento8[0] = str371;
- documento8[1] = "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='";
- str240 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- documento8[2] = str240;
- documento8[3] = "'><p align='left'><b>CLIENTE: </b>";
- documento8[4] = documento3.get_Controle().get_Cliente().get_Nome();
- documento8[5] = "</p></td><td bgcolor='";
- str241 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- documento8[6] = str241;
- documento8[7] = "'><p align='left' x-ms-format-detection='none'><b>RG: </b>";
- str242 = (!string.IsNullOrWhiteSpace(documento3.get_Controle().get_Cliente().get_Identidade()) ? documento3.get_Controle().get_Cliente().get_Identidade() : "-");
- documento8[8] = str242;
- documento8[9] = "</p></td><td width='222' bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str243 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- documento8[10] = str243;
- documento8[11] = "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>";
- documento8[12] = documento3.get_Controle().get_Cliente().get_Documento();
- documento8[13] = "</p></td></tr></font></table>";
- str371 = string.Concat(documento8);
- }
- if (this.SelectedTipoExtrato != null)
- {
- num10 = 0;
- IList<Documento> documentos2 = documento3.get_Controle().get_Documentos();
- if (documentos2 != null)
- {
- documento = documentos2.LastOrDefault<Documento>((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] = "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='";
- str244 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString19[2] = str244;
- shortDateString19[3] = "'><p align='left'><b>RAMO: </b>";
- shortDateString19[4] = documento3.get_Controle().get_Ramo().get_Nome();
- shortDateString19[5] = "</p></td><td bgcolor='";
- str245 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString19[6] = str245;
- shortDateString19[7] = "'><p align='left' x-ms-format-detection='none'><b>VIGÊNCIA INICIAL: </b>";
- date = documento3.get_Vigencia1();
- shortDateString19[8] = date.ToShortDateString();
- shortDateString19[9] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str246 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString19[10] = str246;
- shortDateString19[11] = "'><p align='left'><b>VIGÊNCIA FINAL: </b>";
- 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] = "</p></td></tr><tr><td bgcolor='";
- str247 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString19[14] = str247;
- shortDateString19[15] = "'><p align='left'><b>CONTRATO: </b>";
- str248 = (string.IsNullOrWhiteSpace(documento3.get_Apolice()) ? "-" : documento3.get_Apolice());
- shortDateString19[16] = str248;
- shortDateString19[17] = "</p></td><td bgcolor='";
- str249 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString19[18] = str249;
- shortDateString19[19] = "'><p align='left'><b>POSSUI ENDOSSO? </b>";
- str250 = (documento3.get_TemEndosso() ? "SIM" : "NÃO");
- shortDateString19[20] = str250;
- shortDateString19[21] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str251 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- shortDateString19[22] = str251;
- shortDateString19[23] = "'><p align='left' x-ms-format-detection='none'><b>ADITAMENTO: </b>";
- if (string.IsNullOrWhiteSpace(documento3.get_Endosso()))
- {
- endosso1 = (!flag || documento9 == null ? "-" : documento9.get_Endosso());
- }
- else
- {
- endosso1 = documento3.get_Endosso();
- }
- shortDateString19[24] = endosso1;
- shortDateString19[25] = "</p></td></tr><tr>";
- 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, "<td bgcolor='", null, null, null, null, null, null, null, null };
- str330 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description9[2] = str330;
- description9[3] = "'><p align='left'><b>NEGÓCIO CORRETORA: </b>";
- description9[4] = ValidationHelper.GetDescription(documento3.get_NegocioCorretora());
- description9[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str331 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description9[6] = str331;
- description9[7] = "' colspan='2'><p align='left'><b>STATUS DO SEGURO: </b>";
- description9[8] = ValidationHelper.GetDescription(documento3.get_Situacao());
- description9[9] = "</p></td>";
- str371 = string.Concat(description9);
- }
- string[] strArrays51 = new string[] { str371, "</tr><tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str252 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays51[2] = str252;
- strArrays51[3] = "' colspan='3'><p align='left'><b>VENDEDOR: </b>";
- str253 = (documento3.get_VendedorPrincipal() == null ? "-" : documento3.get_VendedorPrincipal().get_Nome());
- strArrays51[4] = str253;
- strArrays51[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays51);
- if (this.SelectedTipoExtrato != 2)
- {
- str371 = string.Concat(str371, "<tr>");
- 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, "<td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str328 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays52[2] = str328;
- strArrays52[3] = "' colspan='3'><p align='left'><b>ESTIPULANTE(S): </b>";
- str329 = (string.IsNullOrWhiteSpace(str397) ? "-" : str397);
- strArrays52[4] = str329;
- strArrays52[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays52);
- }
- if (this.SelectedTipoExtrato == 2)
- {
- string[] strArrays53 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str254 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays53[2] = str254;
- strArrays53[3] = "' colspan='3'><p align='left'><b>SEGURADORA: </b>";
- strArrays53[4] = documento3.get_Controle().get_Seguradora().get_Nome();
- strArrays53[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays53);
- }
- else
- {
- string[] strArrays54 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null, null, null, null, null };
- str325 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays54[2] = str325;
- strArrays54[3] = "' colspan='2'><p align='left'><b>SEGURADORA: </b>";
- strArrays54[4] = documento3.get_Controle().get_Seguradora().get_Nome();
- strArrays54[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str326 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays54[6] = str326;
- strArrays54[7] = "'><p align='left'><b>APÓLICE SINISTRADA: </b>";
- str327 = (documento3.get_Sinistro() ? "SIM" : "NÃO");
- strArrays54[8] = str327;
- strArrays54[9] = "</p></td></tr>";
- str371 = string.Concat(strArrays54);
- }
- string[] description10 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str255 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description10[2] = str255;
- description10[3] = "' colspan='3'><p align='left'><b>FORMA PAGAMENTO: </b>";
- description10[4] = ValidationHelper.GetDescription(documento3.get_FormaPagamento());
- description10[5] = "</p></td></tr>";
- str371 = string.Concat(description10);
- str371 = string.Concat(str371, "</font></table>");
- if (this.PremioParcela || this.ExtratoResumido)
- {
- str371 = string.Concat(str371, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr>");
- if (this.ComissaoDocumento && this.ComissaoDocumentoEnabled || this.ExtratoResumido)
- {
- string[] strArrays55 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str324 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays55[2] = str324;
- strArrays55[3] = "'><p align='left'><b>COMISSÃO: </b>";
- strArrays55[4] = string.Format("{0:n2}%", Math.Round(documento3.get_Comissao(), 2));
- strArrays55[5] = "</p></td>";
- str371 = string.Concat(strArrays55);
- }
- string[] strArrays56 = new string[26];
- strArrays56[0] = str371;
- strArrays56[1] = "<td bgcolor='";
- str256 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays56[2] = str256;
- strArrays56[3] = "'><p align='left'><b>PRÊMIO LÍQUIDO: </b>";
- strArrays56[4] = string.Format("{0:c}", Math.Round(documento3.get_PremioLiquido(), 2));
- strArrays56[5] = "</p></td><td bgcolor='";
- str257 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays56[6] = str257;
- strArrays56[7] = "'><p align='left'><b>ADICIONAL: </b>";
- strArrays56[8] = string.Format("{0:c}", Math.Round(documento3.get_PremioAdicional(), 2));
- strArrays56[9] = "</p></td><td bgcolor='";
- str258 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays56[10] = str258;
- strArrays56[11] = "'><p align='left'><b>CUSTO APÓLICE: </b>";
- strArrays56[12] = string.Format("{0:c}", Math.Round(documento3.get_Custo(), 2));
- strArrays56[13] = "</p></td><td bgcolor='";
- str259 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays56[14] = str259;
- strArrays56[15] = "'><p align='left'><b>I.O.F.: </b>";
- strArrays56[16] = string.Format("{0:c}", Math.Round(documento3.get_Iof(), 2));
- strArrays56[17] = "</p></td><td bgcolor='";
- str260 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays56[18] = str260;
- strArrays56[19] = "'><p align='left'><b>PRÊMIO TOTAL: </b>";
- strArrays56[20] = string.Format("{0:c}", Math.Round(documento3.get_PremioTotal(), 2));
- strArrays56[21] = "</p></td><td bgcolor='";
- str261 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays56[22] = str261;
- strArrays56[23] = "'><p align='left'><b>Nº PARCELAS: </b>";
- premioLiquido = documento3.get_NumeroParcelas();
- strArrays56[24] = premioLiquido.ToString();
- strArrays56[25] = "</p></td></tr>";
- str371 = string.Concat(strArrays56);
- str371 = string.Concat(str371, "</font></table>");
- }
- if (this.PerfilCondutor && this.PerfilVisibility && documento3.get_Controle().get_Ramo().get_Id() == (long)5 && this.PerfilCondutorEnabled)
- {
- List<Perfil> perfils1 = perfils.ToList<Perfil>();
- foreach (Perfil perfil1 in perfils1)
- {
- num10 = 0;
- if (string.IsNullOrEmpty(perfil1.get_Nome()))
- {
- continue;
- }
- string[] description11 = new string[60];
- description11[0] = str371;
- description11[1] = "<hr style='width:999; border-top: 2px solid #ccc'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='";
- str299 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[2] = str299;
- description11[3] = "'><p align='left'><b>";
- description11[4] = string.Format("CONDUTOR {0}: ", perfils1.IndexOf(perfil1) + 1);
- description11[5] = "</b>";
- description11[6] = perfil1.get_Nome();
- description11[7] = "</p></td><td bgcolor='";
- str300 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[8] = str300;
- description11[9] = "'><p align='left' x-ms-format-detection='none'><b>CPF: </b>";
- str301 = (string.IsNullOrWhiteSpace(perfil1.get_Cpf()) ? "-" : perfil1.get_Cpf());
- description11[10] = str301;
- description11[11] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str302 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description11[12] = str302;
- description11[13] = "'><p align='left'><b>NASCIMENTO: </b>";
- 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] = "</p></td></tr><tr><td bgcolor='";
- str303 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[16] = str303;
- description11[17] = "'><p align='left'><b>ESTADO CIVIL: </b>";
- str304 = (!perfil1.get_EstadoCivil().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_EstadoCivil()));
- description11[18] = str304;
- description11[19] = "</p></td><td bgcolor='";
- str305 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[20] = str305;
- description11[21] = "'><p align='left'><b>SEXO: </b>";
- str306 = (!perfil1.get_Sexo().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_Sexo()));
- description11[22] = str306;
- description11[23] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str307 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description11[24] = str307;
- description11[25] = "'><p align='left'><b>RELAÇÃO SEGURADO/CONDUTOR: </b>";
- description11[26] = ValidationHelper.GetDescription(perfil1.get_Relacao());
- description11[27] = "</p></td></tr><tr><td bgcolor='";
- str308 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[28] = str308;
- description11[29] = "'><p align='left'><b>GARAGEM NA RESIDÊNCIA: </b>";
- str309 = (!perfil1.get_GaragemResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemResidencia()));
- description11[30] = str309;
- description11[31] = "</p></td><td bgcolor='";
- str310 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[32] = str310;
- description11[33] = "'><p align='left'><b>GARAGEM NO TRABALHO: </b>";
- str311 = (!perfil1.get_GaragemTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemTrabalho()));
- description11[34] = str311;
- description11[35] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str312 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description11[36] = str312;
- description11[37] = "'><p align='left'><b>GARAGEM NO ESTUDO: </b>";
- str313 = (!perfil1.get_GaragemEstudo().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_GaragemEstudo()));
- description11[38] = str313;
- description11[39] = "</p></td></tr><tr><td bgcolor='";
- str314 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[40] = str314;
- description11[41] = "'><p align='left'><b>TIPO DE RESIDÊNCIA: </b>";
- str315 = (!perfil1.get_TipoResidencia().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_TipoResidencia()));
- description11[42] = str315;
- description11[43] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str316 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description11[44] = str316;
- description11[45] = "' colspan='2'><p align='left'><b>DISTÂNCIA ATÉ O TRABALHO: </b>";
- str317 = (!perfil1.get_DistanciaResidenciaTrabalho().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_DistanciaResidenciaTrabalho()));
- description11[46] = str317;
- description11[47] = "</p></td></tr><tr><td bgcolor='";
- str318 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[48] = str318;
- description11[49] = "' colspan='2'><p align='left'><b>USO PROFISSIONAL: </b>";
- str319 = (!perfil1.get_UsoProfissional().HasValue || !perfil1.get_UsoProfissional().Value ? "NÃO" : "SIM");
- description11[50] = str319;
- description11[51] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str320 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- description11[52] = str320;
- description11[53] = "'><p align='left'><b>USO POR DEPENDENTES: </b>";
- str321 = (!perfil1.get_UsoDependentes().HasValue ? "-" : ValidationHelper.GetDescription(perfil1.get_UsoDependentes()));
- description11[54] = str321;
- description11[55] = "</p></td></tr><tr><td bgcolor='";
- str322 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- description11[56] = str322;
- description11[57] = "' colspan='3'><p align='left'><b>ISENÇÃO DE IMPOSTOS: </b>";
- str323 = (!perfil1.get_Isencao().HasValue || !perfil1.get_Isencao().Value ? "NÃO" : "SIM");
- description11[58] = str323;
- description11[59] = "</p></td></tr></font></table>";
- str371 = string.Concat(description11);
- }
- }
- list = items1.ToList<Item>();
- 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 ? "" : "<div style='page-break-before:always;'>");
- str371 = string.Concat(str398, str262);
- string str399 = str371;
- str263 = (this.SelectedTipoExtrato != 2 || list.IndexOf(item5) == 0 ? "<br>" : "");
- str371 = string.Concat(str399, str263);
- str371 = string.Concat(str371, "<table border='1' bordercolor='#ededed' width='999'>");
- str371 = string.Concat(str371, "<style> td > p { margin: 2px; }</style>");
- str371 = string.Concat(str371, "<font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr>");
- 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] = "<td bgcolor='";
- str264 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- estado1[2] = str264;
- estado1[3] = "' colspan='4'><p align='left'><b>";
- estado1[4] = string.Format("ITEM {0}: ", item5.get_Ordem());
- estado1[5] = "</b>";
- 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] = "</p></td>";
- str371 = string.Concat(estado1);
- }
- else
- {
- string[] descricao3 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null };
- str298 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- descricao3[2] = str298;
- descricao3[3] = "'><p align='left'><b>";
- descricao3[4] = string.Format("ITEM {0}: ", item5.get_Ordem());
- descricao3[5] = "</b>";
- descricao3[6] = item5.get_Descricao();
- descricao3[7] = "</p></td>";
- str371 = string.Concat(descricao3);
- }
- Label10:
- if (item5.get_Sinistros().Count > 0)
- {
- Item item6 = item5;
- if (item6 != null)
- {
- IList<ControleSinistro> controleSinistros3 = item6.get_Sinistros();
- if (controleSinistros3 != null)
- {
- ControleSinistro controleSinistro3 = controleSinistros3.LastOrDefault<ControleSinistro>();
- if (controleSinistro3 != null)
- {
- List<Sinistro> sinistros4 = controleSinistro3.get_Sinistros();
- if (sinistros4 != null)
- {
- Sinistro sinistro5 = sinistros4.LastOrDefault<Sinistro>();
- 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] = "</tr><td bgcolor='";
- numeroParcela = num10 + 1;
- num10 = numeroParcela;
- str292 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- currency1[2] = str292;
- currency1[3] = "' colspan='2'><p align='left'><b>SINISTRO STATUS: </b>";
- currency1[4] = ValidationHelper.GetDescription(item5.get_Sinistros().LastOrDefault<ControleSinistro>().get_Sinistros().LastOrDefault<Sinistro>().get_StatusSinistro());
- currency1[5] = "</p></td><td bgcolor='";
- str293 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- currency1[6] = str293;
- currency1[7] = "'><p align='left'><b>DATA: </b>";
- currency1[8] = str400;
- currency1[9] = "</p></td><td bgcolor='";
- str294 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- currency1[10] = str294;
- currency1[11] = "'><p align='left'><b>VALOR: </b>";
- currency1[12] = ValidationHelper.ToCurrency<decimal>(item5.get_Sinistros().LastOrDefault<ControleSinistro>().get_Sinistros().LastOrDefault<Sinistro>().get_Valor(), "pt-BR");
- currency1[13] = "</p></td>";
- str371 = string.Concat(currency1);
- }
- str371 = string.Concat(str371, "</tr>");
- if (this.SelectedTipoExtrato != 2)
- {
- string[] strArrays57 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10 + 1;
- num10 = numeroParcela;
- str271 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays57[2] = str271;
- strArrays57[3] = "' colspan='4'><p align='left'><b>ATIVO: </b>";
- str272 = (!item5.get_Substituido().HasValue ? "SIM" : "NÃO");
- strArrays57[4] = str272;
- strArrays57[5] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str273 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays58[2] = str273;
- strArrays58[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str274 = (string.IsNullOrWhiteSpace(item5.get_Patrimonial().get_Bens()) ? "-" : item5.get_Patrimonial().get_Bens());
- strArrays58[4] = str274;
- strArrays58[5] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null };
- str275 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays59[2] = str275;
- strArrays59[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str276 = (string.IsNullOrWhiteSpace(item5.get_RiscosDiversos().get_Observacao()) ? "-" : item5.get_RiscosDiversos().get_Observacao());
- strArrays59[4] = str276;
- strArrays59[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays59);
- break;
- }
- case 4:
- case 36:
- {
- if (this.ObsItem && this.ObsItemEnabled)
- {
- string[] strArrays60 = new string[] { str371, "<tr><td bgcolor='", null, null, null, null };
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str285 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays60[2] = str285;
- strArrays60[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str286 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_Observacao()) ? "-" : item5.get_Auto().get_Observacao());
- strArrays60[4] = str286;
- strArrays60[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays60);
- }
- string[] strArrays61 = new string[26];
- strArrays61[0] = str371;
- strArrays61[1] = "<tr><td bgcolor='";
- numeroParcela = num10 + 1;
- num10 = numeroParcela;
- str277 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays61[2] = str277;
- strArrays61[3] = "' colspan='2'><p align='left'><b>COBERTURA PADRÃO: </b>";
- tipoCobertura = item5.get_Auto().get_TipoCobertura();
- if (tipoCobertura.HasValue)
- {
- description3 = ValidationHelper.GetDescription(tipoCobertura.GetValueOrDefault());
- }
- else
- {
- description3 = null;
- }
- strArrays61[4] = description3;
- strArrays61[5] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str278 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays61[6] = str278;
- strArrays61[7] = "' colspan='2'><p align='left'><b>BÔNUS: </b>";
- bonus = item5.get_Auto().get_Bonus();
- strArrays61[8] = bonus.ToString();
- strArrays61[9] = "</p></td></tr><tr><td bgcolor='";
- str279 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays61[10] = str279;
- strArrays61[11] = "'><p align='left'><b>REGIÃO DE CIRCULAÇÃO: </b>";
- str280 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_RegiaoCirculacao()) ? "-" : item5.get_Auto().get_RegiaoCirculacao());
- strArrays61[12] = str280;
- strArrays61[13] = "</p></td><td bgcolor='";
- str281 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays61[14] = str281;
- strArrays61[15] = "'><p align='left'><b>TABELA DE REFERÊNCIA: </b>";
- tabelaReferencia = item5.get_Auto().get_TabelaReferencia();
- if (tabelaReferencia.HasValue)
- {
- description4 = ValidationHelper.GetDescription(tabelaReferencia.GetValueOrDefault());
- }
- else
- {
- description4 = null;
- }
- strArrays61[16] = description4;
- strArrays61[17] = "</p></td><td bgcolor='";
- str282 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays61[18] = str282;
- strArrays61[19] = "'><p align='left'><b>FIPE: </b>";
- str283 = (string.IsNullOrWhiteSpace(item5.get_Auto().get_Fipe()) ? "-" : item5.get_Auto().get_Fipe());
- strArrays61[20] = str283;
- strArrays61[21] = "</p></td><td bgcolor='";
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- str284 = (numeroParcela % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays61[22] = str284;
- strArrays61[23] = "'><p align='left'><b>% DE REFERÊNCIA: </b>";
- strArrays61[24] = string.Format("{0}%", item5.get_Auto().get_PorcentagemReferencia());
- strArrays61[25] = "</p></td></tr></tr>";
- 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, "<tr><td bgcolor='", str287, "' colspan='3'><p align='left'><b>BENEFICIÁRIOS: </b>");
- 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, "</p></td></tr>");
- 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, "<tr><td bgcolor='", null, null, null, null };
- str288 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays62[2] = str288;
- strArrays62[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str289 = (string.IsNullOrWhiteSpace(item5.get_Aeronautico().get_Observacao()) ? "-" : item5.get_Aeronautico().get_Observacao());
- strArrays62[4] = str289;
- strArrays62[5] = "</p></td></tr>";
- 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, "<tr><td bgcolor='", null, null, null, null };
- str290 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays63[2] = str290;
- strArrays63[3] = "' colspan='3'><p align='left'><b>OBSERVAÇÕES: </b>";
- str291 = (string.IsNullOrWhiteSpace(item5.get_Granizo().get_Observacao()) ? "-" : item5.get_Granizo().get_Observacao());
- strArrays63[4] = str291;
- strArrays63[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays63);
- break;
- }
- }
- }
- else
- {
- }
- }
- str371 = string.Concat(str371, "</font></table>");
- if (this.SelectedTipoExtrato != 2)
- {
- ObservableCollection<Cobertura> observableCollection6 = await (new ItemServico()).BuscarCoberturasPorItemAsync(item5.get_Id());
- if (observableCollection6.Count > 0 && this.Coberturas)
- {
- str371 = string.Concat(str371, "<br><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>COBERTURA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>FRANQUIA</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>LMI</div></b></p></td><td bgcolor='WhiteSmoke'><p align='left'><b><div align='left'>PRÊMIO</div></b></p></td></tr>");
- foreach (Cobertura cobertura1 in observableCollection6)
- {
- numeroParcela = num10;
- num10 = numeroParcela + 1;
- string[] strArrays64 = new string[18];
- strArrays64[0] = str371;
- strArrays64[1] = "<tr><td bgcolor='";
- str267 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays64[2] = str267;
- strArrays64[3] = "'><p align='left'><div align='left'>";
- strArrays64[4] = cobertura1.get_Observacao();
- strArrays64[5] = "</div></p></td><td style='white-space:nowrap; bgcolor='";
- str268 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays64[6] = str268;
- strArrays64[7] = "'><p align='left'><div align='left'>";
- strArrays64[8] = string.Format("{0:c}", cobertura1.get_Franquia());
- strArrays64[9] = "</div></p></td><td style='white-space:nowrap; bgcolor='";
- str269 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays64[10] = str269;
- strArrays64[11] = "'><p align='left'><div align='left'>";
- strArrays64[12] = string.Format("{0:c}", cobertura1.get_Lmi());
- strArrays64[13] = "</div></p></td><td style='white-space:nowrap; bgcolor='";
- str270 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays64[14] = str270;
- strArrays64[15] = "'><p align='left'><div align='left'>";
- strArrays64[16] = string.Format("{0:c}", cobertura1.get_Premio());
- strArrays64[17] = "</div></p></td></tr>";
- str371 = string.Concat(strArrays64);
- }
- str371 = string.Concat(str371, "</font></table>");
- }
- string str403 = str371;
- str266 = (!this.SepararPagina || !this.SepararPaginaEnabled ? "" : "</div>");
- str371 = string.Concat(str403, str266);
- }
- if (this.SelectedTipoExtrato != 2)
- {
- num10 = 0;
- }
- }
- }
- else
- {
- str371 = string.Concat(str371, "<br><p align='center'><b>ESTA APÓLICE NÃO POSSUI ITENS</b></p>");
- }
- 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 ? "" : "<div style='page-break-before:always;'>");
- str371 = string.Concat(str404, str19);
- str371 = string.Concat(str371, "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>");
- if (this.SelectedTipoExtrato == null)
- {
- str39 = (this.ExtratoResumido ? " RESUMIDO" : "");
- str370 = string.Concat("EXTRATO", str39, " DO CLIENTE: ", prospecco.get_Nome());
- }
- str371 = string.Concat(str371, str370, "</h4></td></table><br>");
- str371 = string.Concat(str371, "<style>td > p {margin: 2px;}</style>");
- if (!this.ExtratoResumido)
- {
- string str405 = "NASCIMENTO";
- string[] documento11 = new string[16];
- documento11[0] = str371;
- documento11[1] = "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='";
- str20 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- documento11[2] = str20;
- documento11[3] = "'><p align='left'><b>CLIENTE: </b>";
- documento11[4] = prospecco.get_Nome();
- documento11[5] = "</p></td><td width='222' bgcolor='";
- str21 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- documento11[6] = str21;
- documento11[7] = "'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>";
- documento11[8] = prospecco.get_Documento();
- documento11[9] = "</p></td><td width='222' bgcolor='";
- str22 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- documento11[10] = str22;
- documento11[11] = "'><p align='left'><b>";
- documento11[12] = str405;
- documento11[13] = ": </b>";
- clienteDesde = prospecco.get_Nascimento();
- if (clienteDesde.HasValue)
- {
- shortDateString = clienteDesde.GetValueOrDefault().ToShortDateString();
- }
- else
- {
- shortDateString = null;
- }
- documento11[14] = shortDateString;
- documento11[15] = "</p></td></tr>";
- str371 = string.Concat(documento11);
- if ((prospecco.get_Telefone1() != null || prospecco.get_Email() != null) && this.SelectedTipoExtrato != 2)
- {
- str371 = string.Concat(str371, "<tr>");
- if (prospecco.get_Telefone1() != null)
- {
- string str406 = "";
- string[] prefixo1 = new string[] { str406, "<br> (", prospecco.get_Prefixo1(), ") ", prospecco.get_Telefone1() };
- str406 = string.Concat(prefixo1);
- if (prospecco.get_Telefone2() != null)
- {
- string[] prefixo2 = new string[] { str406, "<br> (", prospecco.get_Prefixo2(), ") ", prospecco.get_Telefone2() };
- str406 = string.Concat(prefixo2);
- }
- string[] strArrays65 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str28 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays65[2] = str28;
- strArrays65[3] = "' colspan='2'><p align='left'><b>CONTATOS: </b>";
- strArrays65[4] = str406;
- strArrays65[5] = "</p></td>";
- str371 = string.Concat(strArrays65);
- }
- if (prospecco.get_Email() != null && !this.ExtratoResumido)
- {
- string str407 = "";
- str407 = string.Concat(str407, "<br>", prospecco.get_Email());
- string[] strArrays66 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str27 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays66[2] = str27;
- strArrays66[3] = "' colspan='2'><p align='left'><b>EMAILS: </b>";
- strArrays66[4] = str407;
- strArrays66[5] = "</p></td>";
- str371 = string.Concat(strArrays66);
- }
- num19++;
- str371 = string.Concat(str371, "</font></tr>");
- }
- string str408 = str371;
- str23 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "</div>");
- str371 = string.Concat(str408, str23);
- if (this.SelectedTipoExtrato != null)
- {
- num19 = 0;
- string[] strArrays67 = new string[] { str371, "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='222' bgcolor='", null, null, null, null };
- int num20 = num19;
- num19 = num20 + 1;
- str24 = (num20 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays67[2] = str24;
- strArrays67[3] = "'><p align='left'><b>VIGÊNCIA FINAL: </b>";
- 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] = "</p></td></tr>";
- str371 = string.Concat(strArrays67);
- string[] strArrays68 = new string[] { str371, "</tr><tr><td bgcolor='", null, null, null, null };
- str25 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays68[2] = str25;
- strArrays68[3] = "'><p align='left'><b>VENDEDOR: </b>";
- str26 = (prospecco.get_Vendedor() == null ? "-" : prospecco.get_Vendedor().get_Nome());
- strArrays68[4] = str26;
- strArrays68[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays68);
- str371 = string.Concat(str371, "</font></table>");
- }
- else
- {
- variable9 = null;
- return;
- }
- }
- else
- {
- string[] documento12 = new string[] { str371, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='333' bgcolor='", null, null, null, null, null, null, null, null };
- str29 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- documento12[2] = str29;
- documento12[3] = "'><p align='left'><b>CLIENTE: </b>";
- documento12[4] = prospecco.get_Nome();
- documento12[5] = "</p></td><td width='222' bgcolor='";
- int num21 = num19;
- num19 = num21 + 1;
- str30 = (num21 % 2 == 0 ? "WhiteSmoke" : "White");
- documento12[6] = str30;
- documento12[7] = "' colspan='2'><p align='left' x-ms-format-detection='none'><b>CPF/CNPJ: </b>";
- documento12[8] = prospecco.get_Documento();
- documento12[9] = "</p></td></tr>";
- str371 = string.Concat(documento12);
- if (this.SelectedTipoExtrato != 2)
- {
- str371 = string.Concat(str371, "<tr>");
- string str409 = "";
- if (prospecco.get_Telefone1() != null)
- {
- string[] prefixo11 = new string[] { str409, "<br> (", prospecco.get_Prefixo1(), ") ", prospecco.get_Telefone1() };
- str409 = string.Concat(prefixo11);
- }
- if (prospecco.get_Telefone2() != null)
- {
- string[] prefixo21 = new string[] { str409, "<br> (", prospecco.get_Prefixo2(), ") ", prospecco.get_Telefone2() };
- str409 = string.Concat(prefixo21);
- }
- string[] strArrays69 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str35 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays69[2] = str35;
- strArrays69[3] = "'><p align='left'><b>CONTATOS: </b>";
- str36 = (string.IsNullOrEmpty(str409) ? "-" : str409);
- strArrays69[4] = str36;
- strArrays69[5] = "</p></td>";
- str371 = string.Concat(strArrays69);
- string str410 = "";
- if (prospecco.get_Email() != null)
- {
- str410 = string.Concat("<br>", prospecco.get_Email());
- }
- string[] strArrays70 = new string[] { str371, "<td bgcolor='", null, null, null, null };
- str37 = (num19 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays70[2] = str37;
- strArrays70[3] = "'><p align='left'><b>EMAILS: </b>";
- str38 = (string.IsNullOrEmpty(str410) ? "-" : str410);
- strArrays70[4] = str38;
- strArrays70[5] = "</p></td>";
- str371 = string.Concat(strArrays70);
- }
- str371 = string.Concat(str371, "</font></table>");
- string str411 = str371;
- str31 = (this.ClientePorPaginaVisibility != Visibility.Visible || !this.ClientePorPagina || !this.ClientePorPaginaEnabled ? "" : "</div>");
- str371 = string.Concat(str411, str31);
- if (this.SelectedTipoExtrato != null)
- {
- num19 = 0;
- string[] strArrays71 = new string[] { str371, "<hr style='width:999; border-top: 3px solid #000'><table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'><tr><td width='222' bgcolor='", null, null, null, null };
- int num22 = num19;
- num19 = num22 + 1;
- str32 = (num22 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays71[2] = str32;
- strArrays71[3] = "'><p align='left'><b>VIGÊNCIA FINAL: </b>";
- 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] = "</p></td></tr>";
- str371 = string.Concat(strArrays71);
- string[] strArrays72 = new string[] { str371, "</tr><tr><td bgcolor='", null, null, null, null };
- int num23 = num19;
- num19 = num23 + 1;
- str33 = (num23 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays72[2] = str33;
- strArrays72[3] = "' colspan='3'><p align='left'><b>VENDEDOR: </b>";
- str34 = (prospecco.get_Vendedor() == null ? "-" : prospecco.get_Vendedor().get_Nome());
- strArrays72[4] = str34;
- strArrays72[5] = "</p></td></tr>";
- str371 = string.Concat(strArrays72);
- str371 = string.Concat(str371, "</font></table>");
- }
- else
- {
- variable9 = null;
- return;
- }
- }
- }
- }
- DateTime dateTime = Funcoes.GetNetworkTime();
- string[] shortDateString20 = new string[] { str371, "<br><font face='Verdana' size='1'><br>", Recursos.Usuario.get_Nome(), " - ", null, null };
- date = dateTime.Date;
- shortDateString20[4] = date.ToShortDateString();
- shortDateString20[5] = "</font></div><script src='https://code.jquery.com/jquery-3.3.1.slim.min.js' integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo' crossorigin='anonymous'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js' integrity='sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1' crossorigin='anonymous'></script><script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous'></script></body></html>";
- 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<Documento> documentos3 = this.Documentos;
- extratosViewModel1.RegistrarAcao(str413, num24, nullable5, string.Concat("IDS DOS DOCUMENTOS:\n", string.Join<long>("\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<Prospeccao> prospeccoes = this.Prospeccoes;
- extratosViewModel2.RegistrarAcao(str414, num25, nullable6, string.Concat("IDS DOS DOCUMENTOS:\n", string.Join<long>("\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] = "<td bgcolor='";
- str111 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- modelo[2] = str111;
- modelo[3] = "' colspan='4'><p align='left'><b>";
- modelo[4] = string.Format("ITEM {0}: ", item.get_Ordem());
- modelo[5] = "</b><br>";
- 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] = ")<br>PLACA: ";
- modelo[14] = item.get_Auto().get_Placa();
- modelo[15] = ", CHASSI: ";
- modelo[16] = item.get_Auto().get_Chassi();
- modelo[17] = "<br>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] = "<br>FINANCIADO: ";
- str112 = (item.get_Auto().get_Financiado().GetValueOrDefault() ? "SIM" : "NÃO");
- modelo[24] = str112;
- modelo[25] = "</p></td>";
- str371 = string.Concat(modelo);
- goto Label9;
- Label4:
- string[] descricao4 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null, null, null };
- str113 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- descricao4[2] = str113;
- descricao4[3] = "' colspan='4'><p align='left'><b>";
- descricao4[4] = string.Format("ITEM {0}: ", item.get_Ordem());
- descricao4[5] = "</b>";
- descricao4[6] = item.get_Descricao();
- descricao4[7] = "</p>QTDE SINISTRO(S): </b>";
- numeroParcela = item.get_Sinistros().Count;
- descricao4[8] = numeroParcela.ToString();
- descricao4[9] = "</p></td>";
- 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] = "<td bgcolor='";
- str295 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- anoFabricacao[2] = str295;
- anoFabricacao[3] = "' colspan='4'><p align='left'><b>";
- anoFabricacao[4] = string.Format("ITEM {0}: ", item.get_Ordem());
- anoFabricacao[5] = "</b><br>";
- 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] = ")<br>PLACA: ";
- anoFabricacao[14] = item.get_Auto().get_Placa();
- anoFabricacao[15] = ", CHASSI: ";
- anoFabricacao[16] = item.get_Auto().get_Chassi();
- anoFabricacao[17] = "<br>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] = "<br>FINANCIADO: ";
- str296 = (item.get_Auto().get_Financiado().GetValueOrDefault() ? "SIM" : "NÃO");
- anoFabricacao[24] = str296;
- anoFabricacao[25] = "</p></td>";
- str371 = string.Concat(anoFabricacao);
- goto Label10;
- Label7:
- string[] descricao5 = new string[] { str371, "<td bgcolor='", null, null, null, null, null, null };
- str297 = (num10 % 2 == 0 ? "WhiteSmoke" : "White");
- descricao5[2] = str297;
- descricao5[3] = "' colspan='4'><p align='left'><b>";
- descricao5[4] = string.Format("ITEM {0}: ", item.get_Ordem());
- descricao5[5] = "</b>";
- descricao5[6] = item.get_Descricao();
- descricao5[7] = "</p></td>";
- 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<ClientesAtivosInativos> clientes, List<Documento> documentos, List<Prospeccao> prospeccoes, Relatorio? tipoRelatorio = null, List<long> selecionadosDoc = null, List<long> selecionadosPros = null, bool pdf = false)
- {
- ObservableCollection<ClienteEndereco> observableCollection;
- ObservableCollection<ClienteEmail> observableCollection1;
- ObservableCollection<ClienteTelefone> observableCollection2;
- ObservableCollection<MaisContato> observableCollection3;
- ObservableCollection<ClienteVinculo> observableCollection4;
- bool count;
- List<Documento> documentos1;
- bool flag;
- List<Cliente> clientes1;
- Cliente cliente;
- Cliente cliente1;
- List<Documento> 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<Documento> documentos3 = documentos;
- if (documentos3 != null)
- {
- count = documentos3.Count > 200;
- }
- else
- {
- count = false;
- }
- if (!count)
- {
- List<Prospeccao> 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<Cliente>();
- 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<Documento>();
- this.Prospeccoes = new List<Prospeccao>();
- 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<Documento>()
- {
- documento2
- } : new List<Documento>());
- List<Documento> documentos4 = documentos1;
- if (this.SomenteEndossos)
- {
- IEnumerable<Documento> documentos5 = documento2.get_Controle().get_Documentos().Where<Documento>((Documento x) => {
- if (x.get_Excluido() || x.get_Ordem() == 0)
- {
- return false;
- }
- return !documentos4.Any<Documento>((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<Documento> documentos6 = documento2.get_Controle().get_Documentos().Where<Documento>((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>((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<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 31) && documento2.get_TemEndosso())
- {
- Documento documento5 = documento2;
- IList<Documento> documentos7 = documento2.get_Controle().get_Documentos();
- IEnumerable<Documento> excluido =
- from x in documentos7
- where !x.get_Excluido()
- select x;
- documento5.set_PremioTotal(excluido.Sum<Documento>((Documento x) => x.get_PremioTotal()));
- Documento documento6 = documento2;
- IList<Documento> documentos8 = documento2.get_Controle().get_Documentos();
- IEnumerable<Documento> excluido1 =
- from x in documentos8
- where !x.get_Excluido()
- select x;
- documento6.set_Iof(excluido1.Sum<Documento>((Documento x) => x.get_Iof()));
- Documento documento7 = documento2;
- IList<Documento> documentos9 = documento2.get_Controle().get_Documentos();
- IEnumerable<Documento> excluido2 =
- from x in documentos9
- where !x.get_Excluido()
- select x;
- documento7.set_Custo(excluido2.Sum<Documento>((Documento x) => x.get_Custo()));
- Documento documento8 = documento2;
- IList<Documento> documentos10 = documento2.get_Controle().get_Documentos();
- IEnumerable<Documento> excluido3 =
- from x in documentos10
- where !x.get_Excluido()
- select x;
- documento8.set_PremioLiquido(excluido3.Sum<Documento>((Documento x) => x.get_PremioLiquido()));
- Documento documento9 = documento2;
- IList<Documento> documentos11 = documento2.get_Controle().get_Documentos();
- IEnumerable<Documento> excluido4 =
- from x in documentos11
- where !x.get_Excluido()
- select x;
- documento9.set_PremioAdicional(excluido4.Sum<Documento>((Documento x) => x.get_PremioAdicional()));
- }
- List<Documento> documentos12 = this.Documentos;
- List<Documento> documentos13 = documentos4;
- documentos12.AddRange((
- from x in documentos13
- orderby x.get_Ordem()
- select x).ToList<Documento>());
- }
- }
- 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<Item> observableCollection5 = await base.ShowSelecionarItensDialog(this.Documentos.First<Documento>().get_Controle().get_Id());
- ExtratosViewModel list = this;
- ObservableCollection<Item> observableCollection6 = observableCollection5;
- list._itensSelecionados = (
- from x in observableCollection6
- where x.get_Selecionado()
- select x).ToList<Item>();
- }
- 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<Documento>();
- ApoliceServico apoliceServico = new ApoliceServico();
- long id = documentos.First<Documento>().get_Controle().get_Cliente().get_Id();
- FiltroStatusDocumento statusSelecionado = MainViewModel.StatusSelecionado;
- List<VendedorUsuario> vendedorUsuarios = await base.VerificaVinculoVendedor(Recursos.Usuario);
- ObservableCollection<Documento> observableCollection7 = await apoliceServico.BuscarApolicesAsync(id, statusSelecionado, vendedorUsuarios);
- apoliceServico = null;
- this.Documentos = new List<Documento>(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<Cliente>();
- List<ClientesAtivosInativos> 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<Documento> documentos14 = this.Documentos;
- extratosViewModel.Documentos = documentos14.Where<Documento>((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<Documento>();
- }
- 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<Seguradora> _seguradoras;
-
- private List<Ramo> _ramos;
-
- private ObservableCollection<Imposto> _impostos = new ObservableCollection<Imposto>();
-
- private Imposto _selectedImposto = new Imposto();
-
- private Ramo _selectedRamo = new Ramo();
-
- private Seguradora _selectedSeguradora = new Seguradora();
-
- 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<Imposto> Impostos
- {
- get
- {
- return this._impostos;
- }
- set
- {
- this._impostos = value;
- base.OnPropertyChanged("Impostos");
- }
- }
-
- public List<Ramo> Ramos
- {
- get
- {
- return this._ramos;
- }
- set
- {
- this._ramos = value;
- base.OnPropertyChanged("Ramos");
- }
- }
-
- public List<Seguradora> 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>((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<Seguradora> list = Recursos.Seguradoras.Where<Seguradora>((Seguradora x) => {
- if (x.get_Ativo())
- {
- return true;
- }
- if (tipo != 0)
- {
- return false;
- }
- return x.get_Id() == id;
- }).OrderBy<Seguradora, string>((Seguradora x) => {
- if (!this.Apelido)
- {
- return x.get_Nome();
- }
- return x.get_NomeSocial();
- }).ToList<Seguradora>();
- 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<Seguradora>();
- IEnumerable<Ramo> ramos = Recursos.Ramos.Where<Ramo>((Ramo x) => {
- if (x.get_Ativo())
- {
- return true;
- }
- if (tipo != 1)
- {
- return false;
- }
- return x.get_Id() == id;
- });
- List<Ramo> list1 = (
- from x in ramos
- orderby x.get_Nome()
- select x).ToList<Ramo>();
- 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<Ramo>();
- str = (tipo == 1 ? string.Concat("O RAMO \"", this.Ramos.First<Ramo>((Ramo x) => x.get_Id() == id).get_Nome(), "\"") : string.Concat("A SEGURADORA \"", this.Seguradoras.First<Seguradora>((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<Imposto> impostos = await this.Servico.Buscar(new bool?(true));
- if (tipo == 1)
- {
- impostos = impostos.Where<Imposto>((Imposto x) => {
- if (x.get_Ramo() == null || x.get_Ramo().get_Id() != id)
- {
- return false;
- }
- return x.get_Seguradora() == null;
- }).ToList<Imposto>();
- this.SelectedRamo = this.Ramos.Find((Ramo x) => x.get_Id() == id);
- }
- else
- {
- impostos = impostos.Where<Imposto>((Imposto x) => {
- if (x.get_Seguradora() == null || x.get_Seguradora().get_Id() != id)
- {
- return false;
- }
- return x.get_Ramo() == null;
- }).ToList<Imposto>();
- this.SelectedSeguradora = this.Seguradoras.Find((Seguradora x) => x.get_Id() == id);
- }
- ImpostoViewModel observableCollection = this;
- List<Imposto> impostos1 = impostos;
- observableCollection.Impostos = new ObservableCollection<Imposto>(
- from x in impostos1
- orderby x.get_Ativo() descending
- select x);
- this.SelectedImposto = this.Impostos.FirstOrDefault<Imposto>();
- }
-
- public async Task Carregar(long id = 0L)
- {
- Imposto imposto;
- List<Imposto> list = await this.Servico.Buscar(this.Ativo);
- if (this.SelectedSeguradora.get_Id() == 0)
- {
- List<Imposto> impostos = list;
- list = (
- from x in impostos
- where x.get_Seguradora() == null
- select x).ToList<Imposto>();
- }
- if (this.SelectedSeguradora.get_Id() > (long)0)
- {
- list = list.Where<Imposto>((Imposto x) => {
- if (x.get_Seguradora() == null)
- {
- return false;
- }
- return x.get_Seguradora().get_Id() == this.SelectedSeguradora.get_Id();
- }).ToList<Imposto>();
- }
- if (this.SelectedRamo.get_Id() == 0)
- {
- List<Imposto> impostos1 = list;
- list = (
- from x in impostos1
- where x.get_Ramo() == null
- select x).ToList<Imposto>();
- }
- if (this.SelectedRamo.get_Id() > (long)0)
- {
- list = list.Where<Imposto>((Imposto x) => {
- if (x.get_Ramo() == null)
- {
- return false;
- }
- return x.get_Ramo().get_Id() == this.SelectedRamo.get_Id();
- }).ToList<Imposto>();
- }
- this.Impostos = new ObservableCollection<Imposto>(list.Where<Imposto>((Imposto x) => {
- if (!this.Ativo.HasValue)
- {
- return true;
- }
- return x.get_Ativo() == this.Ativo.Value;
- }).ToList<Imposto>());
- ImpostoViewModel impostoViewModel = this;
- imposto = (id == 0 ? this.Impostos.FirstOrDefault<Imposto>() : this.Impostos.FirstOrDefault<Imposto>((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<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- string str;
- string str1;
- string str2;
- object obj;
- string str3;
- List<KeyValuePair<string, string>> 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<KeyValuePair<string, string>>()
- {
- new KeyValuePair<string, string>("GRAVAR", "HOUVE UM ERRO AO SALVAR O IMPOSTO SELECIONADO.")
- };
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- str3 = null;
- return keyValuePairs;
- }
-
- public List<KeyValuePair<string, string>> Validate(Imposto imposto)
- {
- List<KeyValuePair<string, string>> keyValuePairs = new List<KeyValuePair<string, string>>();
- if (imposto == null)
- {
- return keyValuePairs;
- }
- if (imposto.get_Ativo() && this.Impostos.Any<Imposto>((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<string, string>("IMPOSTO DUPLICADO", "NÃO É POSSIVEL INSERIR UM NOVO PARAMETRO DE IMPOSTO, POIS JÁ EXISTEM PARAMETROS PARA A MESMA SEGURADORA E RAMO"));
- }
- return keyValuePairs.Distinct<KeyValuePair<string, string>>().ToList<KeyValuePair<string, string>>();
- }
- }
-}
\ 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<Contato> _contatos = new ObservableCollection<Contato>();
-
- private ObservableCollection<Item> _itens = new ObservableCollection<Item>();
-
- private ObservableCollection<Parcela> _parcelas = new ObservableCollection<Parcela>();
-
- 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<Contato> 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<Item> 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<Parcela> 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<Parcela> 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<Parcela> observableCollection1 = await (new ParcelaServico()).BuscarParcelasAsync(this.Documento.get_Id());
- InfoViewModel infoViewModel = this;
- if (this.Documento.get_TipoRecebimento().GetValueOrDefault() == 2)
- {
- ObservableCollection<Parcela> observableCollection2 = observableCollection1;
- observableCollection = new ObservableCollection<Parcela>(
- 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<Contato> contatos = new List<Contato>();
- ClienteServico clienteServico = new ClienteServico();
- if (this.Documento.get_Controle().get_Cliente() != null)
- {
- ObservableCollection<ClienteTelefone> observableCollection3 = await clienteServico.BuscarTelefonesAsync(this.Documento.get_Controle().get_Cliente().get_Id());
- ObservableCollection<ClienteEmail> observableCollection4 = await clienteServico.BuscarEmailsAsync(this.Documento.get_Controle().get_Cliente().get_Id());
- if (observableCollection3 != null)
- {
- List<Contato> contatos1 = contatos;
- ObservableCollection<ClienteTelefone> observableCollection5 = observableCollection3;
- contatos1.AddRange(observableCollection5.Select<ClienteTelefone, Contato>((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<Contato>(2).ToList<Contato>());
- }
- if (observableCollection4 != null)
- {
- List<Contato> contatos2 = contatos;
- ObservableCollection<ClienteEmail> observableCollection6 = observableCollection4;
- contatos2.AddRange(observableCollection6.Select<ClienteEmail, Contato>((ClienteEmail x) => {
- Contato contato = new Contato();
- contato.set_Tipo(1);
- contato.set_TipoTelefone(null);
- contato.set_Numero(x.get_Email());
- return contato;
- }).Take<Contato>(1).ToList<Contato>());
- }
- observableCollection3 = null;
- }
- this.Contatos = new ObservableCollection<Contato>(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<Filtros>(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<TipoSeguro>(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<NegocioCorretora>(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<TipoTela>(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<Gestor.Model.Common.Relatorio>(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>((FiltroTipoParcela x) => x.get_Selecionado()))
- {
- goto Label1;
- }
- string[] newLine5 = new string[] { "TIPOS DE PARCELAS FILTRADOS: ", Environment.NewLine, null, null, null };
- newLine5[2] = string.Join<SubTipo>(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<LogEmail> _logs = new ObservableCollection<LogEmail>();
-
- private LogEmail _selectedLog;
-
- private List<TupleList> _lists = new List<TupleList>();
-
- public List<TupleList> Lists
- {
- get
- {
- return this._lists;
- }
- set
- {
- this._lists = value;
- base.OnPropertyChanged("Lists");
- }
- }
-
- public ObservableCollection<LogEmail> 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>((ConfiguracaoSistema c) => c.get_Configuracao() == 55) ? Visibility.Visible : Visibility.Hidden);
- this.Seleciona(tela, id, singleMode);
- }
-
- public void Imprimir()
- {
- string str = "<html><head><style type='text/css'>@page{size: A4; margin: 0cm}</style><title>LOGS</title><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css' integrity='sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh' crossorigin='anonymous'></head><body><div align='center'><font size='5px' face='Arial' style='font-weight: 900;'>LOG ENVIO DE E-MAIL</font>";
- foreach (TupleList list in this.Lists)
- {
- foreach (Tuple<string, string, string> tuple in list.get_Tuples())
- {
- if (tuple == list.get_Tuples().First<Tuple<string, string, string>>())
- {
- str = string.Concat(str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: 240px; text-align:center;'><font size='3px' face='Arial' style='font-weight: 700'>E-MAIL ENVIADO</font></td>");
- str = string.Concat(str, "</tr></table>");
- }
- bool flag = tuple.Item1.Contains("$");
- string[] item2 = new string[] { str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: ", null, null, null, null, null, null };
- item2[2] = (flag ? "900" : "700");
- item2[3] = "; padding-left: 5px'>";
- item2[4] = tuple.Item1.Replace(" ", " ").Replace("$", "");
- item2[5] = "</font></td><td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>";
- item2[6] = tuple.Item2;
- item2[7] = "</font></td>";
- str = string.Concat(item2);
- str = string.Concat(str, "</tr></table>");
- }
- }
- str = string.Concat(str, "</div><script src='https://code.jquery.com/jquery-3.4.1.slim.min.js' integrity='sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n' crossorigin='anonymous'></script><script src = 'https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js' integrity = 'sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo' crossorigin = 'anonymous' ></script ><script src = 'https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js' integrity = 'sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6' crossorigin = 'anonymous' ></script > </body></html>");
- string tempPath = Path.GetTempPath();
- string 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<RegistroLog> _logs;
-
- private string _currentDescription;
-
- private RegistroLog _selectedLog;
-
- private List<TupleList> _lists;
-
- private ObservableCollection<TupleList> _listsAlterados;
-
- private ObservableCollection<TupleList> _listsAdicionados;
-
- private ObservableCollection<TupleList> _listsRemovidos;
-
- private string _textAdicoes;
-
- public string CurrentDescription
- {
- get
- {
- return this._currentDescription;
- }
- set
- {
- this._currentDescription = value;
- base.OnPropertyChanged("CurrentDescription");
- }
- }
-
- public List<TupleList> Lists
- {
- get
- {
- return this._lists;
- }
- set
- {
- this._lists = value;
- this.SetListaFiltrada(value);
- base.OnPropertyChanged("Lists");
- }
- }
-
- public ObservableCollection<TupleList> ListsAdicionados
- {
- get
- {
- return this._listsAdicionados;
- }
- set
- {
- this._listsAdicionados = value;
- base.OnPropertyChanged("ListsAdicionados");
- }
- }
-
- public ObservableCollection<TupleList> ListsAlterados
- {
- get
- {
- return this._listsAlterados;
- }
- set
- {
- this._listsAlterados = value;
- base.OnPropertyChanged("ListsAlterados");
- }
- }
-
- public ObservableCollection<TupleList> 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<RegistroLog> 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<TupleList> tupleLists;
- ObservableCollection<Tuple<string, string, string>> observableCollection;
- List<TupleList>.Enumerator enumerator;
- this._selectedLog = value;
- List<TupleList> tupleLists1 = new List<TupleList>();
- try
- {
- if (!value.get_ModeloNovo())
- {
- switch (this._tipoTela)
- {
- case 1:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Cliente>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 2:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Documento>(this.SelectedLog.get_Descricao()).Log(base.Restricao(14));
- break;
- }
- case 3:
- {
- Item item = JsonConvert.DeserializeObject<Item>(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<Trilha>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 5:
- {
- try
- {
- tupleLists1 = JsonConvert.DeserializeObject<Parcelas>(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<Sinistro>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 9:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Estipulante>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 10:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Produto>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 11:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Status>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 12:
- {
- Ramo ramo = JsonConvert.DeserializeObject<Ramo>(this.SelectedLog.get_Descricao());
- List<CoberturaPadrao> list = (
- from x in Recursos.Coberturas
- where x.get_IdRamo() == ramo.get_Id()
- orderby x.get_Padrao() descending, x.get_Descricao()
- select x).ToList<CoberturaPadrao>();
- tupleLists1 = JsonConvert.DeserializeObject<Ramo>(this.SelectedLog.get_Descricao()).Log(list);
- break;
- }
- case 13:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Seguradora>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 14:
- {
- tupleLists1 = JsonConvert.DeserializeObject<TipoVendedor>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 15:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Vendedor>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 16:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Usuario>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 17:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Credencial>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 18:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Empresa>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 19:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Socio>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 22:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Parceiro>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 24:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Fornecedor>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 26:
- {
- tupleLists1 = JsonConvert.DeserializeObject<BancosContas>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 28:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Planos>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 29:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Centro>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 30:
- {
- tupleLists1 = JsonConvert.DeserializeObject<MetaVendedor>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 31:
- {
- tupleLists1 = JsonConvert.DeserializeObject<MetaSeguradora>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 33:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Prospeccao>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 34:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Agenda>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 36:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Adiantamento>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 37:
- {
- tupleLists1 = JsonConvert.DeserializeObject<VendedorParcelas>(this.SelectedLog.get_Descricao()).Log(base.Restricao(14), base.Restricao(95));
- break;
- }
- case 38:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Tarefa>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 41:
- {
- tupleLists1 = JsonConvert.DeserializeObject<TrocaCliente>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 42:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Recibo>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 43:
- {
- List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>> tuples = JsonConvert.DeserializeObject<List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>>>(this.SelectedLog.get_Descricao());
- tupleLists = new List<TupleList>();
- foreach (Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>> tuple in tuples)
- {
- observableCollection = new ObservableCollection<Tuple<string, string, string>>()
- {
- new Tuple<string, string, string>(string.Concat(tuple.Item1, "$"), "", "")
- };
- foreach (Tuple<string, List<Tuple<string, string>>> item2 in tuple.Item2)
- {
- observableCollection.Add(new Tuple<string, string, string>(string.Concat(" ", item2.Item1, "$"), "", ""));
- foreach (Tuple<string, string> item21 in item2.Item2)
- {
- observableCollection.Add(new Tuple<string, string, string>(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<Vendedor> vendedors = JsonConvert.DeserializeObject<List<Vendedor>>(this.SelectedLog.get_Descricao());
- tupleLists = new List<TupleList>();
- observableCollection = new ObservableCollection<Tuple<string, string, string>>()
- {
- new Tuple<string, string, string>("VENDEDORES VINCULADOS$", "", "")
- };
- foreach (Vendedor vendedor in vendedors)
- {
- observableCollection.Add(new Tuple<string, string, string>(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<Expedicao>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 48:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Qualificacao>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 52:
- {
- tupleLists1 = JsonConvert.DeserializeObject<TipoDeTarefa>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 54:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Repasse>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 55:
- {
- tupleLists1 = JsonConvert.DeserializeObject<NotaFiscal>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- case 56:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Imposto>(this.SelectedLog.get_Descricao()).Log();
- break;
- }
- default:
- {
- goto case 53;
- }
- }
- }
- else
- {
- switch (value.get_Acao())
- {
- case 0:
- case 2:
- {
- tupleLists1 = JsonConvert.DeserializeObject<List<ValorOriginal>>(this.SelectedLog.get_Descricao()).LogList(base.Restricao(14));
- break;
- }
- case 1:
- {
- tupleLists1 = JsonConvert.DeserializeObject<List<Diferenca>>(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<long> 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<RegistroLog>();
- this._currentDescription = "";
- this._lists = new List<TupleList>();
- this._listsAlterados = new ObservableCollection<TupleList>();
- this._listsAdicionados = new ObservableCollection<TupleList>();
- this._listsRemovidos = new ObservableCollection<TupleList>();
- this._textAdicoes = "INCLUSÃO";
- base();
- this._servico = new LogServico();
- this._tipoTela = tela;
- this._id = id;
- this.VisiblityDetalhesLog = (Recursos.Configuracoes.Any<ConfiguracaoSistema>((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>((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<TupleList> DefaultLog(string log, TipoAcao acao)
- {
- List<TupleList> tupleLists = new List<TupleList>();
- TupleList tupleList = new TupleList();
- tupleList.set_Tuples(new ObservableCollection<Tuple<string, string, string>>()
- {
- new Tuple<string, string, string>(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 = "<html><head><style type='text/css'>@page{size: A4; margin: 0cm}</style><title>LOGS</title></head><body><div align='center'>";
- ObservableCollection<TupleList> listsAlterados = this.ListsAlterados;
- if (listsAlterados != null)
- {
- count = listsAlterados.Count > 0;
- }
- else
- {
- count = false;
- }
- if (count)
- {
- str = string.Concat(str, "<font size='5px' face='Arial' style='font-weight: 900;'>ALTERAÇÃO</font>");
- }
- if (this.ListsAlterados != null)
- {
- foreach (TupleList listsAlterado in this.ListsAlterados)
- {
- foreach (Tuple<string, string, string> tuple in listsAlterado.get_Tuples())
- {
- if (tuple == listsAlterado.get_Tuples().First<Tuple<string, string, string>>())
- {
- str = string.Concat(str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: ", (this.Mostrar ? "483px" : "240px"), "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>");
- if (!this.Mostrar)
- {
- str = string.Concat(str, "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>");
- }
- str = string.Concat(str, "</tr></table>");
- }
- bool flag3 = tuple.Item1.Contains("$");
- string[] item2 = new string[] { str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: ", null, null, null, null, null, null, null, null };
- item2[2] = (flag3 ? "900" : "700");
- item2[3] = "; padding-left: 5px'>";
- item2[4] = tuple.Item1.Replace(" ", " ").Replace("$", "");
- item2[5] = "</font></td><td style='width: ";
- item2[6] = (this.Mostrar ? "483px" : "240px");
- item2[7] = "'><font size='2px' face='Arial' style='padding-left: 5px'>";
- item2[8] = tuple.Item2;
- item2[9] = "</font></td>";
- str = string.Concat(item2);
- if (!this.Mostrar)
- {
- str = string.Concat(str, "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>", tuple.Item3, "</font></td>");
- }
- str = string.Concat(str, "</tr></table>");
- }
- if ((object)listsAlterado == (object)this.ListsAlterados.Last<TupleList>())
- {
- continue;
- }
- str = string.Concat(str, "<br>");
- }
- }
- ObservableCollection<TupleList> listsAdicionados = this.ListsAdicionados;
- if (listsAdicionados != null)
- {
- flag = listsAdicionados.Count > 0;
- }
- else
- {
- flag = false;
- }
- if (flag)
- {
- ObservableCollection<TupleList> observableCollection = this.ListsAlterados;
- if (observableCollection != null)
- {
- flag2 = observableCollection.Count > 0;
- }
- else
- {
- flag2 = false;
- }
- if (flag2)
- {
- str = string.Concat(str, "<br><br><br>");
- }
- str = string.Concat(str, "<font size='5px' face='Arial' style='font-weight: 900;'>INCLUSÃO</font>");
- }
- if (this.ListsAdicionados != null)
- {
- foreach (TupleList listsAdicionado in this.ListsAdicionados)
- {
- foreach (Tuple<string, string, string> tuple1 in listsAdicionado.get_Tuples())
- {
- if (tuple1 == listsAdicionado.get_Tuples().First<Tuple<string, string, string>>())
- {
- str = string.Concat(str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: ", (this.Mostrar ? "483px" : "240px"), "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>");
- if (!this.Mostrar)
- {
- str = string.Concat(str, "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>");
- }
- str = string.Concat(str, "</tr></table>");
- }
- bool flag4 = tuple1.Item1.Contains("$");
- string[] strArrays = new string[] { str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: ", null, null, null, null, null, null, null, null };
- strArrays[2] = (flag4 ? "900" : "700");
- strArrays[3] = "; padding-left: 5px'>";
- strArrays[4] = tuple1.Item1.Replace(" ", " ").Replace("$", "");
- strArrays[5] = "</font></td><td style='width: ";
- strArrays[6] = (this.Mostrar ? "483px" : "240px");
- strArrays[7] = "'><font size='2px' face='Arial' style='padding-left: 5px'>";
- strArrays[8] = tuple1.Item2;
- strArrays[9] = "</font></td>";
- str = string.Concat(strArrays);
- if (!this.Mostrar)
- {
- str = string.Concat(str, "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>", tuple1.Item3, "</font></td>");
- }
- str = string.Concat(str, "</tr></table>");
- }
- if ((object)listsAdicionado == (object)this.ListsAdicionados.Last<TupleList>())
- {
- continue;
- }
- str = string.Concat(str, "<br>");
- }
- }
- ObservableCollection<TupleList> listsRemovidos = this.ListsRemovidos;
- if (listsRemovidos != null)
- {
- count1 = listsRemovidos.Count > 0;
- }
- else
- {
- count1 = false;
- }
- if (count1)
- {
- ObservableCollection<TupleList> listsAlterados1 = this.ListsAlterados;
- if (listsAlterados1 != null)
- {
- flag1 = listsAlterados1.Count > 0;
- }
- else
- {
- flag1 = false;
- }
- if (!flag1)
- {
- ObservableCollection<TupleList> listsAdicionados1 = this.ListsAdicionados;
- if (listsAdicionados1 != null)
- {
- count2 = listsAdicionados1.Count > 0;
- }
- else
- {
- count2 = false;
- }
- if (!count2)
- {
- goto Label0;
- }
- }
- str = string.Concat(str, "<br><br><br>");
- Label0:
- str = string.Concat(str, "<font size='5px' face='Arial' style='font-weight: 900;'>EXCLUSÃO</font>");
- }
- if (this.ListsRemovidos != null)
- {
- foreach (TupleList listsRemovido in this.ListsRemovidos)
- {
- foreach (Tuple<string, string, string> tuple2 in listsRemovido.get_Tuples())
- {
- if (tuple2 == listsRemovido.get_Tuples().First<Tuple<string, string, string>>())
- {
- str = string.Concat(str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid'><tr style='height: 45px;'><td style='width: 220px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700;'>DESCRIÇÃO</font></td><td style='width: ", (this.Mostrar ? "483px" : "240px"), "; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG SELECIONADO</font></td>");
- if (!this.Mostrar)
- {
- str = string.Concat(str, "<td style='width: 240px; text-align: center;'><font size='3px' face='Arial' style='font-weight: 700'>VALOR LOG ANTERIOR</font></td>");
- }
- str = string.Concat(str, "</tr></table>");
- }
- bool flag5 = tuple2.Item1.Contains("$");
- string[] item21 = new string[] { str, "<table border='1' style='border-collapse: collapse; page-break-inside: avoid; border-TOP: none'><tr style='height: 30px;'><td style='width: 220px'><font size='2px' face='Arial' style='font-weight: ", null, null, null, null, null, null, null, null };
- item21[2] = (flag5 ? "900" : "700");
- item21[3] = "; padding-left: 5px'>";
- item21[4] = tuple2.Item1.Replace(" ", " ").Replace("$", "");
- item21[5] = "</font></td><td style='width: ";
- item21[6] = (this.Mostrar ? "483px" : "240px");
- item21[7] = "'><font size='2px' face='Arial' style='padding-left: 5px'>";
- item21[8] = tuple2.Item2;
- item21[9] = "</font></td>";
- str = string.Concat(item21);
- if (!this.Mostrar)
- {
- str = string.Concat(str, "<td style='width: 240px'><font size='2px' face='Arial' style='padding-left: 5px'>", tuple2.Item3, "</font></td>");
- }
- str = string.Concat(str, "</tr></table>");
- }
- if ((object)listsRemovido == (object)this.ListsRemovidos.Last<TupleList>())
- {
- continue;
- }
- str = string.Concat(str, "<br>");
- }
- }
- str = string.Concat(str, "</div></body></html>");
- 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<long> parcelas, int numparcela)
- {
- base.Loading(true);
- List<long> nums = new List<long>();
- nums.AddRange(parcelas);
- nums.Add(documento);
- this.Logs = new ObservableCollection<RegistroLog>((IEnumerable<!0>)await this._servico.BuscaLogParcelas(nums));
- ObservableCollection<RegistroLog> observableCollection = new ObservableCollection<RegistroLog>();
- List<RegistroLog> list = this.Logs.Where<RegistroLog>((RegistroLog x) => {
- if (x.get_ModeloNovo())
- {
- return false;
- }
- return x.get_EntidadeId() == documento;
- }).ToList<RegistroLog>();
- for (int i = list.Count - 1; i >= 0; i--)
- {
- ObservableCollection<Parcela> observableCollection1 = new ObservableCollection<Parcela>();
- try
- {
- for (int j = i; j >= 0 && list[j].get_DataHora() < list[i].get_DataHora().AddSeconds(4); j--)
- {
- Parcela parcela = JsonConvert.DeserializeObject<Parcela>(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<Parcela> parcelas1 = JsonConvert.DeserializeObject<List<Parcela>>(this.Logs[i].get_Descricao());
- if (parcelas1 != null && (numparcela == 0 || this.BuscaNumeroParcela(this.Logs[i].get_Descricao()) == numparcela))
- {
- ExtensionMethods.AddRange<Parcela>(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<Parcela> observableCollection2 = observableCollection1;
- observableCollection1 = new ObservableCollection<Parcela>(
- 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<RegistroLog> registroLogs = new List<RegistroLog>();
- ObservableCollection<RegistroLog> logs = this.Logs;
- List<RegistroLog> list1 = (
- from x in logs
- where x.get_ModeloNovo()
- select x).ToList<RegistroLog>();
- 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<RegistroLog>(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<long> parcelas = null, long? parcela = null)
- {
- base.Loading(true);
- this.Logs = new ObservableCollection<RegistroLog>((IEnumerable<!0>)await this._servico.FindByEntityId(tela, id));
- if (tela == 37)
- {
- ObservableCollection<RegistroLog> observableCollection = new ObservableCollection<RegistroLog>();
- ObservableCollection<RegistroLog> logs = this.Logs;
- List<RegistroLog> list = (
- from x in logs
- where !x.get_ModeloNovo()
- select x).ToList<RegistroLog>();
- for (int i = list.Count - 1; i >= 0; i--)
- {
- ObservableCollection<VendedorParcela> observableCollection1 = new ObservableCollection<VendedorParcela>();
- for (int j = i; j >= 0 && list[j].get_DataHora() < list[i].get_DataHora().AddSeconds(4); j--)
- {
- observableCollection1.Add(JsonConvert.DeserializeObject<VendedorParcela>(list[j].get_Descricao()));
- i = j;
- }
- ObservableCollection<VendedorParcela> observableCollection2 = observableCollection1;
- observableCollection1 = new ObservableCollection<VendedorParcela>(
- 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<RegistroLog> logs1 = this.Logs;
- List<RegistroLog> registroLogs = (
- from x in logs1
- where x.get_ModeloNovo()
- select x).ToList<RegistroLog>();
- this.Logs = observableCollection;
- ExtensionMethods.AddRange<RegistroLog>(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<TupleList> listAtual)
- {
- List<TupleList> tupleLists;
- ObservableCollection<Tuple<string, string, string>> observableCollection;
- List<TupleList>.Enumerator enumerator;
- ObservableCollection<TupleList> observableCollection1;
- ObservableCollection<TupleList> observableCollection2;
- ObservableCollection<TupleList> 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<TupleList>(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<TupleList>(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<TupleList>(listAtual);
- this.MostrarMensagem = false;
- return;
- }
- if (this.Mostrar || (object)this.Logs.Last<RegistroLog>() == (object)this.SelectedLog)
- {
- this.TextAdicoes = ((object)this.Logs.Last<RegistroLog>() != (object)this.SelectedLog ? "LOG COMPLETO" : "INCLUSÃO");
- this.ListsAlterados = null;
- this.ListsAdicionados = new ObservableCollection<TupleList>(listAtual);
- this.ListsRemovidos = null;
- return;
- }
- this.TextAdicoes = "INCLUSÃO";
- List<TupleList> tupleLists1 = new List<TupleList>();
- try
- {
- switch (this._tipoTela)
- {
- case 1:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Cliente>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 2:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Documento>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log(base.Restricao(14));
- goto case 53;
- }
- case 3:
- {
- Item item = JsonConvert.DeserializeObject<Item>(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<Trilha>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 5:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Parcelas>(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<Sinistro>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 9:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Estipulante>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 10:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Produto>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 11:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Status>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 12:
- {
- Ramo ramo = JsonConvert.DeserializeObject<Ramo>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao());
- List<CoberturaPadrao> list = (
- from x in Recursos.Coberturas
- where x.get_IdRamo() == ramo.get_Id()
- orderby x.get_Padrao() descending, x.get_Descricao()
- select x).ToList<CoberturaPadrao>();
- tupleLists1 = ramo.Log(list);
- goto case 53;
- }
- case 13:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Seguradora>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 14:
- {
- tupleLists1 = JsonConvert.DeserializeObject<TipoVendedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 15:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Vendedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 16:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Usuario>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 17:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Credencial>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 18:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Empresa>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 19:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Socio>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 22:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Parceiro>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 24:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Fornecedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 26:
- {
- tupleLists1 = JsonConvert.DeserializeObject<BancosContas>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 28:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Planos>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 29:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Centro>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 30:
- {
- tupleLists1 = JsonConvert.DeserializeObject<MetaVendedor>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 31:
- {
- tupleLists1 = JsonConvert.DeserializeObject<MetaSeguradora>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 33:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Prospeccao>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 34:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Agenda>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 36:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Adiantamento>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 37:
- {
- tupleLists1 = JsonConvert.DeserializeObject<VendedorParcelas>(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<Tarefa>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 41:
- {
- tupleLists1 = JsonConvert.DeserializeObject<TrocaCliente>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 42:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Recibo>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 43:
- {
- List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>> tuples = JsonConvert.DeserializeObject<List<Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>>>>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao());
- tupleLists = new List<TupleList>();
- foreach (Tuple<string, List<Tuple<string, List<Tuple<string, string>>>>> tuple in tuples)
- {
- observableCollection = new ObservableCollection<Tuple<string, string, string>>()
- {
- new Tuple<string, string, string>(string.Concat(tuple.Item1, "$"), "", "")
- };
- foreach (Tuple<string, List<Tuple<string, string>>> item2 in tuple.Item2)
- {
- observableCollection.Add(new Tuple<string, string, string>(string.Concat(" ", item2.Item1, "$"), "", ""));
- foreach (Tuple<string, string> item21 in item2.Item2)
- {
- observableCollection.Add(new Tuple<string, string, string>(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<Vendedor> vendedors = JsonConvert.DeserializeObject<List<Vendedor>>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao());
- tupleLists = new List<TupleList>();
- observableCollection = new ObservableCollection<Tuple<string, string, string>>()
- {
- new Tuple<string, string, string>("VENDEDORES VINCULADOS$", "", "")
- };
- foreach (Vendedor vendedor in vendedors)
- {
- observableCollection.Add(new Tuple<string, string, string>(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<Expedicao>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 48:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Qualificacao>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 52:
- {
- tupleLists1 = JsonConvert.DeserializeObject<TipoDeTarefa>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 54:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Repasse>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 55:
- {
- tupleLists1 = JsonConvert.DeserializeObject<NotaFiscal>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- case 56:
- {
- tupleLists1 = JsonConvert.DeserializeObject<Imposto>(this.Logs[this.Logs.IndexOf(this.SelectedLog) + 1].get_Descricao()).Log();
- goto case 53;
- }
- default:
- {
- goto case 53;
- }
- }
- }
- catch (Exception exception)
- {
- }
- ObservableCollection<TupleList> observableCollection4 = new ObservableCollection<TupleList>();
- 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<string, string, string> item1 = tupleList2.get_Tuples()[i];
- if (LogViewModel.QntEspaco(item1.Item1) != 0)
- {
- List<string> strs = new List<string>();
- 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<Tuple<string, string, string>>());
- observableCollection4.Add(tupleList3);
- num = listAtual.IndexOf(tupleList2);
- }
- int count = observableCollection4.Last<TupleList>().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<TupleList>().get_Tuples().Count - 1;
- while (count1 >= 0)
- {
- if (observableCollection4.Last<TupleList>().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<TupleList>().get_Tuples().Insert(count, new Tuple<string, string, string>(tupleList2.get_Tuples()[k].Item1, tupleList2.get_Tuples()[k].Item2, ""));
- }
- }
- observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(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<Tuple<string, string, string>>());
- observableCollection4.Add(tupleList4);
- num = listAtual.IndexOf(tupleList2);
- }
- observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(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<TupleList>();
- 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<string, string, string> tuple1 = tupleList5.get_Tuples()[l];
- if (LogViewModel.QntEspaco(tuple1.Item1) > 0)
- {
- List<string> strs1 = new List<string>();
- 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<Tuple<string, string, string>>());
- observableCollection4.Add(tupleList6);
- num5 = listAtual.IndexOf(tupleList5);
- }
- int count2 = observableCollection4.Last<TupleList>().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<TupleList>().get_Tuples().Count - 1;
- while (count3 >= 0)
- {
- if (observableCollection4.Last<TupleList>().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<TupleList>().get_Tuples().Insert(count2, new Tuple<string, string, string>(tupleList5.get_Tuples()[n].Item1, tupleList5.get_Tuples()[n].Item2, ""));
- }
- }
- observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(tuple1.Item1, tuple1.Item2, ""));
- }
- }
- }
- }
- if (observableCollection4.Count == 0)
- {
- observableCollection2 = null;
- }
- else
- {
- observableCollection2 = observableCollection4;
- }
- this.ListsAdicionados = observableCollection2;
- observableCollection4 = new ObservableCollection<TupleList>();
- foreach (TupleList tupleList7 in tupleLists1)
- {
- int num10 = -1;
- for (int o = 0; o < tupleList7.get_Tuples().Count; o++)
- {
- Tuple<string, string, string> tuple2 = tupleList7.get_Tuples()[o];
- if (LogViewModel.QntEspaco(tuple2.Item1) > 0)
- {
- List<string> strs2 = new List<string>();
- 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<Tuple<string, string, string>>());
- observableCollection4.Add(tupleList8);
- num10 = tupleLists1.IndexOf(tupleList7);
- }
- int count4 = observableCollection4.Last<TupleList>().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<TupleList>().get_Tuples().Count - 1;
- while (count5 >= 0)
- {
- if (observableCollection4.Last<TupleList>().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<TupleList>().get_Tuples().Insert(count4, new Tuple<string, string, string>(tupleList7.get_Tuples()[q].Item1, tupleList7.get_Tuples()[q].Item2, ""));
- }
- }
- observableCollection4.Last<TupleList>().get_Tuples().Add(new Tuple<string, string, string>(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<MetaSeguradora> _metasSeguradora = new ObservableCollection<MetaSeguradora>();
-
- 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<MetaSeguradora> 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>((MetaSeguradora x) => x.get_Id() == this.CancelMetaSeguradora.get_Id()))
- {
- DomainBase.Copy<MetaSeguradora, MetaSeguradora>(this.MetasSeguradora.First<MetaSeguradora>((MetaSeguradora x) => x.get_Id() == this.CancelMetaSeguradora.get_Id()), this.CancelMetaSeguradora);
- this.SelectedMetaSeguradora = this.MetasSeguradora.First<MetaSeguradora>((MetaSeguradora x) => x.get_Id() == this.CancelMetaSeguradora.get_Id());
- }
- base.Alterar(false);
- this.Carregando = false;
- }
-
- private async Task CarregarMetas(Seguradora seguradora)
- {
- List<MetaSeguradora> metaSeguradoras = await (new BaseServico()).BuscarMetaSeguradoraAsync(seguradora);
- MetaSeguradoraViewModel observableCollection = this;
- List<MetaSeguradora> metaSeguradoras1 = metaSeguradoras;
- IOrderedEnumerable<MetaSeguradora> mes =
- from x in metaSeguradoras1
- orderby x.get_Mes()
- select x;
- observableCollection.MetasSeguradora = new ObservableCollection<MetaSeguradora>(mes.ThenBy<MetaSeguradora, decimal>((MetaSeguradora x) => x.get_Valor()));
- }
-
- public async Task<bool> 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<MetaSeguradora>(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<MetaSeguradora>(num) : this.MetasSeguradora.Last<MetaSeguradora>());
- 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<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> 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>((MetaSeguradora x) => x.get_Id() == metaSeguradora.get_Id()))
- {
- this.MetasSeguradora.Add(metaSeguradora);
- }
- else
- {
- DomainBase.Copy<MetaSeguradora, MetaSeguradora>(this.MetasSeguradora.First<MetaSeguradora>((MetaSeguradora x) => x.get_Id() == metaSeguradora.get_Id()), metaSeguradora);
- }
- this.MetasSeguradora = new ObservableCollection<MetaSeguradora>(this.MetasSeguradora);
- this.SelectedMetaSeguradora = this.MetasSeguradora.First<MetaSeguradora>((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<MetaSeguradora>());
- }
- 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<MetaVendedor> _metasVendedor = new ObservableCollection<MetaVendedor>();
-
- 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<MetaVendedor> 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>((MetaVendedor x) => x.get_Id() == this.CancelMetaVendedor.get_Id()))
- {
- DomainBase.Copy<MetaVendedor, MetaVendedor>(this.MetasVendedor.First<MetaVendedor>((MetaVendedor x) => x.get_Id() == this.CancelMetaVendedor.get_Id()), this.CancelMetaVendedor);
- this.SelectedMetaVendedor = this.MetasVendedor.First<MetaVendedor>((MetaVendedor x) => x.get_Id() == this.CancelMetaVendedor.get_Id());
- }
- base.Alterar(false);
- this.Carregando = false;
- }
-
- private async Task CarregarMetas(Vendedor vendedor)
- {
- List<MetaVendedor> metaVendedors = await (new BaseServico()).BuscarMetaVendedorAsync(vendedor);
- MetaVendedorViewModel observableCollection = this;
- List<MetaVendedor> metaVendedors1 = metaVendedors;
- IOrderedEnumerable<MetaVendedor> mes =
- from x in metaVendedors1
- orderby x.get_Mes()
- select x;
- observableCollection.MetasVendedor = new ObservableCollection<MetaVendedor>(mes.ThenBy<MetaVendedor, decimal>((MetaVendedor x) => x.get_Valor()).ToList<MetaVendedor>());
- }
-
- public async Task<bool> 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<MetaVendedor>();
- }
- 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<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> 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>((MetaVendedor x) => x.get_Id() == metaVendedor.get_Id()))
- {
- this.MetasVendedor.Add(metaVendedor);
- }
- else
- {
- DomainBase.Copy<MetaVendedor, MetaVendedor>(this.MetasVendedor.First<MetaVendedor>((MetaVendedor x) => x.get_Id() == metaVendedor.get_Id()), metaVendedor);
- }
- this.MetasVendedor = new ObservableCollection<MetaVendedor>(this.MetasVendedor);
- this.SelectedMetaVendedor = this.MetasVendedor.First<MetaVendedor>((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<MetaVendedor>());
- }
- 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<PermissaoUsuario> _seguros;
-
- private ObservableCollection<PermissaoUsuario> _ferramentas;
-
- private ObservableCollection<PermissaoArquivoDigital> _arquivosDigitais;
-
- private bool _enableAlterarPermiss = true;
-
- private ObservableCollection<RestricaoUsuario> _restricoesBisFiltradas;
-
- private ObservableCollection<RestricaoUsuario> _restricoesSegurosFiltradas;
-
- private ObservableCollection<RestricaoUsuario> _restricoesRelatoriosFiltrados;
-
- private ObservableCollection<RestricaoUsuario> _restricoesTotalizacoesRelatoriosFiltrados;
-
- private ObservableCollection<RestricaoUsuarioCamposRelatorios> _restricoesCamposRelatoriosFiltrados;
-
- private ObservableCollection<RestricaoUsuario> _restricoesFinanceirosFiltradas;
-
- private ObservableCollection<RestricaoUsuario> _restricoesFerramentasFiltradas;
-
- private ObservableCollection<RestricaoUsuario> _restricoesAjudasFiltrados;
-
- private List<RestricaoUsuario> _restricoesBis;
-
- private List<RestricaoUsuario> _restricoesSeguros;
-
- private List<RestricaoUsuario> _restricoesRelatorios;
-
- private List<RestricaoUsuario> _restricoesTotalizacoesRelatorios;
-
- private List<RestricaoUsuarioCamposRelatorios> _restricoesCamposRelatorios;
-
- private List<RestricaoUsuario> _restricoesFinanceiros;
-
- private List<RestricaoUsuario> _restricoesFerramentas;
-
- private List<RestricaoUsuario> _restricoesAjudas;
-
- private Visibility _restricoesBisVisibility;
-
- private Visibility _restricoesSegurosVisibility;
-
- private Visibility _restricoesRelatoriosVisibility;
-
- private Visibility _restricoesTotalizacoesRelatoriosVisibility;
-
- private Visibility _restricoesCamposRelatoriosVisibility;
-
- private Visibility _restricoesFinanceirosVisibility;
-
- private Visibility _restricoesFerramentasVisibility;
-
- private Visibility _restricoesAjudasVisibility;
-
- private List<Gestor.Model.Common.PermissaoAggilizador> _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<PermissaoArquivoDigital> 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<PermissaoUsuario> Ferramentas
- {
- get
- {
- return this._ferramentas;
- }
- set
- {
- this._ferramentas = value;
- base.OnPropertyChanged("Ferramentas");
- if (value != null && this.Seguros != null)
- {
- if (value.All<PermissaoUsuario>((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>((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<Gestor.Model.Common.PermissaoAggilizador> PermissaoAggilizador
- {
- get
- {
- return this._permissaoAggilizador;
- }
- set
- {
- this._permissaoAggilizador = value;
- base.OnPropertyChanged("PermissaoAggilizador");
- }
- }
-
- public List<RestricaoUsuario> RestricoesAjudas
- {
- get
- {
- return this._restricoesAjudas;
- }
- set
- {
- this._restricoesAjudas = value;
- base.OnPropertyChanged("RestricoesAjudas");
- }
- }
-
- public ObservableCollection<RestricaoUsuario> RestricoesAjudasFiltrados
- {
- get
- {
- return this._restricoesAjudasFiltrados;
- }
- set
- {
- this.RestricoesAjudasVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesAjudasFiltrados = new ObservableCollection<RestricaoUsuario>(
- from x in value.ToList<RestricaoUsuario>()
- 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<RestricaoUsuario> RestricoesBis
- {
- get
- {
- return this._restricoesBis;
- }
- set
- {
- this._restricoesBis = value;
- base.OnPropertyChanged("RestricoesBis");
- }
- }
-
- public ObservableCollection<RestricaoUsuario> RestricoesBisFiltradas
- {
- get
- {
- return this._restricoesBisFiltradas;
- }
- set
- {
- this.RestricoesBisVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesBisFiltradas = new ObservableCollection<RestricaoUsuario>(
- from x in value.ToList<RestricaoUsuario>()
- 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<RestricaoUsuarioCamposRelatorios> RestricoesCamposRelatorios
- {
- get
- {
- return this._restricoesCamposRelatorios;
- }
- set
- {
- this._restricoesCamposRelatorios = value;
- base.OnPropertyChanged("RestricoesCamposRelatorios");
- }
- }
-
- public ObservableCollection<RestricaoUsuarioCamposRelatorios> RestricoesCamposRelatoriosFiltrados
- {
- get
- {
- return this._restricoesCamposRelatoriosFiltrados;
- }
- set
- {
- this.RestricoesCamposRelatoriosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesCamposRelatoriosFiltrados = new ObservableCollection<RestricaoUsuarioCamposRelatorios>(
- from x in value.ToList<RestricaoUsuarioCamposRelatorios>()
- 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<RestricaoUsuario> RestricoesFerramentas
- {
- get
- {
- return this._restricoesFerramentas;
- }
- set
- {
- this._restricoesFerramentas = value;
- base.OnPropertyChanged("RestricoesFerramentas");
- }
- }
-
- public ObservableCollection<RestricaoUsuario> RestricoesFerramentasFiltradas
- {
- get
- {
- return this._restricoesFerramentasFiltradas;
- }
- set
- {
- this.RestricoesFerramentasVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesFerramentasFiltradas = new ObservableCollection<RestricaoUsuario>(
- from x in value.ToList<RestricaoUsuario>()
- 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<RestricaoUsuario> RestricoesFinanceiros
- {
- get
- {
- return this._restricoesFinanceiros;
- }
- set
- {
- this._restricoesFinanceiros = value;
- base.OnPropertyChanged("RestricoesFinanceiros");
- }
- }
-
- public ObservableCollection<RestricaoUsuario> RestricoesFinanceirosFiltradas
- {
- get
- {
- return this._restricoesFinanceirosFiltradas;
- }
- set
- {
- this.RestricoesFinanceirosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesFinanceirosFiltradas = new ObservableCollection<RestricaoUsuario>(
- from x in value.ToList<RestricaoUsuario>()
- 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<RestricaoUsuario> RestricoesRelatorios
- {
- get
- {
- return this._restricoesRelatorios;
- }
- set
- {
- this._restricoesRelatorios = value;
- base.OnPropertyChanged("RestricoesRelatorios");
- }
- }
-
- public ObservableCollection<RestricaoUsuario> RestricoesRelatoriosFiltrados
- {
- get
- {
- return this._restricoesRelatoriosFiltrados;
- }
- set
- {
- this.RestricoesRelatoriosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(
- from x in value.ToList<RestricaoUsuario>()
- 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<RestricaoUsuario> RestricoesSeguros
- {
- get
- {
- return this._restricoesSeguros;
- }
- set
- {
- this._restricoesSeguros = value;
- base.OnPropertyChanged("RestricoesSeguros");
- }
- }
-
- public ObservableCollection<RestricaoUsuario> RestricoesSegurosFiltradas
- {
- get
- {
- return this._restricoesSegurosFiltradas;
- }
- set
- {
- this.RestricoesSegurosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesSegurosFiltradas = new ObservableCollection<RestricaoUsuario>(
- from x in value.ToList<RestricaoUsuario>()
- 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<RestricaoUsuario> RestricoesTotalizacoesRelatorios
- {
- get
- {
- return this._restricoesTotalizacoesRelatorios;
- }
- set
- {
- this._restricoesTotalizacoesRelatorios = value;
- base.OnPropertyChanged("RestricoesTotalizacoesRelatorios");
- }
- }
-
- public ObservableCollection<RestricaoUsuario> RestricoesTotalizacoesRelatoriosFiltrados
- {
- get
- {
- return this._restricoesTotalizacoesRelatoriosFiltrados;
- }
- set
- {
- this.RestricoesTotalizacoesRelatoriosVisibility = (value == null || value.Count <= 0 ? Visibility.Collapsed : Visibility.Visible);
- this._restricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(
- from x in value.ToList<RestricaoUsuario>()
- 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<PermissaoUsuario> Seguros
- {
- get
- {
- return this._seguros;
- }
- set
- {
- this._seguros = value;
- base.OnPropertyChanged("Seguros");
- if (value != null && this.Ferramentas != null)
- {
- if (value.All<PermissaoUsuario>((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>((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<PermissaoUsuario>().ForEach((PermissaoUsuario x) => {
- x.set_Consultar(permiss);
- x.set_Incluir(permiss);
- x.set_Alterar(permiss);
- x.set_Excluir(permiss);
- });
- this.Ferramentas.ToList<PermissaoUsuario>().ForEach((PermissaoUsuario x) => {
- x.set_Consultar(permiss);
- x.set_Incluir(permiss);
- x.set_Alterar(permiss);
- x.set_Excluir(permiss);
- });
- this.ArquivosDigitais.ToList<PermissaoArquivoDigital>().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>((Gestor.Model.Common.PermissaoAggilizador x) => x.get_Descricao() == "ADMINISTRADOR");
- }
- else
- {
- permissaoAggilizador = null;
- }
- this.SelectedPermissao = permissaoAggilizador;
- this.Seguros = new ObservableCollection<PermissaoUsuario>(this.Seguros);
- this.Ferramentas = new ObservableCollection<PermissaoUsuario>(this.Ferramentas);
- this.ArquivosDigitais = new ObservableCollection<PermissaoArquivoDigital>(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<RestricaoUsuario>(this.RestricoesBisFiltradas);
- this.RestricoesSegurosFiltradas = new ObservableCollection<RestricaoUsuario>(this.RestricoesSegurosFiltradas);
- this.RestricoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(this.RestricoesRelatoriosFiltrados);
- this.RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(this.RestricoesTotalizacoesRelatoriosFiltrados);
- this.RestricoesCamposRelatoriosFiltrados = new ObservableCollection<RestricaoUsuarioCamposRelatorios>(this.RestricoesCamposRelatoriosFiltrados);
- this.RestricoesFinanceirosFiltradas = new ObservableCollection<RestricaoUsuario>(this.RestricoesFinanceirosFiltradas);
- this.RestricoesFerramentasFiltradas = new ObservableCollection<RestricaoUsuario>(this.RestricoesFerramentasFiltradas);
- this.RestricoesAjudasFiltrados = new ObservableCollection<RestricaoUsuario>(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>((RestricaoUsuario x) => x.get_Restricao()))
- {
- if (this.RestricoesAjudasFiltrados.All<RestricaoUsuario>((RestricaoUsuario x) => x.get_Restricao()))
- {
- if (this.RestricoesSegurosFiltradas.All<RestricaoUsuario>((RestricaoUsuario x) => x.get_Restricao()))
- {
- if (this.RestricoesRelatoriosFiltrados.All<RestricaoUsuario>((RestricaoUsuario x) => x.get_Restricao()))
- {
- if (this.RestricoesFinanceirosFiltradas.All<RestricaoUsuario>((RestricaoUsuario x) => x.get_Restricao()))
- {
- if (this.RestricoesFerramentasFiltradas.All<RestricaoUsuario>((RestricaoUsuario x) => x.get_Restricao()))
- {
- if (this.RestricoesTotalizacoesRelatoriosFiltrados.All<RestricaoUsuario>((RestricaoUsuario x) => x.get_Restricao()))
- {
- if (this.RestricoesCamposRelatoriosFiltrados.All<RestricaoUsuarioCamposRelatorios>((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<List<PermissaoUsuario>, Usuario, List<RestricaoUsuario>, List<PermissaoArquivoDigital>, List<RestricaoUsuarioCamposRelatorios>> copiarPermiss)
- {
- Gestor.Model.Common.PermissaoAggilizador permissaoAggilizador1;
- if (copiarPermiss.Item1.Count <= 0)
- {
- this.Seguros.ToList<PermissaoUsuario>().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<PermissaoUsuario>().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<PermissaoUsuario>().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<PermissaoUsuario>().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<PermissaoArquivoDigital>().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<PermissaoArquivoDigital>().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>((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>((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<PermissaoArquivoDigital>(this.ArquivosDigitais);
- }
-
- public void DesabilitarConsulta(PermissaoUsuario desabilitar, string source)
- {
- if (source != "Ferramentas")
- {
- PermissaoUsuario permissaoUsuario = this.Seguros.First<PermissaoUsuario>((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<PermissaoUsuario>(this.Seguros);
- return;
- }
- PermissaoUsuario permissaoUsuario1 = this.Ferramentas.First<PermissaoUsuario>((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<PermissaoUsuario>(this.Ferramentas);
- }
-
- public async Task<bool> ExportarPermissoes(List<Usuario> usuarios)
- {
- object obj;
- List<Usuario> 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<Usuario> 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<List<RestricaoUsuario>> FiltrarRestricoesAjuda(string value)
- {
- List<RestricaoUsuario> restricaoUsuarios = await Task.Run<List<RestricaoUsuario>>(() => this.FiltrarRestricoesAjudas(value));
- return restricaoUsuarios;
- }
-
- public List<RestricaoUsuario> FiltrarRestricoesAjudas(string filter)
- {
- this.RestricoesAjudasFiltrados = (filter == "" ? new ObservableCollection<RestricaoUsuario>(this.RestricoesAjudas) : new ObservableCollection<RestricaoUsuario>(
- 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<RestricaoUsuario>();
- }
-
- internal async Task<List<RestricaoUsuario>> FiltrarRestricoesBi(string value)
- {
- List<RestricaoUsuario> restricaoUsuarios = await Task.Run<List<RestricaoUsuario>>(() => this.FiltrarRestricoesBis(value));
- return restricaoUsuarios;
- }
-
- public List<RestricaoUsuario> FiltrarRestricoesBis(string filter)
- {
- this.RestricoesBisFiltradas = (filter == "" ? new ObservableCollection<RestricaoUsuario>(this.RestricoesBis) : new ObservableCollection<RestricaoUsuario>(
- 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<RestricaoUsuario>();
- }
-
- internal async Task<List<RestricaoUsuarioCamposRelatorios>> FiltrarRestricoesCamposRelatorio(string value)
- {
- List<RestricaoUsuarioCamposRelatorios> restricaoUsuarioCamposRelatorios = await Task.Run<List<RestricaoUsuarioCamposRelatorios>>(() => this.FiltrarRestricoesCamposRelatorios(value));
- return restricaoUsuarioCamposRelatorios;
- }
-
- public List<RestricaoUsuarioCamposRelatorios> FiltrarRestricoesCamposRelatorios(string filter)
- {
- this.RestricoesCamposRelatoriosFiltrados = (filter == "" ? new ObservableCollection<RestricaoUsuarioCamposRelatorios>(this.RestricoesCamposRelatorios) : new ObservableCollection<RestricaoUsuarioCamposRelatorios>(this.RestricoesCamposRelatorios.Where<RestricaoUsuarioCamposRelatorios>((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<RestricaoUsuarioCamposRelatorios>();
- }
-
- internal async Task<List<RestricaoUsuario>> FiltrarRestricoesFerramenta(string value)
- {
- List<RestricaoUsuario> restricaoUsuarios = await Task.Run<List<RestricaoUsuario>>(() => this.FiltrarRestricoesFerramentas(value));
- return restricaoUsuarios;
- }
-
- public List<RestricaoUsuario> FiltrarRestricoesFerramentas(string filter)
- {
- this.RestricoesFerramentasFiltradas = (filter == "" ? new ObservableCollection<RestricaoUsuario>(this.RestricoesFerramentas) : new ObservableCollection<RestricaoUsuario>(
- 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<RestricaoUsuario>();
- }
-
- internal async Task<List<RestricaoUsuario>> FiltrarRestricoesFinanceiro(string value)
- {
- List<RestricaoUsuario> restricaoUsuarios = await Task.Run<List<RestricaoUsuario>>(() => this.FiltrarRestricoesFinanceiros(value));
- return restricaoUsuarios;
- }
-
- public List<RestricaoUsuario> FiltrarRestricoesFinanceiros(string filter)
- {
- this.RestricoesFinanceirosFiltradas = (filter == "" ? new ObservableCollection<RestricaoUsuario>(this.RestricoesFinanceiros) : new ObservableCollection<RestricaoUsuario>(
- 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<RestricaoUsuario>();
- }
-
- internal async Task<List<RestricaoUsuario>> FiltrarRestricoesRelatorio(string value)
- {
- List<RestricaoUsuario> restricaoUsuarios = await Task.Run<List<RestricaoUsuario>>(() => this.FiltrarRestricoesRelatorios(value));
- return restricaoUsuarios;
- }
-
- public List<RestricaoUsuario> FiltrarRestricoesRelatorios(string filter)
- {
- this.RestricoesRelatoriosFiltrados = (filter == "" ? new ObservableCollection<RestricaoUsuario>(this.RestricoesRelatorios) : new ObservableCollection<RestricaoUsuario>(
- 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<RestricaoUsuario>();
- }
-
- internal async Task<List<RestricaoUsuario>> FiltrarRestricoesSeguro(string value)
- {
- List<RestricaoUsuario> restricaoUsuarios = await Task.Run<List<RestricaoUsuario>>(() => this.FiltrarRestricoesSeguros(value));
- return restricaoUsuarios;
- }
-
- public List<RestricaoUsuario> FiltrarRestricoesSeguros(string filter)
- {
- this.RestricoesSegurosFiltradas = (filter == "" ? new ObservableCollection<RestricaoUsuario>(this.RestricoesSeguros) : new ObservableCollection<RestricaoUsuario>(
- 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<RestricaoUsuario>();
- }
-
- internal async Task<List<RestricaoUsuario>> FiltrarRestricoesTotalizacoesRelatorio(string value)
- {
- List<RestricaoUsuario> restricaoUsuarios = await Task.Run<List<RestricaoUsuario>>(() => this.FiltrarRestricoesTotalizacoesRelatorios(value));
- return restricaoUsuarios;
- }
-
- public List<RestricaoUsuario> FiltrarRestricoesTotalizacoesRelatorios(string filter)
- {
- this.RestricoesTotalizacoesRelatoriosFiltrados = (filter == "" ? new ObservableCollection<RestricaoUsuario>(this.RestricoesTotalizacoesRelatorios) : new ObservableCollection<RestricaoUsuario>(
- 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<RestricaoUsuario>();
- }
-
- private async Task<List<PermissaoUsuario>> GetPermissoes(Usuario usuario, string modulo)
- {
- List<PermissaoUsuario> permissaoUsuarios = new List<PermissaoUsuario>();
- IEnumerable<TipoTela> tipoTelas = Enum.GetValues(typeof(TipoTela)).Cast<TipoTela>();
- IEnumerable<string> str =
- from v in tipoTelas
- select v.ToString();
- List<string> list = (
- from x in str
- orderby x
- select x).ToList<string>();
- List<PermissaoUsuario> 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>((PermissaoUsuario y) => y.get_Tela() == tipoTela))
- {
- id = permissaoUsuarios1.First<PermissaoUsuario>((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Id();
- consultar = permissaoUsuarios1.First<PermissaoUsuario>((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Consultar();
- incluir = permissaoUsuarios1.First<PermissaoUsuario>((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Incluir();
- alterar = permissaoUsuarios1.First<PermissaoUsuario>((PermissaoUsuario y) => y.get_Tela() == tipoTela).get_Alterar();
- excluir = permissaoUsuarios1.First<PermissaoUsuario>((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<PermissaoUsuario> permissaoUsuarios2 = permissaoUsuarios;
- list = null;
- return permissaoUsuarios2;
- }
-
- private async Task<List<PermissaoArquivoDigital>> GetPermissoesArquivoDigital(Usuario usuario)
- {
- List<PermissaoArquivoDigital> permissaoArquivoDigitals = new List<PermissaoArquivoDigital>();
- IEnumerable<TipoArquivoDigital> tipoArquivoDigitals = Enum.GetValues(typeof(TipoArquivoDigital)).Cast<TipoArquivoDigital>();
- IEnumerable<string> str =
- from v in tipoArquivoDigitals
- select v.ToString();
- List<string> list = (
- from x in str
- orderby x
- select x).ToList<string>();
- List<PermissaoArquivoDigital> 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>((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital))
- {
- id = permissaoArquivoDigitals1.First<PermissaoArquivoDigital>((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital).get_Id();
- consultar = permissaoArquivoDigitals1.First<PermissaoArquivoDigital>((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital).get_Consultar();
- incluir = permissaoArquivoDigitals1.First<PermissaoArquivoDigital>((PermissaoArquivoDigital y) => y.get_Tela() == tipoArquivoDigital).get_Incluir();
- excluir = permissaoArquivoDigitals1.First<PermissaoArquivoDigital>((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<PermissaoArquivoDigital> permissaoArquivoDigitals2 = permissaoArquivoDigitals;
- list = null;
- return permissaoArquivoDigitals2;
- }
-
- private async Task<List<RestricaoUsuario>> GetRestricoes(Usuario usuario, string modulo)
- {
- List<RestricaoUsuario> restricaoUsuarios = new List<RestricaoUsuario>();
- IEnumerable<TipoRestricao> tipoRestricaos = Enum.GetValues(typeof(TipoRestricao)).Cast<TipoRestricao>();
- IEnumerable<string> str =
- from v in tipoRestricaos
- select v.ToString();
- List<string> list = (
- from x in str
- orderby x
- select x).ToList<string>();
- List<RestricaoUsuario> restricaoUsuarios1 = await this.ServicoRestriUsuario.BuscarRestricoes(usuario.get_Id());
- List<RestricaoUsuario> 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>((RestricaoUsuario y) => y.get_Tipo() == tipoRestricao))
- {
- id = restricaoUsuarios2.First<RestricaoUsuario>((RestricaoUsuario y) => y.get_Tipo() == tipoRestricao).get_Id();
- restricao = restricaoUsuarios2.First<RestricaoUsuario>((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<RestricaoUsuario> restricaoUsuarios3 = restricaoUsuarios;
- list = null;
- return restricaoUsuarios3;
- }
-
- private async Task<List<RestricaoUsuarioCamposRelatorios>> GetRestricoesCamposRelatorios(Usuario usuario)
- {
- List<RestricaoUsuarioCamposRelatorios> restricaoUsuarioCamposRelatorios = new List<RestricaoUsuarioCamposRelatorios>();
- List<ParametrosRelatorio> parametrosRelatorios = new List<ParametrosRelatorio>();
- foreach (Relatorio relatorio in Enum.GetValues(typeof(Relatorio)).Cast<Relatorio>())
- {
- switch (relatorio)
- {
- case 0:
- case 1:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<ClientesAtivosInativos>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 2:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Producao>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 3:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<ApolicePendente>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 4:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Renovacao>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 5:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Gestor.Model.Domain.Relatorios.Comissao.Comissao>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 6:
- case 16:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Pendente>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 7:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<DadosRelatorio>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 8:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Auditoria>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 9:
- case 10:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Sinistro>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 11:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Fechamento>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 12:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<FaturaPendente>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 13:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<ExtratoBaixadoRelatorio>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 14:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<MetaSeguradoraRelatorio>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 15:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<MetaVendedorRelatorio>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 17:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Licenciamento>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 18:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Tarefa>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 19:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<NotaFiscalRelatorio>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 20:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<PrevisaoPagamento>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 23:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<LogsEnvio>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- case 27:
- {
- parametrosRelatorios.AddRange(Funcoes.ColunasRelatorio<Placas>(relatorio, new List<ParametrosRelatorio>()));
- continue;
- }
- default:
- {
- continue;
- }
- }
- }
- List<RestricaoUsuarioCamposRelatorios> restricaoUsuarioCamposRelatorios1 = await this.ServicoRestriUsuario.BuscarRestricoesCamposRelatorios(usuario.get_Id());
- List<RestricaoUsuarioCamposRelatorios> restricaoUsuarioCamposRelatorios2 = restricaoUsuarioCamposRelatorios1;
- parametrosRelatorios.ForEach((ParametrosRelatorio x) => {
- long id = (long)0;
- bool restricao = false;
- if (restricaoUsuarioCamposRelatorios2.Count > 0 && restricaoUsuarioCamposRelatorios2.Any<RestricaoUsuarioCamposRelatorios>((RestricaoUsuarioCamposRelatorios y) => {
- if (y.get_Campo() != x.get_Header())
- {
- return false;
- }
- return y.get_Relatorio() == x.get_Relatorio();
- }))
- {
- id = restricaoUsuarioCamposRelatorios2.First<RestricaoUsuarioCamposRelatorios>((RestricaoUsuarioCamposRelatorios y) => {
- if (y.get_Campo() != x.get_Header())
- {
- return false;
- }
- return y.get_Relatorio() == x.get_Relatorio();
- }).get_Id();
- restricao = restricaoUsuarioCamposRelatorios2.First<RestricaoUsuarioCamposRelatorios>((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<RestricaoUsuarioCamposRelatorios> restricaoUsuarioCamposRelatorios3 = restricaoUsuarioCamposRelatorios;
- parametrosRelatorios = null;
- return restricaoUsuarioCamposRelatorios3;
- }
-
- public void HabilitarArquivoDigital(PermissaoArquivoDigital habilitar)
- {
- PermissaoArquivoDigital permissaoArquivoDigital = this.ArquivosDigitais.First<PermissaoArquivoDigital>((PermissaoArquivoDigital x) => x.get_Tela() == habilitar.get_Tela());
- if (permissaoArquivoDigital.get_Consultar())
- {
- return;
- }
- permissaoArquivoDigital.set_Consultar(true);
- this.ArquivosDigitais = new ObservableCollection<PermissaoArquivoDigital>(this.ArquivosDigitais);
- }
-
- public void HabilitarConsulta(PermissaoUsuario habilitar, string source)
- {
- if (source != "Ferramentas")
- {
- PermissaoUsuario permissaoUsuario = this.Seguros.First<PermissaoUsuario>((PermissaoUsuario x) => x.get_Tela() == habilitar.get_Tela());
- if (permissaoUsuario.get_Consultar())
- {
- return;
- }
- permissaoUsuario.set_Consultar(true);
- this.Seguros = new ObservableCollection<PermissaoUsuario>(this.Seguros);
- return;
- }
- PermissaoUsuario permissaoUsuario1 = this.Ferramentas.First<PermissaoUsuario>((PermissaoUsuario x) => x.get_Tela() == habilitar.get_Tela());
- if (permissaoUsuario1.get_Consultar())
- {
- return;
- }
- permissaoUsuario1.set_Consultar(true);
- this.Ferramentas = new ObservableCollection<PermissaoUsuario>(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<PermissaoUsuario>(await this.GetPermissoes(usuario1, "seguros"));
- this.Ferramentas = new ObservableCollection<PermissaoUsuario>(await this.GetPermissoes(usuario1, "ferramentas"));
- this.ArquivosDigitais = new ObservableCollection<PermissaoArquivoDigital>(await this.GetPermissoesArquivoDigital(usuario1));
- this.PermissaoAggilizador = new List<Gestor.Model.Common.PermissaoAggilizador>((IEnumerable<!0>)await this._servicoUsuario.BuscarPermissaoAggilizador());
- this.RestricoesBis = await this.GetRestricoes(usuario1, "b.i.");
- this.RestricoesBisFiltradas = new ObservableCollection<RestricaoUsuario>(this.RestricoesBis);
- this.RestricoesSeguros = await this.GetRestricoes(usuario1, "seguros");
- this.RestricoesSegurosFiltradas = new ObservableCollection<RestricaoUsuario>(this.RestricoesSeguros);
- this.RestricoesRelatorios = await this.GetRestricoes(usuario1, "relatorios");
- this.RestricoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(this.RestricoesRelatorios);
- this.RestricoesFinanceiros = await this.GetRestricoes(usuario1, "financeiro");
- this.RestricoesFinanceirosFiltradas = new ObservableCollection<RestricaoUsuario>(this.RestricoesFinanceiros);
- this.RestricoesFerramentas = await this.GetRestricoes(usuario1, "ferramentas");
- this.RestricoesFerramentasFiltradas = new ObservableCollection<RestricaoUsuario>(this.RestricoesFerramentas);
- this.RestricoesAjudas = await this.GetRestricoes(usuario1, "ajuda");
- this.RestricoesAjudasFiltrados = new ObservableCollection<RestricaoUsuario>(this.RestricoesAjudas);
- this.RestricoesTotalizacoesRelatorios = await this.GetRestricoes(usuario1, "totalizacoesRelatorios");
- this.RestricoesTotalizacoesRelatoriosFiltrados = new ObservableCollection<RestricaoUsuario>(this.RestricoesTotalizacoesRelatorios);
- this.RestricoesCamposRelatorios = await this.GetRestricoesCamposRelatorios(usuario1);
- this.RestricoesCamposRelatoriosFiltrados = new ObservableCollection<RestricaoUsuarioCamposRelatorios>(this.RestricoesCamposRelatorios);
- this.Carregando = false;
- this.AdmUsuario = usuario1.get_Administrador();
- PermissaoUsuarioViewModel permissaoUsuarioViewModel = this;
- if (!usuario1.get_PermissaoAggilizador().HasValue)
- {
- List<Gestor.Model.Common.PermissaoAggilizador> permissaoAggilizadors = this.PermissaoAggilizador;
- permissaoAggilizador1 = permissaoAggilizadors.FirstOrDefault<Gestor.Model.Common.PermissaoAggilizador>((Gestor.Model.Common.PermissaoAggilizador x) => x.get_Id() == (long)2);
- }
- else
- {
- permissaoAggilizador1 = this.PermissaoAggilizador.FirstOrDefault<Gestor.Model.Common.PermissaoAggilizador>((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<bool> Salvar(long? idUsuario = null, bool registrar = true)
- {
- bool flag;
- bool alterar;
- long num;
- long id;
- List<PermissaoUsuario> permissaoUsuarios;
- List<RestricaoUsuarioCamposRelatorios> 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<PermissaoUsuario> permissaoUsuarios1 = new List<PermissaoUsuario>();
- List<PermissaoUsuario> permissaoUsuarios2 = permissaoUsuarios1;
- List<PermissaoUsuario> 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<PermissaoArquivoDigital> permissaoArquivoDigitals = new List<PermissaoArquivoDigital>();
- List<PermissaoArquivoDigital> permissaoArquivoDigitals1 = permissaoArquivoDigitals;
- permissaoArquivoDigitals1.AddRange(await this.GetPermissoesArquivoDigital(usuario));
- permissaoArquivoDigitals1 = null;
- List<PermissaoArquivoDigital> list = this.ArquivosDigitais.Select<PermissaoArquivoDigital, PermissaoArquivoDigital>((PermissaoArquivoDigital x) => {
- PermissaoArquivoDigital permissaoArquivoDigital = new PermissaoArquivoDigital();
- permissaoArquivoDigital.set_Id((permissaoArquivoDigitals.Count == 0 ? (long)0 : permissaoArquivoDigitals.First<PermissaoArquivoDigital>((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<PermissaoArquivoDigital>();
- permissaoUsuarios = new List<PermissaoUsuario>();
- List<PermissaoUsuario> list1 = this.Seguros.Select<PermissaoUsuario, PermissaoUsuario>((PermissaoUsuario x) => {
- PermissaoUsuario permissaoUsuario = new PermissaoUsuario();
- permissaoUsuario.set_Id((permissaoUsuarios1.Count == 0 ? (long)0 : permissaoUsuarios1.First<PermissaoUsuario>((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<PermissaoUsuario>();
- permissaoUsuarios.AddRange(list1);
- list1 = this.Ferramentas.Select<PermissaoUsuario, PermissaoUsuario>((PermissaoUsuario x) => {
- PermissaoUsuario permissaoUsuario = new PermissaoUsuario();
- permissaoUsuario.set_Id((permissaoUsuarios1.Count == 0 ? (long)0 : permissaoUsuarios1.First<PermissaoUsuario>((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<PermissaoUsuario>();
- 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<RestricaoUsuario> restricaoUsuarios = new List<RestricaoUsuario>();
- List<RestricaoUsuario> restricaoUsuarios1 = restricaoUsuarios;
- List<RestricaoUsuario> 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<RestricaoUsuarioCamposRelatorios> restricaoUsuarioCamposRelatorios1 = new List<RestricaoUsuarioCamposRelatorios>();
- List<RestricaoUsuarioCamposRelatorios> restricaoUsuarioCamposRelatorios2 = restricaoUsuarioCamposRelatorios1;
- restricaoUsuarioCamposRelatorios2.AddRange(await this.GetRestricoesCamposRelatorios(usuario));
- restricaoUsuarioCamposRelatorios2 = null;
- List<RestricaoUsuario> restricaoUsuarios2 = new List<RestricaoUsuario>();
- restricaoUsuarioCamposRelatorios = new List<RestricaoUsuarioCamposRelatorios>();
- List<RestricaoUsuario> list2 = this.RestricoesBis.Select<RestricaoUsuario, RestricaoUsuario>((RestricaoUsuario x) => {
- RestricaoUsuario restricaoUsuario = new RestricaoUsuario();
- restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First<RestricaoUsuario>((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<RestricaoUsuario>();
- restricaoUsuarios2.AddRange(list2);
- list2 = this.RestricoesSeguros.Select<RestricaoUsuario, RestricaoUsuario>((RestricaoUsuario x) => {
- RestricaoUsuario restricaoUsuario = new RestricaoUsuario();
- restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First<RestricaoUsuario>((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<RestricaoUsuario>();
- restricaoUsuarios2.AddRange(list2);
- list2 = this.RestricoesRelatorios.Select<RestricaoUsuario, RestricaoUsuario>((RestricaoUsuario x) => {
- RestricaoUsuario restricaoUsuario = new RestricaoUsuario();
- restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First<RestricaoUsuario>((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<RestricaoUsuario>();
- restricaoUsuarios2.AddRange(list2);
- list2 = this.RestricoesTotalizacoesRelatorios.Select<RestricaoUsuario, RestricaoUsuario>((RestricaoUsuario x) => {
- RestricaoUsuario restricaoUsuario = new RestricaoUsuario();
- restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First<RestricaoUsuario>((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<RestricaoUsuario>();
- restricaoUsuarios2.AddRange(list2);
- list2 = this.RestricoesFinanceiros.Select<RestricaoUsuario, RestricaoUsuario>((RestricaoUsuario x) => {
- RestricaoUsuario restricaoUsuario = new RestricaoUsuario();
- restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First<RestricaoUsuario>((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<RestricaoUsuario>();
- restricaoUsuarios2.AddRange(list2);
- list2 = this.RestricoesFerramentas.Select<RestricaoUsuario, RestricaoUsuario>((RestricaoUsuario x) => {
- RestricaoUsuario restricaoUsuario = new RestricaoUsuario();
- restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First<RestricaoUsuario>((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<RestricaoUsuario>();
- restricaoUsuarios2.AddRange(list2);
- list2 = this.RestricoesAjudas.Select<RestricaoUsuario, RestricaoUsuario>((RestricaoUsuario x) => {
- RestricaoUsuario restricaoUsuario = new RestricaoUsuario();
- restricaoUsuario.set_Id((restricaoUsuarios.Count == 0 ? (long)0 : restricaoUsuarios.First<RestricaoUsuario>((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<RestricaoUsuario>();
- restricaoUsuarios2.AddRange(list2);
- List<RestricaoUsuarioCamposRelatorios> list3 = this.RestricoesCamposRelatorios.Select<RestricaoUsuarioCamposRelatorios, RestricaoUsuarioCamposRelatorios>((RestricaoUsuarioCamposRelatorios x) => {
- RestricaoUsuarioCamposRelatorios restricaoUsuarioCamposRelatorio = new RestricaoUsuarioCamposRelatorios();
- restricaoUsuarioCamposRelatorio.set_Id((restricaoUsuarioCamposRelatorios1.Count == 0 ? (long)0 : restricaoUsuarioCamposRelatorios1.First<RestricaoUsuarioCamposRelatorios>((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>();
- 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<Gestor.Model.Domain.Ferramentas.Tarefa> _tarefasFiltradas = new ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa>();
-
- private List<Gestor.Model.Domain.Ferramentas.Tarefa> _tarefas = new List<Gestor.Model.Domain.Ferramentas.Tarefa>();
-
- private bool _isAnotacoes = true;
-
- private Gestor.Model.Domain.Ferramentas.Tarefa _selectedTarefa;
-
- private ObservableCollection<Usuario> _usuarios;
-
- private ObservableCollection<TipoDeTarefa> _tiposTarefa;
-
- private List<TelefoneBase> _telefones;
-
- private DateTime _dataAgendamento = Funcoes.GetNetworkTime();
-
- private DateTime _horaAgendamento = Funcoes.GetNetworkTime();
-
- private Usuario _selectedUsuario;
-
- private TipoDeTarefa _selectedTipoTarefa;
-
- private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital();
-
- private ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital> _arquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>();
-
- private List<Gestor.Model.Domain.Common.ArquivoDigital> _arquivosFinais = new List<Gestor.Model.Domain.Common.ArquivoDigital>();
-
- 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<Gestor.Model.Domain.Common.ArquivoDigital> ArquivosAnexados
- {
- get
- {
- return this._arquivosAnexados;
- }
- set
- {
- this._arquivosAnexados = value;
- base.OnPropertyChanged("ArquivosAnexados");
- }
- }
-
- public List<Gestor.Model.Domain.Common.ArquivoDigital> 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<ResponsavelTarefa> observableCollection;
- bool tipoDeTarefa;
- TipoDeTarefa tipoDeTarefa1;
- long? nullable;
- bool usuario;
- ObservableCollection<ResponsavelTarefa> 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<ResponsavelTarefa>();
- }
- else
- {
- observableCollection = (value.get_Responsaveis() == null ? new ObservableCollection<ResponsavelTarefa>() : new ObservableCollection<ResponsavelTarefa>(value.get_Responsaveis()));
- }
- base.Responsaveis = observableCollection;
- if (!base.Responsaveis.Any<ResponsavelTarefa>())
- {
- Gestor.Model.Domain.Ferramentas.Tarefa tarefa3 = value;
- if (tarefa3 != null)
- {
- usuario = tarefa3.get_Usuario();
- }
- else
- {
- usuario = false;
- }
- if (!usuario)
- {
- observableCollection1 = new ObservableCollection<ResponsavelTarefa>();
- }
- else
- {
- ResponsavelTarefa[] responsavelTarefaArray = new ResponsavelTarefa[1];
- ResponsavelTarefa responsavelTarefa = new ResponsavelTarefa();
- responsavelTarefa.set_Usuario(value.get_Usuario());
- responsavelTarefaArray[0] = responsavelTarefa;
- observableCollection1 = new ObservableCollection<ResponsavelTarefa>(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>((TipoDeTarefa x) => x.get_Id() != value.get_Id()) || value.get_TipoDeTarefa().get_Ativo())
- {
- this.TiposTarefa = new ObservableCollection<TipoDeTarefa>((
- from x in this.TiposTarefa
- where x.get_Ativo()
- select x).ToList<TipoDeTarefa>());
- }
- 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<Gestor.Model.Domain.Ferramentas.Tarefa> Tarefas
- {
- get
- {
- return this._tarefas;
- }
- set
- {
- this._tarefas = value;
- base.OnPropertyChanged("Tarefas");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa> TarefasFiltradas
- {
- get
- {
- return this._tarefasFiltradas;
- }
- set
- {
- this._tarefasFiltradas = value;
- base.OnPropertyChanged("TarefasFiltradas");
- }
- }
-
- public List<TelefoneBase> Telefones
- {
- get
- {
- return this._telefones;
- }
- set
- {
- this._telefones = value;
- base.OnPropertyChanged("Telefones");
- }
- }
-
- public ObservableCollection<TipoDeTarefa> 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<Usuario> 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<TipoDeTarefa>((
- from x in Recursos.TiposTarefa
- where x.get_Ativo()
- select x).ToList<TipoDeTarefa>());
- 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<ResponsavelTarefa> 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<Gestor.Model.Domain.Ferramentas.Tarefa>()
- {
- this.SelectedTarefa
- };
- base.ListaUsuariosResponsaveis();
- base.Responsaveis.ToList<ResponsavelTarefa>().ForEach((ResponsavelTarefa x) => this.Usuarios.Remove(x.get_Usuario()));
- }
-
- public async void Anexar()
- {
- this.InclusaoArquivoDigitalEnable = false;
- List<Gestor.Model.Domain.Common.ArquivoDigital> arquivoDigitals = await base.AddAttachments(this.ArquivosAnexados.ToList<Gestor.Model.Domain.Common.ArquivoDigital>(), new List<Gestor.Model.Domain.Common.ArquivoDigital>());
- await Task.Run(async () => {
- await Task.Delay(200);
- this.InclusaoArquivoDigitalEnable = true;
- });
- if (arquivoDigitals != null)
- {
- arquivoDigitals.AddRange(this.ArquivosAnexados);
- this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(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>((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<ClienteTelefone> observableCollection = await clienteServico.BuscarTelefonesAsync(tarefa.get_IdCliente());
- TarefaDrawerViewModel list = this;
- ObservableCollection<ClienteTelefone> observableCollection1 = observableCollection;
- IEnumerable<ClienteTelefone> clienteTelefones =
- from x in observableCollection1
- where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero())
- select x;
- list.Telefones = clienteTelefones.Select<ClienteTelefone, TelefoneBase>((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<TelefoneBase>();
- 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<ClienteTelefone> observableCollection2 = observableCollection;
- IEnumerable<ClienteTelefone> clienteTelefones1 =
- from x in observableCollection2
- where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero())
- select x;
- list1.Telefones = clienteTelefones1.Select<ClienteTelefone, TelefoneBase>((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<TelefoneBase>();
- }
- 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<ClienteTelefone> observableCollection3 = observableCollection;
- IEnumerable<ClienteTelefone> clienteTelefones2 =
- from x in observableCollection3
- where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero())
- select x;
- list2.Telefones = clienteTelefones2.Select<ClienteTelefone, TelefoneBase>((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<TelefoneBase>();
- }
- else
- {
- clienteServico = null;
- return;
- }
- }
- }
- clienteServico = null;
- }
-
- public async Task CarregarTarefas(int index)
- {
- List<Gestor.Model.Domain.Ferramentas.Tarefa> 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<Gestor.Model.Domain.Ferramentas.Tarefa> tarefas1 = tarefas;
- list.Tarefas = (
- from x in tarefas1
- orderby x.get_Agendamento() descending
- select x).ToList<Gestor.Model.Domain.Ferramentas.Tarefa>();
- this.TarefasFiltradas = new ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa>(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>((Gestor.Model.Domain.Ferramentas.Tarefa x) => x.get_Id() == tarefa2.get_Id()) : this.TarefasFiltradas.First<Gestor.Model.Domain.Ferramentas.Tarefa>());
- }
- 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<Gestor.Model.Domain.Ferramentas.Tarefa> tarefas = await this.Servico.BuscarTarefas(tarefa.get_Entidade(), tarefa.get_IdEntidade(), concluido);
- TarefaDrawerViewModel list = this;
- List<Gestor.Model.Domain.Ferramentas.Tarefa> tarefas1 = tarefas;
- list.Tarefas = (
- from x in tarefas1
- orderby x.get_Agendamento()
- select x).ToList<Gestor.Model.Domain.Ferramentas.Tarefa>();
- this.TarefasFiltradas = new ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa>(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>((Gestor.Model.Domain.Ferramentas.Tarefa x) => x.get_Id() == tarefa.get_Id()) : this.TarefasFiltradas.First<Gestor.Model.Domain.Ferramentas.Tarefa>());
- }
- 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<Usuario>(Recursos.Usuarios.Where<Usuario>((Usuario x) => {
- if (!Recursos.Configuracoes.Any<ConfiguracaoSistema>((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, string>((Usuario x) => x.get_Nome()).ToList<Usuario>());
- }
-
- 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>((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao());
- this.ArquivosAnexados.Remove(arquivoDigital);
- this.ArquivosAnexados = new ObservableCollection<Gestor.Model.Domain.Common.ArquivoDigital>(this.ArquivosAnexados);
- }
-
- public async void Editar(IndiceArquivoDigital arquivo)
- {
- if (arquivo != null && arquivo.get_IdArquivoDigital() != 0)
- {
- await this.ArquivoDigitalServico.Save(arquivo);
- }
- }
-
- public async Task<bool> 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 = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta http-equiv='Content-Language' content='pt-br'><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=yes'><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'><style type='text/css' media='print'>@page{ size: A4;} body; -webkit-print-color-adjust: exact; }</style><title> TAREFA </title></head><body bgcolor='#FFFFFF'><div align='center'>";
- str = string.Concat(str, "<br>");
- str = string.Concat(str, "<table border='0' width='999'><td height='20' width='999' bgcolor='black'><h4 style='text-align: center; color: white; background-color: black'>");
- str = string.Concat(str, "TAREFA</h4></td></table><br>");
- str = string.Concat(str, "<table border='1' bordercolor='#ededed' width='999'><font face='Verdana' style='font-size: 4pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>");
- int num = 0;
- string[] cliente = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num1 = num;
- num = num1 + 1;
- cliente[2] = (num1 % 2 == 0 ? "WhiteSmoke" : "White");
- cliente[3] = "'><p align='left'><b>CLIENTE: </b>";
- cliente[4] = this.SelectedTarefa.get_Cliente();
- cliente[5] = "</p></td></tr>";
- str = string.Concat(cliente);
- string[] referencia = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num2 = num;
- num = num2 + 1;
- referencia[2] = (num2 % 2 == 0 ? "WhiteSmoke" : "White");
- referencia[3] = "'><p align='left'><b>REFERÊNCIA: </b>";
- referencia[4] = this.SelectedTarefa.get_Referencia();
- referencia[5] = "</p></td></tr>";
- str = string.Concat(referencia);
- string[] titulo = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num3 = num;
- num = num3 + 1;
- titulo[2] = (num3 % 2 == 0 ? "WhiteSmoke" : "White");
- titulo[3] = "'><p align='left'><b>TÍTULO: </b>";
- titulo[4] = this.SelectedTarefa.get_Titulo();
- titulo[5] = "</p></td></tr>";
- str = string.Concat(titulo);
- string[] strArrays = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num4 = num;
- num = num4 + 1;
- strArrays[2] = (num4 % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays[3] = "'><p align='left'><b>AGENDAMENTO: </b>";
- DateTime agendamento = this.SelectedTarefa.get_Agendamento();
- strArrays[4] = agendamento.ToString();
- strArrays[5] = "</p></td></tr>";
- str = string.Concat(strArrays);
- string[] nome1 = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num5 = num;
- num = num5 + 1;
- nome1[2] = (num5 % 2 == 0 ? "WhiteSmoke" : "White");
- nome1[3] = "'><p align='left'><b>RESPONSÁVEL PRINCIPAL: </b>";
- nome1[4] = this.SelectedTarefa.get_Usuario().get_Nome();
- nome1[5] = "</p></td></tr>";
- str = string.Concat(nome1);
- string[] description = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- int num6 = num;
- num = num6 + 1;
- description[2] = (num6 % 2 == 0 ? "WhiteSmoke" : "White");
- description[3] = "'><p align='left'><b>STATUS: </b>";
- description[4] = Gestor.Common.Validation.ValidationHelper.GetDescription(this.SelectedTarefa.get_Status());
- description[5] = "</p></td></tr>";
- str = string.Concat(description);
- string[] strArrays1 = new string[] { str, "<tr><td width='333' bgcolor='", null, null, null, null };
- strArrays1[2] = (num % 2 == 0 ? "WhiteSmoke" : "White");
- strArrays1[3] = "'><p align='left'><b>TIPO DE TAREFA: </b>";
- TipoDeTarefa selectedTipoTarefa = this.SelectedTipoTarefa;
- if (selectedTipoTarefa != null)
- {
- nome = selectedTipoTarefa.get_Nome();
- }
- else
- {
- nome = null;
- }
- strArrays1[4] = nome;
- strArrays1[5] = "</p></td></tr>";
- str = string.Concat(strArrays1);
- str = string.Concat(str, "</font></table>");
- if (base.Responsaveis != null && base.Responsaveis.Count > 0)
- {
- str = string.Concat(str, "<h2>RESPONSÁVEIS VINCULADOS</h2>");
- str = string.Concat(str, "<br>");
- str = string.Concat(str, "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>");
- List<string> strs = new List<string>();
- foreach (ResponsavelTarefa responsavei in base.Responsaveis)
- {
- strs.Add(responsavei.get_Usuario().get_Nome().Trim().ToUpper());
- }
- str = string.Concat(str, "<tr><td width='333'><p align='left'>", string.Join(", ", strs), "</p></td></tr>");
- str = string.Concat(str, "</font></table>");
- str = string.Concat(str, "<br><br>");
- }
- str = string.Concat(str, "<br><br>");
- if (this.SelectedTarefa.get_Descricao() != null)
- {
- str = string.Concat(str, "<h2>ANOTAÇÕES</h2>");
- str = string.Concat(str, "<br>");
- str = string.Concat(str, "<table border='1'bordercolor='#cfcfcf' width='999'><font face='Verdana' style='font-size: 12pt; position: absolute; top: 50 %; -moz-transform: translateY(-50 %); -webkit-transform: translateY(-50 %); transform: translateY(-50 %)'>");
- str = string.Concat(str, "<tr><td width='333'><p align='left'>", this.SelectedTarefa.get_Descricao().Replace("<BODY>", "").Replace("</BODY>", ""), "</p></td></tr>");
- str = string.Concat(str, "</font></table>");
- str = string.Concat(str, "<br><br>");
- }
- str = string.Concat(str, "</div></body>");
- return str;
- }
-
- public async Task Incluir()
- {
- TarefaDrawerViewModel observableCollection = this;
- observableCollection.CarregarUsuarios();
- observableCollection.Responsaveis = new ObservableCollection<ResponsavelTarefa>();
- 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<Usuario> usuarios = observableCollection.Usuarios;
- tarefa.set_Usuario(usuarios.FirstOrDefault<Usuario>((Usuario x) => x.get_Id() == Recursos.Usuario.get_Id()));
- tarefa.set_Restrito(new bool?(false));
- tarefa.set_Responsaveis(observableCollection.Responsaveis.ToList<ResponsavelTarefa>());
- tarefaDrawerViewModel.SelectedTarefa = tarefa;
- observableCollection.ArquivosFinais = new List<Gestor.Model.Domain.Common.ArquivoDigital>();
- 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<Gestor.Model.Domain.Common.ArquivoDigital>();
- }
-
- 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<List<KeyValuePair<string, string>>> Salvar(string anotacoes, string anotacoesInternas)
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- Usuario usuario;
- DateTime networkTime = Funcoes.GetNetworkTime();
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- if (configuracoes.All<ConfiguracaoSistema>((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<ResponsavelTarefa>());
- Gestor.Model.Domain.Ferramentas.Tarefa selectedTarefa = this.SelectedTarefa;
- ResponsavelTarefa responsavelTarefa = base.Responsaveis.FirstOrDefault<ResponsavelTarefa>();
- if (responsavelTarefa != null)
- {
- usuario = responsavelTarefa.get_Usuario();
- }
- else
- {
- usuario = null;
- }
- selectedTarefa.set_Usuario(usuario);
- Gestor.Model.Domain.Ferramentas.Tarefa tarefa = this.SelectedTarefa;
- List<ConfiguracaoSistema> configuracaoSistemas = Recursos.Configuracoes;
- tarefa.set_AgendamentoRetroativo(configuracaoSistemas.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 45));
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedTarefa.Validate();
- if (this.SelectedTarefa.get_Descricao() == null && string.IsNullOrWhiteSpace(anotacoes) && string.IsNullOrWhiteSpace(anotacoesInternas))
- {
- keyValuePairs1.Add(new KeyValuePair<string, string>("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(), " <p> ", this.SelectedTarefa.get_Descricao(), " </p>"));
- }
- if (!string.IsNullOrWhiteSpace(anotacoesInternas))
- {
- this.SelectedTarefa.set_AnotacoesInternas(Funcoes.AdicionarLog(this.SelectedTarefa.get_AnotacoesInternas()));
- this.SelectedTarefa.set_DescricaoInterna(string.Concat(this.SelectedTarefa.get_AnotacoesInternas(), " <p> ", this.SelectedTarefa.get_DescricaoInterna(), " </p>"));
- }
- 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>((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<Gestor.Model.Domain.Common.ArquivoDigital>();
- }
-
- 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<VendedorParcela> _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<VendedorParcela> 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>((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>((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>((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault());
- this.Paga = this.SelectedDocumento.get_Pagamentos().Where<VendedorParcela>((VendedorParcela x) => {
- if (x.get_Parcela().get_SubTipo() != 1)
- {
- return false;
- }
- return x.get_DataPrePagamento().HasValue;
- }).Sum<VendedorParcela>((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault());
- }
-
- private void CalculaEspecial()
- {
- if (this.SelectedDocumento.get_Parcelas().All<Parcela>((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>((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>((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault());
- this.PagaEspecial = this.SelectedDocumento.get_Pagamentos().Where<VendedorParcela>((VendedorParcela x) => {
- if (x.get_Parcela().get_SubTipo() == 1)
- {
- return false;
- }
- return x.get_DataPrePagamento().HasValue;
- }).Sum<VendedorParcela>((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault());
- }
-
- private void CalculaRepasse()
- {
- if (this.SelectedDocumento.get_Pagamentos().All<VendedorParcela>((VendedorParcela x) => x.get_Vendedor().get_Corretora()))
- {
- this.IsVisibleVendedores = Visibility.Collapsed;
- return;
- }
- List<VendedorParcela> list = (
- from x in this.SelectedDocumento.get_Pagamentos()
- where !x.get_Vendedor().get_Corretora()
- group x by x.get_Vendedor().get_Id()).Select<IGrouping<long, VendedorParcela>, VendedorParcela>((IGrouping<long, VendedorParcela> x) => {
- VendedorParcela vendedorParcela = new VendedorParcela();
- vendedorParcela.set_Repasse(x.First<VendedorParcela>().get_Repasse());
- vendedorParcela.set_Documento(this.SelectedDocumento);
- vendedorParcela.set_ValorTotal(x.First<VendedorParcela>().get_ValorTotal());
- vendedorParcela.set_Vendedor(x.First<VendedorParcela>().get_Vendedor());
- vendedorParcela.set_ValorTotalPago(x.Where<VendedorParcela>((VendedorParcela y) => {
- if (y.get_Parcela().get_SubTipo() != 1)
- {
- return false;
- }
- return y.get_DataPrePagamento().HasValue;
- }).Sum<VendedorParcela>((VendedorParcela y) => y.get_ValorRepasse()));
- vendedorParcela.set_ValorRepasseB((
- from y in x
- where y.get_Parcela().get_SubTipo() != 1
- select y).Sum<VendedorParcela>((VendedorParcela y) => y.get_ValorRepasse()));
- vendedorParcela.set_ValorRepasse(x.Where<VendedorParcela>((VendedorParcela y) => {
- if (y.get_Parcela().get_SubTipo() == 1)
- {
- return false;
- }
- return y.get_DataPrePagamento().HasValue;
- }).Sum<VendedorParcela>((VendedorParcela y) => y.get_ValorRepasse()));
- decimal? porcentagemRepasse = x.First<VendedorParcela>().get_PorcentagemRepasse();
- vendedorParcela.set_PorcentagemRepasse((porcentagemRepasse.HasValue ? new decimal?(porcentagemRepasse.GetValueOrDefault() / 100) : null));
- vendedorParcela.set_TipoVendedor(x.First<VendedorParcela>().get_TipoVendedor());
- return vendedorParcela;
- }).ToList<VendedorParcela>();
- this.Pagamentos = new ObservableCollection<VendedorParcela>(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<VendedorParcela> _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<VendedorParcela> 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>((VendedorParcela x) => {
- if (this.SelectedParcela.get_SubTipo() == 1)
- {
- return x.get_Parcela().get_SubTipo() == 1;
- }
- return x.get_Parcela().get_SubTipo() != 1;
- }).Sum<VendedorParcela>((VendedorParcela x) => x.get_ValorRepasse().GetValueOrDefault());
- this.Paga = this.SelectedParcela.get_Vendedores().Where<VendedorParcela>((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>((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>((VendedorParcela x) => x.get_Vendedor().get_Corretora()))
- {
- this.IsVisibleVendedores = Visibility.Collapsed;
- return;
- }
- List<VendedorParcela> list = (
- from x in this.SelectedParcela.get_Vendedores()
- where !x.get_Vendedor().get_Corretora()
- group x by x.get_Vendedor().get_Id()).Select<IGrouping<long, VendedorParcela>, VendedorParcela>((IGrouping<long, VendedorParcela> x) => {
- VendedorParcela vendedorParcela = new VendedorParcela();
- vendedorParcela.set_Repasse(x.First<VendedorParcela>().get_Repasse());
- vendedorParcela.set_Documento(this.SelectedParcela.get_Documento());
- vendedorParcela.set_ValorTotal(x.First<VendedorParcela>().get_ValorTotal());
- vendedorParcela.set_Vendedor(x.First<VendedorParcela>().get_Vendedor());
- vendedorParcela.set_ValorTotalPago(x.Where<VendedorParcela>((VendedorParcela y) => {
- if (y.get_Parcela().get_SubTipo() != 1)
- {
- return false;
- }
- return y.get_DataPrePagamento().HasValue;
- }).Sum<VendedorParcela>((VendedorParcela y) => y.get_ValorRepasse()));
- vendedorParcela.set_ValorRepasseB((
- from y in x
- where y.get_Parcela().get_SubTipo() != 1
- select y).Sum<VendedorParcela>((VendedorParcela y) => y.get_ValorRepasse()));
- vendedorParcela.set_ValorRepasse(x.Where<VendedorParcela>((VendedorParcela y) => {
- if (y.get_Parcela().get_SubTipo() == 1)
- {
- return false;
- }
- return y.get_DataPrePagamento().HasValue;
- }).Sum<VendedorParcela>((VendedorParcela y) => y.get_ValorRepasse()));
- decimal? porcentagemRepasse = x.First<VendedorParcela>().get_PorcentagemRepasse();
- vendedorParcela.set_PorcentagemRepasse((porcentagemRepasse.HasValue ? new decimal?(porcentagemRepasse.GetValueOrDefault() / 100) : null));
- vendedorParcela.set_TipoVendedor(x.First<VendedorParcela>().get_TipoVendedor());
- return vendedorParcela;
- }).ToList<VendedorParcela>();
- this.Pagamentos = new ObservableCollection<VendedorParcela>(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<VinculoVendedor> _vinculado;
-
- private List<VinculoVendedor> _vinculadoFiltro;
-
- private List<VinculoVendedor> _vendedor;
-
- private List<VinculoVendedor> _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<VinculoVendedor> Vendedor
- {
- get
- {
- return this._vendedor;
- }
- set
- {
- this._vendedor = value;
- this.IsVisibleVendedor = (value == null ? false : value.Count > 0);
- base.OnPropertyChanged("Vendedor");
- }
- }
-
- public List<VinculoVendedor> VendedorFiltro
- {
- get
- {
- return this._vendedorFiltro;
- }
- set
- {
- this._vendedorFiltro = value;
- base.OnPropertyChanged("VendedorFiltro");
- }
- }
-
- public List<VinculoVendedor> Vinculado
- {
- get
- {
- return this._vinculado;
- }
- set
- {
- this._vinculado = value;
- this.IsVisibleVinculado = (value == null ? false : value.Count > 0);
- base.OnPropertyChanged("Vinculado");
- }
- }
-
- public List<VinculoVendedor> 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<VinculoVendedor>(
- 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<VinculoVendedor>(
- 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<List<VinculoVendedor>> GetVendedor(Usuario usuario)
- {
- List<Gestor.Model.Domain.Seguros.Vendedor> list;
- List<VinculoVendedor> vinculoVendedors;
- List<Gestor.Model.Domain.Seguros.Vendedor> vendedors = await this._servicoVendedor.BuscarVendedoresAtivosAsync();
- if (vendedors != null)
- {
- list = (
- from x in vendedors
- where x.get_IdEmpresa() == usuario.get_IdEmpresa()
- select x).ToList<Gestor.Model.Domain.Seguros.Vendedor>();
- }
- else
- {
- list = null;
- }
- vendedors = list;
- if (vendedors == null || vendedors.Count == 0)
- {
- vinculoVendedors = null;
- }
- else
- {
- IEnumerable<Gestor.Model.Domain.Seguros.Vendedor> vendedors1 =
- from vendedor in vendedors
- where this.Vinculado.All<VinculoVendedor>((VinculoVendedor x) => x.get_Vendedor().get_Id() != vendedor.get_Id())
- select vendedor;
- vinculoVendedors = vendedors1.Select<Gestor.Model.Domain.Seguros.Vendedor, VinculoVendedor>((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<VinculoVendedor>();
- }
- List<VinculoVendedor> vinculoVendedors1 = vinculoVendedors;
- return vinculoVendedors1;
- }
-
- private async Task<List<VinculoVendedor>> GetVinculo(Usuario usuario)
- {
- List<VinculoVendedor> vinculoVendedors = new List<VinculoVendedor>();
- 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<VinculoVendedor> vinculoVendedors1 = vinculoVendedors;
- return vinculoVendedors1;
- }
-
- private async void Load(Usuario usuario)
- {
- await this.AwaitLoad(usuario);
- }
-
- public async Task Salvar()
- {
- string str;
- List<VinculoVendedor> vinculado = this.Vinculado;
- List<VendedorUsuario> list = (
- from x in vinculado
- where !x.get_Vinculado()
- select x).Select<VinculoVendedor, VendedorUsuario>((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<VendedorUsuario>();
- if (list.Count > 0)
- {
- if (!await this._servicoVendedorUsuario.Delete(list))
- {
- return;
- }
- }
- List<VinculoVendedor> vendedor = this.Vendedor;
- List<VendedorUsuario> vendedorUsuarios = (
- from x in vendedor
- where x.get_Vinculado()
- select x).Select<VinculoVendedor, VendedorUsuario>((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<VendedorUsuario>();
- 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<VinculoVendedor> vinculoVendedors = this.Vinculado;
- List<Gestor.Model.Domain.Seguros.Vendedor> vendedors = (
- from x in vinculoVendedors
- select x.get_Vendedor()).ToList<Gestor.Model.Domain.Seguros.Vendedor>();
- 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<IPAddress>)addressList).FirstOrDefault<IPAddress>((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 |