From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Generic/DialogProspeccaoViewModel.cs | 352 --------------------- 1 file changed, 352 deletions(-) delete mode 100644 Gestor.Application/ViewModels/Generic/DialogProspeccaoViewModel.cs (limited to 'Gestor.Application/ViewModels/Generic/DialogProspeccaoViewModel.cs') diff --git a/Gestor.Application/ViewModels/Generic/DialogProspeccaoViewModel.cs b/Gestor.Application/ViewModels/Generic/DialogProspeccaoViewModel.cs deleted file mode 100644 index f95e6d6..0000000 --- a/Gestor.Application/ViewModels/Generic/DialogProspeccaoViewModel.cs +++ /dev/null @@ -1,352 +0,0 @@ -using Gestor.Application.Helpers; -using Gestor.Application.Servicos.Seguros; -using Gestor.Model.Domain.Common; -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; -using System.Windows; - -namespace Gestor.Application.ViewModels.Generic -{ - public class DialogProspeccaoViewModel : BaseSegurosViewModel - { - private readonly ClienteServico _servico; - - private Prospeccao _selectedProspeccao; - - private bool _isVisibleAnexos; - - private ObservableCollection _arquivosAnexados = new ObservableCollection(); - - private Gestor.Model.Domain.Common.ArquivoDigital _selectedAnexado = new Gestor.Model.Domain.Common.ArquivoDigital(); - - private ObservableCollection _arquivos = new ObservableCollection(); - - private Visibility _visibilityStatusPersonalizado; - - private ObservableCollection _usuarios; - - private ObservableCollection _vendedores; - - private DateTime _dataAgendamento; - - private DateTime _horaAgendamento; - - private List _produtos = Recursos.Produtos; - - private ObservableCollection _statusProspeccao; - - private List _ramos = Recursos.Ramos; - - public ObservableCollection Arquivos - { - get - { - return this._arquivos; - } - set - { - this._arquivos = value; - base.OnPropertyChanged("Arquivos"); - } - } - - public ObservableCollection ArquivosAnexados - { - get - { - return this._arquivosAnexados; - } - set - { - List list; - this._arquivosAnexados = value; - base.OnPropertyChanged("ArquivosAnexados"); - this.IsVisibleAnexos = (value != null ? value.Count > 0 : false); - Prospeccao selectedProspeccao = this.SelectedProspeccao; - if (value != null) - { - list = value.ToList(); - } - else - { - list = null; - } - selectedProspeccao.set_Anexos(list); - } - } - - public DateTime DataAgendamento - { - get - { - return this._dataAgendamento; - } - set - { - this._dataAgendamento = value; - if (this.SelectedProspeccao.get_Tarefa() != null) - { - this.SelectedProspeccao.get_Tarefa().set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", value, this.SelectedProspeccao.get_Tarefa().get_Agendamento()))); - } - base.OnPropertyChanged("DataAgendamento"); - } - } - - public DateTime HoraAgendamento - { - get - { - return this._horaAgendamento; - } - set - { - this._horaAgendamento = value; - if (this.SelectedProspeccao.get_Tarefa() != null) - { - this.SelectedProspeccao.get_Tarefa().set_Agendamento(DateTime.Parse(string.Format("{0:d} {1:T}", this.SelectedProspeccao.get_Tarefa().get_Agendamento(), value))); - } - base.OnPropertyChanged("HoraAgendamento"); - } - } - - public bool IsVisibleAnexos - { - get - { - return this._isVisibleAnexos; - } - set - { - this._isVisibleAnexos = value; - base.OnPropertyChanged("IsVisibleAnexos"); - } - } - - public List Produtos - { - get - { - return this._produtos; - } - set - { - this._produtos = value; - base.OnPropertyChanged("Produtos"); - } - } - - public List Ramos - { - get - { - return this._ramos; - } - set - { - this._ramos = value; - base.OnPropertyChanged("Ramos"); - } - } - - public Gestor.Model.Domain.Common.ArquivoDigital SelectedAnexado - { - get - { - return this._selectedAnexado; - } - set - { - this._selectedAnexado = value; - base.OnPropertyChanged("SelectedAnexado"); - } - } - - public Prospeccao SelectedProspeccao - { - get - { - return this._selectedProspeccao; - } - set - { - this._selectedProspeccao = value; - base.OnPropertyChanged("SelectedProspeccao"); - } - } - - public ObservableCollection StatusProspeccao - { - get - { - return this._statusProspeccao; - } - set - { - this._statusProspeccao = value; - base.OnPropertyChanged("StatusProspeccao"); - } - } - - public ObservableCollection Usuarios - { - get - { - return this._usuarios; - } - set - { - this._usuarios = value; - base.OnPropertyChanged("Usuarios"); - } - } - - public ObservableCollection Vendedores - { - get - { - return this._vendedores; - } - set - { - this._vendedores = value; - base.OnPropertyChanged("Vendedores"); - } - } - - public Visibility VisibilityStatusPersonalizado - { - get - { - return this._visibilityStatusPersonalizado; - } - set - { - this._visibilityStatusPersonalizado = value; - base.OnPropertyChanged("VisibilityStatusPersonalizado"); - } - } - - public DialogProspeccaoViewModel(Prospeccao prospeccao) - { - DateTime? vigenciaFinal; - DateTime? nullable; - DateTime? nullable1; - this._servico = new ClienteServico(); - this.Usuarios = new ObservableCollection(Recursos.Usuarios.Where((Usuario x) => { - if (Recursos.Usuario.get_IdEmpresa() != (long)1 && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa()) - { - return false; - } - return !x.get_Excluido(); - }).OrderBy((Usuario x) => x.get_Nome()).ToList()); - this.Vendedores = new ObservableCollection(Recursos.Vendedores.Where((Vendedor x) => { - if (Recursos.Usuario.get_IdEmpresa() != (long)1 && x.get_IdEmpresa() != Recursos.Usuario.get_IdEmpresa()) - { - return false; - } - return x.get_Ativo(); - }).OrderBy((Vendedor x) => x.get_Nome()).ToList()); - this.StatusProspeccao = new ObservableCollection(( - from x in Recursos.StatusProspeccao - where x.get_Ativo() - orderby x.get_Nome() - select x).ToList()); - if (this.StatusProspeccao == null || this.StatusProspeccao.Count == 0) - { - this.VisibilityStatusPersonalizado = Visibility.Collapsed; - } - if (prospeccao.get_Vendedor() == null) - { - prospeccao.set_Vendedor(this.Vendedores.First((Vendedor x) => x.get_Corretora())); - } - if (prospeccao.get_Tarefa() == null) - { - Prospeccao prospeccao1 = prospeccao; - Tarefa tarefa = new Tarefa(); - tarefa.set_Titulo("PROSPECÇÃO"); - tarefa.set_Entidade(5); - tarefa.set_IdEntidade(prospeccao.get_Id()); - tarefa.set_Usuario(Recursos.Usuario); - vigenciaFinal = prospeccao.get_VigenciaFinal(); - tarefa.set_Agendamento((vigenciaFinal.HasValue ? vigenciaFinal.GetValueOrDefault() : Funcoes.GetNetworkTime())); - tarefa.set_Cliente(prospeccao.get_Nome()); - prospeccao1.set_Tarefa(tarefa); - } - this.SelectedProspeccao = prospeccao; - Tarefa tarefa1 = prospeccao.get_Tarefa(); - if (tarefa1 != null) - { - nullable = new DateTime?(tarefa1.get_Agendamento()); - } - else - { - vigenciaFinal = null; - nullable = vigenciaFinal; - } - vigenciaFinal = nullable; - this.DataAgendamento = vigenciaFinal.Value; - Tarefa tarefa2 = prospeccao.get_Tarefa(); - if (tarefa2 != null) - { - nullable1 = new DateTime?(tarefa2.get_Agendamento()); - } - else - { - vigenciaFinal = null; - nullable1 = vigenciaFinal; - } - vigenciaFinal = nullable1; - this.HoraAgendamento = vigenciaFinal.Value; - } - - public async void Anexar() - { - ObservableCollection arquivos = this.Arquivos; - List list = arquivos.Select((IndiceArquivoDigital x) => { - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = new Gestor.Model.Domain.Common.ArquivoDigital(); - arquivoDigital.set_Descricao(x.get_Descricao()); - arquivoDigital.set_Extensao(x.get_Extensao()); - return arquivoDigital; - }).ToList(); - List arquivoDigitals = await base.AddAttachments(this.ArquivosAnexados.ToList(), list); - if (arquivoDigitals != null) - { - arquivoDigitals.AddRange(this.ArquivosAnexados); - this.ArquivosAnexados = new ObservableCollection(arquivoDigitals); - } - } - - public async Task BuscarInfoCliente(Cliente cliente) - { - cliente = await this._servico.BuscarCliente(cliente.get_Id()); - Cliente cliente1 = cliente; - ObservableCollection observableCollection = await this._servico.BuscarTelefonesAsync(cliente.get_Id()); - cliente1.set_Telefones(observableCollection); - cliente1 = null; - cliente1 = cliente; - ObservableCollection observableCollection1 = await this._servico.BuscarEmailsAsync(cliente.get_Id()); - cliente1.set_Emails(observableCollection1); - cliente1 = null; - return cliente; - } - - public void Delete(Gestor.Model.Domain.Common.ArquivoDigital arquivo) - { - if (this.SelectedAnexado == null) - { - return; - } - Gestor.Model.Domain.Common.ArquivoDigital arquivoDigital = this.ArquivosAnexados.First((Gestor.Model.Domain.Common.ArquivoDigital x) => x.get_Descricao() == arquivo.get_Descricao()); - this.ArquivosAnexados.Remove(arquivoDigital); - this.ArquivosAnexados = new ObservableCollection(this.ArquivosAnexados); - } - } -} \ No newline at end of file -- cgit v1.2.3