diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Application/ViewModels/Ferramentas/IncluirRamoViewModel.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Codemerx/Gestor.Application/ViewModels/Ferramentas/IncluirRamoViewModel.cs')
| -rw-r--r-- | Codemerx/Gestor.Application/ViewModels/Ferramentas/IncluirRamoViewModel.cs | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Application/ViewModels/Ferramentas/IncluirRamoViewModel.cs b/Codemerx/Gestor.Application/ViewModels/Ferramentas/IncluirRamoViewModel.cs new file mode 100644 index 0000000..89f3758 --- /dev/null +++ b/Codemerx/Gestor.Application/ViewModels/Ferramentas/IncluirRamoViewModel.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 IncluirRamoViewModel : BaseSegurosViewModel
+ {
+ private Ramo _selectedRamo;
+
+ private Ramo _adicionarRamo;
+
+ private List<Ramo> _ramosAdicionadas;
+
+ private ObservableCollection<Ramo> _ramos;
+
+ private string _filtro;
+
+ public Ramo AdicionarRamo
+ {
+ get
+ {
+ return this._adicionarRamo;
+ }
+ set
+ {
+ this._adicionarRamo = value;
+ base.OnPropertyChanged("AdicionarRamo");
+ }
+ }
+
+ public string Filtro
+ {
+ get
+ {
+ return this._filtro;
+ }
+ set
+ {
+ this._filtro = value;
+ base.OnPropertyChanged("Filtro");
+ }
+ }
+
+ public ObservableCollection<Ramo> Ramos
+ {
+ get
+ {
+ return this._ramos;
+ }
+ set
+ {
+ this._ramos = value;
+ base.OnPropertyChanged("Ramos");
+ }
+ }
+
+ public List<Ramo> RamosAdicionadas
+ {
+ get
+ {
+ return this._ramosAdicionadas;
+ }
+ set
+ {
+ this._ramosAdicionadas = value;
+ base.OnPropertyChanged("RamosAdicionadas");
+ }
+ }
+
+ public Ramo SelectedRamo
+ {
+ get
+ {
+ return this._selectedRamo;
+ }
+ set
+ {
+ this._selectedRamo = value;
+ base.OnPropertyChanged("SelectedRamo");
+ }
+ }
+
+ public IncluirRamoViewModel(List<Ramo> ramos)
+ {
+ this.RamosAdicionadas = ramos;
+ }
+
+ public async void Pesquisar()
+ {
+ if (!string.IsNullOrWhiteSpace(this.Filtro) && this.Filtro.Length >= 3)
+ {
+ string str = Uri.EscapeDataString(this.Filtro);
+ List<Ramo> ramos = await Connection.Get<List<Ramo>>(string.Concat("Ramos/search?ramo=", str), true, false);
+ this.Ramos = new ObservableCollection<Ramo>(
+ from x in ramos
+ where this.RamosAdicionadas.All<Ramo>((Ramo y) => y.get_Id() != x.get_Id())
+ select x);
+ }
+ }
+ }
+}
\ No newline at end of file |