diff options
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs new file mode 100644 index 0000000..992960f --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Ferramentas/IncluirSeguradoraViewModel.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Ferramentas; + +public class IncluirSeguradoraViewModel : BaseSegurosViewModel +{ + private Seguradora _selectedSeguradora; + + private Seguradora _adicionarSeguradora; + + private List<Seguradora> _seguradorasAdicionadas; + + private ObservableCollection<Seguradora> _seguradoras; + + private string _filtro; + + public Seguradora SelectedSeguradora + { + get + { + return _selectedSeguradora; + } + set + { + _selectedSeguradora = value; + OnPropertyChanged("SelectedSeguradora"); + } + } + + public Seguradora AdicionarSeguradora + { + get + { + return _adicionarSeguradora; + } + set + { + _adicionarSeguradora = value; + OnPropertyChanged("AdicionarSeguradora"); + } + } + + public List<Seguradora> SeguradorasAdicionadas + { + get + { + return _seguradorasAdicionadas; + } + set + { + _seguradorasAdicionadas = value; + OnPropertyChanged("SeguradorasAdicionadas"); + } + } + + public ObservableCollection<Seguradora> Seguradoras + { + get + { + return _seguradoras; + } + set + { + _seguradoras = value; + OnPropertyChanged("Seguradoras"); + } + } + + public string Filtro + { + get + { + return _filtro; + } + set + { + _filtro = value; + OnPropertyChanged("Filtro"); + } + } + + public IncluirSeguradoraViewModel(List<Seguradora> seguradoras) + { + SeguradorasAdicionadas = seguradoras; + } + + public async void Pesquisar() + { + if (string.IsNullOrWhiteSpace(Filtro) || Filtro.Length < 3) + { + return; + } + string text = Uri.EscapeDataString(Filtro); + Seguradoras = new ObservableCollection<Seguradora>((await Connection.Get<List<Seguradora>>("Seguradoras/search?cia=" + text)).Where((Seguradora x) => SeguradorasAdicionadas.All((Seguradora y) => ((DomainBase)y).Id != ((DomainBase)x).Id))); + } +} |