summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/CoberturaViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/ViewModels/CoberturaViewModel.cs')
-rw-r--r--Gestor.Application/ViewModels/CoberturaViewModel.cs285
1 files changed, 0 insertions, 285 deletions
diff --git a/Gestor.Application/ViewModels/CoberturaViewModel.cs b/Gestor.Application/ViewModels/CoberturaViewModel.cs
deleted file mode 100644
index fb35f4d..0000000
--- a/Gestor.Application/ViewModels/CoberturaViewModel.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Seguros.Itens;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Common.Validation;
-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
-{
- public class CoberturaViewModel : BaseSegurosViewModel
- {
- private readonly ItemServico _itemServico;
-
- private Cobertura _selectedCobertura;
-
- private List<CoberturaPadrao> _coberturasPadrao;
-
- private ObservableCollection<Cobertura> _coberturas;
-
- private readonly IComparer<Cobertura> _comparerCobertura;
-
- public ObservableCollection<Cobertura> Coberturas
- {
- get
- {
- return this._coberturas;
- }
- set
- {
- this._coberturas = value;
- base.OnPropertyChanged("Coberturas");
- }
- }
-
- public List<CoberturaPadrao> CoberturasPadrao
- {
- get
- {
- return this._coberturasPadrao;
- }
- set
- {
- this._coberturasPadrao = value;
- base.OnPropertyChanged("CoberturasPadrao");
- }
- }
-
- public Gestor.Model.Domain.Seguros.Item Item
- {
- get;
- set;
- }
-
- public Gestor.Model.Domain.Seguros.Ramo Ramo
- {
- get;
- set;
- }
-
- public Cobertura SelectedCobertura
- {
- get
- {
- return this._selectedCobertura;
- }
- set
- {
- this._selectedCobertura = value;
- base.OnPropertyChanged("SelectedCobertura");
- }
- }
-
- public CoberturaViewModel(Gestor.Model.Domain.Seguros.Ramo ramo = null, Gestor.Model.Domain.Seguros.Item item = null)
- {
- //
- // Current member / type: System.Void Gestor.Application.ViewModels.CoberturaViewModel::.ctor(Gestor.Model.Domain.Seguros.Ramo,Gestor.Model.Domain.Seguros.Item)
- // File path: C:\AggerSeguros\Gestor.Application.exe
- //
- // Product version: 0.0.0.0
- // Exception in: System.Void .ctor(Gestor.Model.Domain.Seguros.Ramo,Gestor.Model.Domain.Seguros.Item)
- //
- // Object reference not set to an instance of an object.
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378
- // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331
- // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100
- // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72
- // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61
- // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 133
- //
- // mailto: JustDecompilePublicFeedback@telerik.com
-
- }
-
- public void AdicionaCobertura()
- {
- Cobertura cobertura = new Cobertura();
- cobertura.set_Item(this.Item);
- Cobertura cobertura1 = cobertura;
- ValidationHelper.AddSorted<Cobertura>(this.Coberturas, cobertura1, this._comparerCobertura);
- this.SelectedCobertura = cobertura1;
- }
-
- internal async Task<List<CoberturaPadrao>> BuscarCobertura(string value)
- {
- Func<CoberturaPadrao, bool> func2 = null;
- List<CoberturaPadrao> coberturaPadraos = await Task.Run<List<CoberturaPadrao>>(() => {
- List<CoberturaPadrao> coberturasPadrao = this.CoberturasPadrao;
- if (coberturasPadrao == null)
- {
- return null;
- }
- Func<CoberturaPadrao, bool> u003cu003e9_1 = func2;
- if (u003cu003e9_1 == null)
- {
- Func<CoberturaPadrao, bool> func = (CoberturaPadrao x) => ValidationHelper.RemoveDiacritics(x.get_Descricao().ToUpper().Trim()).Contains(value.ToUpper());
- Func<CoberturaPadrao, bool> func1 = func;
- func2 = func;
- u003cu003e9_1 = func1;
- }
- return coberturasPadrao.Where<CoberturaPadrao>(u003cu003e9_1).ToList<CoberturaPadrao>();
- });
- return coberturaPadraos;
- }
-
- public async Task CancelarAlteracao()
- {
- if (this.Item != null)
- {
- this.Coberturas = await this._itemServico.BuscarCoberturasPorItemAsync(this.Item.get_Id());
- }
- }
-
- public ObservableCollection<Cobertura> CarregaCoberturaPadrao()
- {
- List<Cobertura> list;
- List<CoberturaPadrao> coberturasPadrao = this.CoberturasPadrao;
- if (coberturasPadrao != null)
- {
- list = (
- from x in coberturasPadrao
- where x.get_Padrao()
- select x).Select<CoberturaPadrao, Cobertura>((CoberturaPadrao x) => {
- Cobertura cobertura = new Cobertura();
- cobertura.set_CoberturaPadrao(x);
- cobertura.set_Observacao(x.get_Descricao());
- return cobertura;
- }).ToList<Cobertura>();
- }
- else
- {
- list = null;
- }
- ObservableCollection<Cobertura> observableCollection = new ObservableCollection<Cobertura>(list);
- ObservableCollection<Cobertura> observableCollection1 = observableCollection;
- this.Coberturas = observableCollection;
- return observableCollection1;
- }
-
- public void CarregaPadrao()
- {
- List<Cobertura> list;
- List<CoberturaPadrao> coberturasPadrao = this.CoberturasPadrao;
- if (coberturasPadrao != null)
- {
- list = (
- from x in coberturasPadrao
- where x.get_Padrao()
- select x).Select<CoberturaPadrao, Cobertura>((CoberturaPadrao x) => {
- Cobertura cobertura = new Cobertura();
- cobertura.set_CoberturaPadrao(x);
- cobertura.set_Observacao(x.get_Descricao());
- return cobertura;
- }).ToList<Cobertura>();
- }
- else
- {
- list = null;
- }
- List<Cobertura> coberturas = list;
- if (coberturas == null)
- {
- return;
- }
- this.Coberturas = new ObservableCollection<Cobertura>(coberturas);
- }
-
- public async void ExcluirCobertura(Cobertura cobertura)
- {
- if (cobertura != null)
- {
- string[] newLine = new string[] { "DESEJA REALMENTE EXCLUIR A COBERTURA", Environment.NewLine, "\"", cobertura.get_Observacao(), "\"?" };
- if (await base.ShowMessage(string.Concat(newLine), "SIM", "NÃO", false))
- {
- this.Coberturas.Remove(cobertura);
- }
- }
- }
-
- public async Task<IList<Cobertura>> LimpaCoberturas()
- {
- bool flag;
- IList<Cobertura> list;
- if (this.Coberturas == null)
- {
- flag = false;
- }
- else
- {
- ObservableCollection<Cobertura> coberturas = this.Coberturas;
- flag = coberturas.Any<Cobertura>((Cobertura x) => {
- if (!(x.get_Franquia() == decimal.Zero) || !(x.get_Lmi() == decimal.Zero))
- {
- return false;
- }
- return x.get_Premio() == decimal.Zero;
- });
- }
- bool flag1 = flag;
- if (flag1)
- {
- flag1 = await base.ShowMessage("DESEJA LIMPAR AS COBERTURAS SEM VALOR DE FRANQUIA, LMI E PRÊMIO?", "SIM", "NÃO", false);
- }
- if (flag1)
- {
- ObservableCollection<Cobertura> observableCollection = this.Coberturas;
- if (observableCollection != null)
- {
- list = observableCollection.Where<Cobertura>((Cobertura x) => {
- if (string.IsNullOrEmpty(x.get_Observacao()))
- {
- return false;
- }
- if (x.get_Franquia() != decimal.Zero || x.get_Lmi() != decimal.Zero)
- {
- return true;
- }
- return x.get_Premio() != decimal.Zero;
- }).ToList<Cobertura>();
- }
- else
- {
- list = null;
- }
- }
- else
- {
- ObservableCollection<Cobertura> coberturas1 = this.Coberturas;
- if (coberturas1 != null)
- {
- list = coberturas1.ToList<Cobertura>();
- }
- else
- {
- list = null;
- }
- }
- return list;
- }
-
- public async Task SelectionaCoberturas()
- {
- if (this.Ramo != null)
- {
- this.CoberturasPadrao = (
- from x in Recursos.Coberturas
- where x.get_IdRamo() == this.Ramo.get_Id()
- select x).ToList<CoberturaPadrao>();
- if (this.Item != null)
- {
- this.Coberturas = await this._itemServico.BuscarCoberturasPorItemAsync(this.Item.get_Id());
- }
- }
- }
- }
-} \ No newline at end of file