diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs | 315 |
1 files changed, 315 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs new file mode 100644 index 0000000..a86bb11 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogProspeccaoViewModel.cs @@ -0,0 +1,315 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogProspeccaoViewModel : BaseSegurosViewModel +{ + private readonly ClienteServico _servico; + + private Prospeccao _selectedProspeccao; + + private bool _isVisibleAnexos; + + private ObservableCollection<ArquivoDigital> _arquivosAnexados = new ObservableCollection<ArquivoDigital>(); + + private ArquivoDigital _selectedAnexado = new ArquivoDigital(); + + private ObservableCollection<IndiceArquivoDigital> _arquivos = new ObservableCollection<IndiceArquivoDigital>(); + + private Visibility _visibilityStatusPersonalizado; + + private ObservableCollection<Usuario> _usuarios; + + private ObservableCollection<Vendedor> _vendedores; + + private DateTime _dataAgendamento; + + private DateTime _horaAgendamento; + + private List<Produto> _produtos = Recursos.Produtos; + + private ObservableCollection<StatusDeProspeccao> _statusProspeccao; + + private List<Ramo> _ramos = Recursos.Ramos; + + public Prospeccao SelectedProspeccao + { + get + { + return _selectedProspeccao; + } + set + { + _selectedProspeccao = value; + OnPropertyChanged("SelectedProspeccao"); + } + } + + public bool IsVisibleAnexos + { + get + { + return _isVisibleAnexos; + } + set + { + _isVisibleAnexos = value; + OnPropertyChanged("IsVisibleAnexos"); + } + } + + public ObservableCollection<ArquivoDigital> ArquivosAnexados + { + get + { + return _arquivosAnexados; + } + set + { + _arquivosAnexados = value; + OnPropertyChanged("ArquivosAnexados"); + IsVisibleAnexos = value != null && value.Count > 0; + SelectedProspeccao.Anexos = value?.ToList(); + } + } + + public ArquivoDigital SelectedAnexado + { + get + { + return _selectedAnexado; + } + set + { + _selectedAnexado = value; + OnPropertyChanged("SelectedAnexado"); + } + } + + public ObservableCollection<IndiceArquivoDigital> Arquivos + { + get + { + return _arquivos; + } + set + { + _arquivos = value; + OnPropertyChanged("Arquivos"); + } + } + + public Visibility VisibilityStatusPersonalizado + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _visibilityStatusPersonalizado; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _visibilityStatusPersonalizado = value; + OnPropertyChanged("VisibilityStatusPersonalizado"); + } + } + + public ObservableCollection<Usuario> Usuarios + { + get + { + return _usuarios; + } + set + { + _usuarios = value; + OnPropertyChanged("Usuarios"); + } + } + + public ObservableCollection<Vendedor> Vendedores + { + get + { + return _vendedores; + } + set + { + _vendedores = value; + OnPropertyChanged("Vendedores"); + } + } + + public DateTime DataAgendamento + { + get + { + return _dataAgendamento; + } + set + { + _dataAgendamento = value; + if (SelectedProspeccao.Tarefa != null) + { + SelectedProspeccao.Tarefa.Agendamento = DateTime.Parse($"{value:d} {SelectedProspeccao.Tarefa.Agendamento:T}"); + } + OnPropertyChanged("DataAgendamento"); + } + } + + public DateTime HoraAgendamento + { + get + { + return _horaAgendamento; + } + set + { + _horaAgendamento = value; + if (SelectedProspeccao.Tarefa != null) + { + SelectedProspeccao.Tarefa.Agendamento = DateTime.Parse($"{SelectedProspeccao.Tarefa.Agendamento:d} {value:T}"); + } + OnPropertyChanged("HoraAgendamento"); + } + } + + public List<Produto> Produtos + { + get + { + return _produtos; + } + set + { + _produtos = value; + OnPropertyChanged("Produtos"); + } + } + + public ObservableCollection<StatusDeProspeccao> StatusProspeccao + { + get + { + return _statusProspeccao; + } + set + { + _statusProspeccao = value; + OnPropertyChanged("StatusProspeccao"); + } + } + + public List<Ramo> Ramos + { + get + { + return _ramos; + } + set + { + _ramos = value; + OnPropertyChanged("Ramos"); + } + } + + public DialogProspeccaoViewModel(Prospeccao prospeccao) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_01bc: Unknown result type (might be due to invalid IL or missing references) + //IL_01c1: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Unknown result type (might be due to invalid IL or missing references) + //IL_01d3: Unknown result type (might be due to invalid IL or missing references) + //IL_01df: Unknown result type (might be due to invalid IL or missing references) + //IL_01ea: Unknown result type (might be due to invalid IL or missing references) + //IL_020e: Unknown result type (might be due to invalid IL or missing references) + //IL_021f: Expected O, but got Unknown + _servico = new ClienteServico(); + Usuarios = new ObservableCollection<Usuario>((from x in Recursos.Usuarios + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && !x.Excluido + orderby x.Nome + select x).ToList()); + Vendedores = new ObservableCollection<Vendedor>((from x in Recursos.Vendedores + where (Recursos.Usuario.IdEmpresa == 1 || x.IdEmpresa == Recursos.Usuario.IdEmpresa) && x.Ativo + orderby x.Nome + select x).ToList()); + StatusProspeccao = new ObservableCollection<StatusDeProspeccao>((from x in Recursos.StatusProspeccao + where x.Ativo + orderby x.Nome + select x).ToList()); + if (StatusProspeccao == null || StatusProspeccao.Count == 0) + { + VisibilityStatusPersonalizado = (Visibility)2; + } + if (prospeccao.Vendedor == null) + { + prospeccao.Vendedor = Vendedores.First((Vendedor x) => x.Corretora); + } + if (prospeccao.Tarefa == null) + { + prospeccao.Tarefa = new Tarefa + { + Titulo = "PROSPECÇÃO", + Entidade = (TipoTarefa)5, + IdEntidade = ((DomainBase)prospeccao).Id, + Usuario = Recursos.Usuario, + Agendamento = (prospeccao.VigenciaFinal ?? Funcoes.GetNetworkTime()), + Cliente = prospeccao.Nome + }; + } + SelectedProspeccao = prospeccao; + Tarefa tarefa = prospeccao.Tarefa; + DataAgendamento = ((tarefa != null) ? new DateTime?(tarefa.Agendamento) : null).Value; + Tarefa tarefa2 = prospeccao.Tarefa; + HoraAgendamento = ((tarefa2 != null) ? new DateTime?(tarefa2.Agendamento) : null).Value; + } + + public async Task<Cliente> BuscarInfoCliente(Cliente cliente) + { + cliente = await _servico.BuscarCliente(((DomainBase)cliente).Id); + Cliente val = cliente; + val.Telefones = await _servico.BuscarTelefonesAsync(((DomainBase)cliente).Id); + val = cliente; + val.Emails = await _servico.BuscarEmailsAsync(((DomainBase)cliente).Id); + return cliente; + } + + public async void Anexar() + { + List<ArquivoDigital> attacheds = ((IEnumerable<IndiceArquivoDigital>)Arquivos).Select((Func<IndiceArquivoDigital, ArquivoDigital>)((IndiceArquivoDigital x) => new ArquivoDigital + { + Descricao = x.Descricao, + Extensao = x.Extensao + })).ToList(); + List<ArquivoDigital> list = await AddAttachments(ArquivosAnexados.ToList(), attacheds); + if (list != null) + { + list.AddRange(ArquivosAnexados); + ArquivosAnexados = new ObservableCollection<ArquivoDigital>(list); + } + } + + public void Delete(ArquivoDigital arquivo) + { + if (SelectedAnexado != null) + { + ArquivoDigital item = ArquivosAnexados.First((ArquivoDigital x) => x.Descricao == arquivo.Descricao); + ArquivosAnexados.Remove(item); + ArquivosAnexados = new ObservableCollection<ArquivoDigital>(ArquivosAnexados); + } + } +} |