summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/BI
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/ViewModels/BI')
-rw-r--r--Gestor.Application/ViewModels/BI/BISeriesViewModel.cs70
-rw-r--r--Gestor.Application/ViewModels/BI/NotasViewModel.cs311
-rw-r--r--Gestor.Application/ViewModels/BI/PainelBiViewModel.cs1590
-rw-r--r--Gestor.Application/ViewModels/BI/ProspeccaoViewModel.cs553
-rw-r--r--Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs1453
5 files changed, 0 insertions, 3977 deletions
diff --git a/Gestor.Application/ViewModels/BI/BISeriesViewModel.cs b/Gestor.Application/ViewModels/BI/BISeriesViewModel.cs
deleted file mode 100644
index 0d5a5f0..0000000
--- a/Gestor.Application/ViewModels/BI/BISeriesViewModel.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using Gestor.Application.ViewModels.Generic;
-using LiveCharts;
-using System;
-
-namespace Gestor.Application.ViewModels.BI
-{
- public class BISeriesViewModel : BaseSegurosViewModel
- {
- private int _indice;
-
- private string _titulo;
-
- private SeriesCollection _serie;
-
- public int Indice
- {
- get
- {
- return this._indice;
- }
- set
- {
- if (this._indice == value)
- {
- return;
- }
- this._indice = value;
- base.OnPropertyChanged("Indice");
- }
- }
-
- public SeriesCollection Serie
- {
- get
- {
- return this._serie;
- }
- set
- {
- if ((object)this._serie == (object)value)
- {
- return;
- }
- this._serie = value;
- base.OnPropertyChanged("Serie");
- }
- }
-
- public string Titulo
- {
- get
- {
- return this._titulo;
- }
- set
- {
- if (this._titulo == value)
- {
- return;
- }
- this._titulo = value;
- base.OnPropertyChanged("Titulo");
- }
- }
-
- public BISeriesViewModel()
- {
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/BI/NotasViewModel.cs b/Gestor.Application/ViewModels/BI/NotasViewModel.cs
deleted file mode 100644
index dca2d31..0000000
--- a/Gestor.Application/ViewModels/BI/NotasViewModel.cs
+++ /dev/null
@@ -1,311 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels.Generic;
-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.BI
-{
- public class NotasViewModel : BaseSegurosViewModel
- {
- private readonly TarefaServico _servico;
-
- private bool _enableIncluirNota = true;
-
- private bool _ocultarUsuarios;
-
- private ObservableCollection<Usuario> _usuarios;
-
- private Usuario _selectedUsuario;
-
- private Gestor.Model.Domain.Ferramentas.Tarefa _tarefa;
-
- private ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa> _notas;
-
- private ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa> _notasConcluidas;
-
- private Gestor.Model.Domain.Ferramentas.Tarefa _selectedNota;
-
- private bool _ocultarNotasConcluidas = true;
-
- public bool EnableIncluirNota
- {
- get
- {
- return this._enableIncluirNota;
- }
- set
- {
- this._enableIncluirNota = value;
- base.OnPropertyChanged("EnableIncluirNota");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa> Notas
- {
- get
- {
- return this._notas;
- }
- set
- {
- this._notas = value;
- base.OnPropertyChanged("Notas");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa> NotasConcluidas
- {
- get
- {
- return this._notasConcluidas;
- }
- set
- {
- this._notasConcluidas = value;
- base.OnPropertyChanged("NotasConcluidas");
- }
- }
-
- public bool OcultarNotasConcluidas
- {
- get
- {
- return this._ocultarNotasConcluidas;
- }
- set
- {
- this._ocultarNotasConcluidas = value;
- base.OnPropertyChanged("OcultarNotasConcluidas");
- }
- }
-
- public bool OcultarUsuarios
- {
- get
- {
- return this._ocultarUsuarios;
- }
- set
- {
- this._ocultarUsuarios = value;
- base.OnPropertyChanged("OcultarUsuarios");
- }
- }
-
- public Gestor.Model.Domain.Ferramentas.Tarefa SelectedNota
- {
- get
- {
- return this._selectedNota;
- }
- set
- {
- this._selectedNota = value;
- base.OnPropertyChanged("SelectedNota");
- }
- }
-
- public Usuario SelectedUsuario
- {
- get
- {
- return this._selectedUsuario;
- }
- set
- {
- this._selectedUsuario = value;
- this.Carregar();
- base.OnPropertyChanged("SelectedUsuario");
- }
- }
-
- public Gestor.Model.Domain.Ferramentas.Tarefa Tarefa
- {
- get
- {
- return this._tarefa;
- }
- set
- {
- this._tarefa = value;
- base.OnPropertyChanged("Tarefa");
- }
- }
-
- public ObservableCollection<Usuario> Usuarios
- {
- get
- {
- return this._usuarios;
- }
- set
- {
- this._usuarios = value;
- base.OnPropertyChanged("Usuarios");
- }
- }
-
- public NotasViewModel()
- {
- bool administrador;
- bool id;
- this._servico = new TarefaServico();
- this.Usuarios = new ObservableCollection<Usuario>(Recursos.Usuarios.Where<Usuario>((Usuario x) => {
- if (Recursos.Usuario.get_IdEmpresa() != (long)1 && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa())
- {
- return false;
- }
- return !x.get_Excluido();
- }).OrderBy<Usuario, string>((Usuario x) => x.get_Nome()).ToList<Usuario>());
- this.SelectedUsuario = this.Usuarios.FirstOrDefault<Usuario>((Usuario x) => x.get_Id() == Recursos.Usuario.get_Id());
- Usuario usuario = Recursos.Usuario;
- if (usuario != null)
- {
- administrador = usuario.get_Administrador();
- }
- else
- {
- administrador = false;
- }
- this.OcultarUsuarios = administrador;
- Usuario usuario1 = Recursos.Usuario;
- if (usuario1 != null)
- {
- id = usuario1.get_Id() > (long)0;
- }
- else
- {
- id = false;
- }
- this.EnableIncluirNota = id;
- }
-
- public async Task AdicionarNota()
- {
- Gestor.Model.Domain.Ferramentas.Tarefa tarefa;
- if (this.Notas != null)
- {
- ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa> notas = this.Notas;
- if (notas.Any<Gestor.Model.Domain.Ferramentas.Tarefa>((Gestor.Model.Domain.Ferramentas.Tarefa x) => {
- if (x.get_Titulo() != "TÍTULO")
- {
- return false;
- }
- return x.get_Descricao() == "DESCRIÇÃO";
- }))
- {
- await base.ShowMessage("PARA ADICIONAR OUTRA NOTA, INSERIR TÍTULO E DESCRIÇÃO DA NOTA JÁ ADICIONADA", "OK", "", false);
- tarefa = null;
- return;
- }
- }
- Gestor.Model.Domain.Ferramentas.Tarefa tarefa1 = new Gestor.Model.Domain.Ferramentas.Tarefa();
- tarefa1.set_Agendamento(Funcoes.GetNetworkTime());
- tarefa1.set_Titulo("TÍTULO");
- tarefa1.set_Anotacoes("DESCRIÇÃO");
- tarefa1.set_Usuario(this.Usuarios.First<Usuario>((Usuario x) => x.get_Id() == this.SelectedUsuario.get_Id()));
- tarefa1.set_UsuarioCadastro(Recursos.Usuario);
- tarefa1.set_Entidade(1);
- tarefa1.set_Status(0);
- tarefa = tarefa1;
- tarefa = await this._servico.Salvar(tarefa);
- await this.CarregarNotas();
- this.SelectedNota = tarefa;
- tarefa = null;
- }
-
- public async void Carregar()
- {
- await this.CarregarNotas();
- }
-
- public async Task CarregarNotas()
- {
- if (this.SelectedUsuario != null)
- {
- List<Gestor.Model.Domain.Ferramentas.Tarefa> tarefas = await this._servico.BuscarNotas(this.SelectedUsuario.get_Id());
- List<Gestor.Model.Domain.Ferramentas.Tarefa> tarefas1 = tarefas;
- tarefas1.ForEach((Gestor.Model.Domain.Ferramentas.Tarefa x) => {
- if (x.get_Titulo() == "TÍTULO" && x.get_Descricao() == "DESCRIÇÃO")
- {
- x.set_HabilitarPublica(true);
- }
- });
- this.Notas = new ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa>(tarefas);
- this.NotasConcluidas = new ObservableCollection<Gestor.Model.Domain.Ferramentas.Tarefa>(await this._servico.BuscarNotasConcluidas(this.SelectedUsuario.get_Id()));
- }
- }
-
- public async Task ExcluirNota(Gestor.Model.Domain.Ferramentas.Tarefa nota)
- {
- await this._servico.Excluir(nota.get_Id());
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar(Gestor.Model.Domain.Ferramentas.Tarefa destino)
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- Gestor.Model.Domain.Ferramentas.Tarefa tarefa = destino;
- List<ConfiguracaoSistema> configuracoes = Recursos.Configuracoes;
- tarefa.set_AgendamentoRetroativo(configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema x) => x.get_Configuracao() == 45));
- List<KeyValuePair<string, string>> keyValuePairs1 = destino.Validate();
- if (keyValuePairs1.Count <= 0)
- {
- bool publica = destino.get_Publica();
- await this._servico.Salvar(destino);
- if (this._servico.Sucesso)
- {
- if (publica)
- {
- long id = destino.get_Usuario().get_Id();
- List<Usuario> usuarios = Recursos.Usuarios;
- List<Task> tasks = new List<Task>();
- foreach (Usuario usuario in usuarios)
- {
- if (id == usuario.get_Id())
- {
- continue;
- }
- Gestor.Model.Domain.Ferramentas.Tarefa tarefa1 = (Gestor.Model.Domain.Ferramentas.Tarefa)destino.Clone();
- tarefa1.set_Id((long)0);
- tarefa1.set_Usuario(usuario);
- tasks.Add(this._servico.Salvar(tarefa1));
- }
- await Task.WhenAll(tasks);
- }
- await this.CarregarNotas();
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- return keyValuePairs;
- }
-
- public async Task<Gestor.Model.Domain.Ferramentas.Tarefa> SalvarNota(Gestor.Model.Domain.Ferramentas.Tarefa nota)
- {
- return await this._servico.Salvar(nota);
- }
-
- public void ToggleNotasConcluidas()
- {
- this.OcultarNotasConcluidas = !this.OcultarNotasConcluidas;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/BI/PainelBiViewModel.cs b/Gestor.Application/ViewModels/BI/PainelBiViewModel.cs
deleted file mode 100644
index 99695e4..0000000
--- a/Gestor.Application/ViewModels/BI/PainelBiViewModel.cs
+++ /dev/null
@@ -1,1590 +0,0 @@
-using Gestor.Application.Componentes;
-using Gestor.Application.Helpers;
-using Gestor.Application.Model;
-using Gestor.Application.Servicos;
-using Gestor.Application.Servicos.Seguros;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Application.Views.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.BI;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos;
-using Gestor.Model.Domain.Seguros;
-using LiveCharts;
-using LiveCharts.Defaults;
-using LiveCharts.Definitions.Series;
-using LiveCharts.Helpers;
-using LiveCharts.Wpf;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace Gestor.Application.ViewModels.BI
-{
- public class PainelBiViewModel : BaseSegurosViewModel
- {
- private readonly ClienteServico _clienteServico;
-
- private readonly ApoliceServico _apoliceServico;
-
- private readonly ParcelaServico _parcelaServico;
-
- private Visibility _isVisibleProducao = Visibility.Collapsed;
-
- private Visibility _isVisibleClientes = Visibility.Collapsed;
-
- private Visibility _isVisiblePendencia = Visibility.Collapsed;
-
- private Visibility _isVisibleVencimento = Visibility.Collapsed;
-
- private DateTime _inicio;
-
- private DateTime _fim;
-
- private DateTime _inicioClientes;
-
- private DateTime _fimClientes;
-
- private DateTime _inicioVencimento;
-
- private DateTime _fimVencimento;
-
- private Grafico _producao;
-
- private Grafico _fechamento;
-
- private int _aniversariantes;
-
- private int _vencimentoCnh;
-
- private int _vencimentos;
-
- private int _parcelasPendentes;
-
- private int _parcelasAVencer;
-
- private int _cotacoes;
-
- private List<Parcela> _parcelasPendencia;
-
- private List<Parcela> _parcelasVencimento;
-
- private List<Documento> _documentosVencimento;
-
- private List<ClientesAtivosInativos> _clientesAniversariantes;
-
- private List<ClientesAtivosInativos> _clientesCnh;
-
- private int _quatidadeProducao;
-
- private int _endossos;
-
- private int _faturas;
-
- private int _apolicesPendentes;
-
- private int _novosNegocios;
-
- private int _renovacoes;
-
- private int _cancelamentos;
-
- private decimal _producaoTotal;
-
- private decimal _producaoTotalAnterior;
-
- private decimal _comissaoTotal;
-
- private List<Documento> _documentosProducao;
-
- private List<Documento> _documentosPendentes;
-
- private List<Documento> _documentosFechamento;
-
- private Grafico _gerada;
-
- private Grafico _mediaComissao;
-
- private Func<double, string> _yFormatter;
-
- private Func<double, string> _xFormatter;
-
- public int Aniversariantes
- {
- get
- {
- return this._aniversariantes;
- }
- set
- {
- this._aniversariantes = value;
- base.OnPropertyChanged("Aniversariantes");
- }
- }
-
- public int ApolicesPendentes
- {
- get
- {
- return this._apolicesPendentes;
- }
- set
- {
- this._apolicesPendentes = value;
- base.OnPropertyChanged("ApolicesPendentes");
- }
- }
-
- public int Cancelamentos
- {
- get
- {
- return this._cancelamentos;
- }
- set
- {
- this._cancelamentos = value;
- base.OnPropertyChanged("Cancelamentos");
- }
- }
-
- public decimal ComissaoTotal
- {
- get
- {
- return this._comissaoTotal;
- }
- set
- {
- this._comissaoTotal = value;
- base.OnPropertyChanged("ComissaoTotal");
- }
- }
-
- public int Cotacoes
- {
- get
- {
- return this._cotacoes;
- }
- set
- {
- this._cotacoes = value;
- base.OnPropertyChanged("Cotacoes");
- }
- }
-
- public int Endossos
- {
- get
- {
- return this._endossos;
- }
- set
- {
- this._endossos = value;
- base.OnPropertyChanged("Endossos");
- }
- }
-
- public int Faturas
- {
- get
- {
- return this._faturas;
- }
- set
- {
- this._faturas = value;
- base.OnPropertyChanged("Faturas");
- }
- }
-
- public Grafico Fechamento
- {
- get
- {
- return this._fechamento;
- }
- set
- {
- this._fechamento = value;
- base.OnPropertyChanged("Fechamento");
- }
- }
-
- public DateTime Fim
- {
- get
- {
- return this._fim;
- }
- set
- {
- this._fim = value;
- base.OnPropertyChanged("Fim");
- }
- }
-
- public DateTime FimClientes
- {
- get
- {
- return this._fimClientes;
- }
- set
- {
- this._fimClientes = value;
- base.OnPropertyChanged("FimClientes");
- }
- }
-
- public DateTime FimVencimento
- {
- get
- {
- return this._fimVencimento;
- }
- set
- {
- this._fimVencimento = value;
- base.OnPropertyChanged("FimVencimento");
- }
- }
-
- public Grafico Gerada
- {
- get
- {
- return this._gerada;
- }
- set
- {
- this._gerada = value;
- base.OnPropertyChanged("Gerada");
- }
- }
-
- public DateTime Inicio
- {
- get
- {
- return this._inicio;
- }
- set
- {
- this._inicio = value;
- base.OnPropertyChanged("Inicio");
- }
- }
-
- public DateTime InicioClientes
- {
- get
- {
- return this._inicioClientes;
- }
- set
- {
- this._inicioClientes = value;
- base.OnPropertyChanged("InicioClientes");
- }
- }
-
- public DateTime InicioVencimento
- {
- get
- {
- return this._inicioVencimento;
- }
- set
- {
- this._inicioVencimento = value;
- base.OnPropertyChanged("InicioVencimento");
- }
- }
-
- public Visibility IsVisibleClientes
- {
- get
- {
- return this._isVisibleClientes;
- }
- set
- {
- this._isVisibleClientes = value;
- base.OnPropertyChanged("IsVisibleClientes");
- }
- }
-
- public Visibility IsVisiblePendencia
- {
- get
- {
- return this._isVisiblePendencia;
- }
- set
- {
- this._isVisiblePendencia = value;
- base.OnPropertyChanged("IsVisiblePendencia");
- }
- }
-
- public Visibility IsVisibleProducao
- {
- get
- {
- return this._isVisibleProducao;
- }
- set
- {
- this._isVisibleProducao = value;
- base.OnPropertyChanged("IsVisibleProducao");
- }
- }
-
- public Visibility IsVisibleVencimento
- {
- get
- {
- return this._isVisibleVencimento;
- }
- set
- {
- this._isVisibleVencimento = value;
- base.OnPropertyChanged("IsVisibleVencimento");
- }
- }
-
- public Grafico MediaComissao
- {
- get
- {
- return this._mediaComissao;
- }
- set
- {
- this._mediaComissao = value;
- base.OnPropertyChanged("MediaComissao");
- }
- }
-
- public int NovosNegocios
- {
- get
- {
- return this._novosNegocios;
- }
- set
- {
- this._novosNegocios = value;
- base.OnPropertyChanged("NovosNegocios");
- }
- }
-
- public int ParcelasAVencer
- {
- get
- {
- return this._parcelasAVencer;
- }
- set
- {
- this._parcelasAVencer = value;
- base.OnPropertyChanged("ParcelasAVencer");
- }
- }
-
- public int ParcelasPendentes
- {
- get
- {
- return this._parcelasPendentes;
- }
- set
- {
- this._parcelasPendentes = value;
- base.OnPropertyChanged("ParcelasPendentes");
- }
- }
-
- public Grafico Producao
- {
- get
- {
- return this._producao;
- }
- set
- {
- this._producao = value;
- base.OnPropertyChanged("Producao");
- }
- }
-
- public decimal ProducaoTotal
- {
- get
- {
- return this._producaoTotal;
- }
- set
- {
- this._producaoTotal = value;
- base.OnPropertyChanged("ProducaoTotal");
- }
- }
-
- public decimal ProducaoTotalAnterior
- {
- get
- {
- return this._producaoTotalAnterior;
- }
- set
- {
- this._producaoTotalAnterior = value;
- base.OnPropertyChanged("ProducaoTotalAnterior");
- }
- }
-
- public int QuatidadeProducao
- {
- get
- {
- return this._quatidadeProducao;
- }
- set
- {
- this._quatidadeProducao = value;
- base.OnPropertyChanged("QuatidadeProducao");
- }
- }
-
- public int Renovacoes
- {
- get
- {
- return this._renovacoes;
- }
- set
- {
- this._renovacoes = value;
- base.OnPropertyChanged("Renovacoes");
- }
- }
-
- public int VencimentoCnh
- {
- get
- {
- return this._vencimentoCnh;
- }
- set
- {
- this._vencimentoCnh = value;
- base.OnPropertyChanged("VencimentoCnh");
- }
- }
-
- public int Vencimentos
- {
- get
- {
- return this._vencimentos;
- }
- set
- {
- this._vencimentos = value;
- base.OnPropertyChanged("Vencimentos");
- }
- }
-
- public Func<double, string> XFormatter
- {
- get
- {
- return this._xFormatter;
- }
- set
- {
- this._xFormatter = value;
- base.OnPropertyChanged("XFormatter");
- }
- }
-
- public Func<double, string> YFormatter
- {
- get
- {
- return this._yFormatter;
- }
- set
- {
- this._yFormatter = value;
- base.OnPropertyChanged("YFormatter");
- }
- }
-
- public PainelBiViewModel()
- {
- this._isVisibleProducao = Visibility.Collapsed;
- this._isVisibleClientes = Visibility.Collapsed;
- this._isVisiblePendencia = Visibility.Collapsed;
- this._isVisibleVencimento = Visibility.Collapsed;
- DateTime date = Funcoes.GetNetworkTime().Date;
- this._inicio = date.AddDays(-7);
- this._fim = Funcoes.GetNetworkTime().Date;
- date = Funcoes.GetNetworkTime().Date;
- this._inicioClientes = date.AddDays(-7);
- this._fimClientes = Funcoes.GetNetworkTime().Date;
- this._inicioVencimento = Funcoes.GetNetworkTime().Date;
- date = Funcoes.GetNetworkTime().Date;
- this._fimVencimento = date.AddDays(7);
- base();
- this._clienteServico = new ClienteServico();
- this._apoliceServico = new ApoliceServico();
- this._parcelaServico = new ParcelaServico();
- this.LoadInicial();
- }
-
- public async void Detalhar(int tipo)
- {
- List<Analitico> list;
- string str = "";
- string str1 = "APOLICES";
- List<string> strs = new List<string>()
- {
- "Nome",
- "Apolice",
- "Endosso",
- "Status",
- "Negocio",
- "VigenciaInicial",
- "VigenciaFinal",
- "Comissao",
- "PremioLiquido",
- "PremioTotal",
- "Seguradora",
- "Ramo"
- };
- List<string> strs1 = strs;
- switch (tipo)
- {
- case 1:
- {
- str = "COMPARATIVO";
- List<Documento> documentos = this._documentosProducao;
- List<Documento> documentos1 = this._documentosFechamento;
- List<Documento> documentos2 = new List<Documento>();
- documentos2.AddRange(documentos);
- documentos2.AddRange(documentos1);
- IOrderedEnumerable<Documento> vigencia1 =
- from x in documentos2
- orderby x.get_Vigencia1()
- select x;
- list = vigencia1.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 2:
- {
- str = "NOVOS NEGÓCIOS";
- List<Documento> documentos3 = this._documentosProducao;
- IEnumerable<Documento> documentos4 = documentos3.Where<Documento>((Documento x) => {
- if (x.get_Tipo() != 0)
- {
- return false;
- }
- if (x.get_Situacao() == 1)
- {
- return true;
- }
- if (x.get_Situacao() != 2)
- {
- return false;
- }
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- return negocioCorretora.GetValueOrDefault() == 0 & negocioCorretora.HasValue;
- });
- IOrderedEnumerable<Documento> vigencia11 =
- from x in documentos4
- orderby x.get_Vigencia1()
- select x;
- list = vigencia11.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 3:
- {
- str = "RENOVAÇÕES";
- List<Documento> documentos5 = this._documentosProducao;
- IEnumerable<Documento> documentos6 = documentos5.Where<Documento>((Documento x) => {
- if (x.get_Tipo() != 0)
- {
- return false;
- }
- if (x.get_Situacao() != 2)
- {
- return false;
- }
- if (x.get_NegocioCorretora().GetValueOrDefault() == 1)
- {
- return true;
- }
- return x.get_Negocio().GetValueOrDefault() == 1;
- });
- IOrderedEnumerable<Documento> vigencia12 =
- from x in documentos6
- orderby x.get_Vigencia1()
- select x;
- list = vigencia12.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 4:
- {
- str = "CANCELAMENTOS";
- List<Documento> documentos7 = this._documentosProducao;
- IEnumerable<Documento> documentos8 = documentos7.Where<Documento>((Documento x) => {
- if (x.get_Situacao() != 3)
- {
- return false;
- }
- return x.get_Tipo() == 1;
- });
- IOrderedEnumerable<Documento> vigencia13 =
- from x in documentos8
- orderby x.get_Vigencia1()
- select x;
- list = vigencia13.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 5:
- {
- str1 = "CLIENTES";
- List<string> strs2 = new List<string>()
- {
- "Nome",
- "DocumentoCliente",
- "Dia/Mês",
- "Nascimento",
- "TipoPessoa",
- "Cidade",
- "Uf",
- "Cep",
- "Telefone",
- "E-mail",
- "Profissão"
- };
- strs1 = strs2;
- List<ClientesAtivosInativos> clientesAtivosInativos = this._clientesAniversariantes;
- list = clientesAtivosInativos.Select<ClientesAtivosInativos, Analitico>((ClientesAtivosInativos x) => {
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Nome() ?? "");
- analitico.set_DocumentoCliente(x.get_Documento());
- analitico.set_DiaMes(x.get_Aniversario());
- analitico.set_TipoPessoa((ValidationHelper.OnlyNumber(x.get_Documento()).Length > 11 ? "JURÍDICA" : "FÍSICA"));
- analitico.set_Nascimento(x.get_Nascimento());
- analitico.set_VencimentoHabilitacao(x.get_VencimentoCnh());
- analitico.set_Cliente(x);
- analitico.set_Cidade(x.get_Cidade());
- analitico.set_Uf(x.get_Estado());
- analitico.set_Cep(x.get_Cep());
- analitico.set_Telefone(x.get_Telefone());
- analitico.set_Email(x.get_Email());
- analitico.set_Profissao(x.get_Profissao());
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 6:
- {
- str1 = "CLIENTES";
- strs1 = new List<string>()
- {
- "Nome",
- "DocumentoCliente",
- "Nascimento",
- "VencimentoHabilitacao"
- };
- List<ClientesAtivosInativos> clientesAtivosInativos1 = this._clientesCnh;
- list = clientesAtivosInativos1.Select<ClientesAtivosInativos, Analitico>((ClientesAtivosInativos x) => {
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Nome() ?? "");
- analitico.set_DocumentoCliente(x.get_Documento());
- analitico.set_Nascimento(x.get_Nascimento());
- analitico.set_VencimentoHabilitacao(x.get_VencimentoCnh());
- analitico.set_Cliente(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 7:
- {
- str = "APÓLICES À VENCER";
- List<Documento> documentos9 = this._documentosVencimento;
- IOrderedEnumerable<Documento> vigencia14 =
- from x in documentos9
- orderby x.get_Vigencia1()
- select x;
- list = vigencia14.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 8:
- {
- List<string> strs3 = new List<string>()
- {
- "Nome",
- "Apolice",
- "Endosso",
- "Seguradora",
- "Comissao",
- "Vencimento",
- "Recebimento",
- "Valor",
- "ComissaoGerada",
- "NumeroParcela",
- "Ramo"
- };
- strs1 = strs3;
- str = "PARCELAS À VENCER";
- str1 = "PARCELAS";
- List<Parcela> parcelas = this._parcelasVencimento;
- IOrderedEnumerable<Parcela> vencimento =
- from x in parcelas
- orderby x.get_Vencimento()
- select x;
- list = vencimento.Select<Parcela, Analitico>((Parcela x) => {
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Documento().get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Documento().get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Documento().get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- analitico.set_Seguradora(x.get_Documento().get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Documento().get_Controle().get_Ramo().get_Nome());
- analitico.set_Vencimento(x.get_Vencimento());
- analitico.set_Recebimento(x.get_DataRecebimento());
- analitico.set_Valor(x.get_Valor());
- analitico.set_ValorComissao(x.get_ValorComDesconto());
- analitico.set_NumeroParcela(x.get_NumeroParcela());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Documento().get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Documento().get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x.get_Documento());
- analitico.set_Parcela(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 9:
- {
- str = "APÓLICES PENDENTES";
- List<Documento> documentos10 = this._documentosPendentes;
- IEnumerable<Documento> documentos11 = documentos10.Where<Documento>((Documento x) => {
- if (!string.IsNullOrEmpty(x.get_Apolice()))
- {
- return false;
- }
- return x.get_Tipo() != 2;
- });
- IOrderedEnumerable<Documento> vigencia15 =
- from x in documentos11
- orderby x.get_Vigencia1()
- select x;
- list = vigencia15.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 10:
- {
- List<string> strs4 = new List<string>()
- {
- "Nome",
- "Apolice",
- "Endosso",
- "Seguradora",
- "Comissao",
- "Vencimento",
- "Valor",
- "NumeroParcela",
- "Ramo"
- };
- strs1 = strs4;
- str = "PARCELAS PENDENTES";
- str1 = "PARCELAS";
- List<Parcela> parcelas1 = this._parcelasPendencia;
- IOrderedEnumerable<Parcela> vencimento1 =
- from x in parcelas1
- orderby x.get_Vencimento()
- select x;
- list = vencimento1.Select<Parcela, Analitico>((Parcela x) => {
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Documento().get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Documento().get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Documento().get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- analitico.set_Seguradora(x.get_Documento().get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Documento().get_Controle().get_Ramo().get_Nome());
- analitico.set_Vencimento(x.get_Vencimento());
- analitico.set_Recebimento(x.get_DataRecebimento());
- analitico.set_Valor(x.get_Valor());
- analitico.set_ValorComissao(x.get_ValorComissao());
- analitico.set_NumeroParcela(x.get_NumeroParcela());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Documento().get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Documento().get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x.get_Documento());
- analitico.set_Parcela(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 11:
- {
- str = "ENDOSSOS";
- List<Documento> documentos12 = this._documentosProducao;
- IEnumerable<Documento> documentos13 =
- from x in documentos12
- where x.get_Tipo() == 1
- select x;
- IOrderedEnumerable<Documento> vigencia16 =
- from x in documentos13
- orderby x.get_Vigencia1()
- select x;
- list = vigencia16.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 12:
- {
- str = "FATURAS";
- List<Documento> documentos14 = this._documentosProducao;
- IEnumerable<Documento> documentos15 =
- from x in documentos14
- where x.get_Tipo() == 2
- select x;
- IOrderedEnumerable<Documento> vigencia17 =
- from x in documentos15
- orderby x.get_Vigencia1()
- select x;
- list = vigencia17.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 13:
- {
- str = "TOTAL DOCUMENTOS";
- List<Documento> documentos16 = this._documentosProducao;
- IEnumerable<Documento> documentos17 =
- from x in documentos16
- where x.get_Tipo() != 2
- select x;
- IOrderedEnumerable<Documento> vigencia18 =
- from x in documentos17
- orderby x.get_Vigencia1()
- select x;
- list = vigencia18.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- case 14:
- {
- str = "PRODUÇÃO ANTERIOR";
- List<Documento> documentos18 = this._documentosFechamento;
- list = documentos18.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- default:
- {
- str = "PRODUÇÃO";
- List<Documento> documentos19 = this._documentosProducao;
- list = documentos19.Select<Documento, Analitico>((Documento x) => {
- object description;
- Analitico analitico = new Analitico();
- analitico.set_Nome(x.get_Controle().get_Cliente().get_Nome() ?? "");
- analitico.set_Apolice(x.get_Apolice() ?? "");
- analitico.set_Endosso(x.get_Endosso() ?? "");
- analitico.set_Comissao(x.get_Comissao());
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- if (!negocioCorretora.HasValue)
- {
- description = ValidationHelper.GetDescription(x.get_Negocio());
- }
- else
- {
- negocioCorretora = x.get_NegocioCorretora();
- description = (negocioCorretora.HasValue ? ValidationHelper.GetDescription(negocioCorretora.GetValueOrDefault()) : null) ?? "";
- }
- analitico.set_Negocio((string)description);
- analitico.set_PremioLiquido(x.get_PremioLiquido());
- analitico.set_PremioTotal(x.get_PremioTotal());
- analitico.set_VigenciaFinal(x.get_Vigencia2());
- analitico.set_VigenciaInicial(x.get_Vigencia1());
- analitico.set_Status(ValidationHelper.GetDescription(x.get_Situacao()) ?? "");
- analitico.set_Seguradora(x.get_Controle().get_Seguradora().get_NomeSocial());
- analitico.set_Ramo(x.get_Controle().get_Ramo().get_Nome());
- ClientesAtivosInativos clientesAtivosInativo = new ClientesAtivosInativos();
- clientesAtivosInativo.set_Id(x.get_Controle().get_Cliente().get_Id());
- clientesAtivosInativo.set_Nome(x.get_Controle().get_Cliente().get_Nome());
- analitico.set_Cliente(clientesAtivosInativo);
- analitico.set_Documento(x);
- return analitico;
- }).ToList<Analitico>();
- break;
- }
- }
- if (list.Count != 0)
- {
- (new HosterWindow(new DialogAnaliticoBi(str, list, str1, strs1), "ANALÍTICO", new double?((double)1260), new double?((double)500), false)).Show();
- }
- else
- {
- await base.ShowMessage("NÃO FOI POSSÍVEL DETALHAR POIS NÃO HÁ DADOS", "OK", "", false);
- }
- }
-
- public async Task GerarClientes()
- {
- long num;
- this.IsVisibleClientes = Visibility.Collapsed;
- Filtros filtro = new Filtros();
- filtro.set_Inicio(this.InicioClientes);
- filtro.set_Fim(this.FimClientes);
- num = (Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa());
- filtro.set_IdEmpresa(num);
- Filtros filtro1 = filtro;
- this._clientesAniversariantes = await this._clienteServico.BuscarAniversariantes(filtro1);
- this.Aniversariantes = this._clientesAniversariantes.Count;
- this._clientesCnh = await this._clienteServico.BuscarVencimentosCnh(filtro1);
- this.VencimentoCnh = this._clientesCnh.Count;
- this.IsVisibleClientes = Visibility.Visible;
- filtro1 = null;
- }
-
- public async Task GerarPendencia()
- {
- long num;
- this.IsVisiblePendencia = Visibility.Collapsed;
- List<VendedorUsuario> vendedorUsuarios = await (new VendedorUsuarioServico()).FindByVinculo(Recursos.Usuario);
- Filtros filtro = new Filtros();
- filtro.set_Inicio(this.Inicio);
- filtro.set_Fim(this.Fim);
- num = (Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa());
- filtro.set_IdEmpresa(num);
- List<VendedorUsuario> vendedorUsuarios1 = vendedorUsuarios;
- filtro.set_Vendedores((
- from x in vendedorUsuarios1
- select x.get_Vendedor().get_Id()).ToList<long>());
- List<Parcela> parcelas = await this._parcelaServico.BuscarParcelasPendentes(filtro, false);
- PainelBiViewModel list = this;
- List<Parcela> parcelas1 = parcelas;
- list._parcelasPendencia = (
- from x in parcelas1
- where x.get_Documento().get_Situacao() != 7
- select x).ToList<Parcela>();
- this.ParcelasPendentes = this._parcelasPendencia.Count;
- this.IsVisiblePendencia = Visibility.Visible;
- }
-
- public async Task GerarProducao()
- {
- long num2;
- long num3;
- this.IsVisibleProducao = Visibility.Collapsed;
- PainelBiViewModel painelBiViewModel = this;
- Grafico grafico = new Grafico()
- {
- Series = new SeriesCollection(),
- Formatter = (double value) => value.ToString("C0")
- };
- painelBiViewModel.Producao = grafico;
- PainelBiViewModel painelBiViewModel1 = this;
- Grafico grafico1 = new Grafico()
- {
- Series = new SeriesCollection(),
- Formatter = (double value) => value.ToString("C2")
- };
- painelBiViewModel1.Gerada = grafico1;
- PainelBiViewModel painelBiViewModel2 = this;
- Grafico grafico2 = new Grafico()
- {
- Series = new SeriesCollection(),
- Formatter = (double value) => value.ToString("P2")
- };
- painelBiViewModel2.MediaComissao = grafico2;
- PainelBiViewModel painelBiViewModel3 = this;
- Grafico grafico3 = new Grafico()
- {
- Series = new SeriesCollection(),
- Formatter = (double value) => value.ToString("C2")
- };
- painelBiViewModel3.Fechamento = grafico3;
- List<VendedorUsuario> vendedorUsuarios = await (new VendedorUsuarioServico()).FindByVinculo(Recursos.Usuario);
- Filtros filtro = new Filtros();
- filtro.set_Inicio(this.Inicio);
- filtro.set_Fim(this.Fim);
- num2 = (Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa());
- filtro.set_IdEmpresa(num2);
- List<VendedorUsuario> vendedorUsuarios1 = vendedorUsuarios;
- filtro.set_Vendedores((
- from x in vendedorUsuarios1
- select x.get_Vendedor().get_Id()).ToList<long>());
- Filtros filtro1 = filtro;
- Filtros filtro2 = new Filtros();
- DateTime inicio = this.Inicio;
- filtro2.set_Inicio(inicio.AddYears(-1));
- inicio = this.Fim;
- filtro2.set_Fim(inicio.AddYears(-1));
- num3 = (Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa());
- filtro2.set_IdEmpresa(num3);
- List<VendedorUsuario> vendedorUsuarios2 = vendedorUsuarios;
- filtro2.set_Vendedores((
- from x in vendedorUsuarios2
- select x.get_Vendedor().get_Id()).ToList<long>());
- Filtros filtro3 = filtro2;
- List<Documento> documentos = await this._apoliceServico.BuscarApolices(filtro1, false, true);
- PainelBiViewModel list = this;
- List<Documento> documentos1 = documentos;
- list._documentosProducao = (
- from x in documentos1
- where x.get_Situacao() != 7
- select x).ToList<Documento>();
- this._documentosPendentes = await this._apoliceServico.BuscarApolicesPendentes(filtro1);
- List<Documento> documentos2 = await this._parcelaServico.BuscarFaturas(filtro1, false, true);
- List<Documento> documentos3 = this._documentosProducao;
- List<Documento> documentos4 = documentos2;
- documentos3.AddRange(
- from x in documentos4
- where x.get_Situacao() != 7
- select x);
- PainelBiViewModel painelBiViewModel4 = this;
- List<Documento> documentos5 = this._documentosPendentes;
- painelBiViewModel4.ApolicesPendentes = documentos5.Count<Documento>((Documento x) => {
- if (!string.IsNullOrEmpty(x.get_Apolice()))
- {
- return false;
- }
- return x.get_Tipo() != 2;
- });
- await this.GerarPendencia();
- List<Documento> documentos6 = await this._apoliceServico.BuscarApolices(filtro3, false, true);
- PainelBiViewModel list1 = this;
- List<Documento> documentos7 = documentos6;
- list1._documentosFechamento = (
- from x in documentos7
- where x.get_Situacao() != 7
- select x).ToList<Documento>();
- List<Documento> documentos8 = await this._parcelaServico.BuscarFaturas(filtro3, false, true);
- List<Documento> documentos9 = this._documentosFechamento;
- List<Documento> documentos10 = documentos8;
- documentos9.AddRange(
- from x in documentos10
- where x.get_Situacao() != 7
- select x);
- this.Cotacoes = await this._apoliceServico.Cotacoes(filtro1);
- PainelBiViewModel painelBiViewModel5 = this;
- List<Documento> documentos11 = this._documentosProducao;
- painelBiViewModel5.QuatidadeProducao = documentos11.Count<Documento>((Documento x) => x.get_Tipo() != 2);
- PainelBiViewModel painelBiViewModel6 = this;
- List<Documento> documentos12 = this._documentosProducao;
- painelBiViewModel6.Faturas = documentos12.Count<Documento>((Documento x) => x.get_Tipo() == 2);
- PainelBiViewModel painelBiViewModel7 = this;
- List<Documento> documentos13 = this._documentosProducao;
- painelBiViewModel7.NovosNegocios = documentos13.Count<Documento>((Documento x) => {
- if (x.get_Tipo() != 0)
- {
- return false;
- }
- if (x.get_Situacao() == 1)
- {
- return true;
- }
- if (x.get_Situacao() != 2)
- {
- return false;
- }
- NegocioCorretora? negocioCorretora = x.get_NegocioCorretora();
- return negocioCorretora.GetValueOrDefault() == 0 & negocioCorretora.HasValue;
- });
- PainelBiViewModel painelBiViewModel8 = this;
- List<Documento> documentos14 = this._documentosProducao;
- painelBiViewModel8.Renovacoes = documentos14.Count<Documento>((Documento x) => {
- if (x.get_Tipo() != 0)
- {
- return false;
- }
- if (x.get_Situacao() != 2)
- {
- return false;
- }
- if (x.get_NegocioCorretora().GetValueOrDefault() == 1)
- {
- return true;
- }
- return x.get_Negocio().GetValueOrDefault() == 1;
- });
- PainelBiViewModel painelBiViewModel9 = this;
- List<Documento> documentos15 = this._documentosProducao;
- IEnumerable<Documento> documentos16 = documentos15.Where<Documento>((Documento x) => {
- if (x.get_Situacao() != 3)
- {
- return false;
- }
- return x.get_Tipo() == 1;
- });
- painelBiViewModel9.Cancelamentos = (
- from x in documentos16
- select x.get_Controle().get_Id()).Distinct<long>().Count<long>();
- PainelBiViewModel painelBiViewModel10 = this;
- List<Documento> documentos17 = this._documentosProducao;
- painelBiViewModel10.Endossos = documentos17.Count<Documento>((Documento x) => x.get_Tipo() == 1);
- PainelBiViewModel painelBiViewModel11 = this;
- List<Documento> documentos18 = this._documentosProducao;
- painelBiViewModel11.ProducaoTotal = documentos18.Sum<Documento>((Documento x) => x.get_PremioLiquido());
- PainelBiViewModel painelBiViewModel12 = this;
- List<Documento> documentos19 = this._documentosFechamento;
- painelBiViewModel12.ProducaoTotalAnterior = documentos19.Sum<Documento>((Documento x) => x.get_PremioLiquido());
- PainelBiViewModel painelBiViewModel13 = this;
- List<Documento> documentos20 = this._documentosProducao;
- painelBiViewModel13.ComissaoTotal = documentos20.Sum<Documento>((Documento x) => ((x.get_PremioLiquido() + (x.get_AdicionalComiss() ? x.get_PremioAdicional() : decimal.Zero)) * x.get_Comissao()) * new decimal(1, 0, 0, false, 2));
- List<Documento> documentos21 = this._documentosProducao;
- IEnumerable<IGrouping<string, Documento>> nomeSocial =
- from x in documentos21
- group x by x.get_Controle().get_Seguradora().get_NomeSocial();
- (
- from x in nomeSocial
- orderby x.Sum<Documento>((Documento p) => p.get_PremioLiquido()) descending
- select x).ToList<IGrouping<string, Documento>>().ForEach((IGrouping<string, Documento> x) => {
- ColumnSeries columnSeries = new ColumnSeries();
- columnSeries.set_Title(x.Key);
- ChartValues<decimal> chartValue = new ChartValues<decimal>();
- chartValue.Add(x.Sum<Documento>((Documento p) => p.get_PremioLiquido()));
- columnSeries.set_Values(chartValue);
- columnSeries.set_LabelPoint((ChartPoint chartPoint) => {
- IGrouping<string, Documento> strs = x;
- Func<Documento, decimal> u003cu003e9_13631 = PainelBiViewModel.u003cu003ec.u003cu003e9__136_31;
- if (u003cu003e9_13631 == null)
- {
- u003cu003e9_13631 = (Documento p) => p.get_PremioLiquido();
- PainelBiViewModel.u003cu003ec.u003cu003e9__136_31 = u003cu003e9_13631;
- }
- return string.Concat("R$ ", strs.Sum<Documento>(u003cu003e9_13631).ToString("N2"));
- });
- columnSeries.set_MaxColumnWidth(double.PositiveInfinity);
- this.Producao.Series.Add(columnSeries);
- decimal num = x.Sum<Documento>((Documento p) => ((p.get_PremioLiquido() + (p.get_AdicionalComiss() ? p.get_PremioAdicional() : decimal.Zero)) * p.get_Comissao()) * new decimal(1, 0, 0, false, 2));
- PieSeries pieSeries = new PieSeries();
- pieSeries.set_Title(x.Key);
- ChartValues<decimal> chartValue1 = new ChartValues<decimal>();
- chartValue1.Add((num > decimal.Zero ? num : num * decimal.MinusOne));
- pieSeries.set_Values(chartValue1);
- pieSeries.set_DataLabels(false);
- pieSeries.set_LabelPoint((ChartPoint chartPoint) => string.Concat("R$ ", num.ToString("N2")));
- this.Gerada.Series.Add(pieSeries);
- decimal num1 = Math.Round(x.Sum<Documento>((Documento p) => p.get_Comissao()) / x.Count<Documento>(), 2);
- PieSeries pieSeries1 = new PieSeries();
- pieSeries1.set_Title(x.Key);
- ChartValues<decimal> chartValue2 = new ChartValues<decimal>();
- chartValue2.Add(num1);
- pieSeries1.set_Values(chartValue2);
- pieSeries1.set_DataLabels(false);
- pieSeries1.set_LabelPoint((ChartPoint chartPoint) => string.Format(" Media de Comissão {0}% ", num1));
- this.MediaComissao.Series.Add(pieSeries1);
- });
- TimeSpan fim = filtro1.get_Fim() - filtro1.get_Inicio();
- double totalDays = fim.TotalDays;
- ChartValues<DateTimePoint> chartValue3 = new ChartValues<DateTimePoint>();
- ChartValues<DateTimePoint> chartValue4 = new ChartValues<DateTimePoint>();
- for (int i = 0; (double)i <= totalDays; i++)
- {
- inicio = filtro1.get_Inicio();
- DateTime dateTime = inicio.AddDays((double)i);
- DateTime dateTime1 = dateTime.AddYears(-1);
- IEnumerable<Documento> vigencia1 =
- from s in this._documentosFechamento
- where s.get_Vigencia1() == dateTime1
- select s;
- decimal num4 = vigencia1.Sum<Documento>((Documento s) => s.get_PremioLiquido());
- IEnumerable<Documento> vigencia11 =
- from s in this._documentosProducao
- where s.get_Vigencia1() == dateTime
- select s;
- decimal num5 = vigencia11.Sum<Documento>((Documento s) => s.get_PremioLiquido());
- chartValue3.Add(new DateTimePoint(dateTime, (double)((double)num4)));
- chartValue4.Add(new DateTimePoint(dateTime, (double)((double)num5)));
- }
- LineSeries lineSeries = new LineSeries();
- inicio = filtro3.get_Inicio();
- lineSeries.set_Title(string.Format("{0}", inicio.Year));
- lineSeries.set_Values(chartValue3);
- LineSeries lineSeries1 = lineSeries;
- LineSeries lineSeries2 = new LineSeries();
- inicio = filtro1.get_Inicio();
- lineSeries2.set_Title(string.Format("{0}", inicio.Year));
- lineSeries2.set_Values(chartValue4);
- LineSeries lineSeries3 = lineSeries2;
- this.Fechamento.Series.Add(lineSeries1);
- this.Fechamento.Series.Add(lineSeries3);
- PainelBiViewModel str = this;
- str.XFormatter = (double val) => (new DateTime((long)val)).ToString("dd/MM");
- PainelBiViewModel str1 = this;
- str1.YFormatter = (double val) => val.ToString("C2");
- this.IsVisibleProducao = Visibility.Visible;
- filtro1 = null;
- filtro3 = null;
- }
-
- public async Task GerarVencimento()
- {
- long num;
- this.IsVisibleVencimento = Visibility.Collapsed;
- List<VendedorUsuario> vendedorUsuarios = await (new VendedorUsuarioServico()).FindByVinculo(Recursos.Usuario);
- Filtros filtro = new Filtros();
- filtro.set_Inicio(this.InicioVencimento);
- filtro.set_Fim(this.FimVencimento);
- num = (Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa());
- filtro.set_IdEmpresa(num);
- List<VendedorUsuario> vendedorUsuarios1 = vendedorUsuarios;
- filtro.set_Vendedores((
- from x in vendedorUsuarios1
- select x.get_Vendedor().get_Id()).ToList<long>());
- Filtros filtro1 = filtro;
- List<Documento> documentos = await this._apoliceServico.BuscarApolicesVigenciaFinal(filtro1, false);
- PainelBiViewModel list = this;
- List<Documento> documentos1 = documentos;
- list._documentosVencimento = (
- from x in documentos1
- where x.get_Situacao() != 7
- select x).ToList<Documento>();
- this.Vencimentos = this._documentosVencimento.Count;
- List<Parcela> parcelas = await this._parcelaServico.BuscarParcelas(filtro1, false);
- PainelBiViewModel painelBiViewModel = this;
- List<Parcela> parcelas1 = parcelas;
- painelBiViewModel._parcelasVencimento = (
- from x in parcelas1
- where x.get_Documento().get_Situacao() != 7
- select x).ToList<Parcela>();
- this.ParcelasAVencer = this._parcelasVencimento.Count;
- this.IsVisibleVencimento = Visibility.Visible;
- filtro1 = null;
- }
-
- private async void LoadInicial()
- {
- await this.GerarProducao();
- await this.GerarVencimento();
- await this.GerarClientes();
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/BI/ProspeccaoViewModel.cs b/Gestor.Application/ViewModels/BI/ProspeccaoViewModel.cs
deleted file mode 100644
index 4839d95..0000000
--- a/Gestor.Application/ViewModels/BI/ProspeccaoViewModel.cs
+++ /dev/null
@@ -1,553 +0,0 @@
-using ClosedXML.Excel;
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-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;
-using System.Windows.Controls;
-
-namespace Gestor.Application.ViewModels.BI
-{
- public class ProspeccaoViewModel : BaseViewModel
- {
- private readonly ProspeccaoServico _servico;
-
- private PermissaoUsuario SelectedPermissaoUsuario;
-
- private ObservableCollection<Vendedor> _vendedores;
-
- private Vendedor _selectedVendedor = new Vendedor();
-
- private List<string> _searchStatus = new List<string>()
- {
- "TODOS",
- ValidationHelper.GetDescription((StatusProspeccao)1),
- ValidationHelper.GetDescription((StatusProspeccao)5),
- ValidationHelper.GetDescription((StatusProspeccao)2),
- ValidationHelper.GetDescription((StatusProspeccao)4),
- ValidationHelper.GetDescription((StatusProspeccao)3)
- };
-
- private string _selectedStatusSearch = "AGENDANDO";
-
- private StatusProspeccao? _selectedStatus;
-
- private ObservableCollection<StatusDeProspeccao> _statusProspeccaoPersonalizado;
-
- private DateTime _inicio = Funcoes.GetNetworkTime().Date;
-
- private DateTime _fim = Funcoes.GetNetworkTime().Date.AddDays(7);
-
- private ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao> _prospeccoesFiltradas;
-
- private Gestor.Model.Domain.Seguros.Prospeccao _selectedProspeccao;
-
- private ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao> _prospeccao;
-
- private bool _naoHaDados;
-
- public DateTime Fim
- {
- get
- {
- return this._fim;
- }
- set
- {
- this._fim = value;
- base.OnPropertyChanged("Fim");
- }
- }
-
- public DateTime Inicio
- {
- get
- {
- return this._inicio;
- }
- set
- {
- this._inicio = value;
- base.OnPropertyChanged("Inicio");
- }
- }
-
- public bool NaoHaDados
- {
- get
- {
- return this._naoHaDados;
- }
- set
- {
- this._naoHaDados = value;
- base.OnPropertyChanged("NaoHaDados");
- }
- }
-
- public ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao> Prospeccao
- {
- get
- {
- return this._prospeccao;
- }
- set
- {
- this._prospeccao = value;
- this.NaoHaDados = (value == null ? true : value.Count == 0);
- base.OnPropertyChanged("Prospeccao");
- }
- }
-
- public AutoCompleteFilterPredicate<object> ProspeccaoItemFilter
- {
- get
- {
- AutoCompleteFilterPredicate<object> u003cu003e9_530 = ProspeccaoViewModel.u003cu003ec.u003cu003e9__53_0;
- if (u003cu003e9_530 == null)
- {
- u003cu003e9_530 = new AutoCompleteFilterPredicate<object>(ProspeccaoViewModel.u003cu003ec.u003cu003e9, (string searchText, object obj) => {
- if (((Gestor.Model.Domain.Seguros.Prospeccao)obj).get_Nome().ToUpper().Contains(searchText.ToUpper()) || ((Gestor.Model.Domain.Seguros.Prospeccao)obj).get_Documento().ToString().ToUpper().Contains(searchText.ToUpper()) || ((Gestor.Model.Domain.Seguros.Prospeccao)obj).get_Telefone1().ToString().ToUpper().Contains(searchText.ToUpper()) || ((Gestor.Model.Domain.Seguros.Prospeccao)obj).get_Telefone2().ToString().ToUpper().Contains(searchText.ToUpper()) || ((Gestor.Model.Domain.Seguros.Prospeccao)obj).get_Email().ToString().ToUpper().Contains(searchText.ToUpper()))
- {
- return true;
- }
- return ((Gestor.Model.Domain.Seguros.Prospeccao)obj).get_VigenciaFinal().ToString().ToUpper().Contains(searchText.ToUpper());
- });
- ProspeccaoViewModel.u003cu003ec.u003cu003e9__53_0 = u003cu003e9_530;
- }
- return u003cu003e9_530;
- }
- }
-
- public List<Gestor.Model.Domain.Seguros.Prospeccao> Prospeccoes
- {
- get;
- set;
- }
-
- public ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao> ProspeccoesFiltradas
- {
- get
- {
- return this._prospeccoesFiltradas;
- }
- set
- {
- this._prospeccoesFiltradas = value;
- base.OnPropertyChanged("ProspeccoesFiltradas");
- }
- }
-
- public List<string> SearchStatus
- {
- get
- {
- return this._searchStatus;
- }
- set
- {
- this._searchStatus = value;
- this.SelectedStatusSearch = value[1];
- base.OnPropertyChanged("SearchStatus");
- }
- }
-
- public Gestor.Model.Domain.Seguros.Prospeccao SelectedProspeccao
- {
- get
- {
- return this._selectedProspeccao;
- }
- set
- {
- this._selectedProspeccao = value;
- base.OnPropertyChanged("SelectedProspeccao");
- }
- }
-
- public StatusProspeccao? SelectedStatus
- {
- get
- {
- return this._selectedStatus;
- }
- set
- {
- this._selectedStatus = value;
- base.OnPropertyChanged("SelectedStatus");
- }
- }
-
- public string SelectedStatusSearch
- {
- get
- {
- return this._selectedStatusSearch;
- }
- set
- {
- this._selectedStatusSearch = value;
- if (value == "AGENDADO")
- {
- this.SelectedStatus = new StatusProspeccao?(1);
- }
- else if (value == "GANHO")
- {
- this.SelectedStatus = new StatusProspeccao?(2);
- }
- else if (value == "PERDIDO")
- {
- this.SelectedStatus = new StatusProspeccao?(3);
- }
- else if (value == "NÃO TRABALHADO")
- {
- this.SelectedStatus = new StatusProspeccao?(4);
- }
- else if (value == "EM ANDAMENTO")
- {
- this.SelectedStatus = new StatusProspeccao?(5);
- }
- else
- {
- this.SelectedStatus = null;
- }
- base.OnPropertyChanged("SelectedStatusSearch");
- }
- }
-
- public Vendedor SelectedVendedor
- {
- get
- {
- return this._selectedVendedor;
- }
- set
- {
- this._selectedVendedor = value;
- base.OnPropertyChanged("SelectedVendedor");
- }
- }
-
- public ObservableCollection<StatusDeProspeccao> StatusProspeccaoPersonalizado
- {
- get
- {
- return this._statusProspeccaoPersonalizado;
- }
- set
- {
- this._statusProspeccaoPersonalizado = value;
- base.OnPropertyChanged("StatusProspeccaoPersonalizado");
- }
- }
-
- public ObservableCollection<Vendedor> Vendedores
- {
- get
- {
- return this._vendedores;
- }
- set
- {
- this._vendedores = value;
- base.OnPropertyChanged("Vendedores");
- }
- }
-
- public ProspeccaoViewModel()
- {
- this._servico = new ProspeccaoServico();
- this.StatusProspeccaoPersonalizado = new ObservableCollection<StatusDeProspeccao>((
- from x in Recursos.StatusProspeccao
- where x.get_Ativo()
- select x).ToList<StatusDeProspeccao>());
- this.CarregaVendedores();
- this.SelectedStatusSearch = this.SearchStatus[1];
- this.CarregaProspeccoes();
- }
-
- public async Task<bool> BuscaPermissao(string Tipo)
- {
- bool flag;
- ProspeccaoViewModel prospeccaoViewModel = this;
- if (Recursos.Usuario.get_Administrador())
- {
- flag = true;
- }
- else if (Tipo == "Alterar" && prospeccaoViewModel.SelectedPermissaoUsuario != null && !prospeccaoViewModel.SelectedPermissaoUsuario.get_Alterar())
- {
- flag = false;
- }
- else if (!(Tipo == "Excluir") || prospeccaoViewModel.SelectedPermissaoUsuario == null || prospeccaoViewModel.SelectedPermissaoUsuario.get_Excluir())
- {
- flag = (!(Tipo == "Incluir") || prospeccaoViewModel.SelectedPermissaoUsuario == null || prospeccaoViewModel.SelectedPermissaoUsuario.get_Incluir() ? true : false);
- }
- else
- {
- flag = false;
- }
- return flag;
- }
-
- public async Task CarregaProspeccao()
- {
- ProspeccaoViewModel observableCollection = this;
- if (observableCollection.ProspeccoesFiltradas != null)
- {
- observableCollection.ProspeccoesFiltradas = new ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao>(observableCollection.ProspeccoesFiltradas.ToList<Gestor.Model.Domain.Seguros.Prospeccao>());
- }
- }
-
- public async void CarregaProspeccoes()
- {
- await this.CarregarProspeccoes();
- }
-
- public async Task CarregarPermissao()
- {
- this.SelectedPermissaoUsuario = await this.ServicoPermissUsuario.VerificarPermissao(Recursos.Usuario, 60);
- }
-
- public async Task CarregarProspeccoes()
- {
- if (this.Inicio <= this.Fim)
- {
- base.Loading(true);
- base.IsVisible = Visibility.Collapsed;
- this.Prospeccoes = await this._servico.BuscarProspeccoes(this.SelectedVendedor.get_Id(), this.Inicio, this.Fim, this.SelectedStatus);
- ProspeccaoViewModel observableCollection = this;
- List<Gestor.Model.Domain.Seguros.Prospeccao> prospeccoes = this.Prospeccoes;
- observableCollection.ProspeccoesFiltradas = new ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao>(
- from x in prospeccoes
- orderby x.get_VigenciaFinal()
- select x);
- this.SelectedProspeccao = this.ProspeccoesFiltradas.FirstOrDefault<Gestor.Model.Domain.Seguros.Prospeccao>();
- base.IsVisible = Visibility.Visible;
- base.Loading(false);
- }
- }
-
- public async Task CarregarVendedores()
- {
- List<VendedorUsuario> vendedorUsuarios = await (new VendedorUsuarioServico()).FindByVinculo(Recursos.Usuario);
- List<long> list = (
- from x in vendedorUsuarios
- select x.get_Vendedor().get_Id()).ToList<long>();
- List<Vendedor> vendedors = new List<Vendedor>();
- if (list.Count <= 0 || Recursos.Usuario.get_Administrador())
- {
- Vendedor vendedor = new Vendedor();
- vendedor.set_Id((long)0);
- vendedor.set_Nome("TODOS OS VENDEDORES");
- vendedors.Add(vendedor);
- List<Vendedor> vendedors1 = vendedors;
- List<Vendedor> vendedores = Recursos.Vendedores;
- IEnumerable<Vendedor> vendedors2 = vendedores.Where<Vendedor>((Vendedor x) => {
- if (Recursos.Usuario.get_IdEmpresa() != (long)1 && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa())
- {
- return false;
- }
- return x.get_Ativo();
- });
- vendedors1.AddRange((
- from x in vendedors2
- orderby x.get_Nome()
- select x).ToList<Vendedor>());
- }
- else
- {
- List<Vendedor> vendedors3 = vendedors;
- IEnumerable<Vendedor> vendedors4 = Recursos.Vendedores.Where<Vendedor>((Vendedor x) => {
- if (Recursos.Usuario.get_IdEmpresa() != (long)1 && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa() || !x.get_Ativo())
- {
- return false;
- }
- return list.Contains(x.get_Id());
- });
- vendedors3.AddRange((
- from x in vendedors4
- orderby x.get_Nome()
- select x).ToList<Vendedor>());
- }
- this.Vendedores = new ObservableCollection<Vendedor>(vendedors);
- this.SelectedVendedor = this.Vendedores.FirstOrDefault<Vendedor>();
- }
-
- public async void CarregaVendedores()
- {
- await this.CarregarVendedores();
- }
-
- public async void Excluir(Gestor.Model.Domain.Seguros.Prospeccao prospeccao)
- {
- if (await this.BuscaPermissao("Excluir"))
- {
- if (prospeccao != null)
- {
- bool tarefa = prospeccao.get_Tarefa() == null;
- if (tarefa)
- {
- tarefa = !await base.ShowMessage("DESEJA EXCLUIR ESSA PROSPECÇÃO?", "SIM", "NÃO", false);
- }
- bool flag = tarefa;
- if (!flag)
- {
- bool tarefa1 = prospeccao.get_Tarefa() != null;
- if (tarefa1)
- {
- tarefa1 = !await base.ShowMessage(string.Concat("HÁ UMA TAREFA ANEXADA A ESSA PROSPECÇÃO. ESSE PROCEDIMENTO IRÁ EXCLUIR A TAREFA ANEXADA.", Environment.NewLine, "DESEJA REALMENTE PROSSEGUIR?"), "SIM", "NÃO", false);
- }
- flag = tarefa1;
- }
- if (!flag)
- {
- if (await this._servico.Delete(prospeccao))
- {
- base.RegistrarAcao(string.Format("EXCLUIU PROSPECÇÃO DO ID: {0}", prospeccao.get_Id()), prospeccao.get_Id(), new TipoTela?(33), string.Format("CLIENTE \"{0}\", ID: {1}", prospeccao.get_Nome(), prospeccao.get_Id()));
- await this.CarregarProspeccoes();
- base.ToggleSnackBar("PROSPECÇÃO EXCLUÍDA COM SUCESSO", true);
- }
- }
- }
- }
- }
-
- public List<Gestor.Model.Domain.Seguros.Prospeccao> Filtrar(string filter)
- {
- if (this.Prospeccoes == null)
- {
- return null;
- }
- this.ProspeccoesFiltradas = (string.IsNullOrWhiteSpace(filter) ? new ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao>(this.Prospeccoes) : new ObservableCollection<Gestor.Model.Domain.Seguros.Prospeccao>(this.Prospeccoes.Where<Gestor.Model.Domain.Seguros.Prospeccao>((Gestor.Model.Domain.Seguros.Prospeccao x) => {
- if (ValidationHelper.RemoveDiacritics(ValidationHelper.RemoveDiacritics(x.get_Nome()).ToUpper().Trim()).Contains(filter) || x.get_Documento() != null && ValidationHelper.RemoveDiacritics(x.get_Documento().Trim()).Contains(filter) || x.get_Telefone1() != null && ValidationHelper.RemoveDiacritics(x.get_Telefone1().Trim()).Contains(filter) || x.get_Telefone2() != null && ValidationHelper.RemoveDiacritics(x.get_Telefone2().Trim()).Contains(filter) || x.get_Email() != null && ValidationHelper.RemoveDiacritics(x.get_Email().Trim()).Contains(filter))
- {
- return true;
- }
- if (!x.get_VigenciaFinal().HasValue)
- {
- return false;
- }
- return ValidationHelper.RemoveDiacritics(x.get_VigenciaFinal().ToString().Trim()).Contains(filter);
- }).OrderBy<Gestor.Model.Domain.Seguros.Prospeccao, DateTime?>((Gestor.Model.Domain.Seguros.Prospeccao x) => x.get_VigenciaFinal())));
- return this.ProspeccoesFiltradas.ToList<Gestor.Model.Domain.Seguros.Prospeccao>();
- }
-
- internal async Task<List<Gestor.Model.Domain.Seguros.Prospeccao>> FiltrarProspecao(string value)
- {
- List<Gestor.Model.Domain.Seguros.Prospeccao> prospeccaos = await Task.Run<List<Gestor.Model.Domain.Seguros.Prospeccao>>(() => this.Filtrar(value));
- return prospeccaos;
- }
-
- public async Task GerarExcel()
- {
- string str;
- if (this.ProspeccoesFiltradas != null)
- {
- List<ProspeccaoToPrint> prospeccaoToPrints = new List<ProspeccaoToPrint>();
- this.ProspeccoesFiltradas.AsEnumerable<Gestor.Model.Domain.Seguros.Prospeccao>().ToList<Gestor.Model.Domain.Seguros.Prospeccao>().ForEach((Gestor.Model.Domain.Seguros.Prospeccao x) => {
- ProspeccaoToPrint prospeccaoToPrint = new ProspeccaoToPrint();
- prospeccaoToPrint.set_Nome(x.get_Nome());
- prospeccaoToPrint.set_Documento(x.get_Documento() ?? "");
- prospeccaoToPrint.set_Nascimento(x.get_Nascimento());
- prospeccaoToPrint.set_Prefixo1(x.get_Prefixo1() ?? "");
- prospeccaoToPrint.set_Telefone1(x.get_Telefone1() ?? "");
- prospeccaoToPrint.set_Email(x.get_Email() ?? "");
- prospeccaoToPrint.set_VigenciaFinal(x.get_VigenciaFinal());
- prospeccaoToPrint.set_Item(x.get_Item() ?? "");
- prospeccaoToPrint.set_Status(x.get_Status());
- prospeccaoToPrint.set_StatusPersonalizadotoPrint((x.get_StatusPersonalizado() == null ? "" : x.get_StatusPersonalizado().get_Nome()));
- prospeccaoToPrint.set_Tipo(x.get_Tipo() ?? "");
- object nome = x.get_Vendedor().get_Nome();
- if (nome == null)
- {
- nome = null;
- }
- prospeccaoToPrint.set_Vendedor((string)nome);
- prospeccaoToPrint.set_Valor(x.get_Valor());
- prospeccaoToPrints.Add(prospeccaoToPrint);
- });
- string tempPath = "";
- str = "";
- tempPath = Path.GetTempPath();
- str = string.Format("{0}{1}.xlsx", tempPath, Guid.NewGuid());
- string str1 = "PROSPECÇÃO";
- await Funcoes.GerarXls<ProspeccaoToPrint>(new XLWorkbook(), str1, prospeccaoToPrints, new List<string>()).SaveAs(str);
- Process.Start(str);
- }
- else
- {
- base.ShowMessage("NÃO HÁ DADOS PARA A IMPRESSÃO EM EXCEL", "OK", "", false);
- }
- str = null;
- }
-
- public async Task Print()
- {
- if (this.ProspeccoesFiltradas != null)
- {
- List<ProspeccaoToPrint> prospeccaoToPrints = new List<ProspeccaoToPrint>();
- this.ProspeccoesFiltradas.AsEnumerable<Gestor.Model.Domain.Seguros.Prospeccao>().ToList<Gestor.Model.Domain.Seguros.Prospeccao>().ForEach((Gestor.Model.Domain.Seguros.Prospeccao x) => {
- ProspeccaoToPrint prospeccaoToPrint = new ProspeccaoToPrint();
- prospeccaoToPrint.set_Nome(x.get_Nome());
- prospeccaoToPrint.set_Documento(x.get_Documento() ?? "");
- prospeccaoToPrint.set_Nascimento(x.get_Nascimento());
- prospeccaoToPrint.set_Prefixo1(x.get_Prefixo1() ?? "");
- prospeccaoToPrint.set_Telefone1(x.get_Telefone1() ?? "");
- prospeccaoToPrint.set_Email(x.get_Email() ?? "");
- prospeccaoToPrint.set_VigenciaFinal(x.get_VigenciaFinal());
- prospeccaoToPrint.set_Item(x.get_Item() ?? "");
- prospeccaoToPrint.set_Status(x.get_Status());
- prospeccaoToPrint.set_StatusPersonalizadotoPrint((x.get_StatusPersonalizado() == null ? "" : x.get_StatusPersonalizado().get_Nome()));
- prospeccaoToPrint.set_Tipo(x.get_Tipo() ?? "");
- object nome = x.get_Vendedor().get_Nome();
- if (nome == null)
- {
- nome = null;
- }
- prospeccaoToPrint.set_Vendedor((string)nome);
- prospeccaoToPrint.set_Valor(x.get_Valor());
- prospeccaoToPrints.Add(prospeccaoToPrint);
- });
- List<ProspeccaoToPrint> prospeccaoToPrints1 = prospeccaoToPrints;
- prospeccaoToPrints = (
- from x in prospeccaoToPrints1
- orderby x.get_Vendedor()
- select x).ToList<ProspeccaoToPrint>();
- string str = await Funcoes.GenerateTable<ProspeccaoToPrint>(prospeccaoToPrints.ToList<ProspeccaoToPrint>(), new List<string>(), false, false, "", null);
- if (!string.IsNullOrEmpty(str))
- {
- TipoRelatorio tipoRelatorio = new TipoRelatorio();
- tipoRelatorio.set_Inicio(this.Inicio);
- tipoRelatorio.set_Fim(this.Fim);
- tipoRelatorio.set_Nome(string.Concat("PROSPECÇÕES - ", this.SelectedVendedor.get_Nome()));
- str = Funcoes.ExportarHtml(tipoRelatorio, str, "60", "landscaoe", false, "");
- string tempPath = Path.GetTempPath();
- string str1 = string.Format("{0}PROSPECÇÃO_{1:ddMMyyyyhhmmss}.html", tempPath, Funcoes.GetNetworkTime());
- StreamWriter streamWriter = new StreamWriter(str1, true, Encoding.UTF8);
- streamWriter.Write(str);
- streamWriter.Close();
- Process.Start(str1);
- }
- }
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar(Gestor.Model.Domain.Seguros.Prospeccao prospecao)
- {
- return await base.SalvarProspeccao(prospecao);
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs b/Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs
deleted file mode 100644
index 33d1096..0000000
--- a/Gestor.Application/ViewModels/BI/TarefaBIViewModel.cs
+++ /dev/null
@@ -1,1453 +0,0 @@
-using Gestor.Application.Actions;
-using Gestor.Application.Drawers;
-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.Generic;
-using Gestor.Application.Views.Seguros;
-using Gestor.Common.Validation;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Configuracoes;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.MalaDireta;
-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.BI
-{
- public class TarefaBIViewModel : BaseTarefaViewModel
- {
- private bool _enableAlterarTarefa = true;
-
- private bool _administrador;
-
- private DateTime _inicio;
-
- private DateTime _fim;
-
- private List<string> _status;
-
- private string _selectedStatus;
-
- private Visibility _isVisibleCliente;
-
- private Visibility _isVisibleApolice;
-
- private Visibility _isVisibleArquivoDigital;
-
- private Visibility _isVisibleSinistro;
-
- private ObservableCollection<Usuario> _usuariosFiltro;
-
- private ObservableCollection<Usuario> _usuarios;
-
- private ObservableCollection<TipoDeTarefa> _tiposTarefa;
-
- private TipoDeTarefa _selectedTipoTarefa;
-
- private Usuario _selectedUsuarioFiltro;
-
- private Usuario _selectedUsuario;
-
- private DateTime _dataAgendamento;
-
- private DateTime _horaAgendamento;
-
- private bool _isAnotacoes;
-
- private string _descricao;
-
- private string _historicoInterno;
-
- private ObservableCollection<Tarefa> _tarefas;
-
- private Tarefa _selectedTarefa;
-
- private ObservableCollection<TelefoneBase> _telefones;
-
- private long _cancelTarefa;
-
- private ObservableCollection<Tarefa> _tarefasFiltradas;
-
- private string _filtro;
-
- private ObservableCollection<string> _filtroTarefa;
-
- private GridLength _columnUsuarioPrincipal;
-
- private GridLength _columnUsuarios;
-
- public bool Administrador
- {
- get
- {
- return this._administrador;
- }
- set
- {
- this._administrador = value;
- base.OnPropertyChanged("Administrador");
- }
- }
-
- private Gestor.Application.Servicos.Seguros.ClienteServico ClienteServico
- {
- get;
- }
-
- public GridLength ColumnUsuarioPrincipal
- {
- get
- {
- return this._columnUsuarioPrincipal;
- }
- set
- {
- this._columnUsuarioPrincipal = value;
- base.OnPropertyChanged("ColumnUsuarioPrincipal");
- }
- }
-
- public GridLength ColumnUsuarios
- {
- get
- {
- return this._columnUsuarios;
- }
- set
- {
- this._columnUsuarios = value;
- base.OnPropertyChanged("ColumnUsuarios");
- }
- }
-
- 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 string Descricao
- {
- get
- {
- return this._descricao;
- }
- set
- {
- this._descricao = value;
- base.OnPropertyChanged("Descricao");
- }
- }
-
- public override bool EnableAlterarTarefa
- {
- get
- {
- return this._enableAlterarTarefa;
- }
- set
- {
- this._enableAlterarTarefa = this._alterarPermissEnabled & value;
- base.OnPropertyChanged("EnableAlterarTarefa");
- }
- }
-
- public string Filtro
- {
- get
- {
- return this._filtro;
- }
- set
- {
- this._filtro = value;
- base.OnPropertyChanged("Filtro");
- }
- }
-
- public ObservableCollection<string> FiltroTarefa
- {
- get
- {
- return this._filtroTarefa;
- }
- set
- {
- this._filtroTarefa = value;
- base.OnPropertyChanged("FiltroTarefa");
- }
- }
-
- public DateTime Fim
- {
- get
- {
- return this._fim;
- }
- set
- {
- this._fim = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("Fim");
- }
- }
-
- public string HistoricoInterno
- {
- get
- {
- return this._historicoInterno;
- }
- set
- {
- this._historicoInterno = value;
- base.OnPropertyChanged("HistoricoInterno");
- }
- }
-
- 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 DateTime Inicio
- {
- get
- {
- return this._inicio;
- }
- set
- {
- this._inicio = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("Inicio");
- }
- }
-
- public bool IsAnotacoes
- {
- get
- {
- return this._isAnotacoes;
- }
- set
- {
- this._isAnotacoes = value;
- base.OnPropertyChanged("IsAnotacoes");
- }
- }
-
- public Visibility IsVisibleApolice
- {
- get
- {
- return this._isVisibleApolice;
- }
- set
- {
- this._isVisibleApolice = value;
- base.OnPropertyChanged("IsVisibleApolice");
- }
- }
-
- public Visibility IsVisibleArquivoDigital
- {
- get
- {
- return this._isVisibleArquivoDigital;
- }
- set
- {
- this._isVisibleArquivoDigital = value;
- base.OnPropertyChanged("IsVisibleArquivoDigital");
- }
- }
-
- public Visibility IsVisibleCliente
- {
- get
- {
- return this._isVisibleCliente;
- }
- set
- {
- this._isVisibleCliente = value;
- base.OnPropertyChanged("IsVisibleCliente");
- }
- }
-
- public Visibility IsVisibleSinistro
- {
- get
- {
- return this._isVisibleSinistro;
- }
- set
- {
- this._isVisibleSinistro = value;
- base.OnPropertyChanged("IsVisibleSinistro");
- }
- }
-
- public string SelectedStatus
- {
- get
- {
- return this._selectedStatus;
- }
- set
- {
- this._selectedStatus = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("SelectedStatus");
- }
- }
-
- public override Tarefa SelectedTarefa
- {
- get
- {
- return this._selectedTarefa;
- }
- set
- {
- long? nullable;
- this._cancelTarefa = (value != null ? value.get_Id() : (long)0);
- this.WorkOnSelectedTarefa(value);
- if (value != null)
- {
- nullable = new long?(value.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- this._selectedTarefa = value;
- 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");
- }
- }
-
- public Usuario SelectedUsuarioFiltro
- {
- get
- {
- return this._selectedUsuarioFiltro;
- }
- set
- {
- this._selectedUsuarioFiltro = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("SelectedUsuarioFiltro");
- }
- }
-
- private new TarefaServico Servico
- {
- get;
- }
-
- public List<string> Status
- {
- get
- {
- return this._status;
- }
- set
- {
- this._status = value;
- this.CarregaTarefas(false);
- base.OnPropertyChanged("Status");
- }
- }
-
- public ObservableCollection<Tarefa> Tarefas
- {
- get
- {
- return this._tarefas;
- }
- set
- {
- this._tarefas = value;
- base.OnPropertyChanged("Tarefas");
- }
- }
-
- public ObservableCollection<Tarefa> TarefasFiltradas
- {
- get
- {
- return this._tarefasFiltradas;
- }
- set
- {
- this._tarefasFiltradas = value;
- base.IsVisible = (value.Count > 0 ? Visibility.Visible : Visibility.Collapsed);
- base.OnPropertyChanged("TarefasFiltradas");
- }
- }
-
- public ObservableCollection<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 ObservableCollection<Usuario> Usuarios
- {
- get
- {
- return this._usuarios;
- }
- set
- {
- this._usuarios = value;
- base.OnPropertyChanged("Usuarios");
- }
- }
-
- public ObservableCollection<Usuario> UsuariosFiltro
- {
- get
- {
- return this._usuariosFiltro;
- }
- set
- {
- this._usuariosFiltro = value;
- base.OnPropertyChanged("UsuariosFiltro");
- }
- }
-
- public TarefaBIViewModel()
- {
- this._enableAlterarTarefa = true;
- DateTime date = Funcoes.GetNetworkTime().Date;
- this._inicio = date.AddDays(-4);
- date = Funcoes.GetNetworkTime().Date;
- this._fim = date.AddDays(4);
- this._status = new List<string>()
- {
- "TODAS AS TAREFAS",
- Gestor.Common.Validation.ValidationHelper.GetDescription((StatusTarefa)0),
- Gestor.Common.Validation.ValidationHelper.GetDescription((StatusTarefa)2)
- };
- this._isVisibleCliente = Visibility.Collapsed;
- this._isVisibleApolice = Visibility.Collapsed;
- this._isVisibleArquivoDigital = Visibility.Collapsed;
- this._isVisibleSinistro = Visibility.Collapsed;
- this._selectedUsuarioFiltro = new Usuario();
- this._selectedUsuario = new Usuario();
- this._dataAgendamento = Funcoes.GetNetworkTime();
- this._horaAgendamento = Funcoes.GetNetworkTime();
- this._isAnotacoes = true;
- this._descricao = "";
- this._historicoInterno = "";
- this._tarefasFiltradas = new ObservableCollection<Tarefa>();
- this._filtro = "";
- this._filtroTarefa = new ObservableCollection<string>();
- this._columnUsuarioPrincipal = new GridLength(1, GridUnitType.Star);
- this._columnUsuarios = new GridLength(0, GridUnitType.Pixel);
- base();
- this.Servico = new TarefaServico();
- this.ClienteServico = new Gestor.Application.Servicos.Seguros.ClienteServico();
- this.Administrador = (Recursos.Usuario.get_Id() == 0 ? true : Recursos.Usuario.get_Administrador());
- this.CarregarUsuarios();
- List<Usuario> list = Recursos.Usuarios.Where<Usuario>((Usuario x) => {
- if (!Recursos.Configuracoes.Any<ConfiguracaoSistema>((ConfiguracaoSistema c) => c.get_Configuracao() == 36) && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa())
- {
- return false;
- }
- return !x.get_Excluido();
- }).OrderBy<Usuario, string>((Usuario x) => x.get_Nome()).ToList<Usuario>();
- Usuario usuario = new Usuario();
- usuario.set_Nome("TODOS OS USUÁRIOS");
- usuario.set_Id((long)0);
- list.Insert(0, usuario);
- this.UsuariosFiltro = new ObservableCollection<Usuario>(list);
- this.TiposTarefa = new ObservableCollection<TipoDeTarefa>((
- from x in Recursos.TiposTarefa
- where x.get_Ativo()
- select x).ToList<TipoDeTarefa>());
- this.SelectedUsuarioFiltro = this.UsuariosFiltro.FirstOrDefault<Usuario>((Usuario x) => x.get_Id() == Recursos.Usuario.get_Id()) ?? this.UsuariosFiltro.FirstOrDefault<Usuario>();
- this.SelectedStatus = this.Status[1];
- this.CarregaTarefas(true);
- }
-
- public async void Abrir(TipoTarefa tipo)
- {
- double? nullable;
- long? nullable1;
- long? nullable2;
- switch (tipo)
- {
- case 0:
- {
- long idEntidade = this.SelectedTarefa.get_IdEntidade();
- if (this.SelectedTarefa.get_Entidade() == 4)
- {
- Sinistro sinistro = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- if (sinistro != null)
- {
- ControleSinistro controleSinistro = sinistro.get_ControleSinistro();
- if (controleSinistro != null)
- {
- Item item = controleSinistro.get_Item();
- if (item != null)
- {
- Documento documento = item.get_Documento();
- if (documento != null)
- {
- nullable2 = new long?(documento.get_Id());
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- }
- else
- {
- nullable1 = null;
- nullable2 = nullable1;
- }
- nullable1 = nullable2;
- idEntidade = nullable1.GetValueOrDefault();
- }
- if (idEntidade != 0)
- {
- nullable = null;
- double? nullable3 = nullable;
- nullable = null;
- (new HosterWindow(new ApoliceView(await base.CarregaApolice(idEntidade), true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", this.SelectedTarefa.get_Cliente()), nullable3, nullable, false)).Show();
- goto case 1;
- }
- else
- {
- break;
- }
- }
- case 1:
- {
- break;
- }
- case 2:
- {
- nullable = null;
- double? nullable4 = nullable;
- nullable = null;
- (new HosterWindow(new ClienteView(await base.CarregaCliente(this.SelectedTarefa.get_IdCliente()), true, null), string.Concat("CADASTRO DE CLIENTES - ", this.SelectedTarefa.get_Cliente()), nullable4, nullable, false)).Show();
- goto case 1;
- }
- case 3:
- {
- nullable = null;
- double? nullable5 = nullable;
- nullable = null;
- (new HosterWindow(new ApoliceView(await base.CarregaApoliceParcela(this.SelectedTarefa.get_IdEntidade()), true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", this.SelectedTarefa.get_Cliente(), " - ", this.SelectedTarefa.get_Referencia()), nullable5, nullable, false)).Show();
- goto case 1;
- }
- case 4:
- {
- Sinistro sinistro1 = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- if (sinistro1 != null)
- {
- nullable = null;
- double? nullable6 = nullable;
- nullable = null;
- (new HosterWindow(new SinistroView(sinistro1.get_ControleSinistro().get_Item(), false), string.Concat("CADASTRO DE SINISTROS - ", this.SelectedTarefa.get_Cliente(), " - ", this.SelectedTarefa.get_Referencia()), nullable6, nullable, false)).Show();
- goto case 1;
- }
- else
- {
- await base.ShowMessage("SINISTRO NÃO ENCONTRADO!", "OK", "", false);
- break;
- }
- }
- default:
- {
- goto case 1;
- }
- }
- }
-
- public async void AbrirArquivoDigital()
- {
- FiltroArquivoDigital filtroArquivoDigital;
- if (this.SelectedTarefa.get_IdEntidade() != 0)
- {
- filtroArquivoDigital = new FiltroArquivoDigital();
- switch (this.SelectedTarefa.get_Entidade())
- {
- case 0:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 2).get_Consultar())
- {
- Documento documento = await base.CarregaApolice(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(documento.get_Id());
- filtroArquivoDigital.set_Tipo(2);
- filtroArquivoDigital.set_Parente(documento);
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)2), "."), "OK", "", false);
- break;
- }
- }
- case 1:
- case 6:
- case 7:
- {
- base.ShowDrawer(new ArquivoDigitalDrawer(filtroArquivoDigital), 0, false);
- break;
- }
- case 2:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 1).get_Consultar())
- {
- Cliente cliente = await base.CarregaCliente(this.SelectedTarefa.get_IdCliente());
- filtroArquivoDigital.set_Id(cliente.get_Id());
- filtroArquivoDigital.set_Tipo(1);
- filtroArquivoDigital.set_Parente(cliente);
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)1), "."), "OK", "", false);
- break;
- }
- }
- case 3:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 3).get_Consultar())
- {
- Parcela parcela = await base.CarregaParcela(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(parcela.get_Id());
- filtroArquivoDigital.set_Tipo(3);
- filtroArquivoDigital.set_Parente(parcela);
- filtroArquivoDigital.set_IdApolice(parcela.get_Documento().get_Id());
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)3), "."), "OK", "", false);
- break;
- }
- }
- case 4:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 5).get_Consultar())
- {
- Sinistro sinistro = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(sinistro.get_Id());
- filtroArquivoDigital.set_Tipo(5);
- filtroArquivoDigital.set_Parente(sinistro);
- filtroArquivoDigital.set_IdApolice(sinistro.get_ControleSinistro().get_Item().get_Documento().get_Id());
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)5), "."), "OK", "", false);
- break;
- }
- }
- case 5:
- {
- if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 11).get_Consultar())
- {
- Prospeccao prospeccao = await base.CarregarProspeccao(this.SelectedTarefa.get_IdEntidade());
- filtroArquivoDigital.set_Id(prospeccao.get_Id());
- filtroArquivoDigital.set_Tipo(11);
- filtroArquivoDigital.set_Parente(prospeccao);
- goto case 7;
- }
- else
- {
- await base.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", Gestor.Common.Validation.ValidationHelper.GetDescription((TipoArquivoDigital)11), "."), "OK", "", false);
- break;
- }
- }
- case 8:
- {
- break;
- }
- default:
- {
- goto case 7;
- }
- }
- }
- filtroArquivoDigital = null;
- }
-
- public void AdcionarFiltro()
- {
- if (string.IsNullOrEmpty(this.Filtro))
- {
- return;
- }
- if (this.FiltroTarefa == null)
- {
- this.FiltroTarefa = new ObservableCollection<string>();
- }
- this.FiltroTarefa.Add(this.Filtro);
- this.Filtro = string.Empty;
- this.FiltrarTarefa();
- }
-
- public async Task AdcionarResponsavel()
- {
- if (!await base.ValidaPermissaoParaEditarTarefa())
- {
- await base.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!", "OK", "", false);
- }
- else if (this.SelectedUsuario != null)
- {
- 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 async Task AlterarTarefa()
- {
- GridLength gridLength;
- GridLength gridLength1;
- if (this.SelectedTarefa != null)
- {
- if (await base.ValidaPermissaoParaEditarTarefa())
- {
- this.CarregarUsuarios();
- base.Alterar(true);
- TarefaBIViewModel tarefaBIViewModel = this;
- gridLength = (base.EnableFields ? new GridLength(0, GridUnitType.Pixel) : new GridLength(1, GridUnitType.Star));
- tarefaBIViewModel.ColumnUsuarioPrincipal = gridLength;
- TarefaBIViewModel tarefaBIViewModel1 = this;
- gridLength1 = (base.EnableFields ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel));
- tarefaBIViewModel1.ColumnUsuarios = gridLength1;
- base.ListaUsuariosResponsaveis();
- base.HasResponsaveis = true;
- this.SelectedUsuario = null;
- base.Responsaveis.ToList<ResponsavelTarefa>().ForEach((ResponsavelTarefa x) => this.Usuarios.Remove(this.Usuarios.FirstOrDefault<Usuario>((Usuario u) => u.get_Id() == x.get_Usuario().get_Id())));
- }
- else
- {
- await base.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EXCLUIR ESSA TAREFA!", "OK", "", false);
- }
- }
- }
-
- public async Task Cancelar()
- {
- if (this._cancelTarefa != 0)
- {
- long num = this._cancelTarefa;
- await this.CarregarTarefas();
- this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault<Tarefa>((Tarefa x) => x.get_Id() == num);
- base.Alterar(false);
- }
- }
-
- public async Task CarregarTarefas()
- {
- long id;
- bool? nullable;
- this.ColumnUsuarioPrincipal = new GridLength(1, GridUnitType.Star);
- this.ColumnUsuarios = new GridLength(0, GridUnitType.Pixel);
- this.Filtro = string.Empty;
- TarefaServico servico = this.Servico;
- Usuario selectedUsuarioFiltro = this.SelectedUsuarioFiltro;
- if (selectedUsuarioFiltro != null)
- {
- id = selectedUsuarioFiltro.get_Id();
- }
- else
- {
- id = (long)0;
- }
- DateTime inicio = this.Inicio;
- DateTime fim = this.Fim;
- if (this.SelectedStatus == "TODAS AS TAREFAS")
- {
- nullable = null;
- }
- else
- {
- nullable = new bool?(this.SelectedStatus != "PENDENTE");
- }
- List<Tarefa> tarefas = await servico.BuscarTarefas(id, inicio, fim, nullable);
- TarefaBIViewModel observableCollection = this;
- List<Tarefa> tarefas1 = tarefas;
- IEnumerable<Tarefa> entidade =
- from x in tarefas1
- where x.get_Entidade() != 1
- select x;
- observableCollection.Tarefas = new ObservableCollection<Tarefa>(
- from x in entidade
- orderby x.get_Agendamento()
- select x);
- this.TarefasFiltradas = this.Tarefas;
- this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault<Tarefa>();
- if (this.FiltroTarefa.Count > 0)
- {
- this.FiltrarTarefa();
- }
- }
-
- 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())
- {
- return false;
- }
- return !x.get_Excluido();
- }).OrderBy<Usuario, string>((Usuario x) => x.get_Nome()).ToList<Usuario>());
- }
-
- public async void CarregaTarefas(bool permissoes = false)
- {
- if (permissoes)
- {
- await base.PermissaoTela(38);
- base.Alterar(false);
- }
- await this.CarregarTarefas();
- }
-
- public async Task<Tarefa> ConcluirTarefa(Tarefa tarefa)
- {
- Tarefa tarefa1;
- if (await base.ValidaPermissaoParaEditarTarefa())
- {
- tarefa1 = await this.Servico.Salvar(tarefa);
- }
- else
- {
- await base.ShowMessage("VOCÊ NÃO TEM PERMISSÃO PARA EDITAR ESSA TAREFA!", "OK", "", false);
- tarefa1 = null;
- }
- return tarefa1;
- }
-
- public async Task<MalaDireta> CriarMalaDireta(TipoTarefa tipo)
- {
- MalaDireta malaDiretum;
- switch (tipo)
- {
- case 0:
- {
- Documento documento = await base.CarregaApolice(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum1 = new MalaDireta();
- malaDiretum1.set_Cliente(documento.get_Controle().get_Cliente());
- malaDiretum1.set_Apolice(documento);
- malaDiretum1.set_Tela(2);
- malaDiretum = malaDiretum1;
- break;
- }
- case 1:
- case 6:
- case 7:
- {
- malaDiretum = null;
- break;
- }
- case 2:
- {
- Cliente cliente = await base.CarregaCliente(this.SelectedTarefa.get_IdCliente());
- MalaDireta malaDiretum2 = new MalaDireta();
- malaDiretum2.set_Cliente(cliente);
- malaDiretum2.set_Tela(1);
- malaDiretum = malaDiretum2;
- break;
- }
- case 3:
- {
- Documento documento1 = await base.CarregaApoliceParcela(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum3 = new MalaDireta();
- malaDiretum3.set_Cliente(documento1.get_Controle().get_Cliente());
- malaDiretum3.set_Apolice(documento1);
- malaDiretum3.set_Tela(5);
- malaDiretum = malaDiretum3;
- break;
- }
- case 4:
- {
- Sinistro sinistro = await base.CarregaSinistroApolice(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum4 = new MalaDireta();
- malaDiretum4.set_Cliente(sinistro.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente());
- malaDiretum4.set_Apolice(sinistro.get_ControleSinistro().get_Item().get_Documento());
- malaDiretum4.set_Sinistro(sinistro);
- malaDiretum4.set_Tela(7);
- malaDiretum = malaDiretum4;
- break;
- }
- case 5:
- {
- Prospeccao prospeccao = await base.CarregarProspeccao(this.SelectedTarefa.get_IdEntidade());
- MalaDireta malaDiretum5 = new MalaDireta();
- malaDiretum5.set_Prospeccao(prospeccao);
- malaDiretum5.set_Tela(33);
- malaDiretum = malaDiretum5;
- break;
- }
- case 8:
- {
- malaDiretum = null;
- break;
- }
- default:
- {
- goto case 7;
- }
- }
- return malaDiretum;
- }
-
- public async Task Excluir()
- {
- bool id;
- string titulo;
- Tarefa selectedTarefa = this.SelectedTarefa;
- if (selectedTarefa != null)
- {
- id = selectedTarefa.get_Id() == (long)0;
- }
- else
- {
- id = false;
- }
- if (!id)
- {
- TarefaBIViewModel tarefaBIViewModel = this;
- string[] newLine = new string[] { "DESEJA REALMENTE EXCLUIR A TAREFA ", null, null, null, null };
- Tarefa tarefa = this.SelectedTarefa;
- if (tarefa != null)
- {
- titulo = tarefa.get_Titulo();
- }
- else
- {
- titulo = null;
- }
- newLine[1] = titulo;
- newLine[2] = "?";
- newLine[3] = Environment.NewLine;
- newLine[4] = "ESSE PROCEDIMENTO É IRREVERSÍVEL";
- if (await tarefaBIViewModel.ShowMessage(string.Concat(newLine), "SIM", "NÃO", false))
- {
- if (await this.Servico.Excluir(this.SelectedTarefa.get_Id()))
- {
- await this.CarregarTarefas();
- Action atualizaTrilhas = Gestor.Application.Actions.Actions.AtualizaTrilhas;
- if (atualizaTrilhas != null)
- {
- atualizaTrilhas();
- }
- else
- {
- }
- base.Alterar(false);
- }
- else
- {
- base.Alterar(false);
- }
- }
- }
- }
-
- public void ExcluirFiltro(string filtro)
- {
- this.FiltroTarefa.Remove(filtro);
- this.FiltrarTarefa();
- }
-
- private List<Tarefa> Filtrar()
- {
- List<Tarefa> list = this.Tarefas.ToList<Tarefa>();
- this.FiltroTarefa.ToList<string>().ForEach((string f) => list = list.Where<Tarefa>((Tarefa x) => {
- if (Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Titulo()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Cliente()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_Referencia()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || x.get_Agendamento().ToString("d").ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || x.get_Id().ToString().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)) || x.get_TipoDeTarefa() != null && Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(x.get_TipoDeTarefa().get_Nome()).ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f)))
- {
- return true;
- }
- if (x.get_Usuario() == null)
- {
- return false;
- }
- return x.get_Usuario().get_Nome().ToUpper().Contains(Gestor.Common.Validation.ValidationHelper.RemoveDiacritics(f));
- }).ToList<Tarefa>());
- return list;
- }
-
- public void FiltrarTarefa()
- {
- this.TarefasFiltradas = new ObservableCollection<Tarefa>(this.Filtrar());
- this.SelectedTarefa = this.TarefasFiltradas.FirstOrDefault<Tarefa>();
- }
-
- 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 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);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar(string titulo)
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- Usuario usuario;
- string str;
- if (this.SelectedTarefa != null)
- {
- 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));
- }
- this.SelectedTarefa.set_Responsaveis(base.Responsaveis.ToList<ResponsavelTarefa>());
- Tarefa selectedTarefa = this.SelectedTarefa;
- ResponsavelTarefa responsavelTarefa = base.Responsaveis.FirstOrDefault<ResponsavelTarefa>();
- if (responsavelTarefa != null)
- {
- usuario = responsavelTarefa.get_Usuario();
- }
- else
- {
- usuario = null;
- }
- selectedTarefa.set_Usuario(usuario);
- 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();
- string text = Funcoes.GetText(this.SelectedTarefa.get_Anotacoes());
- string text1 = Funcoes.GetText(this.SelectedTarefa.get_AnotacoesInternas());
- if (string.IsNullOrEmpty(text) && string.IsNullOrEmpty(text1))
- {
- keyValuePairs1.Add(new KeyValuePair<string, string>("Anotações", "OBRIGATÓRIO"));
- }
- if (keyValuePairs1.Count <= 0)
- {
- this.SelectedTarefa.set_Anotacoes(Funcoes.AdicionarLog(this.SelectedTarefa.get_Anotacoes()));
- this.SelectedTarefa.set_Descricao(string.Concat(this.SelectedTarefa.get_Anotacoes(), " <p> ", this.Descricao, " </p>"));
- Tarefa selectedTarefa1 = this.SelectedTarefa;
- str = (string.IsNullOrWhiteSpace(this.SelectedTarefa.get_AnotacoesInternas()) ? this.HistoricoInterno : string.Concat(this.SelectedTarefa.get_AnotacoesInternas(), " <p> ", this.HistoricoInterno, " </p>"));
- selectedTarefa1.set_DescricaoInterna(str);
- this.SelectedTarefa.set_TipoDeTarefa(this.SelectedTipoTarefa);
- this.SelectedTarefa.set_Titulo(titulo);
- this.SelectedTarefa = await this.Servico.Salvar(this.SelectedTarefa);
- if (this.Servico.Sucesso)
- {
- long id = this.SelectedTarefa.get_Id();
- await this.CarregarTarefas();
- TarefaBIViewModel tarefaBIViewModel = this;
- Tarefa tarefa1 = this.TarefasFiltradas.FirstOrDefault<Tarefa>((Tarefa x) => x.get_Id() == id);
- if (tarefa1 == null)
- {
- tarefa1 = this.TarefasFiltradas.FirstOrDefault<Tarefa>();
- }
- tarefaBIViewModel.SelectedTarefa = tarefa1;
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- }
- else
- {
- keyValuePairs = null;
- }
- return keyValuePairs;
- }
-
- private async void WorkOnSelectedTarefa(Tarefa value)
- {
- Usuario usuario;
- ObservableCollection<ResponsavelTarefa> observableCollection;
- TipoTelefone tipoTelefone;
- TipoTelefone tipoTelefone1;
- bool flag;
- ObservableCollection<ResponsavelTarefa> observableCollection1;
- if (value != null)
- {
- TarefaBIViewModel tarefaBIViewModel = this;
- if (value.get_Usuario() != null)
- {
- usuario = this.Usuarios.FirstOrDefault<Usuario>((Usuario x) => x.get_Id() == value.get_Usuario().get_Id());
- }
- else
- {
- usuario = null;
- }
- tarefaBIViewModel.SelectedUsuario = usuario;
- this.DataAgendamento = value.get_Agendamento();
- this.HoraAgendamento = value.get_Agendamento();
- this.Descricao = value.get_Descricao();
- this.HistoricoInterno = value.get_DescricaoInterna();
- TarefaBIViewModel tarefaBIViewModel1 = this;
- if (value == null)
- {
- observableCollection = new ObservableCollection<ResponsavelTarefa>();
- }
- else
- {
- observableCollection = (value.get_Responsaveis() == null ? new ObservableCollection<ResponsavelTarefa>() : new ObservableCollection<ResponsavelTarefa>(value.get_Responsaveis()));
- }
- tarefaBIViewModel1.Responsaveis = observableCollection;
- if (!base.Responsaveis.Any<ResponsavelTarefa>())
- {
- TarefaBIViewModel tarefaBIViewModel2 = this;
- Tarefa tarefa = value;
- if (tarefa != null)
- {
- flag = tarefa.get_Usuario();
- }
- else
- {
- flag = false;
- }
- if (!flag)
- {
- 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);
- }
- tarefaBIViewModel2.Responsaveis = observableCollection1;
- }
- if (value.get_TipoDeTarefa() != null)
- {
- if (!this.TiposTarefa.All<TipoDeTarefa>((TipoDeTarefa x) => x.get_Id() != value.get_Id()) || value.get_TipoDeTarefa().get_Ativo())
- {
- TarefaBIViewModel observableCollection2 = this;
- ObservableCollection<TipoDeTarefa> tiposTarefa = this.TiposTarefa;
- observableCollection2.TiposTarefa = new ObservableCollection<TipoDeTarefa>((
- from x in tiposTarefa
- where x.get_Ativo()
- select x).ToList<TipoDeTarefa>());
- }
- else
- {
- this.TiposTarefa.Add(value.get_TipoDeTarefa());
- }
- }
- this.SelectedTipoTarefa = value.get_TipoDeTarefa();
- this.IsVisibleCliente = Visibility.Collapsed;
- this.IsVisibleApolice = Visibility.Collapsed;
- this.IsVisibleSinistro = Visibility.Collapsed;
- this.IsVisibleArquivoDigital = Visibility.Collapsed;
- TipoTarefa entidade = value.get_Entidade();
- switch (entidade)
- {
- case 0:
- case 3:
- {
- this.IsVisibleCliente = Visibility.Visible;
- this.IsVisibleApolice = Visibility.Visible;
- this.IsVisibleArquivoDigital = Visibility.Visible;
- goto case 1;
- }
- case 1:
- {
- entidade = value.get_Entidade();
- if (entidade == 5)
- {
- Prospeccao prospeccao = await (new ProspeccaoServico()).BuscarProspeccao(value.get_IdEntidade());
- this.Telefones = new ObservableCollection<TelefoneBase>();
- if (prospeccao != null && prospeccao.get_Telefone1() != null)
- {
- ObservableCollection<TelefoneBase> telefones = this.Telefones;
- TelefoneBase telefoneBase1 = new TelefoneBase();
- tipoTelefone1 = (prospeccao.get_Telefone1().StartsWith("9") ? 3 : 7);
- telefoneBase1.set_Tipo(new TipoTelefone?(tipoTelefone1));
- telefoneBase1.set_Numero(prospeccao.get_Telefone1());
- telefoneBase1.set_Prefixo(prospeccao.get_Prefixo1());
- telefones.Add(telefoneBase1);
- }
- if (prospeccao != null && prospeccao.get_Telefone2() != null)
- {
- ObservableCollection<TelefoneBase> telefones1 = this.Telefones;
- TelefoneBase telefoneBase2 = new TelefoneBase();
- tipoTelefone = (prospeccao.get_Telefone2().StartsWith("9") ? 3 : 7);
- telefoneBase2.set_Tipo(new TipoTelefone?(tipoTelefone));
- telefoneBase2.set_Numero(prospeccao.get_Telefone2());
- telefoneBase2.set_Prefixo(prospeccao.get_Prefixo2());
- telefones1.Add(telefoneBase2);
- }
- }
- else if (entidade == 8)
- {
- this.Telefones = new ObservableCollection<TelefoneBase>();
- }
- else
- {
- ObservableCollection<ClienteTelefone> observableCollection3 = await this.ClienteServico.BuscarTelefonesAsync(value.get_IdCliente());
- TarefaBIViewModel tarefaBIViewModel3 = this;
- ObservableCollection<ClienteTelefone> observableCollection4 = observableCollection3;
- IEnumerable<ClienteTelefone> clienteTelefones =
- from x in observableCollection4
- where Gestor.Model.Helper.ValidationHelper.ValidacaoTelefone(x.get_Numero())
- select x;
- tarefaBIViewModel3.Telefones = new ObservableCollection<TelefoneBase>(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>());
- }
- break;
- }
- case 2:
- {
- this.IsVisibleCliente = Visibility.Visible;
- this.IsVisibleArquivoDigital = Visibility.Visible;
- goto case 1;
- }
- case 4:
- {
- this.IsVisibleCliente = Visibility.Visible;
- this.IsVisibleApolice = Visibility.Visible;
- this.IsVisibleSinistro = Visibility.Visible;
- this.IsVisibleArquivoDigital = Visibility.Visible;
- goto case 1;
- }
- default:
- {
- goto case 1;
- }
- }
- }
- else
- {
- base.Responsaveis = new ObservableCollection<ResponsavelTarefa>();
- }
- }
- }
-} \ No newline at end of file