diff options
Diffstat (limited to 'Gestor.Application/ViewModels/Ferramentas/IncluirSeguradoraViewModel.cs')
| -rw-r--r-- | Gestor.Application/ViewModels/Ferramentas/IncluirSeguradoraViewModel.cs | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/Gestor.Application/ViewModels/Ferramentas/IncluirSeguradoraViewModel.cs b/Gestor.Application/ViewModels/Ferramentas/IncluirSeguradoraViewModel.cs new file mode 100644 index 0000000..ebeed40 --- /dev/null +++ b/Gestor.Application/ViewModels/Ferramentas/IncluirSeguradoraViewModel.cs @@ -0,0 +1,110 @@ +using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels.Generic;
+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.Ferramentas
+{
+ public class IncluirSeguradoraViewModel : BaseSegurosViewModel
+ {
+ private Seguradora _selectedSeguradora;
+
+ private Seguradora _adicionarSeguradora;
+
+ private List<Seguradora> _seguradorasAdicionadas;
+
+ private ObservableCollection<Seguradora> _seguradoras;
+
+ private string _filtro;
+
+ public Seguradora AdicionarSeguradora
+ {
+ get
+ {
+ return this._adicionarSeguradora;
+ }
+ set
+ {
+ this._adicionarSeguradora = value;
+ base.OnPropertyChanged("AdicionarSeguradora");
+ }
+ }
+
+ public string Filtro
+ {
+ get
+ {
+ return this._filtro;
+ }
+ set
+ {
+ this._filtro = value;
+ base.OnPropertyChanged("Filtro");
+ }
+ }
+
+ public ObservableCollection<Seguradora> Seguradoras
+ {
+ get
+ {
+ return this._seguradoras;
+ }
+ set
+ {
+ this._seguradoras = value;
+ base.OnPropertyChanged("Seguradoras");
+ }
+ }
+
+ public List<Seguradora> SeguradorasAdicionadas
+ {
+ get
+ {
+ return this._seguradorasAdicionadas;
+ }
+ set
+ {
+ this._seguradorasAdicionadas = value;
+ base.OnPropertyChanged("SeguradorasAdicionadas");
+ }
+ }
+
+ public Seguradora SelectedSeguradora
+ {
+ get
+ {
+ return this._selectedSeguradora;
+ }
+ set
+ {
+ this._selectedSeguradora = value;
+ base.OnPropertyChanged("SelectedSeguradora");
+ }
+ }
+
+ public IncluirSeguradoraViewModel(List<Seguradora> seguradoras)
+ {
+ this.SeguradorasAdicionadas = seguradoras;
+ }
+
+ public async void Pesquisar()
+ {
+ if (!string.IsNullOrWhiteSpace(this.Filtro) && this.Filtro.Length >= 3)
+ {
+ string str = Uri.EscapeDataString(this.Filtro);
+ List<Seguradora> seguradoras = await Connection.Get<List<Seguradora>>(string.Concat("Seguradoras/search?cia=", str), true, false);
+ this.Seguradoras = new ObservableCollection<Seguradora>(
+ from x in seguradoras
+ where this.SeguradorasAdicionadas.All<Seguradora>((Seguradora y) => y.get_Id() != x.get_Id())
+ select x);
+ }
+ }
+ }
+}
\ No newline at end of file |