summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs')
-rw-r--r--Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs505
1 files changed, 505 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs
new file mode 100644
index 0000000..7adcea9
--- /dev/null
+++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs
@@ -0,0 +1,505 @@
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+namespace Gestor.Model.Domain.Seguros
+{
+ public class Item : DomainBase, IDomain, INotifyPropertyChanged
+ {
+ private bool _selecionado;
+
+ private string _descricao;
+
+ private string _status;
+
+ private string _statusInclusao;
+
+ private string _observacao;
+
+ private string _valorCredito;
+
+ private bool _config = true;
+
+ private bool _fabricanteBranco;
+
+ public Gestor.Model.Domain.Seguros.Aeronautico Aeronautico
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Auto Auto
+ {
+ get;
+ set;
+ }
+
+ public bool Cancelado
+ {
+ get;
+ set;
+ }
+
+ public IList<Cobertura> Coberturas
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Consorcio Consorcio
+ {
+ get;
+ set;
+ }
+
+ public string Descricao
+ {
+ get
+ {
+ string str = this._descricao;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._descricao = value;
+ }
+ }
+
+ public Gestor.Model.Domain.Seguros.Documento Documento
+ {
+ get;
+ set;
+ }
+
+ public long? Endosso
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Granizo Granizo
+ {
+ get;
+ set;
+ }
+
+ public long? IdDocumentoCancelado
+ {
+ get;
+ set;
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ string str = this._observacao;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._observacao = value;
+ }
+ }
+
+ public int? Ordem
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Patrimonial Patrimonial
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.RiscosDiversos RiscosDiversos
+ {
+ get;
+ set;
+ }
+
+ public bool Selecionado
+ {
+ get
+ {
+ return this._selecionado;
+ }
+ set
+ {
+ if (value == this._selecionado)
+ {
+ return;
+ }
+ this._selecionado = value;
+ this.OnPropertyChanged("Selecionado");
+ }
+ }
+
+ public bool Sinistrado
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Sinistro Sinistro
+ {
+ get;
+ set;
+ }
+
+ public IList<ControleSinistro> Sinistros
+ {
+ get;
+ set;
+ }
+
+ public string Status
+ {
+ get
+ {
+ string str = this._status;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._status = value;
+ }
+ }
+
+ public string StatusInclusao
+ {
+ get
+ {
+ string str = this._statusInclusao;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._statusInclusao = value;
+ }
+ }
+
+ public long? Substituicao
+ {
+ get;
+ set;
+ }
+
+ public long? Substituido
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.TipoEndosso? TipoEndosso
+ {
+ get;
+ set;
+ }
+
+ public IList<TitularesVida> Titulares
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Item item = this;
+ return new Func<List<KeyValuePair<string, string>>>(item.Validate);
+ }
+ }
+
+ public Gestor.Model.Domain.Seguros.Vida Vida
+ {
+ get;
+ set;
+ }
+
+ public Item()
+ {
+ }
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged;
+ if (propertyChangedEventHandler == null)
+ {
+ return;
+ }
+ propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate(bool config, bool fabricanteBranco = false)
+ {
+ this._config = config;
+ this._fabricanteBranco = fabricanteBranco;
+ return this.Validate();
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ int? ordem = this.Ordem;
+ if (ordem.HasValue)
+ {
+ ordem = this.Ordem;
+ if (!(ordem.GetValueOrDefault() == 0 & ordem.HasValue))
+ {
+ goto Label0;
+ }
+ }
+ keyValuePairs.AddValue<string, string>("Ordem", Messages.Invalido, true);
+ if (string.IsNullOrWhiteSpace(this.Descricao))
+ {
+ keyValuePairs.AddValue<string, string>("Descricao", Messages.Obrigatorio, true);
+ }
+ else if (this.Descricao.Length > 250)
+ {
+ keyValuePairs.AddValue<string, string>("Descricao", string.Format(Messages.MaiorQueLimite, 250), true);
+ }
+ if (this.Documento == null)
+ {
+ return keyValuePairs;
+ }
+ long id = this.Documento.Controle.Ramo.Id;
+ if (id > (long)38)
+ {
+ if (id == (long)47 || id == (long)53 || id == (long)66)
+ {
+ goto Label1;
+ }
+ goto Label2;
+ }
+ else
+ {
+ long num = id - (long)1;
+ if (num <= (long)19)
+ {
+ switch ((uint)num)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 14:
+ case 17:
+ {
+ goto Label4;
+ }
+ case 3:
+ case 7:
+ case 10:
+ case 11:
+ case 13:
+ case 15:
+ case 16:
+ case 18:
+ {
+ goto Label2;
+ }
+ case 4:
+ {
+ goto Label5;
+ }
+ case 5:
+ case 6:
+ case 8:
+ case 9:
+ {
+ goto Label1;
+ }
+ case 12:
+ {
+ if (this.Aeronautico != null)
+ {
+ keyValuePairs.AddRange(this.Aeronautico.Validate());
+ return keyValuePairs;
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("Aeronautico", Messages.Obrigatorio, true);
+ return keyValuePairs;
+ }
+ }
+ case 19:
+ {
+ if (this.Granizo != null)
+ {
+ keyValuePairs.AddRange(this.Granizo.Validate());
+ return keyValuePairs;
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("Granizo", Messages.Obrigatorio, true);
+ return keyValuePairs;
+ }
+ }
+ }
+ }
+ else
+ {
+ }
+ long num1 = id - (long)30;
+ if (num1 <= (long)8)
+ {
+ switch ((uint)num1)
+ {
+ case 0:
+ {
+ break;
+ }
+ case 1:
+ {
+ if (this.RiscosDiversos != null)
+ {
+ keyValuePairs.AddRange(this.RiscosDiversos.Validate());
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("RiscosDiversos", Messages.Obrigatorio, true);
+ }
+ if (this.Titulares == null || this.Titulares.Count <= 0)
+ {
+ return keyValuePairs;
+ }
+ using (IEnumerator<TitularesVida> enumerator = this.Titulares.GetEnumerator())
+ {
+ while (enumerator.MoveNext())
+ {
+ keyValuePairs.AddRange(enumerator.Current.Validate());
+ }
+ return keyValuePairs;
+ }
+ break;
+ }
+ case 6:
+ {
+ if (this.Consorcio != null)
+ {
+ keyValuePairs.AddRange(this.Consorcio.Validate());
+ return keyValuePairs;
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("Consorcio", Messages.Obrigatorio, true);
+ return keyValuePairs;
+ }
+ }
+ case 7:
+ {
+ goto Label5;
+ }
+ case 8:
+ {
+ if (this.Patrimonial != null)
+ {
+ keyValuePairs.AddRange(this.Patrimonial.ValidateGarantia());
+ return keyValuePairs;
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("Patrimonial", Messages.Obrigatorio, true);
+ return keyValuePairs;
+ }
+ }
+ default:
+ {
+ goto Label2;
+ }
+ }
+ }
+ else
+ {
+ goto Label2;
+ }
+ Label4:
+ if (this.Patrimonial != null)
+ {
+ keyValuePairs.AddRange(this.Patrimonial.Validate());
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("Patrimonial", Messages.Obrigatorio, true);
+ }
+ }
+ return keyValuePairs;
+ Label1:
+ if (this.Vida != null)
+ {
+ keyValuePairs.AddRange(this.Vida.Validate());
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("Vida", Messages.Obrigatorio, true);
+ }
+ if (this.Titulares != null && this.Titulares.Count > 0 && this.Documento.Controle.Ramo.Id != (long)6)
+ {
+ using (enumerator = this.Titulares.GetEnumerator())
+ {
+ while (enumerator.MoveNext())
+ {
+ keyValuePairs.AddRange(enumerator.Current.Validate());
+ }
+ return keyValuePairs;
+ }
+ }
+ else
+ {
+ return keyValuePairs;
+ }
+ Label2:
+ if (this.RiscosDiversos != null)
+ {
+ keyValuePairs.AddRange(this.RiscosDiversos.Validate());
+ return keyValuePairs;
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("RiscosDiversos", Messages.Obrigatorio, true);
+ return keyValuePairs;
+ }
+ Label5:
+ if (this.Auto != null)
+ {
+ keyValuePairs.AddRange(this.Auto.Validate(this._config, this._fabricanteBranco));
+ return keyValuePairs;
+ }
+ else
+ {
+ keyValuePairs.AddValue<string, string>("Auto", Messages.Obrigatorio, true);
+ return keyValuePairs;
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+} \ No newline at end of file