From 225aa1499e37faf9d38257caabbadc68d78b427e Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 12:29:41 -0300 Subject: decompiler.com --- .../DashboardViewModel.cs | 925 +++++++++++++++++++++ 1 file changed, 925 insertions(+) create mode 100644 Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs (limited to 'Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs') diff --git a/Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs b/Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs new file mode 100644 index 0000000..be683d2 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/DashboardViewModel.cs @@ -0,0 +1,925 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Relatorios.Dashboard; +using Gestor.Model.Domain.Relatorios.Renovacao; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels; + +public class DashboardViewModel : BaseSegurosViewModel +{ + private readonly TarefaServico _servico; + + private readonly ApoliceServico _apoliceServico; + + private readonly ClienteServico _clienteServico; + + private readonly SinistroServico _sinitrosServico; + + private readonly TarefaServico _tarefaServico; + + private bool _renovacoesEnabled; + + private bool _tarefasEnabled; + + private bool _aniversariantesEnabled; + + private bool _sinistrosEnabled; + + private bool _prospeccoesEnabled; + + private bool _notasEnabled; + + private bool _publica; + + private string _quantidadeRenovacoes = "0"; + + private string _quantidadeAniversariantes = "0"; + + private string _quantidadeProspeccao = "0"; + + private string _quantidadeSinisto = "0"; + + private string _quantidadeTarefas = "0"; + + private List _intervalo = new List { "HOJE", "PRÓXIMOS 3 DIAS", "PRÓXIMOS 7 DIAS" }; + + private string _intervaloSelecionado = "HOJE"; + + private bool _isProspectar; + + private ObservableCollection _notas; + + private ObservableCollection _telefones = new ObservableCollection(); + + private string _anotacoes = ""; + + private ObservableCollection _prospeccoes; + + private ObservableCollection _aniversariantes; + + private ObservableCollection _sinistros; + + private ObservableCollection _renovacaoFiltrado; + + private ObservableCollection _tarefas = new ObservableCollection(); + + private List _ramos; + + private Ramo _selectedRamo; + + private List _referencias = new List { "VENCIMENTO DA ÚLTIMA PARCELA", "VIGÊNCIA INICIAL", "VIGÊNCIA FINAL" }; + + private string _referencia = "VENCIMENTO DA ÚLTIMA PARCELA"; + + private int _selectedTile = 1; + + private string _labelProspeccao; + + private List _filtroCliente = new List { "AMBOS", "CNPJ", "CPF" }; + + private string _filtroClientes; + + public bool RenovacoesEnabled + { + get + { + return _renovacoesEnabled; + } + set + { + _renovacoesEnabled = value; + OnPropertyChanged("RenovacoesEnabled"); + } + } + + public bool TarefasEnabled + { + get + { + return _tarefasEnabled; + } + set + { + _tarefasEnabled = value; + OnPropertyChanged("TarefasEnabled"); + } + } + + public bool AniversariantesEnabled + { + get + { + return _aniversariantesEnabled; + } + set + { + _aniversariantesEnabled = value; + OnPropertyChanged("AniversariantesEnabled"); + } + } + + public bool SinistrosEnabled + { + get + { + return _sinistrosEnabled; + } + set + { + _sinistrosEnabled = value; + OnPropertyChanged("SinistrosEnabled"); + } + } + + public bool ProspeccoesEnabled + { + get + { + return _prospeccoesEnabled; + } + set + { + _prospeccoesEnabled = value; + OnPropertyChanged("ProspeccoesEnabled"); + } + } + + public bool NotasEnabled + { + get + { + return _notasEnabled; + } + set + { + _notasEnabled = value; + OnPropertyChanged("NotasEnabled"); + } + } + + public bool Load { get; set; } = true; + + + public int SelectedTile + { + get + { + return _selectedTile; + } + set + { + _selectedTile = value; + IsProspectar = value == 4 || value == 5; + } + } + + public bool Publica + { + get + { + return _publica; + } + set + { + _publica = value; + OnPropertyChanged("Publica"); + } + } + + public string QuantidadeRenovacoes + { + get + { + return _quantidadeRenovacoes; + } + set + { + _quantidadeRenovacoes = value; + OnPropertyChanged("QuantidadeRenovacoes"); + } + } + + public string QuantidadeAniversariantes + { + get + { + return _quantidadeAniversariantes; + } + set + { + _quantidadeAniversariantes = value; + OnPropertyChanged("QuantidadeAniversariantes"); + } + } + + public string QuantidadeProspeccao + { + get + { + return _quantidadeProspeccao; + } + set + { + _quantidadeProspeccao = value; + OnPropertyChanged("QuantidadeProspeccao"); + } + } + + public string QuantidadeSinistro + { + get + { + return _quantidadeSinisto; + } + set + { + _quantidadeSinisto = value; + OnPropertyChanged("QuantidadeSinistro"); + } + } + + public string QuantidadeTarefas + { + get + { + return _quantidadeTarefas; + } + set + { + _quantidadeTarefas = value; + OnPropertyChanged("QuantidadeTarefas"); + } + } + + public List Intervalo + { + get + { + return _intervalo; + } + set + { + _intervalo = value; + OnPropertyChanged("Intervalo"); + } + } + + public string IntervaloSelecionado + { + get + { + return _intervaloSelecionado; + } + set + { + _intervaloSelecionado = value; + OnPropertyChanged("IntervaloSelecionado"); + } + } + + public bool IsProspectar + { + get + { + return _isProspectar; + } + set + { + _isProspectar = value; + OnPropertyChanged("IsProspectar"); + } + } + + public ObservableCollection Notas + { + get + { + return _notas; + } + set + { + _notas = value; + OnPropertyChanged("Notas"); + } + } + + public ObservableCollection Telefones + { + get + { + return _telefones; + } + set + { + _telefones = value; + OnPropertyChanged("Telefones"); + } + } + + public new string Anotacoes + { + get + { + return _anotacoes; + } + set + { + _anotacoes = value; + OnPropertyChanged("Anotacoes"); + } + } + + public ObservableCollection Prospeccoes + { + get + { + return _prospeccoes; + } + set + { + _prospeccoes = value; + OnPropertyChanged("Prospeccoes"); + } + } + + public List Restricoes { get; set; } + + public List Permissoes { get; set; } + + public ObservableCollection Aniversariantes + { + get + { + return _aniversariantes; + } + set + { + _aniversariantes = value; + OnPropertyChanged("Aniversariantes"); + } + } + + public ObservableCollection Sinistros + { + get + { + return _sinistros; + } + set + { + _sinistros = value; + OnPropertyChanged("Sinistros"); + } + } + + public Filtros Filtros { get; set; } + + private Filtros _filtroRenovacao { get; set; } + + private Filtros _filtroAniversariantes { get; set; } + + private Filtros _filtroTarefas { get; set; } + + private Filtros _filtroSinistros { get; set; } + + public ObservableCollection RenovacaoFiltrado + { + get + { + return _renovacaoFiltrado; + } + set + { + _renovacaoFiltrado = value; + OnPropertyChanged("RenovacaoFiltrado"); + } + } + + public ObservableCollection Tarefas + { + get + { + return _tarefas; + } + set + { + _tarefas = value; + OnPropertyChanged("Tarefas"); + } + } + + private Filtros _filtroProspectar { get; set; } + + public List Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public Ramo SelectedRamo + { + get + { + return _selectedRamo; + } + set + { + _selectedRamo = value; + OnPropertyChanged("SelectedRamo"); + } + } + + public List Referencias + { + get + { + return _referencias; + } + set + { + _referencias = value; + OnPropertyChanged("Referencias"); + } + } + + public string Referencia + { + get + { + return _referencia; + } + set + { + _referencia = value; + OnPropertyChanged("Referencia"); + } + } + + public string LabelProspeccao + { + get + { + return _labelProspeccao; + } + set + { + _labelProspeccao = value; + OnPropertyChanged("LabelProspeccao"); + } + } + + public List FiltroCliente + { + get + { + return _filtroCliente; + } + set + { + _filtroCliente = value; + OnPropertyChanged("FiltroCliente"); + } + } + + public string FiltroClientes + { + get + { + return _filtroClientes; + } + set + { + _filtroClientes = value; + OnPropertyChanged("FiltroClientes"); + } + } + + public DashboardViewModel() + { + _servico = new TarefaServico(); + _apoliceServico = new ApoliceServico(); + _clienteServico = new ClienteServico(); + _tarefaServico = new TarefaServico(); + _sinitrosServico = new SinistroServico(); + } + + public async Task BuscarRestricoes() + { + Restricoes = await ServicoRestriUsuario.BuscarRestricoes(((DomainBase)Recursos.Usuario).Id); + Permissoes = new List(); + PermissaoUsuario val = await ServicoPermissUsuario.VerificarPermissao(Recursos.Usuario, (TipoTela)38); + if (val != null) + { + Permissoes.Add(val); + } + } + + public async Task CarregarAniversariantes(bool force = false) + { + AniversariantesEnabled = false; + if (!force && CompararFiltros(_filtroAniversariantes)) + { + AniversariantesEnabled = true; + return; + } + _filtroAniversariantes = Filtros; + List list = await VerificaVinculoVendedor(Recursos.Usuario); + List vinculoVendedores = new List(); + list.ForEach(delegate(VendedorUsuario v) + { + vinculoVendedores.Add(((DomainBase)v.Vendedor).Id); + }); + List list2 = ((list.Count <= 0) ? (await _clienteServico.BuscarAniversariantes(Filtros)) : (await _clienteServico.BuscarAniversariantesVinculo(Filtros, list))); + List list3 = list2; + QuantidadeAniversariantes = list3.Count.ToString(); + if (list3.Count == 0) + { + Aniversariantes = null; + AniversariantesEnabled = true; + } + else + { + Aniversariantes = new ObservableCollection(list3); + AniversariantesEnabled = true; + } + } + + public async Task CarregarSinistros(bool force = false) + { + SinistrosEnabled = false; + if (!force && CompararFiltros(_filtroSinistros)) + { + SinistrosEnabled = true; + return; + } + _filtroSinistros = Filtros; + List list = await _sinitrosServico.BuscarSinistroPendente(Filtros); + QuantidadeSinistro = list.Count.ToString(); + if (list.Count == 0) + { + Sinistros = null; + SinistrosEnabled = true; + } + else + { + Sinistros = new ObservableCollection(list); + SinistrosEnabled = true; + } + } + + public async Task CarregarSinistros(DateTime inicio, DateTime fim) + { + _filtroSinistros.Fim = fim; + _filtroSinistros.Inicio = inicio; + List list = await _sinitrosServico.BuscarSinistroPendente(_filtroSinistros); + QuantidadeSinistro = list.Count.ToString(); + Sinistros = new ObservableCollection(list); + } + + public async Task CarregarFiltros() + { + List vendedores = new List(); + List list = await VerificaVinculoVendedor(Recursos.Usuario); + if (list.Count > 0) + { + list.ForEach(delegate(VendedorUsuario x) + { + vendedores.Add(((DomainBase)x.Vendedor).Id); + }); + } + DateTime today = DateTime.Today; + DateTime fim = DateTime.Today; + string intervaloSelecionado = IntervaloSelecionado; + if (!(intervaloSelecionado == "PRÓXIMOS 3 DIAS")) + { + if (intervaloSelecionado == "PRÓXIMOS 7 DIAS") + { + fim = today.AddDays(7.0); + } + } + else + { + fim = today.AddDays(3.0); + } + Filtros = new Filtros + { + Inicio = today, + Fim = fim, + Vendedores = vendedores, + IdEmpresa = ((Recursos.Usuario.IdEmpresa > 1) ? Recursos.Usuario.IdEmpresa : 0), + Status = new List { 1L, 2L } + }; + } + + private bool CompararFiltros(Filtros comparacao) + { + if (comparacao == null) + { + return false; + } + if (Filtros == null) + { + return false; + } + if (comparacao.Inicio != Filtros.Inicio) + { + return false; + } + if (comparacao.Fim != Filtros.Fim) + { + return false; + } + return true; + } + + public async Task CarregarRenovacoes(bool force = false) + { + RenovacoesEnabled = false; + if (!force && CompararFiltros(_filtroRenovacao)) + { + RenovacoesEnabled = true; + return; + } + _filtroRenovacao = Filtros; + List analiticoRenovacao = (await _apoliceServico.BuscarApolicesVigenciaFinal(Filtros)).Where((Documento x) => x.Tipo != 3).Select((Func)delegate(Documento x) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Unknown result type (might be due to invalid IL or missing references) + //IL_0111: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Invalid comparison between Unknown and I4 + //IL_0174: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Invalid comparison between Unknown and I4 + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Unknown result type (might be due to invalid IL or missing references) + //IL_01e9: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Unknown result type (might be due to invalid IL or missing references) + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_027c: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_0313: Unknown result type (might be due to invalid IL or missing references) + //IL_0332: Unknown result type (might be due to invalid IL or missing references) + //IL_0343: Unknown result type (might be due to invalid IL or missing references) + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_037f: Unknown result type (might be due to invalid IL or missing references) + //IL_03a7: Unknown result type (might be due to invalid IL or missing references) + //IL_03dc: Unknown result type (might be due to invalid IL or missing references) + //IL_0402: Unknown result type (might be due to invalid IL or missing references) + //IL_0413: Unknown result type (might be due to invalid IL or missing references) + //IL_0424: Unknown result type (might be due to invalid IL or missing references) + //IL_0435: Unknown result type (might be due to invalid IL or missing references) + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_0462: Expected O, but got Unknown + Renovacao val2 = new Renovacao(); + Cliente cliente = x.Controle.Cliente; + val2.Cliente = ((cliente != null) ? cliente.Nome : null) ?? ""; + val2.Apolice = x.Apolice ?? ""; + val2.PremioLiquido = x.PremioLiquido; + val2.PremioTotal = x.PremioTotal; + Negocio? negocio = x.Negocio; + val2.Negocio = (negocio.HasValue ? ValidationHelper.GetDescription((Enum)(object)negocio.GetValueOrDefault()) : null) ?? ""; + val2.VigenciaFinal = x.Vigencia2; + Produto produto2 = x.Controle.Produto; + val2.Produto = ((produto2 != null) ? produto2.Nome : null) ?? ""; + val2.Ramo = x.Controle.Ramo.Nome ?? ""; + val2.Seguradora = ((!string.IsNullOrWhiteSpace(x.Controle.Seguradora.NomeSocial)) ? x.Controle.Seguradora.NomeSocial : x.Controle.Seguradora.Nome); + val2.Status = (((int)x.Situacao == 1 || (int)x.Situacao == 2) ? "NÃO TRABALHADO" : (ValidationHelper.GetDescription((Enum)(object)x.Situacao) ?? "")); + Vendedor vendedorPrincipal = x.VendedorPrincipal; + val2.Vendedor = ((vendedorPrincipal != null) ? vendedorPrincipal.Nome : null); + Estipulante estipulante = x.Estipulante1; + val2.Estipulante = ((estipulante != null) ? estipulante.Nome : null) ?? ""; + val2.TodosVendedores = ((x.Vendedores == null || x.Vendedores.Count == 0) ? "" : string.Join("; ", x.Vendedores.Select((Vendedor v) => v.Nome))); + val2.Tipo = x.Tipo; + val2.Documento = x; + val2.Comissao = x.Comissao; + val2.Item = ((x.ItensAtivo == null) ? "" : ((x.ItensAtivo.Count > 1) ? "APÓLICE COLETIVA" : ((x.ItensAtivo.Count == 1) ? x.ItensAtivo.First().Descricao : ""))); + val2.TipoDocumento = ((x.Tipo == 0) ? "APÓLICE" : ((x.Tipo == 1) ? "ENDOSSO" : "")); + val2.Sinistro = (x.Sinistro ? "SIM" : "NÃO"); + val2.DataControle = x.DataControle; + Status status2 = x.Status; + val2.StatusApolice = ((status2 != null) ? status2.Nome : null) ?? ""; + val2.IdEmpresa = x.Controle.IdEmpresa; + Empresa? obj = ((IEnumerable)Recursos.Empresas).FirstOrDefault((Func)((Empresa e) => ((DomainBase)e).Id == x.Controle.IdEmpresa)); + val2.Empresa = ((obj != null) ? obj.Nome : null); + val2.QtdSinistro = x.ItensAtivo.Sum((Item s) => s.Sinistros.Count); + Banco banco = x.Banco; + val2.Banco = ((banco != null) ? banco.Nome : null) ?? ""; + val2.Conta = x.Conta; + val2.Agencia = x.Agencia; + val2.Pasta = x.Pasta; + val2.PastaCliente = x.Controle.Cliente.Pasta; + val2.Calculos = x.Calculos; + return val2; + }).ToList(); + List collection = (await new ProspeccaoServico().BuscarProspeccoes(Filtros)).Where((Prospeccao x) => x.Renovacao).Select(delegate(Prospeccao x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + Renovacao val = new Renovacao(); + val.Cliente = x.Nome ?? ""; + val.Apolice = "PROSPECÇÃO"; + val.VigenciaFinal = x.VigenciaFinal; + StatusProspeccao? status = x.Status; + val.Status = (status.HasValue ? ValidationHelper.GetDescription((Enum)(object)status.GetValueOrDefault()) : null) ?? ""; + Vendedor vendedor = x.Vendedor; + val.Vendedor = ((vendedor != null) ? vendedor.Nome : null); + Vendedor vendedor2 = x.Vendedor; + val.TodosVendedores = ((vendedor2 != null) ? vendedor2.Nome : null); + val.Telefone = x.Prefixo1 + " " + x.Telefone1 + " | " + x.Prefixo2 + " " + x.Telefone2; + val.Tipo = 3; + val.TipoDocumento = "PROSPECÇÃO"; + val.Item = x.Item; + Produto produto = x.Produto; + val.Produto = ((produto != null) ? produto.Nome : null); + val.Prospeccao = x; + return val; + }).ToList(); + analiticoRenovacao.AddRange(collection); + QuantidadeRenovacoes = analiticoRenovacao.Count.ToString(); + if (analiticoRenovacao.Count == 0) + { + RenovacaoFiltrado = null; + RenovacoesEnabled = true; + return; + } + RenovacaoFiltrado = new ObservableCollection(analiticoRenovacao.OrderBy((Renovacao x) => x.VigenciaFinal).ToList()); + RenovacoesEnabled = true; + } + + public async Task CarregarNotas() + { + NotasEnabled = false; + Notas = new ObservableCollection(await _servico.BuscarNotas(((DomainBase)Recursos.Usuario).Id)); + NotasEnabled = true; + } + + public async Task>> Salvar(Tarefa destino) + { + destino.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List> list = destino.Validate(); + if (list.Count > 0) + { + return list; + } + await _servico.Salvar(destino); + if (!_servico.Sucesso) + { + return null; + } + if (Publica) + { + long id = ((DomainBase)destino.Usuario).Id; + List usuarios = Recursos.Usuarios; + List list2 = new List(); + foreach (Usuario item in usuarios) + { + if (id != ((DomainBase)item).Id) + { + Tarefa val = (Tarefa)((DomainBase)destino).Clone(); + ((DomainBase)val).Id = 0L; + val.Usuario = item; + list2.Add(_servico.Salvar(val)); + } + } + await Task.WhenAll(list2); + } + await CarregarNotas(); + return null; + } + + public async Task SalvarNota(Tarefa nota) + { + return await _servico.Salvar(nota); + } + + public async Task ExcluirNota(Tarefa nota) + { + await _servico.Excluir(((DomainBase)nota).Id); + } + + public async Task CarregarTarefas(bool force = false) + { + TarefasEnabled = false; + if (!force && CompararFiltros(_filtroTarefas)) + { + TarefasEnabled = true; + return; + } + _filtroTarefas = Filtros; + List list = await _tarefaServico.BuscarTarefas(((DomainBase)Recursos.Usuario).Id, _filtroTarefas.Inicio, _filtroTarefas.Fim, false); + QuantidadeTarefas = list.Count.ToString(); + if (list.Count == 0) + { + Tarefas = null; + TarefasEnabled = true; + return; + } + Tarefas = new ObservableCollection(from x in list + where (int)x.Entidade != 1 + orderby x.Agendamento + select x); + TarefasEnabled = true; + } + + public async Task CarregarProspect(DateTime inicio, DateTime fim) + { + ProspeccoesEnabled = false; + Filtros val = new Filtros + { + Inicio = inicio, + Fim = fim, + Ramos = new List { ((DomainBase)SelectedRamo).Id }, + Vendedores = Filtros.Vendedores, + Referencia = Referencia, + FiltrarDocumento = FiltroClientes + }; + LabelProspeccao = "CLIENTES QUE NÃO POSSUEM SEGUROS DO RAMO " + SelectedRamo.Nome + " "; + string referencia = Referencia; + if (!(referencia == "VIGÊNCIA INICIAL")) + { + if (!(referencia == "VIGÊNCIA FINAL")) + { + LabelProspeccao += "E QUE ESTÃO COM A ULTIMA PARCELA VENCENDO NO PERÍODO"; + } + else + { + LabelProspeccao += "E QUE ESTÃO COM UMA APÓLICE VENCENDO NO PERÍODO"; + } + } + else + { + LabelProspeccao += "E QUE ESTÃO COM UMA APÓLICE INICIANDO NO PERÍODO"; + } + if (_filtroProspectar != null && _filtroProspectar.Inicio == val.Inicio && _filtroProspectar.Fim == val.Fim && _filtroProspectar.Ramos == val.Ramos && _filtroProspectar.Referencia == val.Referencia) + { + ProspeccoesEnabled = true; + return; + } + _filtroProspectar = val; + List list = await _clienteServico.BuscarProspect(val); + QuantidadeProspeccao = list.Count.ToString(); + if (list.Count == 0) + { + LabelProspeccao = "NÃO HÁ CLIENTES PARA PROSPECTAR"; + } + Prospeccoes = new ObservableCollection(list); + ProspeccoesEnabled = true; + } + + public void LimparProspeccao() + { + } + + public void CarregarRamos() + { + List ids = new List { 1L, 2L, 6L, 7L }; + Ramos = Recursos.Ramos.Where((Ramo x) => ids.Contains(((DomainBase)x).Id)).ToList(); + SelectedRamo = Ramos.Find((Ramo x) => ((DomainBase)x).Id == 1); + } + + public async Task GerarCsv() + { + string fileName = Path.GetFileNameWithoutExtension(Path.GetTempFileName()) + ".csv"; + File.WriteAllText(fileName, (await Funcoes.GerarCsv(Prospeccoes.ToList(), new List { "Nome", "Documento", "Telefone" })).ToString(), Encoding.UTF8); + Process.Start(fileName); + return true; + } +} -- cgit v1.2.3