summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 17:17:46 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 17:17:46 +0000
commit0440c722a221b8068bbf388c1c0c51f0faff0451 (patch)
tree169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Seguros
parent225aa1499e37faf9d38257caabbadc68d78b427e (diff)
downloadgestor-0440c722a221b8068bbf388c1c0c51f0faff0451.tar.gz
gestor-0440c722a221b8068bbf388c1c0c51f0faff0451.zip
some dllsHEADmaster
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros')
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Adiantamento.cs65
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Aeronautico.cs297
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/AggilizadorPermissao.cs10
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Auto.cs540
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs695
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEmail.cs58
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs123
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ClienteTelefone.cs56
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ClienteVinculo.cs31
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Cobertura.cs48
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs74
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaPadrao.cs41
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/CondicaoRepasse.cs24
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ConfigExtratoImport.cs26
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs132
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Controle.cs83
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ControleSinistro.cs84
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/CriticaApolice.cs70
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/DetalheExtrato.cs163
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs835
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Estipulante.cs282
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Expedicao.cs47
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Extrato.cs97
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Fabricante.cs40
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Granizo.cs162
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Item.cs340
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/MaisContato.cs245
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/MetaSeguradora.cs40
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/MetaVendedor.cs34
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Parceiro.cs406
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Parcela.cs389
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Parcelas.cs68
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Patrimonial.cs451
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs147
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/PerfilEmpresa.cs59
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoArquivoDigital.cs43
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoUsuario.cs26
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Produto.cs92
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs210
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ProspeccaoToPrint.cs81
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Qualificacao.cs95
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Ramo.cs120
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs112
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/ResponsavelAssinatura.cs56
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuario.cs38
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs39
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/RiscosDiversos.cs84
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Seguradora.cs1317
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraContato.cs60
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraEndereco.cs81
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Sinistro.cs421
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/SinistroAuto.cs199
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/SinistroVida.cs94
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Status.cs64
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/TipoVendedor.cs102
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/TitularesVida.cs197
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/TupleList.cs9
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Usuario.cs625
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Vendedor.cs245
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcela.cs142
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcelas.cs52
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs62
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/VendedorUsuario.cs30
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Vida.cs129
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/VinculoRepasse.cs74
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/VinculoVendedor.cs10
66 files changed, 11171 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Adiantamento.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Adiantamento.cs
new file mode 100644
index 0000000..74375c0
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Adiantamento.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Validation;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Adiantamento : DomainBase
+{
+ private string _historico;
+
+ public Vendedor Vendedor { get; set; }
+
+ public TipoPagamento? TipoPagamento { get; set; }
+
+ public string Historico
+ {
+ get
+ {
+ return _historico?.ToUpper();
+ }
+ set
+ {
+ _historico = value;
+ }
+ }
+
+ public DateTime? Data { get; set; }
+
+ public decimal Valor { get; set; }
+
+ public bool Pago { get; set; }
+
+ public DateTime? Pagamento { get; set; }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("HISTÓRICO", string.IsNullOrWhiteSpace(Historico) ? "" : Historico, ""),
+ new Tuple<string, string, string>("DATA DO ADIANTAMENTO", (!Data.HasValue) ? "" : Data?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("VALOR DO ADIANTAMENTO", Valor.ToString("c2"), "")
+ };
+ object item;
+ if (TipoPagamento.HasValue)
+ {
+ TipoPagamento? tipoPagamento = TipoPagamento;
+ item = (tipoPagamento.HasValue ? tipoPagamento.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ obj.Add(new Tuple<string, string, string>("TIPO DO PAGAMENTO", (string)item, ""));
+ obj.Add(new Tuple<string, string, string>("PAGO", Pago ? "SIM" : "NÃO", ""));
+ obj.Add(new Tuple<string, string, string>("DATA DO PAGAMENTO", (!Pagamento.HasValue) ? "" : Pagamento?.ToShortDateString(), ""));
+ tupleList.Tuples = obj;
+ list.Add(tupleList);
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Aeronautico.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Aeronautico.cs
new file mode 100644
index 0000000..d780cb4
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Aeronautico.cs
@@ -0,0 +1,297 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Aeronautico : DomainBase, IDomain
+{
+ private string _fabricante;
+
+ private string _modelo;
+
+ private string _serie;
+
+ private string _prefixo;
+
+ private string _marinaAero;
+
+ private string _certificado;
+
+ private string _casco;
+
+ private string _navegacao;
+
+ private string _observacao;
+
+ public Item Item { get; set; }
+
+ public TipoAeronautico Tipo { get; set; }
+
+ public string Fabricante
+ {
+ get
+ {
+ return _fabricante?.ToUpper();
+ }
+ set
+ {
+ _fabricante = value;
+ }
+ }
+
+ public string Modelo
+ {
+ get
+ {
+ return _modelo?.ToUpper();
+ }
+ set
+ {
+ _modelo = value;
+ }
+ }
+
+ public string Serie
+ {
+ get
+ {
+ return _serie?.ToUpper();
+ }
+ set
+ {
+ _serie = value;
+ }
+ }
+
+ public string Prefixo
+ {
+ get
+ {
+ return _prefixo?.ToUpper();
+ }
+ set
+ {
+ _prefixo = value;
+ }
+ }
+
+ public int? Fabricacao { get; set; }
+
+ public int? Tripulantes { get; set; }
+
+ public int? Passageiros { get; set; }
+
+ public string MarinaAero
+ {
+ get
+ {
+ return _marinaAero?.ToUpper();
+ }
+ set
+ {
+ _marinaAero = value;
+ }
+ }
+
+ public long? Peso { get; set; }
+
+ public string Certificado
+ {
+ get
+ {
+ return _certificado?.ToUpper();
+ }
+ set
+ {
+ _certificado = value;
+ }
+ }
+
+ public DateTime? Vistoria { get; set; }
+
+ public string Casco
+ {
+ get
+ {
+ return _casco?.ToUpper();
+ }
+ set
+ {
+ _casco = value;
+ }
+ }
+
+ public string Navegacao
+ {
+ get
+ {
+ return _navegacao?.ToUpper();
+ }
+ set
+ {
+ _navegacao = value;
+ }
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Fabricante))
+ {
+ list.AddValue("Fabricante", Messages.Obrigatorio);
+ }
+ else if (Fabricante != null && Fabricante.Length > 60)
+ {
+ list.AddValue("Fabricante", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (Tipo == (TipoAeronautico)0)
+ {
+ list.AddValue("Tipo", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Modelo))
+ {
+ list.AddValue("Modelo", Messages.Obrigatorio);
+ }
+ else if (Modelo.Length > 60)
+ {
+ list.AddValue("Modelo", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (Vistoria.HasValue && (DateTime.Compare(Vistoria.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Vistoria.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Vistoria", string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Serie))
+ {
+ list.AddValue("Serie", Messages.Obrigatorio);
+ }
+ else if (Serie.Length > 30)
+ {
+ list.AddValue("Serie", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (string.IsNullOrWhiteSpace(Prefixo))
+ {
+ list.AddValue("Prefixo", Messages.Obrigatorio);
+ }
+ else if (Prefixo.Length > 30)
+ {
+ list.AddValue("Prefixo", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (!Fabricacao.HasValue)
+ {
+ list.AddValue("Fabricacao", Messages.Obrigatorio);
+ }
+ else if (!Fabricacao.Value.ToString().ValidacaoFabricacao())
+ {
+ list.AddValue("Fabricacao", Messages.Invalido);
+ }
+ if (!Tripulantes.HasValue)
+ {
+ list.AddValue("Tripulantes", Messages.Obrigatorio);
+ }
+ if (!Passageiros.HasValue)
+ {
+ list.AddValue("Passageiros", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(MarinaAero))
+ {
+ list.AddValue("MarinaAero", Messages.Obrigatorio);
+ }
+ else if (MarinaAero.Length > 60)
+ {
+ list.AddValue("MarinaAero", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!string.IsNullOrWhiteSpace(Certificado) && Certificado.Length > 60)
+ {
+ list.AddValue("Certificado", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (string.IsNullOrWhiteSpace(Casco) && Tipo.Categoria() == "Aero")
+ {
+ list.AddValue("Casco", Messages.Obrigatorio);
+ }
+ else if (Tipo.Categoria() != "Aero" && Casco != null && Casco.Length > 60)
+ {
+ list.AddValue("Casco", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!string.IsNullOrWhiteSpace(Navegacao) && Tipo.Categoria() != "Aero" && Navegacao.Length > 60)
+ {
+ list.AddValue("Navegacao", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!Vistoria.HasValue && Tipo.Categoria() == "Aero")
+ {
+ list.AddValue("Vistoria", Messages.Obrigatorio);
+ }
+ if (!Peso.HasValue && Tipo.Categoria() == "Aero")
+ {
+ list.AddValue("Peso", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public static List<TupleList> Log(Item item)
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("TIPO DE AERONAVE", item.Aeronautico.Tipo.GetDescription(), ""),
+ new Tuple<string, string, string>("FABRICANTE", string.IsNullOrWhiteSpace(item.Aeronautico.Fabricante) ? "" : item.Aeronautico.Fabricante.ToUpper(), ""),
+ new Tuple<string, string, string>("MODELO", string.IsNullOrWhiteSpace(item.Aeronautico.Modelo) ? "" : item.Aeronautico.Modelo.ToUpper(), ""),
+ new Tuple<string, string, string>("REGISTRO", string.IsNullOrWhiteSpace(item.Aeronautico.Serie) ? "" : item.Aeronautico.Serie.ToUpper(), ""),
+ new Tuple<string, string, string>("PREFIXO", string.IsNullOrWhiteSpace(item.Aeronautico.Prefixo) ? "" : item.Aeronautico.Prefixo.ToUpper(), ""),
+ new Tuple<string, string, string>("ANO DE FABRICAÇÃO", (!item.Aeronautico.Fabricacao.HasValue) ? "" : item.Aeronautico.Fabricacao?.ToString(), ""),
+ new Tuple<string, string, string>("TRIPULANTES", (!item.Aeronautico.Tripulantes.HasValue) ? "" : item.Aeronautico.Tripulantes?.ToString(), ""),
+ new Tuple<string, string, string>("PASSAGEIROS", (!item.Aeronautico.Passageiros.HasValue) ? "" : item.Aeronautico.Passageiros?.ToString(), ""),
+ new Tuple<string, string, string>("AERÓDROMO", string.IsNullOrWhiteSpace(item.Aeronautico.MarinaAero) ? "" : item.Aeronautico.MarinaAero.ToUpper(), ""),
+ new Tuple<string, string, string>("PESO", (!item.Aeronautico.Peso.HasValue) ? "" : item.Aeronautico.Peso?.ToString(), ""),
+ new Tuple<string, string, string>("NAVEGAÇÃO", string.IsNullOrWhiteSpace(item.Aeronautico.Navegacao) ? "" : item.Aeronautico.Navegacao.ToUpper(), ""),
+ new Tuple<string, string, string>("CERTIFICADO", string.IsNullOrWhiteSpace(item.Aeronautico.Certificado) ? "" : item.Aeronautico.Certificado.ToUpper(), ""),
+ new Tuple<string, string, string>("MATERIAL DO CASCO", string.IsNullOrWhiteSpace(item.Aeronautico.Casco) ? "" : item.Aeronautico.Casco.ToUpper(), ""),
+ new Tuple<string, string, string>("VALIDADE DA VISTORIA", (!item.Aeronautico.Vistoria.HasValue) ? "" : item.Aeronautico.Vistoria?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("OBSERVAÇÃO", string.IsNullOrWhiteSpace(item.Aeronautico.Observacao) ? "" : item.Aeronautico.Observacao.ToUpper(), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/AggilizadorPermissao.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/AggilizadorPermissao.cs
new file mode 100644
index 0000000..f74d977
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/AggilizadorPermissao.cs
@@ -0,0 +1,10 @@
+using Gestor.Model.Common;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class AggilizadorPermissao
+{
+ public PermissaoAggilizador Aggilizador { get; set; }
+
+ public bool Permissao { get; set; }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Auto.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Auto.cs
new file mode 100644
index 0000000..ca973a4
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Auto.cs
@@ -0,0 +1,540 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using System.Text.RegularExpressions;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Auto : DomainBase, IDomain
+{
+ private string _fipe;
+
+ private string _chassi;
+
+ private string _placa;
+
+ private string _modelo;
+
+ private string _anoFabricacao;
+
+ private string _anoModelo;
+
+ private string _renavam;
+
+ private string _capacidade;
+
+ private string _portas;
+
+ private string _observacao;
+
+ private string _regiaoCirculacao;
+
+ private string _ci;
+
+ private string _cepPernoite;
+
+ private Categoria? _categoria;
+
+ private bool _fabricanteBranco = true;
+
+ private bool _chassiInvalido;
+
+ public Item Item { get; set; }
+
+ public Fabricante Fabricante { get; set; }
+
+ public Combustivel? Combustivel { get; set; }
+
+ public string Fipe
+ {
+ get
+ {
+ if (_fipe == null || !Regex.IsMatch(_fipe, "[0-9]+"))
+ {
+ return "";
+ }
+ return _fipe.Trim();
+ }
+ set
+ {
+ _fipe = value;
+ }
+ }
+
+ public string Modelo
+ {
+ get
+ {
+ return _modelo?.ToUpper();
+ }
+ set
+ {
+ _modelo = value;
+ }
+ }
+
+ public Categoria? Categoria
+ {
+ get
+ {
+ return _categoria;
+ }
+ set
+ {
+ _categoria = value;
+ if (value.GetValueOrDefault() == Gestor.Model.Common.Categoria.Motocicleta)
+ {
+ Portas = "0";
+ }
+ }
+ }
+
+ public string Chassi
+ {
+ get
+ {
+ return _chassi?.ToUpper().Trim();
+ }
+ set
+ {
+ _chassi = value;
+ }
+ }
+
+ public string Placa
+ {
+ get
+ {
+ return _placa?.ToUpper().Trim();
+ }
+ set
+ {
+ _placa = value;
+ }
+ }
+
+ public string AnoFabricacao
+ {
+ get
+ {
+ return _anoFabricacao?.ToUpper().Trim();
+ }
+ set
+ {
+ _anoFabricacao = value;
+ }
+ }
+
+ public string AnoModelo
+ {
+ get
+ {
+ return _anoModelo?.ToUpper().Trim();
+ }
+ set
+ {
+ _anoModelo = value;
+ }
+ }
+
+ public string Renavam
+ {
+ get
+ {
+ return _renavam?.ToUpper().Trim();
+ }
+ set
+ {
+ _renavam = value;
+ }
+ }
+
+ public string Capacidade
+ {
+ get
+ {
+ return _capacidade?.ToUpper().Trim();
+ }
+ set
+ {
+ _capacidade = value;
+ }
+ }
+
+ public string Portas
+ {
+ get
+ {
+ return _portas?.ToUpper().Trim();
+ }
+ set
+ {
+ _portas = value;
+ }
+ }
+
+ public Cor? Cor { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public string RegiaoCirculacao
+ {
+ get
+ {
+ if (_regiaoCirculacao == null || !Regex.IsMatch(_regiaoCirculacao, "[0-9]+"))
+ {
+ return "";
+ }
+ return _regiaoCirculacao.FormataCep().Trim();
+ }
+ set
+ {
+ _regiaoCirculacao = value;
+ }
+ }
+
+ public UsoVeiculo? UsoVeiculo { get; set; }
+
+ public TipoCobertura? TipoCobertura { get; set; }
+
+ public TabelaReferencia? TabelaReferencia { get; set; }
+
+ public int? Bonus { get; set; }
+
+ public decimal PorcentagemReferencia { get; set; }
+
+ public Correcao? Correcao { get; set; }
+
+ public decimal ValorDeterminado { get; set; }
+
+ public bool? Blindagem { get; set; }
+
+ public string Ci
+ {
+ get
+ {
+ return _ci?.ToUpper();
+ }
+ set
+ {
+ _ci = value;
+ }
+ }
+
+ public string CepPernoite
+ {
+ get
+ {
+ if (_cepPernoite == null || !Regex.IsMatch(_cepPernoite, "[0-9]+"))
+ {
+ return string.Empty;
+ }
+ return _cepPernoite.FormataCep().Trim();
+ }
+ set
+ {
+ _cepPernoite = value;
+ }
+ }
+
+ public bool? ZeroKm { get; set; }
+
+ public bool? Financiado { get; set; }
+
+ public bool? Pcd { get; set; }
+
+ public Isencao? Isencao { get; set; }
+
+ public bool Excluido { get; set; }
+
+ public Rastreador Rastreador { get; set; }
+
+ public bool? KitGas { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate(bool chassiInvalido, bool fabricanteBranco)
+ {
+ _chassiInvalido = chassiInvalido;
+ _fabricanteBranco = fabricanteBranco;
+ return Validate();
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Chassi))
+ {
+ list.AddValue("Chassi", Messages.Obrigatorio);
+ }
+ else if (!_chassiInvalido && !Chassi.ValidacaoChassi())
+ {
+ list.AddValue("Chassi", Messages.Invalido);
+ }
+ if (!_fabricanteBranco && (Fabricante == null || Fabricante.Id == 0))
+ {
+ list.AddValue("Fabricante", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Modelo))
+ {
+ list.AddValue("Modelo", Messages.Obrigatorio);
+ }
+ else if (Modelo.Length > 250)
+ {
+ list.AddValue("Modelo", string.Format(Messages.MaiorQueLimite, 250));
+ }
+ if (!Categoria.HasValue)
+ {
+ list.AddValue("Categoria", Messages.Obrigatorio);
+ }
+ if (!Combustivel.HasValue)
+ {
+ list.AddValue("Combustivel|COMBUSTÍVEL", Messages.Obrigatorio);
+ }
+ if (!ZeroKm.HasValue)
+ {
+ list.AddValue("ZeroKm|ZERO KM", Messages.Obrigatorio);
+ }
+ if (ZeroKm.HasValue && !ZeroKm.Value && string.IsNullOrWhiteSpace(Placa))
+ {
+ list.AddValue("Placa", Messages.Obrigatorio);
+ }
+ else if (ZeroKm.HasValue && !ZeroKm.Value && !Placa.ValidacaoPlaca())
+ {
+ list.AddValue("Placa", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(AnoFabricacao))
+ {
+ list.AddValue("AnoFabricacao|ANO DE FABRICAÇÃO", Messages.Obrigatorio);
+ }
+ else if (!AnoFabricacao.ValidacaoFabricacao())
+ {
+ list.AddValue("AnoFabricacao|ANO DE FABRICAÇÃO", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(AnoModelo))
+ {
+ list.AddValue("AnoModelo|ANO DO MODELO", Messages.Obrigatorio);
+ }
+ else if (!AnoModelo.ValidacaoModelo())
+ {
+ list.AddValue("AnoModelo|ANO DO MODELO", Messages.Invalido);
+ }
+ int result;
+ if (string.IsNullOrWhiteSpace(Portas))
+ {
+ if (Categoria.GetValueOrDefault() == Gestor.Model.Common.Categoria.Motocicleta)
+ {
+ Portas = "0";
+ }
+ else
+ {
+ list.AddValue("Portas", Messages.Obrigatorio);
+ }
+ }
+ else if (!int.TryParse(Portas, out result))
+ {
+ list.AddValue("Portas", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(Capacidade))
+ {
+ list.AddValue("Capacidade", Messages.Obrigatorio);
+ }
+ else if (!int.TryParse(Capacidade, out result))
+ {
+ list.AddValue("Capacidade", Messages.Invalido);
+ }
+ if (!Financiado.HasValue)
+ {
+ list.AddValue("Financiado", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Ci) && Ci.Length > 20)
+ {
+ list.AddValue("Ci|C.I.", string.Format(Messages.MaiorQueLimite, 20));
+ }
+ if (string.IsNullOrWhiteSpace(Fipe))
+ {
+ list.AddValue("Fipe|CÓDIGO FIPE", Messages.Obrigatorio);
+ }
+ else if (!Fipe.ValidaFipe())
+ {
+ list.AddValue("Fipe|CÓDIGO FIPE", Messages.Invalido);
+ }
+ if (int.TryParse(Capacidade, out var result2) && result2 > 99)
+ {
+ list.AddValue("Capacidade", Messages.Invalido);
+ }
+ if (!UsoVeiculo.HasValue)
+ {
+ list.AddValue("UsoVeiculo", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrEmpty(Renavam) && Renavam.Replace(".", "").Length > 11)
+ {
+ list.AddValue("Renavam", Messages.Invalido);
+ }
+ return list;
+ }
+
+ public static List<TupleList> Log(Item item)
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("CÓDIGO FIPE", string.IsNullOrWhiteSpace(item.Auto.Fipe) ? "" : item.Auto.Fipe.ToUpper(), ""),
+ new Tuple<string, string, string>("CHASSI", string.IsNullOrWhiteSpace(item.Auto.Chassi) ? "" : item.Auto.Chassi.ToUpper(), ""),
+ new Tuple<string, string, string>("PLACA", string.IsNullOrWhiteSpace(item.Auto.Placa) ? "" : item.Auto.Placa.ToUpper(), ""),
+ new Tuple<string, string, string>("FABRICANTE", (item.Auto.Fabricante == null) ? "" : item.Auto.Fabricante.Descricao.ToUpper(), ""),
+ new Tuple<string, string, string>("MODELO", string.IsNullOrWhiteSpace(item.Auto.Modelo) ? "" : item.Auto.Modelo.ToUpper(), "")
+ };
+ object item2;
+ if (item.Auto.UsoVeiculo.HasValue)
+ {
+ Auto auto = item.Auto;
+ if (auto == null)
+ {
+ item2 = null;
+ }
+ else
+ {
+ UsoVeiculo? usoVeiculo = auto.UsoVeiculo;
+ item2 = (usoVeiculo.HasValue ? usoVeiculo.GetValueOrDefault().GetDescription() : null);
+ }
+ }
+ else
+ {
+ item2 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("USO VEICULO", (string)item2, ""));
+ object item3;
+ if (item.Auto.Categoria.HasValue)
+ {
+ Categoria? categoria = item.Auto.Categoria;
+ item3 = (categoria.HasValue ? categoria.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item3 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("CATEGORIA", (string)item3, ""));
+ object item4;
+ if (item.Auto.Combustivel.HasValue)
+ {
+ Combustivel? combustivel = item.Auto.Combustivel;
+ item4 = (combustivel.HasValue ? combustivel.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item4 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("COMBUSTÍVEL", (string)item4, ""));
+ object item5;
+ if (item.Auto.Cor.HasValue)
+ {
+ Cor? cor = item.Auto.Cor;
+ item5 = (cor.HasValue ? cor.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item5 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("COR", (string)item5, ""));
+ obj.Add(new Tuple<string, string, string>("RENAVAM", string.IsNullOrWhiteSpace(item.Auto.Renavam) ? "" : item.Auto.Renavam.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("ZERO KM", (!item.Auto.ZeroKm.HasValue) ? "" : (item.Auto.ZeroKm.Value ? "SIM" : "NÃO"), ""));
+ obj.Add(new Tuple<string, string, string>("ANO DE FABRICAÇÃO", string.IsNullOrWhiteSpace(item.Auto.AnoFabricacao) ? "" : item.Auto.AnoFabricacao.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("ANO DO MODELO", string.IsNullOrWhiteSpace(item.Auto.AnoModelo) ? "" : item.Auto.AnoModelo.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("PORTAS", string.IsNullOrWhiteSpace(item.Auto.Portas) ? "" : item.Auto.Portas, ""));
+ obj.Add(new Tuple<string, string, string>("CAPACIDADE", string.IsNullOrWhiteSpace(item.Auto.Capacidade) ? "" : item.Auto.Capacidade, ""));
+ obj.Add(new Tuple<string, string, string>("CEP DE CIRCULAÇÃO", string.IsNullOrWhiteSpace(item.Auto.RegiaoCirculacao) ? "" : item.Auto.RegiaoCirculacao.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("CEP PERNOITE", string.IsNullOrWhiteSpace(item.Auto.CepPernoite) ? "" : item.Auto.CepPernoite.ToUpper(), ""));
+ object item6;
+ if (item.Auto.Correcao.HasValue)
+ {
+ Correcao? correcao = item.Auto.Correcao;
+ item6 = (correcao.HasValue ? correcao.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item6 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("CORREÇÃO", (string)item6, ""));
+ object item7;
+ if (item.Auto.TabelaReferencia.HasValue)
+ {
+ TabelaReferencia? tabelaReferencia = item.Auto.TabelaReferencia;
+ item7 = (tabelaReferencia.HasValue ? tabelaReferencia.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item7 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("REFERÊNCIA", (string)item7, ""));
+ obj.Add(new Tuple<string, string, string>("PORCENTAGEM DE REFERÊNCIA", item.Auto.PorcentagemReferencia.ToString(new CultureInfo("pt-BR")), ""));
+ obj.Add(new Tuple<string, string, string>("C.I.", string.IsNullOrWhiteSpace(item.Auto.Ci) ? "" : item.Auto.Ci.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("FINANCEIRO/ALIENADO", (!item.Auto.Financiado.HasValue) ? "" : (item.Auto.Financiado.Value ? "SIM" : "NÃO"), ""));
+ obj.Add(new Tuple<string, string, string>("PCD", (!item.Auto.Pcd.HasValue) ? "" : (item.Auto.Pcd.Value ? "SIM" : "NÃO"), ""));
+ obj.Add(new Tuple<string, string, string>("BLINDAGEM", (!item.Auto.Blindagem.HasValue) ? "" : (item.Auto.Blindagem.Value ? "SIM" : "NÃO"), ""));
+ object item8;
+ if (item.Auto.Isencao.HasValue)
+ {
+ Isencao? isencao = item.Auto.Isencao;
+ item8 = (isencao.HasValue ? isencao.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item8 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("ISENÇÃO", (string)item8, ""));
+ obj.Add(new Tuple<string, string, string>("BÔNUS", (!item.Auto.Bonus.HasValue) ? "" : item.Auto.Bonus.Value.ToString(), ""));
+ object item9;
+ if (item.Auto.TipoCobertura.HasValue)
+ {
+ TipoCobertura? tipoCobertura = item.Auto.TipoCobertura;
+ item9 = (tipoCobertura.HasValue ? tipoCobertura.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item9 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("TIPO DE COBERTURA", (string)item9, ""));
+ obj.Add(new Tuple<string, string, string>("KIT GÁS", (!item.Auto.Pcd.HasValue) ? "" : (item.Auto.KitGas.Value ? "SIM" : "NÃO"), ""));
+ obj.Add(new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(item.Auto.Observacao) ? "" : item.Auto.Observacao.ToUpper(), ""));
+ tupleList.Tuples = obj;
+ list.Add(tupleList);
+ List<TupleList> list2 = list;
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ list2.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list2;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs
new file mode 100644
index 0000000..04a5fe4
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs
@@ -0,0 +1,695 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Globalization;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Cliente : DomainBase, IDomain
+{
+ private string _nome;
+
+ private string _documento;
+
+ private string _identidade;
+
+ private string _emissor;
+
+ private string _estadoEmissor;
+
+ private string _habilitacao;
+
+ private string _categoriaHabilitacao;
+
+ private string _pasta;
+
+ private string _cei;
+
+ private string _rne;
+
+ private string _agencia;
+
+ private string _tipoConta;
+
+ private string _conta;
+
+ private string _caepf;
+
+ private bool? _malaDireta = true;
+
+ private string _nomeSocialRg;
+
+ public long IdEmpresa { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ NomeSocial = $"{value?.ToUpper()} - {base.Id}";
+ }
+ }
+
+ public string NomeSocial { get; set; }
+
+ [Log(true)]
+ public DateTime? Nascimento { get; set; }
+
+ [Log(true)]
+ public Sexo? Sexo { get; set; }
+
+ [Log(true)]
+ [Description("ESTADO CIVIL")]
+ public EstadoCivil? EstadoCivil { get; set; }
+
+ [Log(true)]
+ [Description("DOCUMENTO PRINCIPAL")]
+ public TipoDocumento? DocumentoPrincipal { get; set; }
+
+ [Log(true)]
+ public string Documento
+ {
+ get
+ {
+ return _documento?.ToUpper().Trim();
+ }
+ set
+ {
+ _documento = value;
+ }
+ }
+
+ [Log(true)]
+ public string Identidade
+ {
+ get
+ {
+ return _identidade?.ToUpper().Trim();
+ }
+ set
+ {
+ _identidade = value;
+ }
+ }
+
+ [Log(true)]
+ public string Emissor
+ {
+ get
+ {
+ return _emissor?.ToUpper().Trim();
+ }
+ set
+ {
+ _emissor = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("ESTADO EMISSOR")]
+ public string EstadoEmissor
+ {
+ get
+ {
+ return _estadoEmissor?.ToUpper().Trim();
+ }
+ set
+ {
+ _estadoEmissor = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("EXPEDIÇÃO")]
+ public DateTime? Expedicao { get; set; }
+
+ [Log(true)]
+ [Description("HABILITAÇÃO")]
+ public string Habilitacao
+ {
+ get
+ {
+ return _habilitacao?.ToUpper().Trim();
+ }
+ set
+ {
+ _habilitacao = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("PRIMEIRA HABILITAÇÃO")]
+ public DateTime? PrimeiraHabilitacao { get; set; }
+
+ [Log(true)]
+ [Description("VENCIMENTO HABILITAÇÃO")]
+ public DateTime? VencimentoHabilitacao { get; set; }
+
+ [Log(true)]
+ [Description("CATEGORIA HABILITAÇÃO")]
+ public string CategoriaHabilitacao
+ {
+ get
+ {
+ return _categoriaHabilitacao?.ToUpper().Trim();
+ }
+ set
+ {
+ _categoriaHabilitacao = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("CLIENTE DESDE")]
+ public DateTime? ClienteDesde { get; set; }
+
+ [Log(true)]
+ public string Pasta
+ {
+ get
+ {
+ return _pasta?.ToUpper();
+ }
+ set
+ {
+ _pasta = value;
+ }
+ }
+
+ [Log(true)]
+ public string Cei
+ {
+ get
+ {
+ return _cei?.ToUpper().Trim();
+ }
+ set
+ {
+ _cei = value;
+ }
+ }
+
+ [Log(true)]
+ public string Rne
+ {
+ get
+ {
+ return _rne?.ToUpper().Trim();
+ }
+ set
+ {
+ _rne = value;
+ }
+ }
+
+ [Log(true)]
+ public string Caepf
+ {
+ get
+ {
+ return _caepf?.ToUpper().Trim();
+ }
+ set
+ {
+ _caepf = value;
+ }
+ }
+
+ public Atividade Atividade { get; set; }
+
+ [Description("PROFISSÃO")]
+ public Profissao Profissao { get; set; }
+
+ public Banco Banco { get; set; }
+
+ [Log(true)]
+ [Description("AGÊNCIA")]
+ public string Agencia
+ {
+ get
+ {
+ return _agencia?.ToUpper().Trim();
+ }
+ set
+ {
+ _agencia = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TIPO CONTA")]
+ public string TipoConta
+ {
+ get
+ {
+ return _tipoConta?.ToUpper();
+ }
+ set
+ {
+ _tipoConta = value;
+ }
+ }
+
+ [Log(true)]
+ public string Conta
+ {
+ get
+ {
+ return _conta?.ToUpper().Trim();
+ }
+ set
+ {
+ _conta = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("RENDA MENSAL")]
+ public decimal RendaMensal { get; set; }
+
+ [Log(true)]
+ public bool Falecido { get; set; }
+
+ public ObservableCollection<ClienteTelefone> Telefones { get; set; }
+
+ public ObservableCollection<ClienteEmail> Emails { get; set; }
+
+ public ObservableCollection<ClienteEndereco> Enderecos { get; set; }
+
+ public ObservableCollection<MaisContato> Contatos { get; set; }
+
+ public ObservableCollection<ClienteVinculo> Vinculos { get; set; }
+
+ public List<OrigemCliente> Origens { get; set; }
+
+ [Log(true)]
+ [Description("OBSERVAÇÃO")]
+ public string Observacao { get; set; }
+
+ [Log(true)]
+ public bool Excluido { get; set; }
+
+ [Log(true)]
+ public string Status { get; set; }
+
+ [Log(true)]
+ public ResponsavelAssinatura ResponsavelAssinatura { get; set; }
+
+ [Log(true)]
+ [Description("DESEJA RECEBER MALA DIRETA")]
+ public bool? MalaDireta
+ {
+ get
+ {
+ return _malaDireta.GetValueOrDefault(true);
+ }
+ set
+ {
+ _malaDireta = value.GetValueOrDefault(true);
+ }
+ }
+
+ public string NomeSocialRg
+ {
+ get
+ {
+ return _nomeSocialRg?.ToUpper();
+ }
+ set
+ {
+ _nomeSocialRg = value;
+ }
+ }
+
+ public bool EstaNaCentralSegurado { get; set; }
+
+ public bool PessoaFisica => Documento.Clear().Length < 12;
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ int? num = Nome?.Trim().Split(new char[1] { ' ' }).Length;
+ if (!num.HasValue)
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (num <= 1)
+ {
+ list.AddValue("Nome", Messages.NomeInvalido);
+ }
+ if (!DocumentoPrincipal.HasValue)
+ {
+ list.AddValue("DocumentoPrincipal|DOCUMENTO PRINCIPAL", string.Format(Messages.Obrigatorio));
+ }
+ if (ClienteDesde.HasValue && (DateTime.Compare(ClienteDesde.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(ClienteDesde.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("ClienteDesde|CLIENTE DESDE", string.Format(Messages.DataInvalida));
+ }
+ DateTime date = Funcoes.GetNetworkTime().Date;
+ if (Nascimento.HasValue && Nascimento > date)
+ {
+ list.AddValue("Nascimento|" + ((Documento.OnlyNumber().Length > 11) ? "FUNDAÇÃO" : "NASCIMENTO"), Messages.Invalido);
+ }
+ if (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Nascimento|" + ((Documento.OnlyNumber().Length > 11) ? "FUNDAÇÃO" : "NASCIMENTO"), string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Documento))
+ {
+ list.AddValue("Documento", Messages.Obrigatorio);
+ }
+ else if (!Documento.ValidacaoDocumento())
+ {
+ list.AddValue("Documento", Messages.Invalido);
+ }
+ switch (DocumentoPrincipal)
+ {
+ case TipoDocumento.Rne:
+ if (string.IsNullOrWhiteSpace(Rne))
+ {
+ list.AddValue("Rne", Messages.Obrigatorio);
+ }
+ else if (!Rne.ValidacaoRne())
+ {
+ list.AddValue("Rne", Messages.Invalido);
+ }
+ break;
+ case TipoDocumento.Cei:
+ if (string.IsNullOrWhiteSpace(Cei))
+ {
+ list.AddValue("Cei", Messages.Obrigatorio);
+ }
+ else if (!Cei.ValidacaoCei())
+ {
+ list.AddValue("Cei", Messages.Invalido);
+ }
+ break;
+ case TipoDocumento.Caepf:
+ if (string.IsNullOrWhiteSpace(Caepf))
+ {
+ list.AddValue("Caepf", Messages.Obrigatorio);
+ }
+ else if (!Caepf.ValidateCaepf())
+ {
+ list.AddValue("Caepf", Messages.Invalido);
+ }
+ break;
+ }
+ if (Documento == null || Documento.OnlyNumber().Length <= 11)
+ {
+ if (PrimeiraHabilitacao.HasValue && PrimeiraHabilitacao > date)
+ {
+ list.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", Messages.Invalido);
+ }
+ if (PrimeiraHabilitacao.HasValue && (DateTime.Compare(PrimeiraHabilitacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(PrimeiraHabilitacao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", string.Format(Messages.DataInvalida));
+ }
+ if (VencimentoHabilitacao.HasValue && VencimentoHabilitacao <= PrimeiraHabilitacao)
+ {
+ list.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", Messages.Invalido);
+ }
+ if (VencimentoHabilitacao.HasValue && (DateTime.Compare(VencimentoHabilitacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(VencimentoHabilitacao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", string.Format(Messages.DataInvalida));
+ }
+ if (Expedicao.HasValue && (DateTime.Compare(Expedicao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Expedicao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Expedicao|EXPEDIÇÃO", string.Format(Messages.DataInvalida));
+ }
+ if (Expedicao.HasValue && Expedicao > date)
+ {
+ list.AddValue("Expedicao|EXPEDIÇÃO", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Identidade) && Identidade.Length > 14)
+ {
+ list.AddValue("Identidade", string.Format(Messages.MaiorQueLimite, 14));
+ }
+ if (!string.IsNullOrWhiteSpace(Habilitacao) && Habilitacao.Length > 15)
+ {
+ list.AddValue("Habilitacao|HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 15));
+ }
+ if (!string.IsNullOrWhiteSpace(CategoriaHabilitacao) && CategoriaHabilitacao.Length > 10)
+ {
+ list.AddValue("CategoriaHabilitacao|CATEGORIA HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 10));
+ }
+ if (!string.IsNullOrWhiteSpace(Emissor) && !Emissor.ValidacaoOrgao())
+ {
+ list.AddValue("Emissor|EMISSOR", string.Format(Messages.MaiorQueLimite, 6));
+ }
+ if (!string.IsNullOrWhiteSpace(EstadoEmissor) && !EstadoEmissor.ValidacaoEstado())
+ {
+ list.AddValue("EstadoEmissor|ESTADO EMISSOR", Messages.Invalido);
+ }
+ }
+ if (!string.IsNullOrWhiteSpace(Pasta) && Pasta.Length > 8)
+ {
+ list.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 8));
+ }
+ if (!string.IsNullOrWhiteSpace(Agencia) && Agencia.Length > 8)
+ {
+ list.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 8));
+ }
+ if (!string.IsNullOrWhiteSpace(TipoConta) && TipoConta.Length > 20)
+ {
+ list.AddValue("TipoConta|TIPO CONTA", string.Format(Messages.MaiorQueLimite, 20));
+ }
+ if (!string.IsNullOrWhiteSpace(Conta) && Conta.Length > 12)
+ {
+ list.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 12));
+ }
+ if (ResponsavelAssinatura != null)
+ {
+ list.AddRange(ResponsavelAssinatura.Validate());
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>();
+ object item;
+ if (DocumentoPrincipal.HasValue)
+ {
+ TipoDocumento? documentoPrincipal = DocumentoPrincipal;
+ item = (documentoPrincipal.HasValue ? documentoPrincipal.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ observableCollection.Add(new Tuple<string, string, string>("TIPO DO DOCUMENTO PRINCIPAL", (string)item, ""));
+ observableCollection.Add(new Tuple<string, string, string>("DOCUMENTO PRINCIPAL", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""));
+ observableCollection.Add(new Tuple<string, string, string>("CLIENTE", string.IsNullOrWhiteSpace(Nome) ? "" : Nome.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>((Documento.OnlyNumber().Length > 11) ? "FUNDAÇÃO" : "NASCIMENTO", (!Nascimento.HasValue) ? "" : Nascimento?.ToShortDateString(), ""));
+ tupleList.Tuples = observableCollection;
+ list.Add(tupleList);
+ List<TupleList> list2 = list;
+ if (Documento != null && Documento.OnlyNumber().Length > 11)
+ {
+ list2[0].Tuples.Add(new Tuple<string, string, string>("RAMO DE ATIVIDADE", string.IsNullOrWhiteSpace(Atividade.Nome) ? "" : Atividade.Nome, ""));
+ }
+ else
+ {
+ list2[0].Tuples.Add(new Tuple<string, string, string>("IDENTIDADE", string.IsNullOrWhiteSpace(Identidade) ? "" : Identidade, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("ÓRGÃO EMISSOR", string.IsNullOrWhiteSpace(Emissor) ? "" : Emissor.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("ESTADO EMISSOR", string.IsNullOrWhiteSpace(EstadoEmissor) ? "" : EstadoEmissor.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("DATA DE EXPEDIÇÃO", (!Expedicao.HasValue) ? "" : Expedicao?.ToShortDateString(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("HABILITAÇÃO", string.IsNullOrWhiteSpace(Habilitacao) ? "" : Habilitacao.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("CATEGORIA", string.IsNullOrWhiteSpace(CategoriaHabilitacao) ? "" : CategoriaHabilitacao.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("PRIMEIRA HABILITAÇÃO", (!PrimeiraHabilitacao.HasValue) ? "" : PrimeiraHabilitacao?.ToShortDateString(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("VENCIMENTO DA HABILITAÇÃO", (!VencimentoHabilitacao.HasValue) ? "" : VencimentoHabilitacao?.ToShortDateString(), ""));
+ ObservableCollection<Tuple<string, string, string>> tuples = list2[0].Tuples;
+ object item2;
+ if (Sexo.HasValue)
+ {
+ Sexo? sexo = Sexo;
+ item2 = (sexo.HasValue ? sexo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item2 = "";
+ }
+ tuples.Add(new Tuple<string, string, string>("SEXO", (string)item2, ""));
+ ObservableCollection<Tuple<string, string, string>> tuples2 = list2[0].Tuples;
+ object item3;
+ if (EstadoCivil.HasValue)
+ {
+ EstadoCivil? estadoCivil = EstadoCivil;
+ item3 = (estadoCivil.HasValue ? estadoCivil.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item3 = "";
+ }
+ tuples2.Add(new Tuple<string, string, string>("ESTADO CIVIL", (string)item3, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("PROFISSÃO DO CLIENTE", (Profissao == null) ? "" : Profissao.Nome.ToUpper(), ""));
+ }
+ list2[0].Tuples.Add(new Tuple<string, string, string>("CLIENTE DESDE", (!ClienteDesde.HasValue) ? "" : ClienteDesde?.ToShortDateString(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("PASTA", string.IsNullOrWhiteSpace(Pasta) ? "" : Pasta.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("BANCO", (Banco == null) ? "" : Banco.Nome.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("TIPO DE CONTA", string.IsNullOrWhiteSpace(TipoConta) ? "" : TipoConta.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("NÚMERO DA CONTA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("FALECIDO", Falecido ? "SIM" : "NÃO", ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("ÓRGÃO EMISSOR", string.IsNullOrWhiteSpace(Emissor) ? "" : Emissor.ToUpper(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("RENDA MENSAL", RendaMensal.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ ObservableCollection<Tuple<string, string, string>> observableCollection2 = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("TELEFONES$", "", "")
+ };
+ if (Telefones != null && Telefones.Count > 0)
+ {
+ foreach (ClienteTelefone telefone in Telefones)
+ {
+ observableCollection2.Add(new Tuple<string, string, string>($" TELEFONE {Telefones.IndexOf(telefone) + 1}$", "", ""));
+ object item4;
+ if (telefone.Tipo.HasValue)
+ {
+ TipoTelefone? tipo = telefone.Tipo;
+ item4 = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item4 = "";
+ }
+ observableCollection2.Add(new Tuple<string, string, string>(" TIPO", (string)item4, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo.ToUpper(), ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" ORDEM", (!telefone.Ordem.HasValue) ? "" : telefone.Ordem.ToString(), ""));
+ }
+ }
+ list2.Add(new TupleList
+ {
+ Tuples = observableCollection2
+ });
+ ObservableCollection<Tuple<string, string, string>> observableCollection3 = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("EMAILS$", "", "")
+ };
+ if (Emails != null && Emails.Count > 0)
+ {
+ foreach (ClienteEmail email in Emails)
+ {
+ observableCollection3.Add(new Tuple<string, string, string>($" EMAIL {Emails.IndexOf(email) + 1}$", "", ""));
+ observableCollection3.Add(new Tuple<string, string, string>(" ENDEREÇO DE EMAIL", string.IsNullOrWhiteSpace(email.Email) ? "" : email.Email, ""));
+ observableCollection3.Add(new Tuple<string, string, string>(" ORDEM", (!email.Ordem.HasValue) ? "" : email.Ordem.ToString(), ""));
+ }
+ }
+ list2.Add(new TupleList
+ {
+ Tuples = observableCollection3
+ });
+ ObservableCollection<Tuple<string, string, string>> observableCollection4 = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("ENDEREÇOS$", "", "")
+ };
+ if (Enderecos != null && Enderecos.Count > 0)
+ {
+ foreach (ClienteEndereco endereco in Enderecos)
+ {
+ observableCollection4.Add(new Tuple<string, string, string>($" ENDEREÇO {Enderecos.IndexOf(endereco) + 1}$", "", ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" LOGRADOURO", string.IsNullOrWhiteSpace(endereco.Endereco) ? "" : endereco.Endereco, ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(endereco.Numero) ? "" : endereco.Numero, ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" COMPLEMENTO", string.IsNullOrWhiteSpace(endereco.Complemento) ? "" : endereco.Complemento, ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" BAIRRO", string.IsNullOrWhiteSpace(endereco.Bairro) ? "" : endereco.Bairro, ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" CIDADE", string.IsNullOrWhiteSpace(endereco.Cidade) ? "" : endereco.Cidade, ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" ESTADO", string.IsNullOrWhiteSpace(endereco.Estado) ? "" : endereco.Estado, ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" CEP", string.IsNullOrWhiteSpace(endereco.Cep) ? "" : endereco.Cep, ""));
+ observableCollection4.Add(new Tuple<string, string, string>(" ORDEM", (!endereco.Ordem.HasValue) ? "" : endereco.Ordem.ToString(), ""));
+ }
+ }
+ list2.Add(new TupleList
+ {
+ Tuples = observableCollection4
+ });
+ ObservableCollection<Tuple<string, string, string>> observableCollection5 = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("CONTATOS$", "", "")
+ };
+ if (Contatos != null && Contatos.Count > 0)
+ {
+ foreach (MaisContato contato in Contatos)
+ {
+ observableCollection5.Add(new Tuple<string, string, string>($" CONTATO {Contatos.IndexOf(contato) + 1}$", "", ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" DOCUMENTO", string.IsNullOrWhiteSpace(contato.Documento) ? "" : contato.Documento, ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" NASCIMENTO", (!contato.Nascimento.HasValue) ? "" : contato.Nascimento?.ToShortDateString(), ""));
+ object item5;
+ if (contato.Parentesco.HasValue)
+ {
+ Parentesco? parentesco = contato.Parentesco;
+ item5 = (parentesco.HasValue ? parentesco.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item5 = "";
+ }
+ observableCollection5.Add(new Tuple<string, string, string>(" PARENTESCO", (string)item5, ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" BANCO", string.IsNullOrWhiteSpace(contato.Banco) ? "" : contato.Banco, ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" AGÊNCIA", string.IsNullOrWhiteSpace(contato.Agencia) ? "" : contato.Agencia, ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" CONTA", string.IsNullOrWhiteSpace(contato.Conta) ? "" : contato.Conta, ""));
+ object item6;
+ if (contato.Tipo.HasValue)
+ {
+ TipoTelefone? tipo = contato.Tipo;
+ item6 = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item6 = "";
+ }
+ observableCollection5.Add(new Tuple<string, string, string>(" TIPO DO TELEFONE", (string)item6, ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(contato.Prefixo) ? "" : contato.Prefixo, ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(contato.Telefone) ? "" : contato.Telefone, ""));
+ observableCollection5.Add(new Tuple<string, string, string>(" EMAIL", string.IsNullOrWhiteSpace(contato.Email) ? "" : contato.Email, ""));
+ }
+ }
+ list2.Add(new TupleList
+ {
+ Tuples = observableCollection5
+ });
+ ObservableCollection<Tuple<string, string, string>> observableCollection6 = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("VÍNCULOS$", "", "")
+ };
+ if (Vinculos == null)
+ {
+ Vinculos = new ObservableCollection<ClienteVinculo>();
+ }
+ if (Vinculos != null && Vinculos.Count > 0)
+ {
+ foreach (ClienteVinculo vinculo in Vinculos)
+ {
+ observableCollection6.Add(new Tuple<string, string, string>($" VÍNCULO {Vinculos.IndexOf(vinculo) + 1}$", "", ""));
+ observableCollection6.Add(new Tuple<string, string, string>(" COM CLIENTE", (vinculo.Cliente1.Id != base.Id) ? vinculo.Cliente1.Nome : vinculo.Cliente2.Nome, ""));
+ observableCollection6.Add(new Tuple<string, string, string>(" PARENTESCO", (vinculo.Cliente1.Id == base.Id) ? vinculo.Parentesco.GetDescription() : Funcoes.ParentescoInverso(vinculo.Parentesco).GetDescription(), ""));
+ }
+ }
+ list2.Add(new TupleList
+ {
+ Tuples = observableCollection6
+ });
+ return list2;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEmail.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEmail.cs
new file mode 100644
index 0000000..28872c8
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEmail.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ClienteEmail : EmailBase, IDomain
+{
+ private string _observacao;
+
+ public bool Selecionado { get; set; }
+
+ public Cliente Cliente { get; set; }
+
+ public int? Ordem { get; set; }
+
+ [Log(true)]
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(base.Email))
+ {
+ list.AddValue("Email", Messages.Obrigatorio);
+ }
+ else if (base.Email.Length > 80)
+ {
+ list.AddValue("Email", string.Format(Messages.MaiorQueLimite, 80));
+ }
+ else if (!base.Email.ValidacaoEmail())
+ {
+ list.AddValue("Email", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Observacao) && Observacao.Length > 255)
+ {
+ list.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 255));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs
new file mode 100644
index 0000000..c2086be
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs
@@ -0,0 +1,123 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ClienteEndereco : EnderecoBase, IDomain, INotifyPropertyChanged
+{
+ private bool _selecionado;
+
+ private string _observacao;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ [Log(true)]
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public Cliente Cliente { get; set; }
+
+ public int? Ordem { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(base.Cep))
+ {
+ list.AddValue("Cep", Messages.Obrigatorio);
+ }
+ else if (!base.Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(base.Endereco))
+ {
+ list.AddValue("Endereco", Messages.Obrigatorio);
+ }
+ else if (base.Endereco.Length > 150)
+ {
+ list.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 150));
+ }
+ if (string.IsNullOrWhiteSpace(base.Numero))
+ {
+ list.AddValue("Numero", Messages.Obrigatorio);
+ }
+ else if (base.Numero.Length > 6)
+ {
+ list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 6));
+ }
+ if (!string.IsNullOrWhiteSpace(base.Complemento) && base.Complemento.Length > 45)
+ {
+ list.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 45));
+ }
+ if (string.IsNullOrWhiteSpace(base.Bairro))
+ {
+ list.AddValue("Bairro", Messages.Obrigatorio);
+ }
+ else if (base.Bairro.Length > 100)
+ {
+ list.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (string.IsNullOrWhiteSpace(base.Cidade))
+ {
+ list.AddValue("Cidade", Messages.Obrigatorio);
+ }
+ else if (base.Cidade.Length > 50)
+ {
+ list.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (string.IsNullOrWhiteSpace(base.Estado))
+ {
+ list.AddValue("Estado", Messages.Obrigatorio);
+ }
+ else if (!base.Estado.ValidacaoEstado())
+ {
+ list.AddValue("Estado", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Observacao) && Observacao.Length > 255)
+ {
+ list.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 255));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteTelefone.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteTelefone.cs
new file mode 100644
index 0000000..6ca47ce
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteTelefone.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ClienteTelefone : TelefoneBase, IDomain
+{
+ private string _observacao;
+
+ public Cliente Cliente { get; set; }
+
+ public int? Ordem { get; set; }
+
+ [Log(true)]
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidateBase();
+ if (!string.IsNullOrWhiteSpace(Observacao) && Observacao.Length > 30)
+ {
+ list.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (string.IsNullOrWhiteSpace(base.Numero))
+ {
+ list.AddValue("Numero", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Prefixo))
+ {
+ list.AddValue("Prefixo", Messages.Obrigatorio);
+ }
+ if (!base.Tipo.HasValue)
+ {
+ list.AddValue("Tipo", Messages.Obrigatorio);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteVinculo.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteVinculo.cs
new file mode 100644
index 0000000..67ff238
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteVinculo.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ClienteVinculo : DomainBase, IDomain
+{
+ public Cliente Cliente1 { get; set; }
+
+ public Cliente Cliente2 { get; set; }
+
+ public ParentescoVinculo? Parentesco { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!Parentesco.HasValue)
+ {
+ list.AddValue("Parentesco", Messages.Obrigatorio);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Cobertura.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Cobertura.cs
new file mode 100644
index 0000000..00f769b
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Cobertura.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Cobertura : DomainBase, IDomain
+{
+ private string _observacao;
+
+ public Item Item { get; set; }
+
+ public CoberturaPadrao CoberturaPadrao { get; set; }
+
+ public decimal Franquia { get; set; }
+
+ public decimal Premio { get; set; }
+
+ public decimal Lmi { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = ((string.IsNullOrWhiteSpace(value) && CoberturaPadrao != null) ? CoberturaPadrao.Descricao : value);
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if ((Lmi != 0m || Premio != 0m || Franquia != 0m) && string.IsNullOrWhiteSpace(Observacao))
+ {
+ list.AddValue("Observacao", Messages.Obrigatorio);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs
new file mode 100644
index 0000000..fe689b3
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class CoberturaGranizo : DomainBase, IDomain
+{
+ private string _variedade;
+
+ private string _quadra;
+
+ public Item Item { get; set; }
+
+ public Granizo Granizo { get; set; }
+
+ public string Variedade
+ {
+ get
+ {
+ return _variedade?.ToUpper();
+ }
+ set
+ {
+ _variedade = value;
+ }
+ }
+
+ public string Quadra
+ {
+ get
+ {
+ return _quadra?.ToUpper();
+ }
+ set
+ {
+ _quadra = value;
+ }
+ }
+
+ public decimal? Produtividade { get; set; }
+
+ public decimal? Lmi { get; set; }
+
+ public decimal? Premio { get; set; }
+
+ public decimal? Area { get; set; }
+
+ public DateTime? Plantio { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Plantio.HasValue && (DateTime.Compare(Plantio.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Plantio.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Plantio", string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Variedade) && Variedade.Length > 60)
+ {
+ list.AddValue("Variedade", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (string.IsNullOrWhiteSpace(Quadra) && Quadra.Length > 30)
+ {
+ list.AddValue("Quadra", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaPadrao.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaPadrao.cs
new file mode 100644
index 0000000..fa767a6
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaPadrao.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class CoberturaPadrao : DomainBase, IDomain
+{
+ private string _descricao;
+
+ public long IdRamo { get; set; }
+
+ public string Descricao
+ {
+ get
+ {
+ if (!string.IsNullOrWhiteSpace(_descricao))
+ {
+ _descricao = Regex.Replace(_descricao, "[\n\r]", "");
+ }
+ return _descricao?.ToUpper();
+ }
+ set
+ {
+ _descricao = value;
+ }
+ }
+
+ public bool Padrao { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ return ValidationHelper.AddValue();
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/CondicaoRepasse.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/CondicaoRepasse.cs
new file mode 100644
index 0000000..a00dbc1
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/CondicaoRepasse.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class CondicaoRepasse : DomainBase, IDomain
+{
+ public Seguradora Seguradora { get; set; }
+
+ public Ramo Ramo { get; set; }
+
+ public int Parcela { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ return ValidationHelper.AddValue();
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ConfigExtratoImport.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ConfigExtratoImport.cs
new file mode 100644
index 0000000..7d1b274
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ConfigExtratoImport.cs
@@ -0,0 +1,26 @@
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ConfigExtratoImport : DomainBase
+{
+ private string _descricao;
+
+ public long IdSeguradora { get; set; }
+
+ public string Descricao
+ {
+ get
+ {
+ return _descricao?.ToUpper();
+ }
+ set
+ {
+ _descricao = value;
+ }
+ }
+
+ public string Codigo { get; set; }
+
+ public bool Ativo { get; set; }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs
new file mode 100644
index 0000000..73c7e8e
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Consorcio : DomainBase, IDomain
+{
+ private string _bensConsorcio;
+
+ private string _grupo;
+
+ private string _cota;
+
+ private decimal? _valorCredito;
+
+ private string _observacao;
+
+ public Item Item { get; set; }
+
+ public string BensConsorcio
+ {
+ get
+ {
+ return _bensConsorcio?.ToUpper();
+ }
+ set
+ {
+ _bensConsorcio = value;
+ }
+ }
+
+ public string Grupo
+ {
+ get
+ {
+ return _grupo?.ToUpper();
+ }
+ set
+ {
+ _grupo = value;
+ }
+ }
+
+ public string Cota
+ {
+ get
+ {
+ return _cota?.ToUpper();
+ }
+ set
+ {
+ _cota = value;
+ }
+ }
+
+ public decimal? ValorCredito
+ {
+ get
+ {
+ return _valorCredito;
+ }
+ set
+ {
+ _valorCredito = value;
+ }
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(BensConsorcio))
+ {
+ list.AddValue("BensConsorcio", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public static List<TupleList> Log(Item item)
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(item.Consorcio.BensConsorcio) ? "" : item.Consorcio.BensConsorcio, ""),
+ new Tuple<string, string, string>("GRUPO", string.IsNullOrWhiteSpace(item.Consorcio.Grupo) ? "" : item.Consorcio.Grupo, ""),
+ new Tuple<string, string, string>("COTA", string.IsNullOrWhiteSpace(item.Consorcio.Cota) ? "" : item.Consorcio.Cota, ""),
+ new Tuple<string, string, string>("GRUPO", (!item.Consorcio.ValorCredito.HasValue) ? "" : item.Consorcio.ValorCredito?.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Controle.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Controle.cs
new file mode 100644
index 0000000..af89311
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Controle.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Controle : DomainBase, IDomain
+{
+ private long _idEmpresa;
+
+ [Log(false)]
+ public Cliente Cliente { get; set; }
+
+ public long IdEmpresa
+ {
+ get
+ {
+ return _idEmpresa;
+ }
+ set
+ {
+ _idEmpresa = ((value == 0L) ? 1 : value);
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("SEGURADORA")]
+ public Seguradora Seguradora { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("RAMO")]
+ public Ramo Ramo { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("PRODUTO")]
+ public Produto Produto { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("SEGURADORA ANTERIOR")]
+ public Seguradora SeguradoraAnterior { get; set; }
+
+ [Log(false)]
+ public IList<Documento> Documentos { get; set; }
+
+ [Log(false)]
+ public Item Item { get; set; }
+
+ public string AssistenciaId { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Cliente == null || Cliente.Id == 0L)
+ {
+ list.AddValue("Cliente", Messages.Obrigatorio);
+ }
+ if (Seguradora == null || Seguradora.Id == 0L)
+ {
+ list.AddValue("Seguradora", Messages.Obrigatorio);
+ }
+ if (Ramo == null || Ramo.Id == 0L)
+ {
+ list.AddValue("Ramo", Messages.Obrigatorio);
+ }
+ if (IdEmpresa == 0L)
+ {
+ list.AddValue("Empresa", Messages.Obrigatorio);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ControleSinistro.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ControleSinistro.cs
new file mode 100644
index 0000000..b0b4bc6
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ControleSinistro.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ControleSinistro : DomainBase, IDomain
+{
+ private DateTime? _dataSinistro;
+
+ private DateTime? _horaSinistro;
+
+ public Item Item { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("DATA SINISTRO")]
+ public DateTime? DataSinistro
+ {
+ get
+ {
+ return _dataSinistro;
+ }
+ set
+ {
+ if (value.HasValue)
+ {
+ if (!HoraSinistro.HasValue)
+ {
+ HoraSinistro = value;
+ }
+ _dataSinistro = DateTime.Parse($"{value.Value:d} {HoraSinistro.Value:T}");
+ }
+ else
+ {
+ _dataSinistro = null;
+ }
+ }
+ }
+
+ public DateTime? HoraSinistro
+ {
+ get
+ {
+ return _horaSinistro;
+ }
+ set
+ {
+ _horaSinistro = value;
+ if (value.HasValue)
+ {
+ DataSinistro = ((DataSinistro.HasValue && value.HasValue) ? new DateTime?(DateTime.Parse($"{DataSinistro.Value:d} {value:T}")) : null);
+ }
+ }
+ }
+
+ public List<Sinistro> Sinistros { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!DataSinistro.HasValue)
+ {
+ list.AddValue("DataSinistro", Messages.Obrigatorio);
+ }
+ if (DataSinistro.HasValue && (DateTime.Compare(DataSinistro.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataSinistro.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataSinistro", string.Format(Messages.DataInvalida));
+ }
+ if (HoraSinistro.HasValue && (DateTime.Compare(HoraSinistro.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(HoraSinistro.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("HoraSinistro", string.Format(Messages.DataInvalida));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/CriticaApolice.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/CriticaApolice.cs
new file mode 100644
index 0000000..3b0a7a6
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/CriticaApolice.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class CriticaApolice : DomainBase, IDomain
+{
+ private string _naoEncontrados;
+
+ private bool? _critica;
+
+ public Documento Documento { get; set; }
+
+ public Usuario UsuarioImportacao { get; set; }
+
+ public long? UsuarioCritica { get; set; }
+
+ public bool? Critica
+ {
+ get
+ {
+ return _critica;
+ }
+ set
+ {
+ _critica = value.GetValueOrDefault();
+ }
+ }
+
+ public string NaoEncontrados
+ {
+ get
+ {
+ return _naoEncontrados?.ToUpper();
+ }
+ set
+ {
+ _naoEncontrados = value;
+ }
+ }
+
+ public DateTime? DataImportacao { get; set; }
+
+ public DateTime? DataCritica { get; set; }
+
+ public bool? Aggilizador { get; set; }
+
+ public string Tipo { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (DataImportacao.HasValue && (DateTime.Compare(DataImportacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataImportacao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataImportacao", string.Format(Messages.DataInvalida));
+ }
+ if (DataCritica.HasValue && (DateTime.Compare(DataCritica.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataCritica.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataCritica", string.Format(Messages.DataInvalida));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/DetalheExtrato.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/DetalheExtrato.cs
new file mode 100644
index 0000000..07b3e51
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/DetalheExtrato.cs
@@ -0,0 +1,163 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class DetalheExtrato : DomainBase, IDomain, INotifyPropertyChanged
+{
+ private bool _selecionado;
+
+ private string _cliente;
+
+ private string _apolice;
+
+ private string _endosso;
+
+ private string _numeroParcela;
+
+ private string _historico;
+
+ public bool IsNormal = true;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+
+ public Extrato Extrato { get; set; }
+
+ public long? Documento { get; set; }
+
+ public long? Parcela { get; set; }
+
+ public StatusParcela? Status { get; set; }
+
+ public SubTipo? SubTipo { get; set; }
+
+ public bool Corrigir { get; set; }
+
+ public string Cliente
+ {
+ get
+ {
+ return _cliente?.ToUpper();
+ }
+ set
+ {
+ _cliente = value;
+ }
+ }
+
+ public string Apolice
+ {
+ get
+ {
+ return _apolice?.ToUpper().Trim();
+ }
+ set
+ {
+ _apolice = value;
+ }
+ }
+
+ public string Endosso
+ {
+ get
+ {
+ return _endosso?.ToUpper().Trim();
+ }
+ set
+ {
+ _endosso = value;
+ }
+ }
+
+ public string NumeroParcela
+ {
+ get
+ {
+ return _numeroParcela?.ToUpper().Trim();
+ }
+ set
+ {
+ _numeroParcela = value;
+ }
+ }
+
+ public DateTime? Recebimento { get; set; }
+
+ public DateTime? Credito { get; set; }
+
+ public decimal? Valor { get; set; }
+
+ public decimal? Comissao { get; set; }
+
+ public decimal? ValorComissao { get; set; }
+
+ public string Historico
+ {
+ get
+ {
+ return _historico?.ToUpper();
+ }
+ set
+ {
+ _historico = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Recebimento.HasValue && (DateTime.Compare(Recebimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Recebimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Recebimento", string.Format(Messages.DataInvalida));
+ }
+ if (Credito.HasValue && (DateTime.Compare(Credito.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Credito.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Credito", string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Cliente) && Cliente.Length > 100)
+ {
+ list.AddValue("Cliente", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (string.IsNullOrWhiteSpace(Apolice) && Apolice.Length > 30)
+ {
+ list.AddValue("Apolice", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (string.IsNullOrWhiteSpace(Endosso) && Endosso.Length > 20)
+ {
+ list.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 20));
+ }
+ if (string.IsNullOrWhiteSpace(NumeroParcela) && NumeroParcela.Length > 4)
+ {
+ list.AddValue("NumeroParcela", string.Format(Messages.MaiorQueLimite, 4));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs
new file mode 100644
index 0000000..4b6acf7
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs
@@ -0,0 +1,835 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Aggilizador;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Documento : DomainBase, IDomain
+{
+ private bool _selecionado;
+
+ private string _proposta;
+
+ private string _propostaEndosso;
+
+ private string _apoliceAnterior;
+
+ private string _apolice;
+
+ private string _endosso;
+
+ private string _pasta;
+
+ private string _agencia;
+
+ private string _conta;
+
+ private string _numeroCartao;
+
+ private string _vencimentoCartao;
+
+ private string _nomeProponente;
+
+ private bool _isEndosso;
+
+ private bool _vencimentoParcela;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ public bool ProtocoloTelefone { get; set; }
+
+ public bool ProtocoloEmail { get; set; }
+
+ public bool ProtocoloEndereco { get; set; }
+
+ public bool ProtocoloParcela { get; set; }
+
+ public bool ProtocoloVendedor { get; set; }
+
+ public Controle Controle { get; set; }
+
+ [Log(true)]
+ [Description("NEGÓCIO CORRETORA")]
+ public NegocioCorretora? NegocioCorretora { get; set; }
+
+ public DateTime? DataCriacao { get; set; }
+
+ [Log(true)]
+ [Description("DATA DE CONTROLE")]
+ public DateTime? DataControle { get; set; }
+
+ public int Ordem { get; set; }
+
+ public int Tipo { get; set; }
+
+ [Log(true)]
+ [Description("STATUS INTERNO")]
+ public Status Status { get; set; }
+
+ public string ObsProtocolo { get; set; }
+
+ [Log(true)]
+ public string Proposta
+ {
+ get
+ {
+ return _proposta?.ToUpper();
+ }
+ set
+ {
+ _proposta = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("PROPOSTA DE ENDOSSO")]
+ public string PropostaEndosso
+ {
+ get
+ {
+ return _propostaEndosso?.ToUpper();
+ }
+ set
+ {
+ _propostaEndosso = value;
+ }
+ }
+
+ [Log(false)]
+ public Usuario UsuarioCriacao { get; set; }
+
+ [Log(true)]
+ [Description("APÓLICE ANTERIOR")]
+ public string ApoliceAnterior
+ {
+ get
+ {
+ return _apoliceAnterior?.ToUpper();
+ }
+ set
+ {
+ _apoliceAnterior = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("APÓLICE")]
+ public string Apolice
+ {
+ get
+ {
+ return _apolice?.ToUpper();
+ }
+ set
+ {
+ _apolice = value;
+ }
+ }
+
+ [Log(true)]
+ public string Endosso
+ {
+ get
+ {
+ return _endosso?.ToUpper();
+ }
+ set
+ {
+ _endosso = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TIPO DO ENDOSSO")]
+ public TipoEndosso? TipoEndosso { get; set; }
+
+ [Log(true)]
+ [Description("COMISSÃO")]
+ public decimal Comissao { get; set; }
+
+ [Log(true)]
+ [Description("PRÊMIO LÍQUIDO")]
+ public decimal PremioLiquido { get; set; }
+
+ [Log(true)]
+ [Description("PRÊMIO ADICIONAL")]
+ public decimal PremioAdicional { get; set; }
+
+ [Log(true)]
+ [Description("CUSTO DE EMISSÃO")]
+ public decimal Custo { get; set; }
+
+ [Log(true)]
+ [Description("IOF")]
+ public decimal Iof { get; set; }
+
+ [Log(true)]
+ [Description("DIFERENÇA")]
+ public decimal Diferenca { get; set; }
+
+ [Log(true)]
+ [Description("PRÊMIO TOTAL")]
+ public decimal PremioTotal { get; set; }
+
+ [Log(true)]
+ [Description("QUANTIDADE DE PARCELAS")]
+ public decimal NumeroParcelas { get; set; }
+
+ [Log(true)]
+ public string Observacao { get; set; }
+
+ [Log(true)]
+ public string Pasta
+ {
+ get
+ {
+ return _pasta?.ToUpper();
+ }
+ set
+ {
+ _pasta = value;
+ }
+ }
+
+ [Log(true)]
+ public Banco Banco { get; set; }
+
+ [Log(true)]
+ [Description("AGÊNCIA")]
+ public string Agencia
+ {
+ get
+ {
+ return _agencia?.ToUpper().Trim();
+ }
+ set
+ {
+ _agencia = value;
+ }
+ }
+
+ [Log(true)]
+ public string Conta
+ {
+ get
+ {
+ return _conta?.ToUpper().Trim();
+ }
+ set
+ {
+ _conta = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TIPO RECEBIMENTO")]
+ public TipoRecebimento? TipoRecebimento { get; set; }
+
+ [Log(false)]
+ public Negocio? Negocio { get; set; }
+
+ [Log(true)]
+ [Description("SITUAÇÃO")]
+ public TipoSeguro Situacao { get; set; }
+
+ [Log(false)]
+ public TipoSeguro? SituacaoAnterior { get; set; }
+
+ [Log(true)]
+ [Description("ADICIONAL DE COMISSÃO")]
+ public bool AdicionalComiss { get; set; }
+
+ public bool Excluido { get; set; }
+
+ public bool AssinadaSiggner { get; set; }
+
+ [Log(true)]
+ public bool PropostaAssinada { get; set; }
+
+ public StatusAssinatura StatusAssinatura { get; set; }
+
+ [Log(true)]
+ [Description("APÓLICE CONFERIDA")]
+ public bool ApoliceConferida { get; set; }
+
+ public bool FinalVigencia { get; set; }
+
+ [Log(true)]
+ public BandeiraCartao? Bandeira { get; set; }
+
+ [Log(true)]
+ [Description("NÚMERO CARTÃO")]
+ public string NumeroCartao
+ {
+ get
+ {
+ return _numeroCartao?.ToUpper().Trim();
+ }
+ set
+ {
+ _numeroCartao = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("VENCIMENTO CARTÃO")]
+ public string VencimentoCartao
+ {
+ get
+ {
+ return _vencimentoCartao?.ToUpper().Trim();
+ }
+ set
+ {
+ _vencimentoCartao = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("PROPONENTE")]
+ public string NomeProponente
+ {
+ get
+ {
+ return _nomeProponente?.ToUpper();
+ }
+ set
+ {
+ _nomeProponente = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("VIGÊNCIA INICIAL")]
+ public DateTime Vigencia1 { get; set; }
+
+ [Log(true)]
+ [Description("VIGÊNCIA FINAL")]
+ public DateTime? Vigencia2 { get; set; }
+
+ [Log(true)]
+ [Description("EMISSÃO")]
+ public DateTime? Emissao { get; set; }
+
+ [Log(true)]
+ [Description("TRANSMISSÃO DA PROPOSTA")]
+ public DateTime? Remessa { get; set; }
+
+ [Log(true)]
+ [Description("ESTIPULANTE 1")]
+ public Estipulante Estipulante1 { get; set; }
+
+ [Log(true)]
+ [Description("ESTIPULANTE 2")]
+ public Estipulante Estipulante2 { get; set; }
+
+ [Log(true)]
+ [Description("ESTIPULANTE 3")]
+ public Estipulante Estipulante3 { get; set; }
+
+ [Log(true)]
+ [Description("ESTIPULANTE 4")]
+ public Estipulante Estipulante4 { get; set; }
+
+ [Log(true)]
+ [Description("ESTIPULANTE 5")]
+ public Estipulante Estipulante5 { get; set; }
+
+ public string Estipulantes { get; set; }
+
+ [Log(false)]
+ public Vendedor VendedorPrincipal { get; set; }
+
+ [Log(false)]
+ public decimal? PercentualRepasse { get; set; }
+
+ [Log(false)]
+ public List<Item> ItensAtivo { get; set; }
+
+ [Log(false)]
+ public ObservableCollection<Parcela> Parcelas { get; set; }
+
+ [Log(false)]
+ public List<VendedorParcela> Pagamentos { get; set; }
+
+ [Log(false)]
+ public List<Vendedor> Vendedores { get; set; }
+
+ [Log(false)]
+ public bool Sinistro { get; set; }
+
+ [Log(false)]
+ public bool TemEndosso { get; set; }
+
+ [Log(true)]
+ [Description("FORMA DE PAGAMENTO")]
+ public FormaPagamento? FormaPagamento { get; set; }
+
+ [Log(false)]
+ public List<StatusDocumentoAssinado> Assinaturas { get; set; }
+
+ [Log(false)]
+ public VinculoDocumento Vinculo { get; set; }
+
+ [Log(false)]
+ public List<Calculo> Calculos { get; set; }
+
+ public decimal? ComissaoTotal { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public Documento DeepCopy()
+ {
+ return JsonConvert.DeserializeObject<Documento>(JsonConvert.SerializeObject((object)this));
+ }
+
+ public List<KeyValuePair<string, string>> Validate(bool isEndosso, bool vencimentoParcela)
+ {
+ _isEndosso = isEndosso;
+ _vencimentoParcela = vencimentoParcela;
+ return Validate();
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ list.AddRange(Controle.Validate());
+ if (!NegocioCorretora.HasValue)
+ {
+ list.AddValue("NegocioCorretora|NEGÓCIO CORRETORA", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Proposta) && !_isEndosso)
+ {
+ list.AddValue("Proposta", Messages.Obrigatorio);
+ }
+ else if (!string.IsNullOrEmpty(Proposta) && Proposta.Length > 50)
+ {
+ list.AddValue("Proposta", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (!string.IsNullOrWhiteSpace(PropostaEndosso) && PropostaEndosso.Length > 50)
+ {
+ list.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (!string.IsNullOrWhiteSpace(ApoliceAnterior) && ApoliceAnterior.Length > 50)
+ {
+ list.AddValue("ApoliceAnterior|APÓLICE ANTERIOR", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (!string.IsNullOrWhiteSpace(Endosso) && Endosso.Length > 30)
+ {
+ list.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (!string.IsNullOrWhiteSpace(Pasta) && Pasta.Length > 15)
+ {
+ list.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 15));
+ }
+ if (!string.IsNullOrWhiteSpace(Agencia) && Agencia.Length > 10)
+ {
+ list.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 10));
+ }
+ if (!string.IsNullOrWhiteSpace(Conta) && Conta.Length > 15)
+ {
+ list.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 15));
+ }
+ if (!string.IsNullOrWhiteSpace(NumeroCartao) && NumeroCartao.Length > 20)
+ {
+ list.AddValue("NumeroCartao|NÚMERO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 20));
+ }
+ if (!string.IsNullOrWhiteSpace(VencimentoCartao) && VencimentoCartao.Length > 5)
+ {
+ list.AddValue("VencimentoCartao|VENCIMENTO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 5));
+ }
+ if (!string.IsNullOrWhiteSpace(NomeProponente) && NomeProponente.Length > 100)
+ {
+ list.AddValue("NomeProponente|PROPONENTE", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (Emissao.HasValue && (DateTime.Compare(Emissao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Emissao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), string.Format(Messages.DataInvalida));
+ }
+ if (Remessa.HasValue && (DateTime.Compare(Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Remessa.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Remessa|" + (_isEndosso ? "TRANSMISSÃO DA PROPOSTA DE ENDOSSO" : "TRANSMISSÃO DA PROPOSTA"), string.Format(Messages.DataInvalida));
+ }
+ _ = Vigencia1;
+ if (DateTime.Compare(Vigencia1, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Vigencia1, new DateTime(9999, 12, 31)) > 0)
+ {
+ list.AddValue("Vigencia1|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida));
+ }
+ if (Vigencia2.HasValue && (DateTime.Compare(Vigencia2.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Vigencia2.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Vigencia2|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida));
+ }
+ _ = Vigencia1;
+ if (Vigencia2.HasValue)
+ {
+ DateTime vigencia = Vigencia1;
+ DateTime? vigencia2 = Vigencia2;
+ if (vigencia > vigencia2)
+ {
+ list.AddValue("Vigencia2|VIGÊNCIA FINAL", "A DATA DE VIGÊNCIA FINAL NÃO PODE SER ANTERIOR A DATA DE VIGÊNCIA INCIAL");
+ }
+ }
+ if (Tipo == 0)
+ {
+ if (string.IsNullOrWhiteSpace(Apolice) && Emissao.HasValue)
+ {
+ list.AddValue("Apolice|APÓLICE", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Apolice) && !Emissao.HasValue)
+ {
+ list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Apolice) && Apolice.Length > 50)
+ {
+ list.AddValue("Apolice|APÓLICE", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ }
+ if (Tipo > 0)
+ {
+ if (string.IsNullOrWhiteSpace(PropostaEndosso))
+ {
+ list.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", Messages.Obrigatorio);
+ }
+ else if (PropostaEndosso.Length > 30)
+ {
+ list.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (string.IsNullOrWhiteSpace(Endosso))
+ {
+ if (Emissao.HasValue)
+ {
+ list.AddValue("Endosso", Messages.Obrigatorio);
+ }
+ }
+ else
+ {
+ if (Endosso.Length > 30)
+ {
+ list.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (!Emissao.HasValue && Tipo > 0)
+ {
+ list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), Messages.Obrigatorio);
+ }
+ }
+ }
+ if (Tipo > 0 && !TipoEndosso.HasValue)
+ {
+ list.AddValue("TipoEndosso|TIPO DE ENDOSSO", Messages.Obrigatorio);
+ }
+ if (TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela && !Vigencia2.HasValue)
+ {
+ list.AddValue("Vigencia2|VIGÊNCIA FINAL", Messages.Obrigatorio);
+ }
+ if (TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela && Tipo == 0)
+ {
+ list.AddRange(ObrigarValores());
+ }
+ if (TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Fatura && Tipo == 0)
+ {
+ list.AddRange(ObrigarValores(valores: false));
+ }
+ if (TipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (PremioLiquido != 0m || Comissao != 0m) && NumeroParcelas == 0m)
+ {
+ list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio);
+ }
+ if (TipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (PremioLiquido != 0.0m || NumeroParcelas != 0m))
+ {
+ if (Comissao == 0m)
+ {
+ list.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio);
+ }
+ if (NumeroParcelas == 0m)
+ {
+ list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio);
+ }
+ if (PremioLiquido == 0m)
+ {
+ list.AddValue("PremioLiquido|PRÊMIO LÍQUID", Messages.Obrigatorio);
+ }
+ }
+ long num = 10000000000L;
+ if (PremioTotal > (decimal)num)
+ {
+ list.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido);
+ }
+ if (PremioLiquido > (decimal)num)
+ {
+ list.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido);
+ }
+ if (NumeroParcelas > 1000m)
+ {
+ list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO");
+ }
+ if (Tipo > 0)
+ {
+ switch (TipoEndosso)
+ {
+ default:
+ if (PremioTotal == 0m && Comissao == 0m)
+ {
+ return list;
+ }
+ list.AddRange(ObrigarValores());
+ break;
+ case Gestor.Model.Common.TipoEndosso.SemMovimento:
+ case Gestor.Model.Common.TipoEndosso.Cancelamento:
+ return list;
+ case Gestor.Model.Common.TipoEndosso.ComMovimento:
+ list.AddRange(ObrigarValores());
+ break;
+ }
+ }
+ return list;
+ }
+
+ private List<KeyValuePair<string, string>> ObrigarValores(bool valores = true)
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (valores)
+ {
+ if (Comissao <= 0m)
+ {
+ list.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio);
+ }
+ if (PremioLiquido == 0m)
+ {
+ list.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Obrigatorio);
+ }
+ if (PremioTotal == 0m)
+ {
+ list.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Obrigatorio);
+ }
+ if (NumeroParcelas <= 0m)
+ {
+ list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio);
+ }
+ if (!_vencimentoParcela)
+ {
+ if (NumeroParcelas > 0m && NumeroParcelas < 998m)
+ {
+ DateTime vigencia = Vigencia1;
+ DateTime dateTime = ((NumeroParcelas == 1m || vigencia == DateTime.MinValue) ? vigencia : vigencia.AddMonths(int.Parse(NumeroParcelas.ToString(new CultureInfo("pt-BR"))) - 1));
+ DateTime? vigencia2 = Vigencia2;
+ if (vigencia2.HasValue && dateTime > vigencia2.GetValueOrDefault() && (Controle.Ramo == null || Controle.Ramo.Id != 23))
+ {
+ list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.VencimentoParcela);
+ }
+ }
+ else if (NumeroParcelas > 1000m)
+ {
+ list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO");
+ }
+ }
+ }
+ if (!valores)
+ {
+ if (PremioLiquido != 0m)
+ {
+ list.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido);
+ }
+ if (PremioAdicional != 0m)
+ {
+ list.AddValue("PremioAdicional|PRÊMIO ADICIONAL", Messages.Invalido);
+ }
+ if (Iof != 0m)
+ {
+ list.AddValue("Iof", Messages.Invalido);
+ }
+ if (Diferenca != 0m)
+ {
+ list.AddValue("Diferenca|DIFERÊNÇA", Messages.Invalido);
+ }
+ if (PremioTotal != 0m)
+ {
+ list.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido);
+ }
+ if (NumeroParcelas != 0m)
+ {
+ list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Invalido);
+ }
+ }
+ return list;
+ }
+
+ public List<TupleList> Log(bool restricaoComissao)
+ {
+ List<Tuple<string, string, string>> obj = new List<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("SEGURADORA", string.IsNullOrWhiteSpace(Controle?.Seguradora?.Nome) ? "" : Controle.Seguradora.Nome.ToUpper(), ""),
+ new Tuple<string, string, string>("RAMO", string.IsNullOrWhiteSpace(Controle?.Ramo?.Nome) ? "" : Controle.Ramo.Nome.ToUpper(), ""),
+ new Tuple<string, string, string>("PRODUTO", string.IsNullOrWhiteSpace(Controle?.Produto?.Nome) ? "" : Controle.Produto.Nome.ToUpper(), "")
+ };
+ object item;
+ if (NegocioCorretora.HasValue)
+ {
+ NegocioCorretora? negocioCorretora = NegocioCorretora;
+ item = (negocioCorretora.HasValue ? negocioCorretora.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ obj.Add(new Tuple<string, string, string>("NEGÓCIO CORRETORA", (string)item, ""));
+ obj.Add(new Tuple<string, string, string>("STATUS DO SEGURO", Situacao.GetDescription(), ""));
+ object item2;
+ if (TipoRecebimento.HasValue)
+ {
+ TipoRecebimento? tipoRecebimento = TipoRecebimento;
+ item2 = (tipoRecebimento.HasValue ? tipoRecebimento.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item2 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("TIPO DE RECEBIMENTO", (string)item2, ""));
+ object item3;
+ if (TipoEndosso.HasValue)
+ {
+ TipoEndosso? tipoEndosso = TipoEndosso;
+ item3 = (tipoEndosso.HasValue ? tipoEndosso.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item3 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("TIPO ENDOSSO", (string)item3, ""));
+ obj.Add(new Tuple<string, string, string>("PROPOSTA", string.IsNullOrWhiteSpace(Proposta) ? "" : Proposta.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("PROPOSTA ENDOSSO", string.IsNullOrWhiteSpace(PropostaEndosso) ? "" : PropostaEndosso.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("APÓLICE", string.IsNullOrWhiteSpace(Apolice) ? "" : Apolice.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("ENDOSSO", string.IsNullOrWhiteSpace(Endosso) ? "" : Endosso.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("VIGÊNCIA INICIAL", Vigencia1.ToShortDateString(), ""));
+ obj.Add(new Tuple<string, string, string>("VIGÊNCIA FINAL", (!Vigencia2.HasValue) ? "" : Vigencia2?.ToShortDateString(), ""));
+ obj.Add(new Tuple<string, string, string>("TRANSMISSÃO DA PROPOSTA", (!Remessa.HasValue) ? "" : Remessa?.ToShortDateString(), ""));
+ obj.Add(new Tuple<string, string, string>("EMISSÃO DA APÓLICE", (!Emissao.HasValue) ? "" : Emissao?.ToShortDateString(), ""));
+ obj.Add(new Tuple<string, string, string>("SEGURADORA ANTERIOR", string.IsNullOrWhiteSpace(Controle?.SeguradoraAnterior?.Nome) ? "" : Controle.SeguradoraAnterior.Nome.ToUpper(), ""));
+ obj.Add(new Tuple<string, string, string>("APÓLICE ANTERIOR", string.IsNullOrWhiteSpace(ApoliceAnterior) ? "" : ApoliceAnterior.ToUpper(), ""));
+ object item4;
+ if (FormaPagamento.HasValue)
+ {
+ FormaPagamento? formaPagamento = FormaPagamento;
+ item4 = (formaPagamento.HasValue ? formaPagamento.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item4 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("FORMA DE PAGAMENTO", (string)item4, ""));
+ obj.Add(new Tuple<string, string, string>("PROPOSTA ASSINADA", PropostaAssinada ? "SIM" : "NÃO", ""));
+ obj.Add(new Tuple<string, string, string>("APÓLICE CONFERIDA", ApoliceConferida ? "SIM" : "NÃO", ""));
+ obj.Add(new Tuple<string, string, string>("ADICIONAL DE COMISSÃO", AdicionalComiss ? "SIM" : "NÃO", ""));
+ List<Tuple<string, string, string>> list = obj;
+ if (!restricaoComissao)
+ {
+ list.Add(new Tuple<string, string, string>("COMISSÃO", (Comissao / 100m).ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ List<Tuple<string, string, string>> obj2 = new List<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COMISSÃO", (Comissao / 100m).ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("PRÊMIO LÍQUIDO", PremioLiquido.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("PRÊMIO ADICIONAL", PremioAdicional.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("I.O.F.", Iof.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("DIFERENÇA", Diferenca.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("PRÊMIO TOTAL", PremioTotal.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("NÚMERO DE PARCELAS", decimal.ToInt32(NumeroParcelas).ToString(), ""),
+ new Tuple<string, string, string>("BANCO", (Banco == null) ? "" : Banco.Nome.ToUpper(), ""),
+ new Tuple<string, string, string>("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia.ToUpper(), ""),
+ new Tuple<string, string, string>("CONTA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta.ToUpper(), ""),
+ new Tuple<string, string, string>("CARTÃO DE CRÉDITO", string.IsNullOrWhiteSpace(NumeroCartao) ? "" : NumeroCartao.ToUpper(), "")
+ };
+ object item5;
+ if (Bandeira.HasValue)
+ {
+ BandeiraCartao? bandeira = Bandeira;
+ item5 = (bandeira.HasValue ? bandeira.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item5 = "";
+ }
+ obj2.Add(new Tuple<string, string, string>("BANDEIRA", (string)item5, ""));
+ obj2.Add(new Tuple<string, string, string>("PROPONENTE", string.IsNullOrWhiteSpace(NomeProponente) ? "" : NomeProponente.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("VENCIMENTO DO CARTÃO", string.IsNullOrWhiteSpace(VencimentoCartao?.Replace("/", "")) ? "" : VencimentoCartao.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("PASTA", string.IsNullOrWhiteSpace(Pasta) ? "" : Pasta.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 1", (Estipulante1 == null) ? "" : Estipulante1.Nome.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 2", (Estipulante2 == null) ? "" : Estipulante2.Nome.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 3", (Estipulante3 == null) ? "" : Estipulante3.Nome.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 4", (Estipulante4 == null) ? "" : Estipulante4.Nome.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 5", (Estipulante5 == null) ? "" : Estipulante5.Nome.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("STATUS", (Status == null) ? "" : Status.Nome.ToUpper(), ""));
+ obj2.Add(new Tuple<string, string, string>("DATA DE CONTROLE", (!DataControle.HasValue) ? "" : DataControle?.ToShortDateString(), ""));
+ obj2.Add(new Tuple<string, string, string>("ANOTAÇÕES", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao.ToUpper(), ""));
+ list.AddRange(obj2);
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>(list)
+ }
+ };
+ }
+
+ public List<KeyValuePair<string, string>> ValidateEndossar()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Proposta))
+ {
+ list.AddValue("Proposta", Messages.Obrigatorio);
+ }
+ if (Emissao.HasValue && (DateTime.Compare(Emissao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Emissao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Emissao|EMISSÃO DA APÓLICE", string.Format(Messages.DataInvalida));
+ }
+ if (Remessa.HasValue && (DateTime.Compare(Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Remessa.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Remessa|TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Apolice) && Emissao.HasValue)
+ {
+ list.AddValue("Apolice|APÓLICE", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Apolice) && !Emissao.HasValue)
+ {
+ list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Apolice) && !Emissao.HasValue)
+ {
+ list.AddValue("Apolice|EMISSÃO DA APÓLICE", "NÃO É POSSÍVEL ENDOSSAR UM DOCUMENTO SEM EMISSÃO DE APÓLICE");
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Estipulante.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Estipulante.cs
new file mode 100644
index 0000000..50e418a
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Estipulante.cs
@@ -0,0 +1,282 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Estipulante : EnderecoBase, IDomain, INotifyPropertyChanged
+{
+ private bool _selecionado;
+
+ private string _nome;
+
+ private string _documento;
+
+ private string _primeiroPrefixo;
+
+ private string _primeiroTelefone;
+
+ private string _segundoPrefixo;
+
+ private string _segundoTelefone;
+
+ private string _email;
+
+ private string _observacao;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ public long IdEmpresa { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ public string Documento
+ {
+ get
+ {
+ return _documento?.ToUpper().Trim();
+ }
+ set
+ {
+ _documento = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TIPO TELEFONE")]
+ public TipoTelefone? PrimeiroTipo { get; set; }
+
+ [Log(true)]
+ [Description("PREFIXO")]
+ public string PrimeiroPrefixo
+ {
+ get
+ {
+ return _primeiroPrefixo?.ToUpper().Trim();
+ }
+ set
+ {
+ _primeiroPrefixo = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TELEFONE")]
+ public string PrimeiroTelefone
+ {
+ get
+ {
+ return _primeiroTelefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _primeiroTelefone = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TIPO TELEFONE")]
+ public TipoTelefone? SegundoTipo { get; set; }
+
+ [Log(true)]
+ [Description("PREFIXO")]
+ public string SegundoPrefixo
+ {
+ get
+ {
+ return _segundoPrefixo?.ToUpper().Trim();
+ }
+ set
+ {
+ _segundoPrefixo = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TELEFONE")]
+ public string SegundoTelefone
+ {
+ get
+ {
+ return _segundoTelefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _segundoTelefone = value;
+ }
+ }
+
+ [Log(true)]
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower().Trim();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ [Log(true)]
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [Log(true)]
+ public bool Ativo { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrEmpty(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 100)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrEmpty(Documento) && !Documento.ValidacaoDocumento())
+ {
+ list.AddValue("Documento", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrimeiroPrefixo) && !PrimeiroPrefixo.ValidacaoPrefixo())
+ {
+ list.AddValue("PrimeiroPrefixo|PRIMEIRO DDD", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrimeiroTelefone) && !PrimeiroTelefone.ValidacaoTelefone())
+ {
+ list.AddValue("PrimeiroTelefone|PRIMEIRO TELEFONE", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(SegundoPrefixo) && !SegundoPrefixo.ValidacaoPrefixo())
+ {
+ list.AddValue("SegundoPrefixo|SEGUNDO DDD", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(SegundoTelefone) && !SegundoTelefone.ValidacaoTelefone())
+ {
+ list.AddValue("SegundoTelefone|SEGUNDO TELEFONE", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(Email) && Email.Length > 100)
+ {
+ list.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrEmpty(Email) && !Email.ValidacaoEmail())
+ {
+ list.AddValue("Email|E-MAIL", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(base.Cep) && !base.Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep|CEP", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(base.Estado) && !base.Estado.ValidacaoEstado())
+ {
+ list.AddValue("Estado|ESTADO", Messages.Invalido);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("CPF", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""),
+ new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "")
+ };
+ object item;
+ if (PrimeiroTipo.HasValue)
+ {
+ TipoTelefone? primeiroTipo = PrimeiroTipo;
+ item = (primeiroTipo.HasValue ? primeiroTipo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ obj.Add(new Tuple<string, string, string>("PRIMEIRO TIPO", (string)item, ""));
+ obj.Add(new Tuple<string, string, string>("PRIMEIRO PREFIXO", string.IsNullOrWhiteSpace(PrimeiroPrefixo) ? "" : PrimeiroPrefixo, ""));
+ obj.Add(new Tuple<string, string, string>("PRIMEIRO TELEFONE", string.IsNullOrWhiteSpace(PrimeiroTelefone) ? "" : PrimeiroTelefone, ""));
+ object item2;
+ if (SegundoTipo.HasValue)
+ {
+ TipoTelefone? primeiroTipo = SegundoTipo;
+ item2 = (primeiroTipo.HasValue ? primeiroTipo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item2 = "";
+ }
+ obj.Add(new Tuple<string, string, string>("SEGUNDO TIPO", (string)item2, ""));
+ obj.Add(new Tuple<string, string, string>("SEGUNDO PREFIXO", string.IsNullOrWhiteSpace(SegundoPrefixo) ? "" : SegundoPrefixo, ""));
+ obj.Add(new Tuple<string, string, string>("SEGUNDO TELEFONE", string.IsNullOrWhiteSpace(SegundoTelefone) ? "" : SegundoTelefone, ""));
+ obj.Add(new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""));
+ obj.Add(new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(base.Cep) ? "" : base.Cep, ""));
+ obj.Add(new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(base.Endereco) ? "" : base.Endereco, ""));
+ obj.Add(new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(base.Numero) ? "" : base.Numero, ""));
+ obj.Add(new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(base.Complemento) ? "" : base.Complemento, ""));
+ obj.Add(new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(base.Bairro) ? "" : base.Bairro, ""));
+ obj.Add(new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(base.Cidade) ? "" : base.Cidade, ""));
+ obj.Add(new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(base.Estado) ? "" : base.Estado, ""));
+ tupleList.Tuples = obj;
+ list.Add(tupleList);
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Expedicao.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Expedicao.cs
new file mode 100644
index 0000000..c91e2de
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Expedicao.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Expedicao : DomainBase
+{
+ public Documento Apolice { get; set; }
+
+ public string Documento { get; set; }
+
+ public string Destino { get; set; }
+
+ public DateTime? DataEnvio { get; set; }
+
+ public DateTime? DataRecebimento { get; set; }
+
+ public string Responsavel { get; set; }
+
+ public long? UsuarioCriacao { get; set; }
+
+ public DateTime? DataCriacao { get; set; }
+
+ public long? UsuarioAlteracao { get; set; }
+
+ public DateTime? DataAlteracao { get; set; }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("DOCUMENTO", Documento, ""),
+ new Tuple<string, string, string>("DESTINO", Destino, ""),
+ new Tuple<string, string, string>("DATA ENVIO", DataEnvio.ToString(), ""),
+ new Tuple<string, string, string>("DATA RECEBIMENTO", DataRecebimento.ToString(), ""),
+ new Tuple<string, string, string>("RESPONSÁVEL", Responsavel, "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Extrato.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Extrato.cs
new file mode 100644
index 0000000..0ddb505
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Extrato.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Extrato : DomainBase, IDomain
+{
+ private string _numero;
+
+ private string _historico;
+
+ private string _observacao;
+
+ public long IdEmpresa { get; set; }
+
+ public Seguradora Seguradora { get; set; }
+
+ public StatusExtrato Status { get; set; }
+
+ public bool Selecionado { get; set; }
+
+ public string Numero
+ {
+ get
+ {
+ return _numero?.ToUpper();
+ }
+ set
+ {
+ _numero = value;
+ }
+ }
+
+ public string Historico
+ {
+ get
+ {
+ return _historico?.ToUpper();
+ }
+ set
+ {
+ _historico = value;
+ }
+ }
+
+ public DateTime? Data { get; set; }
+
+ public DateTime? DataCredito { get; set; }
+
+ public decimal? Bruto { get; set; }
+
+ public decimal? Liquido { get; set; }
+
+ public decimal? Ir { get; set; }
+
+ public decimal? Iss { get; set; }
+
+ public decimal? Outro { get; set; }
+
+ public bool Completo { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public virtual long IdUsuario { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!string.IsNullOrWhiteSpace(Numero) && Numero.Length > 50)
+ {
+ list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (Data.HasValue && (DateTime.Compare(Data.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Data.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Data", string.Format(Messages.DataInvalida));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Fabricante.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Fabricante.cs
new file mode 100644
index 0000000..5058bfe
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Fabricante.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Fabricante : IDomain
+{
+ private string _descricao;
+
+ public int Id { get; set; }
+
+ public string Descricao
+ {
+ get
+ {
+ return _descricao?.ToUpper();
+ }
+ set
+ {
+ _descricao = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!string.IsNullOrWhiteSpace(Descricao) && Descricao.Length > 150)
+ {
+ list.AddValue("Descricao", string.Format(Messages.MaiorQueLimite, 150));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Granizo.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Granizo.cs
new file mode 100644
index 0000000..fa93869
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Granizo.cs
@@ -0,0 +1,162 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Granizo : EnderecoBase, IDomain
+{
+ private string _cultura;
+
+ private string _sitio;
+
+ private string _observacao;
+
+ public Item Item { get; set; }
+
+ public string Cultura
+ {
+ get
+ {
+ return _cultura?.ToUpper();
+ }
+ set
+ {
+ _cultura = value;
+ }
+ }
+
+ public string Sitio
+ {
+ get
+ {
+ return _sitio?.ToUpper();
+ }
+ set
+ {
+ _sitio = value;
+ }
+ }
+
+ public decimal? SubsidioEstadual { get; set; }
+
+ public decimal? SubsidioFederal { get; set; }
+
+ public string Area { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(base.Cep))
+ {
+ list.AddValue("Cep", Messages.Obrigatorio);
+ }
+ else if (!base.Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(Cultura))
+ {
+ list.AddValue("Cultura", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Cultura) && Cultura.Length > 60)
+ {
+ list.AddValue("Cultura", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (string.IsNullOrWhiteSpace(Sitio))
+ {
+ list.AddValue("Sitio", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Sitio) && Sitio.Length > 100)
+ {
+ list.AddValue("Sitio", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (string.IsNullOrWhiteSpace(base.Endereco))
+ {
+ list.AddValue("Endereco", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Numero))
+ {
+ list.AddValue("Numero", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Bairro))
+ {
+ list.AddValue("Bairro", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Cidade))
+ {
+ list.AddValue("Cidade", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Estado))
+ {
+ list.AddValue("Estado", Messages.Obrigatorio);
+ }
+ else if (!base.Estado.ValidacaoEstado())
+ {
+ list.AddValue("Estado", Messages.Invalido);
+ }
+ return list;
+ }
+
+ public static List<TupleList> Log(Item item)
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(item.Granizo.Cep) ? "" : item.Granizo.Cep, ""),
+ new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(item.Granizo.Endereco) ? "" : item.Granizo.Endereco.ToUpper(), ""),
+ new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(item.Granizo.Numero) ? "" : item.Granizo.Numero, ""),
+ new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(item.Granizo.Complemento) ? "" : item.Granizo.Complemento.ToUpper(), ""),
+ new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(item.Granizo.Bairro) ? "" : item.Granizo.Bairro.ToUpper(), ""),
+ new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(item.Granizo.Cidade) ? "" : item.Granizo.Cidade.ToUpper(), ""),
+ new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(item.Granizo.Estado) ? "" : item.Granizo.Estado.ToUpper(), ""),
+ new Tuple<string, string, string>("CULTURA", string.IsNullOrWhiteSpace(item.Granizo.Cultura) ? "" : item.Granizo.Cultura.ToUpper(), ""),
+ new Tuple<string, string, string>("SÍTIO", string.IsNullOrWhiteSpace(item.Granizo.Sitio) ? "" : item.Granizo.Sitio.ToUpper(), ""),
+ new Tuple<string, string, string>("SUBSÍDIO FEDERAL", (!item.Granizo.SubsidioFederal.HasValue) ? "" : item.Granizo.SubsidioFederal?.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("SUBSÍDIO ESTADUAL", (!item.Granizo.SubsidioEstadual.HasValue) ? "" : item.Granizo.SubsidioEstadual?.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(item.Granizo.Observacao) ? "" : item.Granizo.Observacao.ToUpper(), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Item.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Item.cs
new file mode 100644
index 0000000..057fd46
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Item.cs
@@ -0,0 +1,340 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+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 bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ public Documento Documento { get; set; }
+
+ public long? Substituido { get; set; }
+
+ public long? Substituicao { get; set; }
+
+ public long? Endosso { get; set; }
+
+ public int? Ordem { get; set; }
+
+ public long? IdDocumentoCancelado { get; set; }
+
+ public string Descricao
+ {
+ get
+ {
+ return _descricao?.ToUpper();
+ }
+ set
+ {
+ _descricao = value;
+ }
+ }
+
+ public bool Cancelado { get; set; }
+
+ public bool Sinistrado { get; set; }
+
+ public TipoEndosso? TipoEndosso { get; set; }
+
+ public string Status
+ {
+ get
+ {
+ return _status?.ToUpper();
+ }
+ set
+ {
+ _status = value;
+ }
+ }
+
+ public string StatusInclusao
+ {
+ get
+ {
+ return _statusInclusao?.ToUpper();
+ }
+ set
+ {
+ _statusInclusao = value;
+ }
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public IList<ControleSinistro> Sinistros { get; set; }
+
+ public IList<Cobertura> Coberturas { get; set; }
+
+ public Auto Auto { get; set; }
+
+ public Patrimonial Patrimonial { get; set; }
+
+ public Aeronautico Aeronautico { get; set; }
+
+ public RiscosDiversos RiscosDiversos { get; set; }
+
+ public Granizo Granizo { get; set; }
+
+ public Vida Vida { get; set; }
+
+ public Sinistro Sinistro { get; set; }
+
+ public Consorcio Consorcio { get; set; }
+
+ public IList<TitularesVida> Titulares { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate(bool config, bool fabricanteBranco = false)
+ {
+ _config = config;
+ _fabricanteBranco = fabricanteBranco;
+ return Validate();
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!Ordem.HasValue || Ordem == 0)
+ {
+ list.AddValue("Ordem", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(Descricao))
+ {
+ list.AddValue("Descricao", Messages.Obrigatorio);
+ }
+ else if (Descricao.Length > 250)
+ {
+ list.AddValue("Descricao", string.Format(Messages.MaiorQueLimite, 250));
+ }
+ if (Documento == null)
+ {
+ return list;
+ }
+ long id = Documento.Controle.Ramo.Id;
+ if (id <= 38)
+ {
+ long num = id - 1;
+ if ((ulong)num <= 19uL)
+ {
+ switch (num)
+ {
+ case 4L:
+ goto IL_0184;
+ case 0L:
+ case 1L:
+ case 2L:
+ case 14L:
+ case 17L:
+ goto IL_01c5;
+ case 12L:
+ goto IL_022f;
+ case 19L:
+ goto IL_0264;
+ case 5L:
+ case 6L:
+ case 8L:
+ case 9L:
+ goto IL_0299;
+ case 3L:
+ case 7L:
+ case 10L:
+ case 11L:
+ case 13L:
+ case 15L:
+ case 16L:
+ case 18L:
+ goto IL_03f1;
+ }
+ }
+ long num2 = id - 30;
+ if ((ulong)num2 <= 8uL)
+ {
+ switch (num2)
+ {
+ case 7L:
+ break;
+ case 0L:
+ goto IL_01c5;
+ case 8L:
+ goto IL_01fa;
+ case 1L:
+ goto IL_033d;
+ case 6L:
+ goto IL_03c2;
+ default:
+ goto IL_03f1;
+ }
+ goto IL_0184;
+ }
+ }
+ else if (id == 47 || id == 53 || id == 66)
+ {
+ goto IL_0299;
+ }
+ goto IL_03f1;
+ IL_0264:
+ if (Granizo == null)
+ {
+ list.AddValue("Granizo", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(Granizo.Validate());
+ }
+ goto IL_041e;
+ IL_01fa:
+ if (Patrimonial == null)
+ {
+ list.AddValue("Patrimonial", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(Patrimonial.ValidateGarantia());
+ }
+ goto IL_041e;
+ IL_01c5:
+ if (Patrimonial == null)
+ {
+ list.AddValue("Patrimonial", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(Patrimonial.Validate());
+ }
+ goto IL_041e;
+ IL_03f1:
+ if (RiscosDiversos == null)
+ {
+ list.AddValue("RiscosDiversos", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(RiscosDiversos.Validate());
+ }
+ goto IL_041e;
+ IL_033d:
+ if (RiscosDiversos == null)
+ {
+ list.AddValue("RiscosDiversos", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(RiscosDiversos.Validate());
+ }
+ if (Titulares != null && Titulares.Count > 0)
+ {
+ foreach (TitularesVida titulare in Titulares)
+ {
+ list.AddRange(titulare.Validate());
+ }
+ }
+ goto IL_041e;
+ IL_03c2:
+ if (Consorcio == null)
+ {
+ list.AddValue("Consorcio", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(Consorcio.Validate());
+ }
+ goto IL_041e;
+ IL_0299:
+ if (Vida == null)
+ {
+ list.AddValue("Vida", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(Vida.Validate());
+ }
+ if (Titulares != null && Titulares.Count > 0 && Documento.Controle.Ramo.Id != 6)
+ {
+ foreach (TitularesVida titulare2 in Titulares)
+ {
+ list.AddRange(titulare2.Validate());
+ }
+ }
+ goto IL_041e;
+ IL_041e:
+ return list;
+ IL_022f:
+ if (Aeronautico == null)
+ {
+ list.AddValue("Aeronautico", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(Aeronautico.Validate());
+ }
+ goto IL_041e;
+ IL_0184:
+ if (Auto == null)
+ {
+ list.AddValue("Auto", Messages.Obrigatorio);
+ }
+ else
+ {
+ list.AddRange(Auto.Validate(_config, _fabricanteBranco));
+ }
+ goto IL_041e;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/MaisContato.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/MaisContato.cs
new file mode 100644
index 0000000..8860f2b
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/MaisContato.cs
@@ -0,0 +1,245 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class MaisContato : DomainBase, IDomain
+{
+ private string _nome;
+
+ private string _documento;
+
+ private string _identidade;
+
+ private string _prefixo;
+
+ private string _telefone;
+
+ private string _email;
+
+ private string _habilitacao;
+
+ private string _banco;
+
+ private string _agencia;
+
+ private string _conta;
+
+ public Cliente Cliente { get; set; }
+
+ public TipoTelefone? Tipo { get; set; }
+
+ [Log(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ public DateTime? Nascimento { get; set; }
+
+ [Log(true)]
+ public string Documento
+ {
+ get
+ {
+ return _documento?.ToUpper().Trim();
+ }
+ set
+ {
+ _documento = value;
+ }
+ }
+
+ [Log(true)]
+ public string Identidade
+ {
+ get
+ {
+ return _identidade?.ToUpper().Trim();
+ }
+ set
+ {
+ _identidade = value;
+ }
+ }
+
+ [Log(true)]
+ public DateTime? Expedicao { get; set; }
+
+ [Log(true)]
+ public Parentesco? Parentesco { get; set; }
+
+ [Log(true)]
+ public string Prefixo
+ {
+ get
+ {
+ return _prefixo?.ToUpper().Trim();
+ }
+ set
+ {
+ _prefixo = value;
+ }
+ }
+
+ [Log(true)]
+ public string Telefone
+ {
+ get
+ {
+ return _telefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone = value;
+ }
+ }
+
+ [Log(true)]
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower().Trim();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ [Log(true)]
+ public string Habilitacao
+ {
+ get
+ {
+ return _habilitacao?.ToUpper().Trim();
+ }
+ set
+ {
+ _habilitacao = value;
+ }
+ }
+
+ [Log(true)]
+ public DateTime? PrimeiraHabilitacao { get; set; }
+
+ [Log(true)]
+ public Profissao Profissao { get; set; }
+
+ public string Banco
+ {
+ get
+ {
+ return _banco?.ToUpper();
+ }
+ set
+ {
+ _banco = value;
+ }
+ }
+
+ [Log(true)]
+ public string Agencia
+ {
+ get
+ {
+ return _agencia?.ToUpper().Trim();
+ }
+ set
+ {
+ _agencia = value;
+ }
+ }
+
+ [Log(true)]
+ public string Conta
+ {
+ get
+ {
+ return _conta?.ToUpper().Trim();
+ }
+ set
+ {
+ _conta = value;
+ }
+ }
+
+ public bool Excluido { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!string.IsNullOrWhiteSpace(Nome) && Nome.Length > 90)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 90));
+ }
+ if (PrimeiraHabilitacao.HasValue && (DateTime.Compare(PrimeiraHabilitacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(PrimeiraHabilitacao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", string.Format(Messages.DataInvalida));
+ }
+ if (Expedicao.HasValue && (DateTime.Compare(Expedicao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Expedicao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Expedicao|EXPEDIÇÃO", string.Format(Messages.DataInvalida));
+ }
+ if (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Nascimento", string.Format(Messages.DataInvalida));
+ }
+ if (!string.IsNullOrWhiteSpace(Documento) && Documento.Length > 30)
+ {
+ list.AddValue("Documento", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (!string.IsNullOrWhiteSpace(Identidade) && Identidade.Length > 40)
+ {
+ list.AddValue("Identidade", string.Format(Messages.MaiorQueLimite, 40));
+ }
+ if (!string.IsNullOrWhiteSpace(Prefixo) && Prefixo.Length > 6)
+ {
+ list.AddValue("Prefixo", string.Format(Messages.MaiorQueLimite, 6));
+ }
+ if (!string.IsNullOrWhiteSpace(Telefone) && Telefone.Length > 11)
+ {
+ list.AddValue("Telefone", string.Format(Messages.MaiorQueLimite, 11));
+ }
+ if (!string.IsNullOrWhiteSpace(Email) && Email.Length > 80)
+ {
+ list.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 80));
+ }
+ if (!string.IsNullOrWhiteSpace(Habilitacao) && Habilitacao.Length > 40)
+ {
+ list.AddValue("Habilitacao|HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 40));
+ }
+ if (!string.IsNullOrWhiteSpace(Banco) && Banco.Length > 15)
+ {
+ list.AddValue("Banco", string.Format(Messages.MaiorQueLimite, 15));
+ }
+ if (!string.IsNullOrWhiteSpace(Agencia) && Agencia.Length > 15)
+ {
+ list.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 15));
+ }
+ if (!string.IsNullOrWhiteSpace(Conta) && Conta.Length > 20)
+ {
+ list.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 20));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/MetaSeguradora.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/MetaSeguradora.cs
new file mode 100644
index 0000000..842ea93
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/MetaSeguradora.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class MetaSeguradora : DomainBase
+{
+ public Seguradora Seguradora { get; set; }
+
+ public Mes Mes { get; set; }
+
+ public long Ano { get; set; }
+
+ public decimal Valor { get; set; }
+
+ public bool Recorrente { get; set; } = true;
+
+
+ public int TipoCalculo { get; set; } = 1;
+
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("VALOR DA META", Valor.ToString(), ""),
+ new Tuple<string, string, string>("MÊS", Mes.ToString(), ""),
+ new Tuple<string, string, string>("ANO", Ano.ToString(), "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/MetaVendedor.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/MetaVendedor.cs
new file mode 100644
index 0000000..53760f3
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/MetaVendedor.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class MetaVendedor : DomainBase
+{
+ public Vendedor Vendedor { get; set; }
+
+ public Mes Mes { get; set; }
+
+ public long Ano { get; set; }
+
+ public decimal Valor { get; set; }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("VALOR DA META", Valor.ToString("c2"), ""),
+ new Tuple<string, string, string>("MÊS", Mes.ToString(), ""),
+ new Tuple<string, string, string>("ANO", Ano.ToString(), "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Parceiro.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Parceiro.cs
new file mode 100644
index 0000000..2be2390
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Parceiro.cs
@@ -0,0 +1,406 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Parceiro : DomainBase, IDomain
+{
+ private string _nome;
+
+ private string _cep;
+
+ private string _endereco;
+
+ private string _numero;
+
+ private string _complemento;
+
+ private string _bairro;
+
+ private string _cidade;
+
+ private string _uf;
+
+ private string _cgccpf;
+
+ private string _contato;
+
+ private string _email;
+
+ private string _ddd1;
+
+ private string _telefone1;
+
+ private string _ddd2;
+
+ private string _telefone2;
+
+ private string _ddd3;
+
+ private string _telefone3;
+
+ private string _obs;
+
+ public TipoPerda? TipoPerda { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ public string Cep
+ {
+ get
+ {
+ if (_cep == null || !Regex.IsMatch(_cep, "[0-9]+"))
+ {
+ return "";
+ }
+ return _cep.Trim();
+ }
+ set
+ {
+ _cep = value;
+ }
+ }
+
+ [Log(true)]
+ public string Endereco
+ {
+ get
+ {
+ return _endereco?.ToUpper();
+ }
+ set
+ {
+ _endereco = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("NÚMERO")]
+ public string Numero
+ {
+ get
+ {
+ return _numero?.ToUpper();
+ }
+ set
+ {
+ _numero = value;
+ }
+ }
+
+ [Log(true)]
+ public string Complemento
+ {
+ get
+ {
+ return _complemento?.ToUpper();
+ }
+ set
+ {
+ _complemento = value;
+ }
+ }
+
+ [Log(true)]
+ public string Bairro
+ {
+ get
+ {
+ return _bairro?.ToUpper();
+ }
+ set
+ {
+ _bairro = value;
+ }
+ }
+
+ [Log(true)]
+ public string Cidade
+ {
+ get
+ {
+ return _cidade?.ToUpper();
+ }
+ set
+ {
+ _cidade = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("ESTADO")]
+ public string Uf
+ {
+ get
+ {
+ return _uf?.ToUpper().Trim();
+ }
+ set
+ {
+ _uf = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("DOCUMENTO")]
+ public string Cgccpf
+ {
+ get
+ {
+ return _cgccpf?.ToUpper().Trim();
+ }
+ set
+ {
+ _cgccpf = value;
+ }
+ }
+
+ [Log(true)]
+ public string Contato
+ {
+ get
+ {
+ return _contato?.ToUpper();
+ }
+ set
+ {
+ _contato = value;
+ }
+ }
+
+ [Log(true)]
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower().Trim();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("PREFIXO 1")]
+ public string Ddd1
+ {
+ get
+ {
+ return _ddd1?.ToUpper().Trim();
+ }
+ set
+ {
+ _ddd1 = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TELEFONE 1")]
+ public string Telefone1
+ {
+ get
+ {
+ return _telefone1?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone1 = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("PREFIXO 2")]
+ public string Ddd2
+ {
+ get
+ {
+ return _ddd2?.ToUpper().Trim();
+ }
+ set
+ {
+ _ddd2 = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TELEFONE 2")]
+ public string Telefone2
+ {
+ get
+ {
+ return _telefone2?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone2 = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("PREFIXO 3")]
+ public string Ddd3
+ {
+ get
+ {
+ return _ddd3?.ToUpper().Trim();
+ }
+ set
+ {
+ _ddd3 = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TELEFONE 3")]
+ public string Telefone3
+ {
+ get
+ {
+ return _telefone3?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone3 = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("OBSERVAÇÃO")]
+ public string Obs
+ {
+ get
+ {
+ return _obs?.ToUpper();
+ }
+ set
+ {
+ _obs = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!(Nome?.Trim().Split(new char[1] { ' ' }).Length).HasValue)
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 100)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrEmpty(Cgccpf) && !Cgccpf.ValidacaoDocumento())
+ {
+ list.AddValue("Cgccpf", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Ddd1) && !Ddd1.ValidacaoPrefixo())
+ {
+ list.AddValue("Ddd1|PRIMEIRO DDD", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Telefone1) && !Telefone1.ValidacaoTelefone())
+ {
+ list.AddValue("Telefone1|PRIMEIRO TELEFONE", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Ddd2) && !Ddd2.ValidacaoPrefixo())
+ {
+ list.AddValue("Ddd2|SEGUNDO DDD", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Telefone2) && !Telefone2.ValidacaoTelefone())
+ {
+ list.AddValue("Telefone2|SEGUNDO TELEFONE", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Ddd3) && !Ddd3.ValidacaoPrefixo())
+ {
+ list.AddValue("Ddd3|TERCEIRO DDD", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Telefone3) && !Telefone3.ValidacaoTelefone())
+ {
+ list.AddValue("Telefone3|TERCEIRO TELEFONE", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(Email) && Email.Length > 100)
+ {
+ list.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrEmpty(Email) && !Email.ValidacaoEmail())
+ {
+ list.AddValue("Email|E-MAIL", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(Cep) && !Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep|CEP", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(Uf) && !Uf.ValidacaoEstado())
+ {
+ list.AddValue("Uf|ESTADO", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(Numero) && !int.TryParse(Numero, out var _))
+ {
+ list.AddValue("Numero|NÚMERO", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(Numero))
+ {
+ string numero = Numero;
+ if (numero != null && numero.Count() > 5)
+ {
+ list.AddValue("Numero|NÚMERO", Messages.Invalido);
+ }
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("DOCUMENTO", string.IsNullOrWhiteSpace(Cgccpf) ? "" : Cgccpf, ""),
+ new Tuple<string, string, string>("PRIMEIRO PREFIXO", string.IsNullOrWhiteSpace(Ddd1) ? "" : Ddd1, ""),
+ new Tuple<string, string, string>("PRIMEIRO TELEFONE", string.IsNullOrWhiteSpace(Telefone1) ? "" : Telefone1, ""),
+ new Tuple<string, string, string>("SEGUNDO PREFIXO", string.IsNullOrWhiteSpace(Ddd2) ? "" : Ddd2, ""),
+ new Tuple<string, string, string>("SEGUNDO TELEFONE", string.IsNullOrWhiteSpace(Telefone2) ? "" : Telefone2, ""),
+ new Tuple<string, string, string>("TERCEIRO PREFIXO", string.IsNullOrWhiteSpace(Ddd3) ? "" : Ddd3, ""),
+ new Tuple<string, string, string>("TERCEIRO TELEFONE", string.IsNullOrWhiteSpace(Telefone3) ? "" : Telefone3, ""),
+ new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""),
+ new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(Cep) ? "" : Cep, ""),
+ new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(Endereco) ? "" : Endereco, ""),
+ new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(Numero) ? "" : Numero, ""),
+ new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(Complemento) ? "" : Complemento, ""),
+ new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(Bairro) ? "" : Bairro, ""),
+ new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(Cidade) ? "" : Cidade, ""),
+ new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(Uf) ? "" : Uf, "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Parcela.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Parcela.cs
new file mode 100644
index 0000000..00fbedf
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Parcela.cs
@@ -0,0 +1,389 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Parcela : DomainBase, IDomain
+{
+ private string _extrato;
+
+ private string _fatura;
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("STATUS PAGAMENTO")]
+ private StatusPagamento? _statusPagamento;
+
+ private bool _percentualmaiorque100;
+
+ private bool _alteracao;
+
+ private bool _permitirVencimentoMenor;
+
+ private bool _permitirVencimentoMaior;
+
+ public bool Baixando { get; set; }
+
+ public long IdEmpresa { get; set; }
+
+ [Log(false)]
+ [ForceLog(true)]
+ public Documento Documento { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("PARCELA")]
+ public int NumeroParcela { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("VENCIMENTO")]
+ public DateTime Vencimento { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("RECEBIMENTO")]
+ public DateTime? DataRecebimento { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("QUITAÇÃO")]
+ public DateTime? DataQuitacao { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("CONTROLE")]
+ public DateTime? DataControle { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("CRÉDITO")]
+ public DateTime? DataCredito { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("VALOR")]
+ public decimal Valor { get; set; }
+
+ public decimal ValorPago { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("VALOR PARCELA EXTRATO")]
+ public decimal ValorRealizado { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("COMISSÃO")]
+ public decimal Comissao { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("VALOR DE COMISSÃO")]
+ public decimal ValorComissao { get; set; }
+
+ public string Observacao { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("EXTRATO")]
+ public string Extrato
+ {
+ get
+ {
+ return _extrato?.ToUpper();
+ }
+ set
+ {
+ _extrato = value;
+ }
+ }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("IR")]
+ public decimal Irr { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("ISS")]
+ public decimal Iss { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("OUTROS")]
+ public decimal Outros { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("DESCONTO")]
+ public decimal Desconto { get; set; }
+
+ public decimal ValorExtrato { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("COMISSÃO LÍQUIDA")]
+ public decimal ValorComDesconto { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("TIPO DA PARCELA")]
+ public SubTipo SubTipo { get; set; }
+
+ public TipoPagamento TipoPagamento { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("VALOR LÍQUIDO FATURA")]
+ public decimal ValorLiquidoFatura { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("FATURA")]
+ public string Fatura
+ {
+ get
+ {
+ return _fatura?.ToUpper().Trim();
+ }
+ set
+ {
+ _fatura = value;
+ }
+ }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("INÍCIO FATURA")]
+ public DateTime? VigenciaIncial { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("FIM FATURA")]
+ public DateTime? VigenciaFinal { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ [Description("EMISSÃO FATURA")]
+ public DateTime? Emissao { get; set; }
+
+ [Log(false)]
+ public DateTime? DataCriacao { get; set; }
+
+ [Log(false)]
+ public long UsuarioCriacao { get; set; }
+
+ [Log(false)]
+ public StatusPagamento? StatusPagamento
+ {
+ get
+ {
+ return _statusPagamento;
+ }
+ set
+ {
+ _statusPagamento = value.GetValueOrDefault();
+ }
+ }
+
+ [Log(false)]
+ public long IdParcelaPendente { get; set; }
+
+ [Log(false)]
+ public ObservableCollection<VendedorParcela> Vendedores { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate(bool permitirVencimentoMenor, bool permitirVencimentoMaior, bool alteracao = false, bool percentualmaiorque100 = false)
+ {
+ _permitirVencimentoMenor = permitirVencimentoMenor;
+ _permitirVencimentoMaior = permitirVencimentoMaior;
+ _alteracao = alteracao;
+ _percentualmaiorque100 = percentualmaiorque100;
+ return Validate();
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Emissao.HasValue && (DateTime.Compare(Emissao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Emissao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Emissao|EMISSÃO", string.Format(Messages.DataInvalida));
+ }
+ if (VigenciaFinal.HasValue && (DateTime.Compare(VigenciaFinal.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(VigenciaFinal.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("VigenciaFinal|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida));
+ }
+ if (VigenciaIncial.HasValue && (DateTime.Compare(VigenciaIncial.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(VigenciaIncial.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("VigenciaIncial|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida));
+ }
+ if (DataCredito.HasValue && (DateTime.Compare(DataCredito.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataCredito.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataCredito|DATA DE CRÉDITO", string.Format(Messages.DataInvalida));
+ }
+ if (DataRecebimento.HasValue && (DateTime.Compare(DataRecebimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataRecebimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataRecebimento|DATA RECEBIMENTO", string.Format(Messages.DataInvalida));
+ }
+ if (DateTime.Compare(Vencimento, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Vencimento, new DateTime(9999, 12, 31)) > 0)
+ {
+ list.AddValue("Vencimento", string.Format(Messages.DataInvalida));
+ }
+ if (NumeroParcela == 0)
+ {
+ list.AddValue("NumeroParcela|NÚMERO DA PARCELA", Messages.Obrigatorio);
+ }
+ if (Valor == 0m)
+ {
+ list.AddValue("Valor", Messages.Obrigatorio);
+ }
+ if (Comissao == 0m && Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura)
+ {
+ list.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio);
+ }
+ if (Comissao > 100m && (Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura || !_percentualmaiorque100))
+ {
+ list.AddValue("Comissao|% COMISSÃO", "MAIOR QUE 100%");
+ }
+ if (DataRecebimento.HasValue && !DataCredito.HasValue)
+ {
+ list.AddValue("DataCredito|DATA DE CRÉDITO", Messages.Obrigatorio);
+ }
+ if (DataCredito.HasValue && !DataRecebimento.HasValue)
+ {
+ list.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.Obrigatorio);
+ }
+ if (Baixando)
+ {
+ if (!DataRecebimento.HasValue)
+ {
+ list.AddValue("DataRecebimento|DATA DE RECEBIMENTO", Messages.Obrigatorio);
+ }
+ if (!DataCredito.HasValue)
+ {
+ list.AddValue("DataCredito|DATA DE CRÉDITO", Messages.Obrigatorio);
+ }
+ }
+ if (!_alteracao && (DataCredito.HasValue || DataRecebimento.HasValue) && ValorRealizado == 0m)
+ {
+ list.AddValue("ValorRealizado|VALOR REALIZADO", Messages.Obrigatorio);
+ }
+ if (Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && SubTipo == SubTipo.ParcelaNormal)
+ {
+ if (Documento.NumeroParcelas == 1m)
+ {
+ decimal num = Math.Abs(Valor);
+ decimal value = Math.Abs(Documento.PremioTotal);
+ decimal? obj = Documento.Controle?.Seguradora?.Tolerancia;
+ decimal? num2 = (decimal?)value + obj;
+ if ((num > num2.GetValueOrDefault()) & num2.HasValue)
+ {
+ list.AddValue("Valor", Messages.ValorParcelaInvalido);
+ }
+ }
+ else
+ {
+ decimal num3 = Math.Abs(Valor);
+ decimal value2 = Math.Abs(Documento.PremioTotal);
+ decimal? obj2 = Documento.Controle?.Seguradora?.Tolerancia;
+ decimal? num2 = (decimal?)value2 + obj2 - (decimal?)Documento.NumeroParcelas;
+ if ((num3 > num2.GetValueOrDefault()) & num2.HasValue)
+ {
+ decimal valor = Valor;
+ num2 = Documento.Controle?.Seguradora?.Tolerancia;
+ if ((valor > num2.GetValueOrDefault()) & num2.HasValue)
+ {
+ list.AddValue("Valor", Messages.ValorParcelaInvalido);
+ }
+ }
+ }
+ }
+ if (Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && SubTipo == SubTipo.ParcelaNormal && Documento.Parcelas != null && Documento.NumeroParcelas == (decimal)Documento.Parcelas.Count && Math.Abs(Documento.Parcelas.Where((Parcela x) => x.SubTipo == SubTipo.ParcelaNormal).Sum((Parcela x) => x.Valor)) > Math.Abs(Documento.PremioTotal) + (Documento.Controle?.Seguradora?.Tolerancia).GetValueOrDefault() && (decimal)NumeroParcela == Documento.NumeroParcelas)
+ {
+ list.AddValue("Valor", Messages.ValorParcelaInvalido);
+ }
+ if (!_permitirVencimentoMaior && Documento.Vigencia2.HasValue)
+ {
+ DateTime vencimento = Vencimento;
+ DateTime? vigencia = Documento.Vigencia2;
+ if (vigencia.HasValue && vencimento > vigencia.GetValueOrDefault() && Documento.Controle.Ramo.Id != 23)
+ {
+ list.AddValue("Vencimento", Messages.VencimentoMaior);
+ }
+ }
+ if (!_permitirVencimentoMenor && ((Documento.Vigencia1 > DateTime.MinValue && NumeroParcela == 1 && Vencimento < Documento.Vigencia1.AddDays(-30.0)) || (NumeroParcela != 1 && Vencimento < Documento.Vigencia1)))
+ {
+ list.AddValue("Vencimento", Messages.VencimentoMenor);
+ }
+ if (Documento == null || Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura)
+ {
+ return list;
+ }
+ if (string.IsNullOrWhiteSpace(Fatura))
+ {
+ list.AddValue("Fatura", Messages.Obrigatorio);
+ }
+ else if (Fatura.Length > 50)
+ {
+ list.AddValue("Fatura", string.Format(Messages.MaiorQueLimite, 255));
+ }
+ if (ValorLiquidoFatura == 0m)
+ {
+ list.AddValue("ValorLiquidoFatura|VALOR LÍQUIDO DA FATURA", Messages.Obrigatorio);
+ }
+ if (!VigenciaIncial.HasValue)
+ {
+ list.AddValue("VigenciaIncial|VIGÊNCIA INICIAL", Messages.Obrigatorio);
+ }
+ if (!VigenciaFinal.HasValue)
+ {
+ list.AddValue("VigenciaFinal|VIGÊNCIA FINAL", Messages.Obrigatorio);
+ }
+ if (!Emissao.HasValue)
+ {
+ list.AddValue("Emissao|EMISSÃO", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Extrato) && Extrato.Length > 50)
+ {
+ list.AddValue("Extrato", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (VigenciaFinal.HasValue && Documento.Vigencia2.HasValue)
+ {
+ DateTime? vigencia = VigenciaFinal;
+ DateTime? vigencia2 = Documento.Vigencia2;
+ if ((vigencia.HasValue & vigencia2.HasValue) && vigencia.GetValueOrDefault() > vigencia2.GetValueOrDefault() && !_permitirVencimentoMaior)
+ {
+ list.AddValue("VigenciaFinal|VIGÊNCIA FINAL", Messages.VencimentoMaior);
+ }
+ }
+ if (!DataRecebimento.HasValue && ValorComissao != 0m && Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Fatura)
+ {
+ list.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.Obrigatorio);
+ }
+ if (Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && Documento.Parcelas != null && Documento.Parcelas.Any((Parcela x) => x.NumeroParcela < NumeroParcela && !x.DataRecebimento.HasValue))
+ {
+ list.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.BaixaInvalida);
+ }
+ if (DataRecebimento.HasValue && ValorComissao != 0m && Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Fatura)
+ {
+ decimal num4 = ((ValorExtrato == 0m) ? ValorLiquidoFatura : ValorExtrato);
+ if (((num4 > 0m) ? num4.CompareTo(ValorComissao) : ValorComissao.CompareTo(num4)) < 0)
+ {
+ list.AddValue("ValorComissao|RECEBIDO", "VALOR RECEBIDO MAIOR QUE VALOR PARCELA");
+ }
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Parcelas.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Parcelas.cs
new file mode 100644
index 0000000..ca2c52e
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Parcelas.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Parcelas : DomainBase
+{
+ public TipoRecebimento? TipoRecebimento { get; set; }
+
+ public ObservableCollection<Parcela> ParcelasList { get; set; }
+
+ public List<TupleList> Log(bool restricaoComissao, bool restricaoComissaoPorcentagem)
+ {
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("PARCELAS$", "", "")
+ };
+ if (ParcelasList != null)
+ {
+ foreach (Parcela parcelas in ParcelasList)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" PARCELA {parcelas.NumeroParcela}$", "", ""));
+ if (TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Fatura)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" FATURA", string.IsNullOrWhiteSpace(parcelas.Fatura) ? "" : parcelas.Fatura.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" INÍCIO", (!parcelas.VigenciaIncial.HasValue) ? "" : parcelas.VigenciaIncial?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FIM", (!parcelas.VigenciaFinal.HasValue) ? "" : parcelas.VigenciaFinal?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" EMISSÃO", (!parcelas.Emissao.HasValue) ? "" : parcelas.Emissao?.ToShortDateString(), ""));
+ }
+ observableCollection.Add(new Tuple<string, string, string>(" VENCIMENTO", parcelas.Vencimento.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" RECEBIMENTO", (!parcelas.DataRecebimento.HasValue) ? "" : parcelas.DataRecebimento?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" QUITAÇÃO", (!parcelas.DataQuitacao.HasValue) ? "" : parcelas.DataQuitacao?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" DATA PARCELA CONTROLE", (!parcelas.DataControle.HasValue) ? "" : parcelas.DataControle?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" VALOR", parcelas.Valor.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" LÍQUIDO", parcelas.ValorLiquidoFatura.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ if (!restricaoComissao)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" REALIZADO", parcelas.ValorRealizado.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" COMISSÃO", (parcelas.Comissao / 100m).ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" RECEBIDO", parcelas.ValorComissao.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ else if (restricaoComissaoPorcentagem)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" REALIZADO", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" COMISSÃO", (parcelas.Comissao / 100m).ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" RECEBIDO", "", ""));
+ }
+ else
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" REALIZADO", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" COMISSÃO", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" RECEBIDO", "", ""));
+ }
+ }
+ }
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = observableCollection
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Patrimonial.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Patrimonial.cs
new file mode 100644
index 0000000..5779e69
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Patrimonial.cs
@@ -0,0 +1,451 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Patrimonial : EnderecoBase, IDomain
+{
+ private string _bens;
+
+ private string _imobiliaria;
+
+ private string _locatario;
+
+ private string _locatario2;
+
+ private string _locatario3;
+
+ private string _cpfLocatario1;
+
+ private string _cpfLocatario2;
+
+ private string _cpfLocatario3;
+
+ private string _contato;
+
+ private string _prefixo;
+
+ private string _telefone;
+
+ private TipoMoradia _tipoResidencia;
+
+ public Item Item { get; set; }
+
+ public string Bens
+ {
+ get
+ {
+ return _bens?.ToUpper();
+ }
+ set
+ {
+ _bens = value;
+ }
+ }
+
+ public TipoMoradia TipoMoradia
+ {
+ get
+ {
+ return _tipoResidencia;
+ }
+ set
+ {
+ _tipoResidencia = value;
+ }
+ }
+
+ public Utilizacao? Utilizacao { get; set; }
+
+ public string Imobiliaria
+ {
+ get
+ {
+ return _imobiliaria?.ToUpper();
+ }
+ set
+ {
+ _imobiliaria = value;
+ }
+ }
+
+ public string Contato
+ {
+ get
+ {
+ return _contato?.ToUpper();
+ }
+ set
+ {
+ _contato = value;
+ }
+ }
+
+ public TipoTelefone? Tipo { get; set; }
+
+ public string Prefixo
+ {
+ get
+ {
+ return _prefixo?.ToUpper().Trim();
+ }
+ set
+ {
+ _prefixo = value;
+ }
+ }
+
+ public string Telefone
+ {
+ get
+ {
+ return _telefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone = value;
+ }
+ }
+
+ public string Locatario1
+ {
+ get
+ {
+ return _locatario?.ToUpper();
+ }
+ set
+ {
+ _locatario = value;
+ }
+ }
+
+ public string CpfLocatario1
+ {
+ get
+ {
+ return _cpfLocatario1?.ToUpper();
+ }
+ set
+ {
+ _cpfLocatario1 = value;
+ }
+ }
+
+ public string PrefixoLocatario1 { get; set; }
+
+ public string TelefoneLocatario1 { get; set; }
+
+ public string Locatario2
+ {
+ get
+ {
+ return _locatario2?.ToUpper();
+ }
+ set
+ {
+ _locatario2 = value;
+ }
+ }
+
+ public string CpfLocatario2
+ {
+ get
+ {
+ return _cpfLocatario2?.ToUpper();
+ }
+ set
+ {
+ _cpfLocatario2 = value;
+ }
+ }
+
+ public string PrefixoLocatario2 { get; set; }
+
+ public string TelefoneLocatario2 { get; set; }
+
+ public string Locatario3
+ {
+ get
+ {
+ return _locatario3?.ToUpper();
+ }
+ set
+ {
+ _locatario3 = value;
+ }
+ }
+
+ public string CpfLocatario3
+ {
+ get
+ {
+ return _cpfLocatario3?.ToUpper();
+ }
+ set
+ {
+ _cpfLocatario3 = value;
+ }
+ }
+
+ public string PrefixoLocatario3 { get; set; }
+
+ public string TelefoneLocatario3 { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!string.IsNullOrWhiteSpace(Imobiliaria) && Imobiliaria.Length > 60)
+ {
+ list.AddValue("Imobiliaria", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!string.IsNullOrWhiteSpace(Locatario1) && Locatario1.Length > 100)
+ {
+ list.AddValue("Locatario1", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrWhiteSpace(Locatario2) && Locatario2.Length > 100)
+ {
+ list.AddValue("Locatario2", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrWhiteSpace(Locatario3) && Locatario3.Length > 100)
+ {
+ list.AddValue("Locatario3", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrWhiteSpace(CpfLocatario1) && !CpfLocatario1.ValidacaoDocumento())
+ {
+ list.AddValue("CpfLocatario1", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(CpfLocatario2) && !CpfLocatario2.ValidacaoDocumento())
+ {
+ list.AddValue("CpfLocatario2", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(CpfLocatario3) && !CpfLocatario3.ValidacaoDocumento())
+ {
+ list.AddValue("CpfLocatario3", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Contato) && Contato.Length > 60)
+ {
+ list.AddValue("Contato", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!string.IsNullOrWhiteSpace(Prefixo) && !Prefixo.ValidacaoPrefixo())
+ {
+ list.AddValue("Prefixo", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(Telefone) && !Telefone.ValidacaoTelefone())
+ {
+ list.AddValue("Telefone", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrefixoLocatario1) && !PrefixoLocatario1.ValidacaoPrefixo())
+ {
+ list.AddValue("PrefixoLocatario1", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(TelefoneLocatario1) && !TelefoneLocatario1.ValidacaoTelefone())
+ {
+ list.AddValue("TelefoneLocatario1", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrefixoLocatario2) && !PrefixoLocatario2.ValidacaoPrefixo())
+ {
+ list.AddValue("PrefixoLocatario2", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(TelefoneLocatario2) && !TelefoneLocatario2.ValidacaoTelefone())
+ {
+ list.AddValue("TelefoneLocatario2", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrefixoLocatario3) && !PrefixoLocatario3.ValidacaoPrefixo())
+ {
+ list.AddValue("PrefixoLocatario3", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(TelefoneLocatario3) && !TelefoneLocatario3.ValidacaoTelefone())
+ {
+ list.AddValue("TelefoneLocatario3", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(base.Bairro) && base.Bairro.Length > 60)
+ {
+ list.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!string.IsNullOrWhiteSpace(base.Cidade) && base.Cidade.Length > 30)
+ {
+ list.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (!string.IsNullOrWhiteSpace(base.Numero) && base.Numero.Length > 10)
+ {
+ list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 10));
+ }
+ if (string.IsNullOrWhiteSpace(base.Cep))
+ {
+ list.AddValue("Cep", Messages.Obrigatorio);
+ }
+ else if (!base.Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(base.Endereco))
+ {
+ list.AddValue("Endereco", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Numero))
+ {
+ list.AddValue("Numero", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Bairro))
+ {
+ list.AddValue("Bairro", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Cidade))
+ {
+ list.AddValue("Cidade", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(base.Estado))
+ {
+ list.AddValue("Estado", Messages.Obrigatorio);
+ }
+ else if (!base.Estado.ValidacaoEstado())
+ {
+ list.AddValue("Estado", Messages.Invalido);
+ }
+ return list;
+ }
+
+ public List<KeyValuePair<string, string>> ValidateGarantia()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!string.IsNullOrWhiteSpace(Locatario1) && Locatario1.Length > 100)
+ {
+ list.AddValue("Locatario1", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrWhiteSpace(Locatario2) && Locatario2.Length > 100)
+ {
+ list.AddValue("Locatario2", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrWhiteSpace(Locatario3) && Locatario3.Length > 100)
+ {
+ list.AddValue("Locatario3", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrWhiteSpace(CpfLocatario1) && !CpfLocatario1.ValidacaoDocumento())
+ {
+ list.AddValue("CpfLocatario1", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(CpfLocatario2) && !CpfLocatario2.ValidacaoDocumento())
+ {
+ list.AddValue("CpfLocatario2", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(CpfLocatario3) && !CpfLocatario3.ValidacaoDocumento())
+ {
+ list.AddValue("CpfLocatario3", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrefixoLocatario1) && !PrefixoLocatario1.ValidacaoPrefixo())
+ {
+ list.AddValue("PrefixoLocatario1", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(TelefoneLocatario1) && !TelefoneLocatario1.ValidacaoTelefone())
+ {
+ list.AddValue("TelefoneLocatario1", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrefixoLocatario2) && !PrefixoLocatario2.ValidacaoPrefixo())
+ {
+ list.AddValue("PrefixoLocatario2", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(TelefoneLocatario2) && !TelefoneLocatario2.ValidacaoTelefone())
+ {
+ list.AddValue("TelefoneLocatario2", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(PrefixoLocatario3) && !PrefixoLocatario3.ValidacaoPrefixo())
+ {
+ list.AddValue("PrefixoLocatario3", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(TelefoneLocatario3) && !TelefoneLocatario3.ValidacaoTelefone())
+ {
+ list.AddValue("TelefoneLocatario3", Messages.Invalido);
+ }
+ return list;
+ }
+
+ public static List<TupleList> Log(Item item)
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(item.Patrimonial.Cep) ? "" : item.Patrimonial.Cep, ""),
+ new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(item.Patrimonial.Endereco) ? "" : item.Patrimonial.Endereco.ToUpper(), ""),
+ new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(item.Patrimonial.Numero) ? "" : item.Patrimonial.Numero, ""),
+ new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(item.Patrimonial.Complemento) ? "" : item.Patrimonial.Complemento.ToUpper(), ""),
+ new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(item.Patrimonial.Bairro) ? "" : item.Patrimonial.Bairro.ToUpper(), ""),
+ new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(item.Patrimonial.Cidade) ? "" : item.Patrimonial.Cidade.ToUpper(), ""),
+ new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(item.Patrimonial.Estado) ? "" : item.Patrimonial.Estado.ToUpper(), ""),
+ new Tuple<string, string, string>("BENS", string.IsNullOrWhiteSpace(item.Patrimonial.Bens) ? "" : item.Patrimonial.Bens.ToUpper(), ""),
+ new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(item.Patrimonial.Item.Observacao) ? "" : item.Patrimonial.Item.Observacao.ToUpper(), "")
+ }
+ }
+ };
+ if (item.Documento.Controle.Ramo.Id == 15)
+ {
+ ObservableCollection<Tuple<string, string, string>> tuples = list[0].Tuples;
+ object item2;
+ if (item.Patrimonial.Utilizacao.HasValue)
+ {
+ Utilizacao? utilizacao = item.Patrimonial.Utilizacao;
+ item2 = (utilizacao.HasValue ? utilizacao.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item2 = "";
+ }
+ tuples.Add(new Tuple<string, string, string>("UTILIZAÇÃO", (string)item2, ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("IMOBILIÁRIA", string.IsNullOrWhiteSpace(item.Patrimonial.Imobiliaria) ? "" : item.Patrimonial.Imobiliaria.ToUpper(), ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("CONTATO", string.IsNullOrWhiteSpace(item.Patrimonial.Contato) ? "" : item.Patrimonial.Contato.ToUpper(), ""));
+ ObservableCollection<Tuple<string, string, string>> tuples2 = list[0].Tuples;
+ object item3;
+ if (item.Patrimonial.Tipo.HasValue)
+ {
+ TipoTelefone? tipo = item.Patrimonial.Tipo;
+ item3 = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item3 = "";
+ }
+ tuples2.Add(new Tuple<string, string, string>("TIPO TELEFONE", (string)item3, ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("PREFIXO", string.IsNullOrWhiteSpace(item.Patrimonial.Prefixo) ? "" : item.Patrimonial.Prefixo.ToUpper(), ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(item.Patrimonial.Telefone) ? "" : item.Patrimonial.Telefone.ToUpper(), ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("LOCATÁRIO 1", string.IsNullOrWhiteSpace(item.Patrimonial.Locatario1) ? "" : item.Patrimonial.Locatario1.ToUpper(), ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("PREFIXO LOCATÁRIO 1", string.IsNullOrWhiteSpace(item.Patrimonial.PrefixoLocatario1) ? "" : item.Patrimonial.PrefixoLocatario1, ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("NÚMERO LOCATÁRIO 1", string.IsNullOrWhiteSpace(item.Patrimonial.TelefoneLocatario1) ? "" : item.Patrimonial.TelefoneLocatario1, ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("LOCATÁRIO 2", string.IsNullOrWhiteSpace(item.Patrimonial.Locatario2) ? "" : item.Patrimonial.Locatario2.ToUpper(), ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("PREFIXO LOCATÁRIO 2", string.IsNullOrWhiteSpace(item.Patrimonial.PrefixoLocatario2) ? "" : item.Patrimonial.PrefixoLocatario2, ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("NÚMERO LOCATÁRIO 2", string.IsNullOrWhiteSpace(item.Patrimonial.TelefoneLocatario2) ? "" : item.Patrimonial.TelefoneLocatario2, ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("LOCATÁRIO 3", string.IsNullOrWhiteSpace(item.Patrimonial.Locatario3) ? "" : item.Patrimonial.Locatario3.ToUpper(), ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("PREFIXO LOCATÁRIO 3", string.IsNullOrWhiteSpace(item.Patrimonial.PrefixoLocatario3) ? "" : item.Patrimonial.PrefixoLocatario3, ""));
+ list[0].Tuples.Add(new Tuple<string, string, string>("NÚMERO LOCATÁRIO 3", string.IsNullOrWhiteSpace(item.Patrimonial.TelefoneLocatario3) ? "" : item.Patrimonial.TelefoneLocatario3, ""));
+ }
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs
new file mode 100644
index 0000000..ed3772c
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs
@@ -0,0 +1,147 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Perfil : DomainBase, IDomain
+{
+ private string _nome;
+
+ private string _cepCirculacao;
+
+ private string _cepPernoite;
+
+ public Cliente Cliente { get; set; }
+
+ public Controle Controle { get; set; }
+
+ public bool? UsoProfissional { get; set; }
+
+ public bool? SeguroVida { get; set; }
+
+ public Antifurto? AntiFurto { get; set; }
+
+ public bool? EstenderCobertura { get; set; }
+
+ public int? VeiculoResidencia { get; set; }
+
+ public string Cpf { get; set; }
+
+ public string Habilitacao { get; set; }
+
+ public DateTime? Nascimento { get; set; }
+
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ public Relacao? Relacao { get; set; }
+
+ public GaragemTrabalhoEstudo? GaragemTrabalho { get; set; }
+
+ public GaragemTrabalhoEstudo? GaragemEstudo { get; set; }
+
+ public GaragemResidencia? GaragemResidencia { get; set; }
+
+ public TipoResidencia? TipoResidencia { get; set; }
+
+ public UsoDependetes? UsoDependentes { get; set; }
+
+ public DistanciaTrabalho? DistanciaResidenciaTrabalho { get; set; }
+
+ public Ocupacao? Ocupacao { get; set; }
+
+ public Sexo? Sexo { get; set; }
+
+ public TempoHabilitacao? TempoHabilitacao { get; set; }
+
+ public EstadoCivil? EstadoCivil { get; set; }
+
+ public string KmMensal { get; set; }
+
+ public string CepPernoite
+ {
+ get
+ {
+ return _cepPernoite;
+ }
+ set
+ {
+ _cepPernoite = value;
+ }
+ }
+
+ public string CepCirculacao
+ {
+ get
+ {
+ return _cepCirculacao;
+ }
+ set
+ {
+ _cepCirculacao = value;
+ }
+ }
+
+ public bool? Isencao { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Nascimento", string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 255)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 255));
+ }
+ string kmMensal = KmMensal;
+ if (kmMensal != null && kmMensal.Length > 5)
+ {
+ list.AddValue("KmMensal", string.Format(Messages.MaiorQueLimite, 5));
+ }
+ string habilitacao = Habilitacao;
+ if (habilitacao != null && habilitacao.Length > 15)
+ {
+ list.AddValue("Habilitacao", string.Format(Messages.MaiorQueLimite, 15));
+ }
+ if (!Relacao.HasValue)
+ {
+ list.AddValue("Relacao", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Cpf) && !Cpf.ValidacaoDocumento())
+ {
+ list.AddValue("Cpf", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(CepPernoite) && !CepPernoite.FormataCep().ValidacaoCep())
+ {
+ list.AddValue("CepPernoite", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(CepCirculacao) && !CepCirculacao.FormataCep().ValidacaoCep())
+ {
+ list.AddValue("CepCirculacao", Messages.Invalido);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/PerfilEmpresa.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/PerfilEmpresa.cs
new file mode 100644
index 0000000..6b40111
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/PerfilEmpresa.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class PerfilEmpresa : DomainBase, IDomain
+{
+ public Cliente Cliente { get; set; }
+
+ public Controle Controle { get; set; }
+
+ public TipoPavimentacao? TipoPavimento { get; set; }
+
+ public DateTime? AnoConstrucao { get; set; }
+
+ public TipoConstrucao? TipoConstrucao { get; set; }
+
+ public Localizacao? Localizacao { get; set; }
+
+ public string EquipamentoSeguranca { get; set; }
+
+ public string EquipamentoIncendio { get; set; }
+
+ public AtividadeEmpresa? AtividadeEmpresa { get; set; }
+
+ public string AtividadePrincipal { get; set; }
+
+ public bool? ExclusivoDeposito { get; set; }
+
+ public bool? DivisaTerrenoBaldio { get; set; }
+
+ public bool? PatrimonioHistorio { get; set; }
+
+ public bool? PossuiTelhado { get; set; }
+
+ public bool? CaixasEletronicos { get; set; }
+
+ public bool? Isopainel { get; set; }
+
+ public bool? ConstrucaoReforma { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (AtividadeEmpresa == Gestor.Model.Common.AtividadeEmpresa.Outro && (AtividadePrincipal == null || AtividadePrincipal == ""))
+ {
+ list.AddValue("Atividade Empresa", Messages.Invalido);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoArquivoDigital.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoArquivoDigital.cs
new file mode 100644
index 0000000..697257d
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoArquivoDigital.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Validation;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class PermissaoArquivoDigital : DomainBase
+{
+ public Usuario Usuario { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ public TipoArquivoDigital Tela { get; set; }
+
+ [Log(true)]
+ public bool Consultar { get; set; }
+
+ [Log(true)]
+ public bool Incluir { get; set; }
+
+ [Log(true)]
+ public bool Excluir { get; set; }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("$TELA", Tela.GetDescription(), ""),
+ new Tuple<string, string, string>(" INCLUIR", Incluir ? "SIM" : "NÃO", ""),
+ new Tuple<string, string, string>(" EXCLUIR", Excluir ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoUsuario.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoUsuario.cs
new file mode 100644
index 0000000..f2e42a3
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/PermissaoUsuario.cs
@@ -0,0 +1,26 @@
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class PermissaoUsuario : DomainBase
+{
+ public Usuario Usuario { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ public TipoTela Tela { get; set; }
+
+ [Log(true)]
+ public bool Consultar { get; set; }
+
+ [Log(true)]
+ public bool Incluir { get; set; }
+
+ [Log(true)]
+ public bool Alterar { get; set; }
+
+ [Log(true)]
+ public bool Excluir { get; set; }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Produto.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Produto.cs
new file mode 100644
index 0000000..e9c1e78
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Produto.cs
@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Produto : DomainBase, IDomain, INotifyPropertyChanged
+{
+ private bool _selecionado;
+
+ private string _nome;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("PRODUTO")]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ public bool Ativo { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 60)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs
new file mode 100644
index 0000000..613fddc
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs
@@ -0,0 +1,210 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Prospeccao : DomainBase, IDomain
+{
+ private string _nome;
+
+ private string _item;
+
+ private string _observacao;
+
+ public long IdEmpresa { get; set; }
+
+ [Description("CLIENTE")]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Description("DOCUMENTO")]
+ public string Documento { get; set; }
+
+ [Tipo("DATA?")]
+ [Description("NASCIMENTO")]
+ public DateTime? Nascimento { get; set; }
+
+ [Description("DDD")]
+ public string Prefixo1 { get; set; }
+
+ [Description("TELEFONE")]
+ public string Telefone1 { get; set; }
+
+ [Description("DDD")]
+ public string Prefixo2 { get; set; }
+
+ [Description("TELEFONE")]
+ public string Telefone2 { get; set; }
+
+ [Description("E-MAIL")]
+ public string Email { get; set; }
+
+ [Tipo("DATA?")]
+ [Description("VIGÊNCIA FINAL")]
+ public DateTime? VigenciaFinal { get; set; }
+
+ [Description("ITEM")]
+ public string Item
+ {
+ get
+ {
+ return _item?.ToUpper();
+ }
+ set
+ {
+ _item = value;
+ }
+ }
+
+ public Vendedor Vendedor { get; set; }
+
+ [Tipo("ENUM?")]
+ [Description("STATUS")]
+ public StatusProspeccao? Status { get; set; }
+
+ [Description("STATUS PERSONALIZADO")]
+ public StatusDeProspeccao StatusPersonalizado { get; set; }
+
+ [Description("TIPO")]
+ public string Tipo { get; set; }
+
+ [Description("VALOR")]
+ public decimal Valor { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public bool Excluido { get; set; }
+
+ public Tarefa Tarefa { get; set; }
+
+ public bool CriarTarefa { get; set; }
+
+ public bool AbrirTarefa { get; set; }
+
+ public bool Renovacao { get; set; }
+
+ public DateTime? DataCriacao { get; set; }
+
+ public long UsuarioCriacao { get; set; }
+
+ public Produto Produto { get; set; }
+
+ public List<ArquivoDigital> Anexos { get; set; }
+
+ public Ramo Ramo { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Nascimento", string.Format(Messages.DataInvalida));
+ }
+ if (VigenciaFinal.HasValue && (DateTime.Compare(VigenciaFinal.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(VigenciaFinal.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("VigenciaFinal|VENCIMENTO", string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Telefone1) && string.IsNullOrWhiteSpace(Telefone2) && string.IsNullOrWhiteSpace(Email))
+ {
+ list.AddValue("Telefone1|TELEFONE 1", Messages.Obrigatorio);
+ }
+ if (!VigenciaFinal.HasValue)
+ {
+ list.AddValue("VigenciaFinal|VENCIMENTO", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Item))
+ {
+ list.AddValue("Item", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("DOCUMENTO", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""),
+ new Tuple<string, string, string>("NASCIMENTO", (!Nascimento.HasValue) ? "" : Nascimento?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("PRIMEIRO PREFIXO", string.IsNullOrWhiteSpace(Prefixo1) ? "" : Prefixo1, ""),
+ new Tuple<string, string, string>("PRIMEIRO TELEFONE", string.IsNullOrWhiteSpace(Telefone1) ? "" : Telefone1, ""),
+ new Tuple<string, string, string>("SEGUNDO PREFIXO", string.IsNullOrWhiteSpace(Prefixo2) ? "" : Prefixo2, ""),
+ new Tuple<string, string, string>("SEGUNDO TELEFONE", string.IsNullOrWhiteSpace(Telefone2) ? "" : Telefone2, ""),
+ new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""),
+ new Tuple<string, string, string>("ITEM", string.IsNullOrWhiteSpace(Item) ? "" : Item, ""),
+ new Tuple<string, string, string>("PRODUTO", string.IsNullOrWhiteSpace(Produto?.Nome) ? "" : Produto.Nome, ""),
+ new Tuple<string, string, string>("VENCIMENTO", (!VigenciaFinal.HasValue) ? "" : VigenciaFinal?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("VENDEDOR", string.IsNullOrWhiteSpace(Vendedor?.Nome) ? "" : Vendedor.Nome, "")
+ };
+ object item;
+ if (Status.HasValue)
+ {
+ StatusProspeccao? status = Status;
+ item = (status.HasValue ? status.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ obj.Add(new Tuple<string, string, string>("STATUS", (string)item, ""));
+ obj.Add(new Tuple<string, string, string>("STATUS PERSONALIZADO", (StatusPersonalizado == null) ? "" : StatusPersonalizado.Nome, ""));
+ obj.Add(new Tuple<string, string, string>("OBSERVAÇÃO", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, ""));
+ tupleList.Tuples = obj;
+ list.Add(tupleList);
+ List<TupleList> list2 = list;
+ if (Tarefa != null)
+ {
+ ObservableCollection<Tuple<string, string, string>> tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("TAREFA$", "", ""),
+ new Tuple<string, string, string>(" RESPONSÁVEL", string.IsNullOrWhiteSpace(Tarefa.Usuario.Nome) ? "" : Tarefa.Usuario.Nome, ""),
+ new Tuple<string, string, string>(" DATA DO AGENDAMENTO", Tarefa.Agendamento.ToShortDateString(), ""),
+ new Tuple<string, string, string>(" HORA DO AGENDAMENTO", Tarefa.Agendamento.ToShortTimeString(), "")
+ };
+ list2.Add(new TupleList
+ {
+ Tuples = tuples
+ });
+ }
+ return list2;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ProspeccaoToPrint.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ProspeccaoToPrint.cs
new file mode 100644
index 0000000..5adc054
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ProspeccaoToPrint.cs
@@ -0,0 +1,81 @@
+using System;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ProspeccaoToPrint
+{
+ private string _nome;
+
+ private string _item;
+
+ [Description("CLIENTE")]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Description("DOCUMENTO")]
+ public string Documento { get; set; }
+
+ [Tipo("DATA?")]
+ [Description("NASCIMENTO")]
+ public DateTime? Nascimento { get; set; }
+
+ [Description("DDD")]
+ public string Prefixo1 { get; set; }
+
+ [Description("TELEFONE")]
+ public string Telefone1 { get; set; }
+
+ [Description("DDD")]
+ public string Prefixo2 { get; set; }
+
+ [Description("TELEFONE")]
+ public string Telefone2 { get; set; }
+
+ [Description("E-MAIL")]
+ public string Email { get; set; }
+
+ [Tipo("DATA?")]
+ [Description("VIGÊNCIA FINAL")]
+ public DateTime? VigenciaFinal { get; set; }
+
+ [Description("ITEM")]
+ public string Item
+ {
+ get
+ {
+ return _item?.ToUpper();
+ }
+ set
+ {
+ _item = value;
+ }
+ }
+
+ [Description("VENDEDOR")]
+ public string Vendedor { get; set; }
+
+ [Tipo("ENUM?")]
+ [Description("STATUS")]
+ public StatusProspeccao? Status { get; set; }
+
+ [Description("STATUS PERSONALIZADO")]
+ public string StatusPersonalizadotoPrint { get; set; }
+
+ [Description("TIPO")]
+ public string Tipo { get; set; }
+
+ [Description("VALOR")]
+ public decimal Valor { get; set; }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Qualificacao.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Qualificacao.cs
new file mode 100644
index 0000000..999bf18
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Qualificacao.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Globalization;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Qualificacao : DomainBase, IDomain
+{
+ [Log(true)]
+ [Description("PRÊMIO LÍQUIDO BROZE")]
+ public decimal Liquido1 { get; set; }
+
+ [Log(true)]
+ [Description("PRÊMIO LÍQUIDO PRATA")]
+ public decimal Liquido2 { get; set; }
+
+ [Log(true)]
+ [Description("PRÊMIO LÍQUIDO OURO")]
+ public decimal Liquido3 { get; set; }
+
+ [Log(true)]
+ [Description("MÉDIA DE COMISSÃO BRONZE")]
+ public decimal Comissao1 { get; set; }
+
+ [Log(true)]
+ [Description("MÉDIA DE COMISSÃO PRATA")]
+ public decimal Comissao2 { get; set; }
+
+ [Log(true)]
+ [Description("MÉDIA DE COMISSÃO OURO")]
+ public decimal Comissao3 { get; set; }
+
+ [Log(true)]
+ [Description("RESULTADO BRONZE")]
+ public decimal Resultado1 { get; set; }
+
+ [Log(true)]
+ [Description("RESULTADO PRATA")]
+ public decimal Resultado2 { get; set; }
+
+ [Log(true)]
+ [Description("RESULTADO OURO")]
+ public decimal Resultado3 { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ return ValidationHelper.AddValue();
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("PRÊMIO LÍQUIDO$", "", ""),
+ new Tuple<string, string, string>(" BRONZE", Liquido1.ToString(new CultureInfo("pt-BR")), ""),
+ new Tuple<string, string, string>(" PRATA", Liquido2.ToString(new CultureInfo("pt-BR")), ""),
+ new Tuple<string, string, string>(" OURO", Liquido3.ToString(new CultureInfo("pt-BR")), "")
+ }
+ },
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("MÉDIA DE COMISSÃO$", "", ""),
+ new Tuple<string, string, string>(" BRONZE", Comissao1.ToString(new CultureInfo("pt-BR")), ""),
+ new Tuple<string, string, string>(" PRATA", Comissao2.ToString(new CultureInfo("pt-BR")), ""),
+ new Tuple<string, string, string>(" OURO", Comissao3.ToString(new CultureInfo("pt-BR")), "")
+ }
+ },
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("RESULTADO$", "", ""),
+ new Tuple<string, string, string>(" BRONZE", Resultado1.ToString(new CultureInfo("pt-BR")), ""),
+ new Tuple<string, string, string>(" PRATA", Resultado2.ToString(new CultureInfo("pt-BR")), ""),
+ new Tuple<string, string, string>(" OURO", Resultado3.ToString(new CultureInfo("pt-BR")), "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Ramo.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Ramo.cs
new file mode 100644
index 0000000..b6e2320
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Ramo.cs
@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Ramo : DomainBase, IDomain, INotifyPropertyChanged
+{
+ private bool _selecionado;
+
+ private string _nome;
+
+ private string _ramoSusep;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("RAMO")]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ public decimal Iof { get; set; }
+
+ [Log(true)]
+ public bool Ativo { get; set; }
+
+ public bool Fatura { get; set; }
+
+ public string RamoSusep
+ {
+ get
+ {
+ return _ramoSusep?.ToUpper();
+ }
+ set
+ {
+ _ramoSusep = value;
+ }
+ }
+
+ public long CodigoSusep { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ return ValidationHelper.AddValue();
+ }
+
+ public List<TupleList> Log(List<CoberturaPadrao> listCoberturas)
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("I.O.F.", (Iof / 100m).ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), ""),
+ new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (CoberturaPadrao listCobertura in listCoberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {listCoberturas.IndexOf(listCobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" DESCRIÇÃO", string.IsNullOrWhiteSpace(listCobertura.Descricao) ? "" : listCobertura.Descricao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PADRÃO", listCobertura.Padrao ? "SIM" : "NÃO", ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs
new file mode 100644
index 0000000..4beadaf
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Repasse : DomainBase, IDomain
+{
+ private string _incidenciaVendedor = "";
+
+ private string _pgtoVendedor = "";
+
+ public Vendedor Vendedor { get; set; }
+
+ public long? Seguradora { get; set; }
+
+ public Ramo Ramo { get; set; }
+
+ public decimal ValorNovo { get; set; }
+
+ public decimal ValorRenovacao { get; set; }
+
+ public TipoRepasse? Tipo { get; set; }
+
+ public TipoIncidencia? Incidencia { get; set; }
+
+ public FormaRepasse? Forma { get; set; }
+
+ public BaseRepasse? Base { get; set; }
+
+ public bool Ativo { get; set; }
+
+ public List<VinculoRepasse> Vinculo { get; set; }
+
+ public string IncidenciaVendedor => _incidenciaVendedor = Incidencia.GetDescription();
+
+ public string PagtoVendedor => _pgtoVendedor = Forma.GetDescription();
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Vendedor == null)
+ {
+ list.AddValue("Vendedor", Messages.Obrigatorio);
+ }
+ if (TipoRepasse.CoCorretagem != Tipo.GetValueOrDefault() && ValorNovo == 0m)
+ {
+ list.AddValue("ValorNovo", Messages.Obrigatorio);
+ }
+ if (TipoRepasse.CoCorretagem != Tipo.GetValueOrDefault() && ValorRenovacao == 0m)
+ {
+ list.AddValue("ValorRenovacao", Messages.Obrigatorio);
+ }
+ if (!Tipo.HasValue)
+ {
+ list.AddValue("Tipo", Messages.Obrigatorio);
+ }
+ if (!Incidencia.HasValue && Forma.HasValue && Forma.GetValueOrDefault() == FormaRepasse.Recebimento)
+ {
+ list.AddValue("Incidencia", Messages.Obrigatorio);
+ }
+ if (!Forma.HasValue)
+ {
+ list.AddValue("Forma", Messages.Obrigatorio);
+ }
+ if (Forma.HasValue && Forma.GetValueOrDefault() != FormaRepasse.Recebimento)
+ {
+ if (!Base.HasValue)
+ {
+ list.AddValue("Base", Messages.Obrigatorio);
+ }
+ if (Forma.GetValueOrDefault() == FormaRepasse.Prazo && Base.GetValueOrDefault() != BaseRepasse.Vencimento)
+ {
+ list.AddValue("Base", Messages.Invalido);
+ }
+ }
+ if (Forma.HasValue && Forma.GetValueOrDefault() == FormaRepasse.Recebimento && Base.HasValue)
+ {
+ list.AddValue("Base", Messages.Invalido);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("TIPO", Tipo.GetDescription(), ""),
+ new Tuple<string, string, string>("VALOR NOVO", $"{ValorNovo:##.00}", ""),
+ new Tuple<string, string, string>("VALOR RENOVAÇÃO", $"{ValorRenovacao:##.00}", ""),
+ new Tuple<string, string, string>("INCIDÊNCIA", Incidencia.GetDescription(), ""),
+ new Tuple<string, string, string>("FORMA PAGAMENTO", Forma.GetDescription(), ""),
+ new Tuple<string, string, string>("BASE PAGAMENTO", Base.GetDescription(), ""),
+ new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ResponsavelAssinatura.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ResponsavelAssinatura.cs
new file mode 100644
index 0000000..cc341c0
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ResponsavelAssinatura.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class ResponsavelAssinatura : DomainBase, IDomain
+{
+ public long IdCliente { get; set; }
+
+ public string NomeResponsavel { get; set; }
+
+ public string DocumentoResponsavel { get; set; }
+
+ public string EmailResponsavel { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ int? num = (string.IsNullOrWhiteSpace(NomeResponsavel) ? null : NomeResponsavel?.Trim().Split(new char[1] { ' ' }).Length);
+ if (num.HasValue && num <= 1)
+ {
+ list.AddValue("NomeResponsavel", Messages.NomeInvalido);
+ }
+ if (!string.IsNullOrWhiteSpace(DocumentoResponsavel) && !DocumentoResponsavel.ValidacaoDocumento())
+ {
+ list.AddValue("DocumentoResponsavel", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(EmailResponsavel) && !EmailResponsavel.ValidacaoEmail())
+ {
+ list.AddValue("EmailResponsavel", Messages.Invalido);
+ }
+ if (num.HasValue || !string.IsNullOrWhiteSpace(DocumentoResponsavel) || !string.IsNullOrWhiteSpace(EmailResponsavel))
+ {
+ if (!num.HasValue)
+ {
+ list.AddValue("NomeResponsavel", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(DocumentoResponsavel))
+ {
+ list.AddValue("DocumentoResponsavel", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(EmailResponsavel))
+ {
+ list.AddValue("EmailResponsavel", Messages.Obrigatorio);
+ }
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuario.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuario.cs
new file mode 100644
index 0000000..a724a73
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuario.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Validation;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class RestricaoUsuario : DomainBase
+{
+ [Log(true)]
+ [ForceLog(true)]
+ public TipoRestricao Tipo { get; set; }
+
+ public Usuario Usuario { get; set; }
+
+ [Log(true)]
+ public bool Restricao { get; set; }
+
+ public string Ajuda { get; set; }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("$TIPO DE RESTRIÇÃO", Tipo.GetDescription(), ""),
+ new Tuple<string, string, string>(" RESTRIÇÃO ATIVA?", Restricao ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs
new file mode 100644
index 0000000..e781e19
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class RestricaoUsuarioCamposRelatorios : DomainBase
+{
+ [Log(true)]
+ [ForceLog(true)]
+ public string Campo { get; set; }
+
+ public Usuario Usuario { get; set; }
+
+ [Log(true)]
+ [ForceLog(true)]
+ public Relatorio Relatorio { get; set; }
+
+ [Log(true)]
+ public bool Restricao { get; set; }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("$TIPO DE RESTRIÇÃO", Campo, ""),
+ new Tuple<string, string, string>(" RESTRIÇÃO ATIVA?", Restricao ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/RiscosDiversos.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/RiscosDiversos.cs
new file mode 100644
index 0000000..c72eb32
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/RiscosDiversos.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class RiscosDiversos : DomainBase, IDomain
+{
+ private string _observacao;
+
+ public Item Item { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public decimal? SubsidioEstadual { get; set; }
+
+ public decimal? SubsidioFederal { get; set; }
+
+ public string Area { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Observacao))
+ {
+ Item item = Item;
+ if (item == null || item.Documento.Controle.Ramo.Id != 23)
+ {
+ list.AddValue("Observacao", Messages.Obrigatorio);
+ }
+ }
+ return list;
+ }
+
+ public static List<TupleList> Log(Item item)
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(item.Descricao) ? "" : item.Descricao, ""),
+ new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(item.RiscosDiversos.Observacao) ? "" : item.RiscosDiversos.Observacao.ToUpper(), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Seguradora.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Seguradora.cs
new file mode 100644
index 0000000..5cf8636
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Seguradora.cs
@@ -0,0 +1,1317 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Seguradora : DomainBase, IDomain, INotifyPropertyChanged
+{
+ private bool _selecionado;
+
+ private string _nome;
+
+ private string _susep;
+
+ private string _assistencia;
+
+ private string _documento;
+
+ private string _observacao;
+
+ private string _codigo;
+
+ private string _codigoSusep;
+
+ private string _codigoSeguradora;
+
+ private string _nomeSocial;
+
+ private string _nomeSocialBanco;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ [Name(true)]
+ [Log(true)]
+ [Description("SEGURADORA")]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("APELIDO")]
+ public string NomeSocialBanco
+ {
+ get
+ {
+ return _nomeSocialBanco?.ToUpper();
+ }
+ set
+ {
+ _nomeSocialBanco = value;
+ }
+ }
+
+ public string NomeSocial
+ {
+ get
+ {
+ return _nomeSocial?.ToUpper();
+ }
+ set
+ {
+ _nomeSocial = value;
+ if (!string.IsNullOrWhiteSpace(value))
+ {
+ NomeSocialBanco = ((NomeSocialBanco == " ") ? "" : value);
+ return;
+ }
+ long id = base.Id;
+ if (id <= 694)
+ {
+ if (id <= 678)
+ {
+ long num = id - 1;
+ if ((ulong)num <= 606uL)
+ {
+ switch (num)
+ {
+ case 5L:
+ case 6L:
+ case 7L:
+ case 19L:
+ case 20L:
+ case 21L:
+ case 22L:
+ case 23L:
+ case 28L:
+ case 29L:
+ case 30L:
+ case 31L:
+ case 35L:
+ case 36L:
+ case 37L:
+ case 38L:
+ case 42L:
+ case 43L:
+ case 44L:
+ case 45L:
+ case 46L:
+ case 47L:
+ case 49L:
+ case 50L:
+ case 51L:
+ case 57L:
+ case 58L:
+ case 61L:
+ case 62L:
+ case 66L:
+ case 67L:
+ case 68L:
+ case 70L:
+ case 71L:
+ case 72L:
+ case 73L:
+ case 74L:
+ case 75L:
+ case 76L:
+ case 77L:
+ case 78L:
+ case 79L:
+ case 80L:
+ case 81L:
+ case 82L:
+ case 83L:
+ case 84L:
+ case 85L:
+ case 86L:
+ case 87L:
+ case 97L:
+ case 101L:
+ case 102L:
+ case 103L:
+ case 104L:
+ case 109L:
+ case 110L:
+ case 113L:
+ case 114L:
+ case 118L:
+ case 121L:
+ case 122L:
+ case 123L:
+ case 124L:
+ case 127L:
+ case 131L:
+ case 132L:
+ case 133L:
+ case 134L:
+ case 135L:
+ case 136L:
+ case 137L:
+ case 138L:
+ case 139L:
+ case 140L:
+ case 141L:
+ case 142L:
+ case 143L:
+ case 146L:
+ case 147L:
+ case 148L:
+ case 149L:
+ case 150L:
+ case 153L:
+ case 154L:
+ case 155L:
+ case 156L:
+ case 157L:
+ case 158L:
+ case 159L:
+ case 162L:
+ case 163L:
+ case 164L:
+ case 165L:
+ case 166L:
+ case 167L:
+ case 168L:
+ case 169L:
+ case 170L:
+ case 171L:
+ case 172L:
+ case 173L:
+ case 174L:
+ case 175L:
+ case 179L:
+ case 182L:
+ case 183L:
+ case 186L:
+ case 187L:
+ case 189L:
+ case 190L:
+ case 191L:
+ case 192L:
+ case 193L:
+ case 194L:
+ case 195L:
+ case 198L:
+ case 199L:
+ case 202L:
+ case 203L:
+ case 204L:
+ case 207L:
+ case 208L:
+ case 209L:
+ case 210L:
+ case 211L:
+ case 214L:
+ case 219L:
+ case 220L:
+ case 223L:
+ case 224L:
+ case 227L:
+ case 228L:
+ case 229L:
+ case 233L:
+ case 234L:
+ case 237L:
+ case 238L:
+ case 239L:
+ case 240L:
+ case 244L:
+ case 245L:
+ case 246L:
+ case 247L:
+ case 250L:
+ case 252L:
+ case 253L:
+ case 256L:
+ case 261L:
+ case 262L:
+ case 263L:
+ case 270L:
+ case 276L:
+ case 277L:
+ case 278L:
+ case 279L:
+ case 280L:
+ case 281L:
+ case 282L:
+ case 286L:
+ case 287L:
+ case 288L:
+ case 300L:
+ case 301L:
+ case 302L:
+ case 303L:
+ case 304L:
+ case 305L:
+ case 306L:
+ case 312L:
+ case 313L:
+ case 314L:
+ case 315L:
+ case 316L:
+ case 329L:
+ case 331L:
+ case 332L:
+ case 333L:
+ case 334L:
+ case 335L:
+ case 338L:
+ case 339L:
+ case 341L:
+ case 342L:
+ case 343L:
+ case 344L:
+ case 350L:
+ case 357L:
+ case 358L:
+ case 359L:
+ case 360L:
+ case 361L:
+ case 362L:
+ case 363L:
+ case 366L:
+ case 367L:
+ case 368L:
+ case 369L:
+ case 370L:
+ case 371L:
+ case 373L:
+ case 376L:
+ case 377L:
+ case 381L:
+ case 382L:
+ case 383L:
+ case 388L:
+ case 389L:
+ case 390L:
+ case 391L:
+ case 392L:
+ case 393L:
+ case 396L:
+ case 397L:
+ case 402L:
+ case 403L:
+ case 404L:
+ case 405L:
+ case 406L:
+ case 407L:
+ case 408L:
+ case 409L:
+ case 410L:
+ case 413L:
+ case 414L:
+ case 415L:
+ case 419L:
+ case 420L:
+ case 421L:
+ case 422L:
+ case 425L:
+ case 433L:
+ case 434L:
+ case 442L:
+ case 443L:
+ case 444L:
+ case 451L:
+ case 452L:
+ case 453L:
+ case 454L:
+ case 457L:
+ case 460L:
+ case 461L:
+ case 462L:
+ case 463L:
+ case 464L:
+ case 467L:
+ case 468L:
+ case 469L:
+ case 470L:
+ case 472L:
+ case 473L:
+ case 488L:
+ case 495L:
+ case 496L:
+ case 502L:
+ case 504L:
+ case 505L:
+ case 506L:
+ case 510L:
+ case 511L:
+ case 512L:
+ case 519L:
+ case 524L:
+ case 525L:
+ case 526L:
+ case 529L:
+ case 530L:
+ case 531L:
+ case 532L:
+ case 533L:
+ case 534L:
+ case 535L:
+ case 536L:
+ case 552L:
+ case 555L:
+ case 562L:
+ case 563L:
+ case 564L:
+ case 565L:
+ case 566L:
+ case 567L:
+ case 568L:
+ case 575L:
+ case 576L:
+ case 577L:
+ case 578L:
+ case 580L:
+ case 585L:
+ case 586L:
+ case 587L:
+ case 588L:
+ case 589L:
+ case 592L:
+ case 596L:
+ case 598L:
+ case 599L:
+ case 600L:
+ case 601L:
+ goto IL_0ba0;
+ case 1L:
+ case 2L:
+ case 3L:
+ case 4L:
+ NomeSocial = "ACE";
+ return;
+ case 11L:
+ case 12L:
+ case 13L:
+ NomeSocial = "ALFA";
+ return;
+ case 17L:
+ case 18L:
+ goto IL_0be9;
+ case 88L:
+ case 89L:
+ case 90L:
+ case 91L:
+ case 92L:
+ case 583L:
+ NomeSocial = "BRADESCO";
+ return;
+ case 48L:
+ case 243L:
+ NomeSocial = "GENERALI";
+ return;
+ case 257L:
+ case 258L:
+ case 259L:
+ case 260L:
+ case 569L:
+ case 597L:
+ NomeSocial = "HDI";
+ return;
+ case 290L:
+ case 291L:
+ case 295L:
+ case 296L:
+ goto IL_0c19;
+ case 307L:
+ case 308L:
+ case 309L:
+ goto IL_0c25;
+ case 317L:
+ case 318L:
+ case 319L:
+ case 320L:
+ case 321L:
+ case 322L:
+ case 323L:
+ case 324L:
+ case 325L:
+ case 326L:
+ case 327L:
+ case 328L:
+ goto IL_0c31;
+ case 330L:
+ case 542L:
+ case 561L:
+ NomeSocial = "YASUDA MARITIMA";
+ return;
+ case 345L:
+ case 346L:
+ case 347L:
+ NomeSocial = "MITSUI";
+ return;
+ case 398L:
+ case 399L:
+ case 400L:
+ case 401L:
+ case 553L:
+ case 554L:
+ case 573L:
+ goto IL_0c55;
+ case 474L:
+ case 475L:
+ case 476L:
+ case 477L:
+ case 478L:
+ case 479L:
+ case 480L:
+ case 481L:
+ case 482L:
+ case 483L:
+ case 484L:
+ case 485L:
+ case 486L:
+ case 487L:
+ case 557L:
+ case 579L:
+ goto IL_0c61;
+ case 497L:
+ case 498L:
+ case 499L:
+ case 500L:
+ case 501L:
+ NomeSocial = "TOKIO";
+ return;
+ case 543L:
+ case 544L:
+ case 545L:
+ case 546L:
+ case 547L:
+ case 548L:
+ case 549L:
+ case 550L:
+ case 551L:
+ NomeSocial = "ZURICH";
+ return;
+ case 471L:
+ case 594L:
+ goto IL_0c85;
+ case 560L:
+ case 570L:
+ goto IL_0c91;
+ case 178L:
+ case 251L:
+ NomeSocial = "GRALHA AZUL";
+ return;
+ case 69L:
+ NomeSocial = "AZUL";
+ return;
+ case 215L:
+ NomeSocial = "ESSOR";
+ return;
+ case 130L:
+ goto IL_0ccd;
+ case 99L:
+ NomeSocial = "BRASIL VEÍCULOS";
+ return;
+ case 0L:
+ NomeSocial = "ABSOLUTA";
+ return;
+ case 8L:
+ case 9L:
+ case 517L:
+ case 518L:
+ NomeSocial = "AIG";
+ return;
+ case 10L:
+ NomeSocial = "AJAX";
+ return;
+ case 14L:
+ case 15L:
+ case 16L:
+ case 176L:
+ case 177L:
+ NomeSocial = "ALIANÇA";
+ return;
+ case 32L:
+ case 33L:
+ case 34L:
+ NomeSocial = "APLUB";
+ return;
+ case 24L:
+ case 25L:
+ case 26L:
+ case 180L:
+ NomeSocial = "ALLSEG";
+ return;
+ case 39L:
+ case 40L:
+ NomeSocial = "ARCH";
+ return;
+ case 41L:
+ NomeSocial = "ARGO";
+ return;
+ case 52L:
+ case 53L:
+ case 54L:
+ case 55L:
+ case 56L:
+ NomeSocial = "ATLANTICA";
+ return;
+ case 59L:
+ case 60L:
+ NomeSocial = "AUSTRAL";
+ return;
+ case 63L:
+ case 64L:
+ case 65L:
+ case 602L:
+ NomeSocial = "AXA";
+ return;
+ case 93L:
+ NomeSocial = "BRASIL LIBANO";
+ return;
+ case 94L:
+ NomeSocial = "BRASILCAP";
+ return;
+ case 95L:
+ case 96L:
+ NomeSocial = "BRASILPREV";
+ return;
+ case 98L:
+ case 100L:
+ NomeSocial = "BRASILUSITANA";
+ return;
+ case 105L:
+ case 106L:
+ case 107L:
+ case 108L:
+ case 372L:
+ NomeSocial = "CAIXA";
+ return;
+ case 128L:
+ case 129L:
+ NomeSocial = "CHARTIS";
+ return;
+ case 115L:
+ case 116L:
+ case 117L:
+ NomeSocial = "CARDIF";
+ return;
+ case 111L:
+ case 112L:
+ NomeSocial = "CAPEMISA";
+ return;
+ case 119L:
+ case 120L:
+ NomeSocial = "CASTELLO";
+ return;
+ case 125L:
+ case 126L:
+ NomeSocial = "CESCEBRASIL";
+ return;
+ case 151L:
+ case 152L:
+ case 188L:
+ case 416L:
+ case 417L:
+ case 418L:
+ NomeSocial = "REAL";
+ return;
+ case 160L:
+ case 161L:
+ NomeSocial = "URBANIA";
+ return;
+ case 181L:
+ NomeSocial = "EXCELSIOR";
+ return;
+ case 144L:
+ case 184L:
+ case 185L:
+ NomeSocial = "INTERNACIONAL";
+ return;
+ case 196L:
+ case 197L:
+ NomeSocial = "CREDITO Y CAUCIAN";
+ return;
+ case 200L:
+ case 201L:
+ NomeSocial = "CRUZEIRO DO SUL";
+ return;
+ case 205L:
+ case 206L:
+ NomeSocial = "ECC";
+ return;
+ case 212L:
+ case 213L:
+ NomeSocial = "EQUITATIVA";
+ return;
+ case 216L:
+ case 217L:
+ case 218L:
+ NomeSocial = "EULER HERMES";
+ return;
+ case 221L:
+ case 222L:
+ NomeSocial = "EVEREST";
+ return;
+ case 225L:
+ case 226L:
+ NomeSocial = "FACTORY";
+ return;
+ case 230L:
+ case 231L:
+ case 232L:
+ NomeSocial = "FEDERAL";
+ return;
+ case 235L:
+ case 236L:
+ NomeSocial = "FINANCIAL";
+ return;
+ case 241L:
+ case 242L:
+ NomeSocial = "GENERAL";
+ return;
+ case 248L:
+ case 249L:
+ NomeSocial = "GNPP";
+ return;
+ case 254L:
+ case 255L:
+ NomeSocial = "HANNOVER";
+ return;
+ case 264L:
+ case 265L:
+ case 266L:
+ case 267L:
+ case 268L:
+ case 269L:
+ NomeSocial = "HSBC";
+ return;
+ case 271L:
+ case 272L:
+ NomeSocial = "ICATU";
+ return;
+ case 273L:
+ case 274L:
+ NomeSocial = "IF P&C INSURANCE";
+ return;
+ case 275L:
+ NomeSocial = "INDIANA";
+ return;
+ case 283L:
+ case 284L:
+ case 285L:
+ case 603L:
+ NomeSocial = "KOVR";
+ return;
+ case 145L:
+ case 289L:
+ case 292L:
+ case 293L:
+ case 294L:
+ NomeSocial = "ITAÉ";
+ return;
+ case 297L:
+ case 298L:
+ case 299L:
+ NomeSocial = "J. MALUCELLI";
+ return;
+ case 310L:
+ case 311L:
+ NomeSocial = "LIDERANÇA";
+ return;
+ case 336L:
+ case 337L:
+ NomeSocial = "MBM";
+ return;
+ case 348L:
+ case 349L:
+ NomeSocial = "MONGERAL";
+ return;
+ case 351L:
+ case 352L:
+ case 353L:
+ case 354L:
+ case 355L:
+ case 356L:
+ NomeSocial = "MONTEPIO";
+ return;
+ case 364L:
+ case 365L:
+ case 380L:
+ NomeSocial = "NATIONAL";
+ return;
+ case 374L:
+ case 375L:
+ NomeSocial = "NOVA YORK";
+ return;
+ case 378L:
+ case 379L:
+ NomeSocial = "ODYSSEY";
+ return;
+ case 384L:
+ case 385L:
+ NomeSocial = "PARANÁ";
+ return;
+ case 386L:
+ case 387L:
+ NomeSocial = "PARIS";
+ return;
+ case 394L:
+ case 395L:
+ NomeSocial = "PLANALTO";
+ return;
+ case 411L:
+ case 412L:
+ NomeSocial = "PRUDENTIAL";
+ return;
+ case 423L:
+ case 424L:
+ NomeSocial = "ROYAL & SUN ALLIANCE";
+ return;
+ case 426L:
+ case 427L:
+ case 428L:
+ NomeSocial = "SABEMI";
+ return;
+ case 429L:
+ case 430L:
+ case 431L:
+ case 432L:
+ NomeSocial = "SAFRA";
+ return;
+ case 435L:
+ case 436L:
+ case 437L:
+ NomeSocial = "SANTANDER";
+ return;
+ case 438L:
+ case 439L:
+ NomeSocial = "SANTOS";
+ return;
+ case 440L:
+ case 441L:
+ NomeSocial = "SANTOS";
+ return;
+ case 445L:
+ case 446L:
+ case 447L:
+ case 448L:
+ NomeSocial = "SCOR";
+ return;
+ case 449L:
+ case 450L:
+ NomeSocial = "SDB";
+ return;
+ case 455L:
+ case 456L:
+ NomeSocial = "MINEIRA";
+ return;
+ case 458L:
+ case 459L:
+ NomeSocial = "PONTUAL";
+ return;
+ case 465L:
+ case 466L:
+ NomeSocial = "SIRIUS";
+ return;
+ case 489L:
+ case 490L:
+ case 491L:
+ case 492L:
+ case 493L:
+ case 494L:
+ NomeSocial = "SWISS";
+ return;
+ case 503L:
+ NomeSocial = "TOTAL";
+ return;
+ case 507L:
+ case 508L:
+ case 509L:
+ NomeSocial = "TREVO";
+ return;
+ case 513L:
+ case 514L:
+ case 515L:
+ case 516L:
+ NomeSocial = "UNIÃO";
+ return;
+ case 520L:
+ case 521L:
+ case 584L:
+ case 595L:
+ goto IL_102d;
+ case 522L:
+ case 523L:
+ NomeSocial = "UNIVERSAL";
+ return;
+ case 527L:
+ case 528L:
+ NomeSocial = "VALOR CAPITALIZAÇÃO";
+ return;
+ case 537L:
+ case 538L:
+ case 539L:
+ case 540L:
+ case 541L:
+ NomeSocial = "XL";
+ return;
+ case 556L:
+ NomeSocial = "SUHAI";
+ return;
+ case 558L:
+ NomeSocial = "SANCOR";
+ return;
+ case 559L:
+ NomeSocial = "AGROBRASIL";
+ return;
+ case 571L:
+ case 572L:
+ case 574L:
+ case 605L:
+ case 606L:
+ goto IL_1081;
+ case 581L:
+ NomeSocial = "SANTA CASA";
+ return;
+ case 582L:
+ NomeSocial = "AMEX";
+ return;
+ case 27L:
+ case 590L:
+ case 591L:
+ case 593L:
+ goto IL_10a5;
+ case 604L:
+ NomeSocial = "BANCO DO BRASIL";
+ return;
+ case 340L:
+ goto IL_10bd;
+ }
+ }
+ long num2 = id - 621;
+ if ((ulong)num2 <= 57uL)
+ {
+ switch (num2)
+ {
+ case 14L:
+ goto IL_0be9;
+ case 29L:
+ goto IL_0c25;
+ case 57L:
+ goto IL_0c31;
+ case 20L:
+ case 22L:
+ case 53L:
+ goto IL_0c55;
+ case 43L:
+ goto IL_0c61;
+ case 21L:
+ goto IL_0c91;
+ case 9L:
+ case 18L:
+ NomeSocial = "ALIRO";
+ return;
+ case 0L:
+ case 3L:
+ case 24L:
+ case 32L:
+ case 33L:
+ case 34L:
+ case 35L:
+ case 36L:
+ case 37L:
+ case 41L:
+ case 42L:
+ goto IL_102d;
+ case 55L:
+ goto IL_1081;
+ case 28L:
+ goto IL_10a5;
+ case 10L:
+ goto IL_10bd;
+ case 11L:
+ NomeSocial = "VR";
+ return;
+ case 15L:
+ NomeSocial = "HS";
+ return;
+ case 45L:
+ NomeSocial = "AFFINITY";
+ return;
+ case 46L:
+ NomeSocial = "BR";
+ return;
+ case 52L:
+ NomeSocial = "YAMAHA";
+ return;
+ case 56L:
+ NomeSocial = "EMBRACON";
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (id == 683)
+ {
+ goto IL_102d;
+ }
+ long num3 = id - 687;
+ if ((ulong)num3 <= 3uL)
+ {
+ switch (num3)
+ {
+ case 1L:
+ goto IL_0ba0;
+ case 0L:
+ goto IL_0c19;
+ case 3L:
+ goto IL_102d;
+ case 2L:
+ NomeSocial = "SÃO LUCAS";
+ return;
+ }
+ }
+ if (id == 694)
+ {
+ goto IL_0c55;
+ }
+ }
+ }
+ else if (id <= 716)
+ {
+ long num4 = id - 703;
+ if ((ulong)num4 <= 8uL)
+ {
+ switch (num4)
+ {
+ case 2L:
+ case 3L:
+ case 5L:
+ case 7L:
+ goto IL_0ba0;
+ case 1L:
+ case 4L:
+ case 8L:
+ goto IL_0c31;
+ case 0L:
+ case 6L:
+ goto IL_102d;
+ }
+ }
+ if (id == 716)
+ {
+ goto IL_102d;
+ }
+ }
+ else
+ {
+ if (id == 717)
+ {
+ goto IL_0ccd;
+ }
+ if (id == 734)
+ {
+ NomeSocial = "RC";
+ return;
+ }
+ if (id == 741)
+ {
+ goto IL_0c85;
+ }
+ }
+ goto IL_0ba0;
+ IL_0c19:
+ NomeSocial = "ITAÚ";
+ return;
+ IL_0c85:
+ NomeSocial = "SOMPO";
+ return;
+ IL_0ccd:
+ NomeSocial = "CHUBB";
+ return;
+ IL_0c61:
+ NomeSocial = "SULAMERICA";
+ return;
+ IL_0ba0:
+ NomeSocialBanco = ((base.Id == 0L) ? " " : NomeSocial);
+ NomeSocial = Nome ?? "";
+ return;
+ IL_0c91:
+ NomeSocial = "SURA";
+ return;
+ IL_0c25:
+ NomeSocial = "YELUM";
+ return;
+ IL_0c31:
+ NomeSocial = "MAPFRE";
+ return;
+ IL_0c55:
+ NomeSocial = "PORTO SEGURO";
+ return;
+ IL_1081:
+ NomeSocial = "SÃO FRANCISCO";
+ return;
+ IL_102d:
+ NomeSocial = "UNIMED";
+ return;
+ IL_0be9:
+ NomeSocial = "ALLIANZ";
+ return;
+ IL_10bd:
+ NomeSocial = "METLIFE";
+ return;
+ IL_10a5:
+ NomeSocial = "AMIL";
+ }
+ }
+
+ [Log(true)]
+ public string Susep
+ {
+ get
+ {
+ return _susep?.ToUpper();
+ }
+ set
+ {
+ _susep = value;
+ }
+ }
+
+ [Log(true)]
+ public string Assistencia
+ {
+ get
+ {
+ return _assistencia?.ToUpper();
+ }
+ set
+ {
+ _assistencia = value;
+ }
+ }
+
+ [Log(true)]
+ public string Documento
+ {
+ get
+ {
+ return _documento?.ToUpper();
+ }
+ set
+ {
+ _documento = value;
+ }
+ }
+
+ [Log(true)]
+ public bool Ativo { get; set; }
+
+ [Log(true)]
+ public decimal? Tolerancia { get; set; }
+
+ [Log(true)]
+ public decimal? ToleranciaPremio { get; set; }
+
+ [Log(true)]
+ public string Observacao
+ {
+ get
+ {
+ return _observacao;
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("LINK APP ANDROID")]
+ public string LinkAppAndroid { get; set; }
+
+ [Log(true)]
+ [Description("LINK APP IOS")]
+ public string LinkAppIos { get; set; }
+
+ public string Usuario { get; set; }
+
+ public string Senha { get; set; }
+
+ public string Codigo
+ {
+ get
+ {
+ return _codigo?.ToUpper();
+ }
+ set
+ {
+ _codigo = value;
+ }
+ }
+
+ public string CodigoSusep
+ {
+ get
+ {
+ return _codigoSusep?.ToUpper();
+ }
+ set
+ {
+ _codigoSusep = value;
+ }
+ }
+
+ public long? IdAggilizador { get; set; }
+
+ public string CodigoSeguradora
+ {
+ get
+ {
+ return _codigoSeguradora?.ToUpper();
+ }
+ set
+ {
+ _codigoSeguradora = value;
+ }
+ }
+
+ public List<SeguradoraContato> Contatos { get; set; }
+
+ public List<SeguradoraEndereco> Enderecos { get; set; }
+
+ public string CustomId { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (!string.IsNullOrWhiteSpace(Documento) && !Documento.ValidacaoDocumento())
+ {
+ list.AddValue("Documento", Messages.Invalido);
+ }
+ decimal? tolerancia = Tolerancia;
+ decimal num = 999;
+ if ((tolerancia.GetValueOrDefault() > num) & tolerancia.HasValue)
+ {
+ list.AddValue("Tolerancia", Messages.Invalido);
+ }
+ tolerancia = ToleranciaPremio;
+ num = 999999;
+ if ((tolerancia.GetValueOrDefault() > num) & tolerancia.HasValue)
+ {
+ list.AddValue("ToleranciaPremio", Messages.Invalido);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("SEGURADORA", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("CNPJ", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""),
+ new Tuple<string, string, string>("ASSISTÊNCIA 24 HORAS", string.IsNullOrWhiteSpace(Assistencia) ? "" : Assistencia, ""),
+ new Tuple<string, string, string>("SUSEP", string.IsNullOrWhiteSpace(Susep) ? "" : Susep, ""),
+ new Tuple<string, string, string>("CÓDIGO COMPANHIA", string.IsNullOrWhiteSpace(Codigo) ? "" : Codigo, ""),
+ new Tuple<string, string, string>("TOLERÂNCIA DE COMISSÃO", (!Tolerancia.HasValue) ? "" : Tolerancia?.ToString(), ""),
+ new Tuple<string, string, string>("TOLERÂNCIA DE PRÊMIO", (!ToleranciaPremio.HasValue) ? "" : ToleranciaPremio?.ToString(), ""),
+ new Tuple<string, string, string>("SEGURADORA ATIVA", Ativo ? "SIM" : "NÃO", ""),
+ new Tuple<string, string, string>("OBSERVAÇÃO", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, "")
+ }
+ }
+ };
+ if (Contatos != null)
+ {
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("CONTATOS$", "", "")
+ };
+ foreach (SeguradoraContato contato in Contatos)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" CONTATO {Contatos.IndexOf(contato) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" NOME", string.IsNullOrWhiteSpace(contato.NomeContato) ? "" : contato.NomeContato.ToUpper(), ""));
+ object item;
+ if (contato.Tipo.HasValue)
+ {
+ TipoTelefone? tipo = contato.Tipo;
+ item = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ observableCollection.Add(new Tuple<string, string, string>(" TIPO TELEFONE", (string)item, ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(contato.Prefixo) ? "" : contato.Prefixo, ""));
+ observableCollection.Add(new Tuple<string, string, string>(" TELEFONE", string.IsNullOrWhiteSpace(contato.Numero) ? "" : contato.Numero, ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ }
+ if (Enderecos != null)
+ {
+ ObservableCollection<Tuple<string, string, string>> observableCollection2 = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("ENDEREÇOS$", "", "")
+ };
+ foreach (SeguradoraEndereco endereco in Enderecos)
+ {
+ observableCollection2.Add(new Tuple<string, string, string>($" ENDEREÇO {Enderecos.IndexOf(endereco) + 1}$", "", ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" TIPO DO ENDEREÇO", endereco.Tipo.GetDescription(), ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" CEP", string.IsNullOrWhiteSpace(endereco.Cep) ? "" : endereco.Cep, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" ENDEREÇO", string.IsNullOrWhiteSpace(endereco.Endereco) ? "" : endereco.Endereco, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(endereco.Numero) ? "" : endereco.Numero, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" COMPLEMENTO", string.IsNullOrWhiteSpace(endereco.Complemento) ? "" : endereco.Complemento, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" BAIRRO", string.IsNullOrWhiteSpace(endereco.Bairro) ? "" : endereco.Bairro, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" CIDADE", string.IsNullOrWhiteSpace(endereco.Cidade) ? "" : endereco.Cidade, ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" ESTADO", string.IsNullOrWhiteSpace(endereco.Estado) ? "" : endereco.Estado, ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection2
+ });
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraContato.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraContato.cs
new file mode 100644
index 0000000..609596f
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraContato.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class SeguradoraContato : TelefoneBase, IDomain
+{
+ private string _nome;
+
+ private string _email;
+
+ public Empresa Empresa { get; set; }
+
+ public Seguradora Seguradora { get; set; }
+
+ public TipoContatoSeguradora TipoContato { get; set; }
+
+ public string NomeContato
+ {
+ get
+ {
+ return _nome;
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidateBase();
+ if (string.IsNullOrWhiteSpace(NomeContato) && TipoContato == TipoContatoSeguradora.Contato)
+ {
+ list.AddValue("NomeContato|NOME CONTATO", Messages.Obrigatorio);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraEndereco.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraEndereco.cs
new file mode 100644
index 0000000..9839df5
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/SeguradoraEndereco.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class SeguradoraEndereco : EnderecoBase, IDomain
+{
+ public Empresa Empresa { get; set; }
+
+ public Seguradora Seguradora { get; set; }
+
+ public TipoEndereco Tipo { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(base.Cep))
+ {
+ list.AddValue("Cep", Messages.Obrigatorio);
+ }
+ else if (!base.Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(base.Estado))
+ {
+ list.AddValue("Estado", Messages.Obrigatorio);
+ }
+ else if (!base.Estado.ValidacaoEstado())
+ {
+ list.AddValue("Estado", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(base.Endereco))
+ {
+ list.AddValue("Endereco", Messages.Obrigatorio);
+ }
+ else if (base.Endereco.Length > 60)
+ {
+ list.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (string.IsNullOrWhiteSpace(base.Numero))
+ {
+ list.AddValue("Numero", Messages.Obrigatorio);
+ }
+ else if (base.Numero.Length > 5)
+ {
+ list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 5));
+ }
+ if (string.IsNullOrWhiteSpace(base.Bairro))
+ {
+ list.AddValue("Bairro", Messages.Obrigatorio);
+ }
+ else if (base.Bairro.Length > 60)
+ {
+ list.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (string.IsNullOrWhiteSpace(base.Cidade))
+ {
+ list.AddValue("Cidade", Messages.Obrigatorio);
+ }
+ else if (base.Cidade.Length > 30)
+ {
+ list.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ string complemento = base.Complemento;
+ if (complemento != null && complemento.Length > 30)
+ {
+ list.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Sinistro.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Sinistro.cs
new file mode 100644
index 0000000..54176db
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Sinistro.cs
@@ -0,0 +1,421 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Globalization;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Sinistro : DomainBase, IDomain
+{
+ private string _numero;
+
+ private DateTime? _dataReclamacao;
+
+ private string _itemSinistrado;
+
+ private string _descricao;
+
+ private string _observacao;
+
+ private string _motivo;
+
+ private string _auxiliar;
+
+ private string _observacaoInterna;
+
+ private DateTime? _horaReclamacao;
+
+ public ControleSinistro ControleSinistro { get; set; }
+
+ [Log(true)]
+ public SinistroAuto SinistroAuto { get; set; }
+
+ [Log(true)]
+ public SinistroVida SinistroVida { get; set; }
+
+ [Log(true)]
+ public string Numero
+ {
+ get
+ {
+ return _numero?.ToUpper();
+ }
+ set
+ {
+ _numero = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("DATA RECLAMAÇÃO")]
+ public DateTime? DataReclamacao
+ {
+ get
+ {
+ return _dataReclamacao;
+ }
+ set
+ {
+ if (value.HasValue)
+ {
+ if (!HoraReclamacao.HasValue)
+ {
+ HoraReclamacao = value;
+ }
+ _dataReclamacao = DateTime.Parse($"{value.Value:d} {HoraReclamacao.Value:T}");
+ }
+ else
+ {
+ _dataReclamacao = null;
+ }
+ }
+ }
+
+ public DateTime? HoraReclamacao
+ {
+ get
+ {
+ return _horaReclamacao;
+ }
+ set
+ {
+ _horaReclamacao = value;
+ if (value.HasValue)
+ {
+ DataReclamacao = (DataReclamacao.HasValue ? new DateTime?(DateTime.Parse($"{DataReclamacao.Value:d} {value:T}")) : null);
+ }
+ }
+ }
+
+ [Log(true)]
+ [Description("DATA LIQUIDAÇÃO")]
+ public DateTime? DataLiquidacao { get; set; }
+
+ public bool Ativo { get; set; }
+
+ [Log(true)]
+ [Description("ITEM SINISTRADO")]
+ public string ItemSinistrado
+ {
+ get
+ {
+ return _itemSinistrado?.ToUpper();
+ }
+ set
+ {
+ _itemSinistrado = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("DESCRIÇÃO")]
+ public string Descricao
+ {
+ get
+ {
+ return _descricao?.ToUpper();
+ }
+ set
+ {
+ _descricao = value;
+ }
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao;
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("VALOR")]
+ public decimal Valor { get; set; }
+
+ [Log(true)]
+ [Description("MOTIVO")]
+ public string Motivo
+ {
+ get
+ {
+ return _motivo?.ToUpper();
+ }
+ set
+ {
+ _motivo = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("VALOR ORÇADO")]
+ public decimal ValorOrcado { get; set; }
+
+ [Log(true)]
+ [Description("VALOR LIBERADO")]
+ public decimal ValorLiberado { get; set; }
+
+ [Log(true)]
+ [Description("VALOR PAGO")]
+ public decimal ValorPago { get; set; }
+
+ [Log(true)]
+ [Description("VALOR FRANQUIA")]
+ public decimal ValorFranquia { get; set; }
+
+ [Log(true)]
+ [Description("AUXILIAR")]
+ public string Auxiliar
+ {
+ get
+ {
+ return _auxiliar?.ToUpper();
+ }
+ set
+ {
+ _auxiliar = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("VALOR SALVADO")]
+ public decimal? ValorSalvado { get; set; }
+
+ public string ObservacaoInterna
+ {
+ get
+ {
+ return _observacaoInterna;
+ }
+ set
+ {
+ _observacaoInterna = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("STATUS")]
+ public StatusSinistro? StatusSinistro { get; set; }
+
+ [Log(true)]
+ [Description("TIPO")]
+ public TipoSinistro? TipoSinistro { get; set; }
+
+ [Log(true)]
+ [Description("STATUS PERSONALIZADO")]
+ public string StatusPersonalizado { get; set; }
+
+ [Log(true)]
+ [Description("DATA CRIACAO")]
+ public DateTime? DataCriacao { get; set; }
+
+ [Log(true)]
+ [Description("USUARIO CRIACAO")]
+ public long IdUsuarioCriacao { get; set; }
+
+ [Log(true)]
+ [Description("DATA CRIAÇÃO")]
+ public DateTime? DataAlteracao { get; set; }
+
+ [Log(true)]
+ [Description("USUARIO ALTERACAO")]
+ public long IdUsuarioAlteracao { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (DataReclamacao.HasValue && (DateTime.Compare(DataReclamacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataReclamacao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataReclamacao", string.Format(Messages.DataInvalida));
+ }
+ if (HoraReclamacao.HasValue && (DateTime.Compare(HoraReclamacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(HoraReclamacao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("HoraReclamacao", string.Format(Messages.DataInvalida));
+ }
+ if (DataLiquidacao.HasValue && (DateTime.Compare(DataLiquidacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataLiquidacao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataLiquidacao", string.Format(Messages.DataInvalida));
+ }
+ if (ControleSinistro != null)
+ {
+ list.AddRange(ControleSinistro.Validate());
+ }
+ if (!DataReclamacao.HasValue)
+ {
+ list.AddValue("DataReclamacao", Messages.Obrigatorio);
+ }
+ if (StatusSinistro.GetValueOrDefault() != Gestor.Model.Common.StatusSinistro.EmAndamento && !DataLiquidacao.HasValue)
+ {
+ list.AddValue("DataLiquidacao", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>();
+ object item;
+ if (TipoSinistro.HasValue)
+ {
+ TipoSinistro? tipoSinistro = TipoSinistro;
+ item = (tipoSinistro.HasValue ? tipoSinistro.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ observableCollection.Add(new Tuple<string, string, string>("TIPO DO SINISTRO", (string)item, ""));
+ observableCollection.Add(new Tuple<string, string, string>("ITEM SINISTRADO", string.IsNullOrWhiteSpace(ItemSinistrado) ? "" : ItemSinistrado, ""));
+ observableCollection.Add(new Tuple<string, string, string>("NÚMERO DO SINISTRO", string.IsNullOrWhiteSpace(Numero) ? "" : Numero, ""));
+ observableCollection.Add(new Tuple<string, string, string>("DATA DO SINISTRO", (ControleSinistro == null) ? "" : ControleSinistro?.DataSinistro?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>("HORA DO SINISTRO", (ControleSinistro == null) ? "" : ControleSinistro?.HoraSinistro?.ToShortTimeString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>("DATA DA RECLAMAÇÃO", (!DataReclamacao.HasValue) ? "" : DataReclamacao?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>("HORA DA RECLAMAÇÃO", (!HoraReclamacao.HasValue) ? "" : HoraReclamacao?.ToShortTimeString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>("DATA DE LIQUIDAÇÃO", (!DataLiquidacao.HasValue) ? "" : DataLiquidacao?.ToShortDateString(), ""));
+ object item2;
+ if (StatusSinistro.HasValue)
+ {
+ StatusSinistro? statusSinistro = StatusSinistro;
+ item2 = (statusSinistro.HasValue ? statusSinistro.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item2 = "";
+ }
+ observableCollection.Add(new Tuple<string, string, string>("SITUAÇÃO", (string)item2, ""));
+ observableCollection.Add(new Tuple<string, string, string>("VALOR", Valor.ToString(new CultureInfo("pt-BR")), ""));
+ observableCollection.Add(new Tuple<string, string, string>("VALOR ORÇADO", ValorOrcado.ToString(new CultureInfo("pt-BR")), ""));
+ observableCollection.Add(new Tuple<string, string, string>("VALOR LIBERADO", ValorLiberado.ToString(new CultureInfo("pt-BR")), ""));
+ observableCollection.Add(new Tuple<string, string, string>("VALOR PAGO", ValorPago.ToString(new CultureInfo("pt-BR")), ""));
+ observableCollection.Add(new Tuple<string, string, string>("VALOR SALVADO", ValorSalvado.ToString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>("VALOR FRANQUIA", ValorFranquia.ToString(new CultureInfo("pt-BR")), ""));
+ observableCollection.Add(new Tuple<string, string, string>("MOTIVO", string.IsNullOrWhiteSpace(Motivo) ? "" : Motivo, ""));
+ observableCollection.Add(new Tuple<string, string, string>("AUXILIAR", string.IsNullOrWhiteSpace(Auxiliar) ? "" : Auxiliar, ""));
+ observableCollection.Add(new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""));
+ tupleList.Tuples = observableCollection;
+ list.Add(tupleList);
+ List<TupleList> list2 = list;
+ ObservableCollection<Tuple<string, string, string>> tuples2;
+ object item4;
+ if (SinistroAuto != null)
+ {
+ list2[0].Tuples.Add(new Tuple<string, string, string>("NÚMERO DO B.O.", string.IsNullOrWhiteSpace(SinistroAuto?.NumeroBo) ? "" : SinistroAuto?.NumeroBo, ""));
+ ObservableCollection<Tuple<string, string, string>> tuples = list2[0].Tuples;
+ object item3;
+ if (SinistroAuto.TipoPerda.HasValue)
+ {
+ SinistroAuto sinistroAuto = SinistroAuto;
+ if (sinistroAuto == null)
+ {
+ item3 = null;
+ }
+ else
+ {
+ TipoPerda? tipoPerda = sinistroAuto.TipoPerda;
+ item3 = (tipoPerda.HasValue ? tipoPerda.GetValueOrDefault().GetDescription() : null);
+ }
+ }
+ else
+ {
+ item3 = "";
+ }
+ tuples.Add(new Tuple<string, string, string>("TIPO DE PERDA", (string)item3, ""));
+ tuples2 = list2[0].Tuples;
+ if (SinistroAuto.Culpado.HasValue)
+ {
+ SinistroAuto sinistroAuto2 = SinistroAuto;
+ if (sinistroAuto2 == null || sinistroAuto2.Culpado != false)
+ {
+ item4 = "SIM";
+ goto IL_0571;
+ }
+ }
+ item4 = "NÃO";
+ goto IL_0571;
+ }
+ goto IL_0912;
+ IL_0912:
+ if (SinistroVida != null)
+ {
+ ObservableCollection<Tuple<string, string, string>> tuples3 = list2[0].Tuples;
+ SinistroVida sinistroVida = SinistroVida;
+ object item5;
+ if (sinistroVida != null && sinistroVida.TipoPerda.HasValue)
+ {
+ SinistroVida sinistroVida2 = SinistroVida;
+ if (sinistroVida2 == null)
+ {
+ item5 = null;
+ }
+ else
+ {
+ TipoPerda? tipoPerda = sinistroVida2.TipoPerda;
+ item5 = (tipoPerda.HasValue ? tipoPerda.GetValueOrDefault().GetDescription() : null);
+ }
+ }
+ else
+ {
+ item5 = "";
+ }
+ tuples3.Add(new Tuple<string, string, string>("TIPO DE PERDA", (string)item5, ""));
+ ObservableCollection<Tuple<string, string, string>> tuples4 = list2[0].Tuples;
+ SinistroVida sinistroVida3 = SinistroVida;
+ tuples4.Add(new Tuple<string, string, string>("AUXÍLIO FUNERAL", (sinistroVida3 == null || !sinistroVida3.AuxFuneral.HasValue) ? "" : ((SinistroVida?.AuxFuneral.Value).Value ? "SIM" : "NÃO"), ""));
+ ObservableCollection<Tuple<string, string, string>> tuples5 = list2[0].Tuples;
+ SinistroVida sinistroVida4 = SinistroVida;
+ object item6;
+ if (sinistroVida4 != null && sinistroVida4.EstadoCivil.HasValue)
+ {
+ SinistroVida sinistroVida5 = SinistroVida;
+ if (sinistroVida5 == null)
+ {
+ item6 = null;
+ }
+ else
+ {
+ EstadoCivil? estadoCivil = sinistroVida5.EstadoCivil;
+ item6 = (estadoCivil.HasValue ? estadoCivil.GetValueOrDefault().GetDescription() : null);
+ }
+ }
+ else
+ {
+ item6 = "";
+ }
+ tuples5.Add(new Tuple<string, string, string>("ESTADO CIVIL", (string)item6, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("CERTIDÃO DE ÓBITO", string.IsNullOrWhiteSpace(SinistroVida?.CertObito) ? "" : SinistroVida?.CertObito, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("BENEFICIÁRIO", string.IsNullOrWhiteSpace(SinistroVida?.Beneficiario) ? "" : SinistroVida?.Beneficiario, ""));
+ }
+ return list2;
+ IL_0571:
+ tuples2.Add(new Tuple<string, string, string>("CONSIDERA-SE CULPADO?", (string)item4, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("ÚLTIMO DOC. ENVIADO", (!SinistroAuto.UltimoDocEnviado.HasValue) ? "" : SinistroAuto?.UltimoDocEnviado?.ToShortDateString(), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(SinistroAuto?.Endereco) ? "" : SinistroAuto?.Endereco, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("ENVOLVIDO/PROPRIETÁRIO", string.IsNullOrWhiteSpace(SinistroAuto?.Envolvido) ? "" : SinistroAuto?.Envolvido, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("MOTORISTA", string.IsNullOrWhiteSpace(SinistroAuto?.Motorista) ? "" : SinistroAuto?.Motorista, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("DDD", string.IsNullOrWhiteSpace(SinistroAuto?.Ddd) ? "" : SinistroAuto?.Ddd, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("TELEFONE", string.IsNullOrWhiteSpace(SinistroAuto?.Telefone) ? "" : SinistroAuto?.Telefone, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(SinistroAuto?.Email) ? "" : SinistroAuto?.Email, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("VALOR MECÂNICA", SinistroAuto?.ValorMecanica.ToString(new CultureInfo("pt-BR")), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("PARCEIRO MECÂNICA", (SinistroAuto?.ParceiroMecanica == null) ? "" : SinistroAuto?.ParceiroMecanica?.Nome, ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("VALOR FUNILARIA", SinistroAuto?.ValorFunilaria.ToString(new CultureInfo("pt-BR")), ""));
+ list2[0].Tuples.Add(new Tuple<string, string, string>("PARCEIRO FUNILARIA", (SinistroAuto?.ParceiroFunilaria == null) ? "" : SinistroAuto?.ParceiroFunilaria?.Nome, ""));
+ goto IL_0912;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/SinistroAuto.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/SinistroAuto.cs
new file mode 100644
index 0000000..0fac555
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/SinistroAuto.cs
@@ -0,0 +1,199 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class SinistroAuto : DomainBase, IDomain
+{
+ private string _numeroBo;
+
+ private string _endereco;
+
+ private string _envolvido;
+
+ private string _motorista;
+
+ private string _ddd;
+
+ private string _telefone;
+
+ private string _email;
+
+ private string _cnh;
+
+ public Sinistro Sinistro { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("NUMERO B.O.")]
+ public string NumeroBo
+ {
+ get
+ {
+ return _numeroBo?.ToUpper();
+ }
+ set
+ {
+ _numeroBo = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("TIPO PERDA")]
+ public TipoPerda? TipoPerda { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("DECLARA-SE CULPADO")]
+ public bool? Culpado { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("DATA ÚLTIMO DOC. ENVIADO")]
+ public DateTime? UltimoDocEnviado { get; set; }
+
+ [Log(true)]
+ [Description("MECÂNICA")]
+ public Parceiro ParceiroMecanica { get; set; }
+
+ [Log(true)]
+ [Description("FUNILARIA")]
+ public Parceiro ParceiroFunilaria { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("ENDEREÇO")]
+ public string Endereco
+ {
+ get
+ {
+ return _endereco?.ToUpper();
+ }
+ set
+ {
+ _endereco = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ public string Envolvido
+ {
+ get
+ {
+ return _envolvido?.ToUpper();
+ }
+ set
+ {
+ _envolvido = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ public string Motorista
+ {
+ get
+ {
+ return _motorista?.ToUpper();
+ }
+ set
+ {
+ _motorista = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("PREFIXO")]
+ public string Ddd
+ {
+ get
+ {
+ return _ddd?.ToUpper().Trim();
+ }
+ set
+ {
+ _ddd = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("TELEFONE")]
+ public string Telefone
+ {
+ get
+ {
+ return _telefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("E-MAIL")]
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower().Trim();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ public string Cnh
+ {
+ get
+ {
+ return _cnh?.ToUpper().Trim();
+ }
+ set
+ {
+ _cnh = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("VALOR MECÂNICA")]
+ public decimal ValorMecanica { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("VALOR FINILARIA")]
+ public decimal ValorFunilaria { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Sinistro != null)
+ {
+ list.AddRange(Sinistro.Validate());
+ }
+ if (UltimoDocEnviado.HasValue && (DateTime.Compare(UltimoDocEnviado.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(UltimoDocEnviado.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("UltimoDocEnviado", string.Format(Messages.DataInvalida));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/SinistroVida.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/SinistroVida.cs
new file mode 100644
index 0000000..67070c9
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/SinistroVida.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class SinistroVida : DomainBase, IDomain
+{
+ private string _certObito;
+
+ private string _beneficiario;
+
+ private string _observacao;
+
+ public Sinistro Sinistro { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("TIPO PERDA")]
+ public TipoPerda? TipoPerda { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("AUXÍLIO FUNERAL")]
+ public bool? AuxFuneral { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("ESTADO CÍVIL")]
+ public EstadoCivil? EstadoCivil { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("CERT. ÓBITO")]
+ public string CertObito
+ {
+ get
+ {
+ return _certObito?.ToUpper();
+ }
+ set
+ {
+ _certObito = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("BENEFICIÁRIO")]
+ public string Beneficiario
+ {
+ get
+ {
+ return _beneficiario?.ToUpper();
+ }
+ set
+ {
+ _beneficiario = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("OBSERVAÇÃO")]
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Sinistro != null)
+ {
+ list.AddRange(Sinistro.Validate());
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Status.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Status.cs
new file mode 100644
index 0000000..5f22e1b
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Status.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Status : DomainBase, IDomain
+{
+ private string _nome;
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ public bool Ativo { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 60)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/TipoVendedor.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/TipoVendedor.cs
new file mode 100644
index 0000000..8966dff
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/TipoVendedor.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class TipoVendedor : DomainBase, IDomain
+{
+ private bool _selecionado;
+
+ private string _descricao;
+
+ private bool? _ativo;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("DESCRIÇÃO")]
+ public string Descricao
+ {
+ get
+ {
+ return _descricao?.ToUpper();
+ }
+ set
+ {
+ _descricao = value;
+ }
+ }
+
+ [Log(true)]
+ public bool? Ativo
+ {
+ get
+ {
+ return _ativo;
+ }
+ set
+ {
+ _ativo = value.GetValueOrDefault(true);
+ }
+ }
+
+ public bool? Inserido { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Descricao))
+ {
+ list.AddValue("Descricao", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""),
+ new Tuple<string, string, string>("ATIVO", (!Ativo.HasValue) ? "" : (Ativo.Value ? "SIM" : "NÃO"), "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/TitularesVida.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/TitularesVida.cs
new file mode 100644
index 0000000..6ec26af
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/TitularesVida.cs
@@ -0,0 +1,197 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class TitularesVida : DomainBase, IDomain, INotifyPropertyChanged
+{
+ private string _codigo;
+
+ private string _fatura;
+
+ private string _nome;
+
+ private string _observacao;
+
+ private string _matricula;
+
+ private decimal? _premio;
+
+ private decimal? _capital;
+
+ private bool _selecionado;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ public long IdItem { get; set; }
+
+ public string Codigo
+ {
+ get
+ {
+ return _codigo?.ToUpper();
+ }
+ set
+ {
+ _codigo = value;
+ }
+ }
+
+ public DateTime? Inicio { get; set; }
+
+ public DateTime? Fim { get; set; }
+
+ public string Fatura
+ {
+ get
+ {
+ return _fatura?.ToUpper();
+ }
+ set
+ {
+ _fatura = value;
+ }
+ }
+
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public DateTime? Nascimento { get; set; }
+
+ public string Cpf { get; set; }
+
+ public string Matricula
+ {
+ get
+ {
+ return _matricula?.ToUpper();
+ }
+ set
+ {
+ _matricula = value;
+ }
+ }
+
+ public decimal? Premio
+ {
+ get
+ {
+ return _premio.GetValueOrDefault();
+ }
+ set
+ {
+ _premio = value;
+ }
+ }
+
+ public decimal? Capital
+ {
+ get
+ {
+ return _capital.GetValueOrDefault();
+ }
+ set
+ {
+ _capital = value;
+ }
+ }
+
+ public TipoTitular? Tipo { get; set; }
+
+ public TitularesVida Dependente { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 150)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 150));
+ }
+ if (!Inicio.HasValue)
+ {
+ list.AddValue("Inicio|INÍCIO", Messages.Obrigatorio);
+ }
+ else if (DateTime.Compare(Inicio.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Inicio.Value, new DateTime(9999, 12, 31)) > 0)
+ {
+ list.AddValue("Inicio|INÍCIO", string.Format(Messages.DataInvalida));
+ }
+ if (Fim.HasValue && (DateTime.Compare(Fim.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Fim.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Fim", string.Format(Messages.DataInvalida));
+ }
+ if (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Nascimento", string.Format(Messages.DataInvalida));
+ }
+ if ((!Nascimento.HasValue || Funcoes.GetAge(Nascimento.Value) >= 18) && !string.IsNullOrWhiteSpace(Cpf) && !Cpf.ValidacaoDocumento())
+ {
+ list.AddValue("Cpf", Messages.Invalido);
+ }
+ if (!Tipo.HasValue)
+ {
+ list.AddValue("Tipo", Messages.Obrigatorio);
+ }
+ if (Tipo.GetValueOrDefault() == TipoTitular.Dependente && Dependente == null)
+ {
+ list.AddValue("Dependente", "OBRIGATÓRIO. PESQUISE POR UM DOS TITULARES\nQUE SEJA DO TIPO SÓCIO OU FUNCIONÁRIO");
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/TupleList.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/TupleList.cs
new file mode 100644
index 0000000..b5d7763
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/TupleList.cs
@@ -0,0 +1,9 @@
+using System;
+using System.Collections.ObjectModel;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class TupleList
+{
+ public ObservableCollection<Tuple<string, string, string>> Tuples { get; set; }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Usuario.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Usuario.cs
new file mode 100644
index 0000000..969b8e6
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Usuario.cs
@@ -0,0 +1,625 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Text.RegularExpressions;
+using Gestor.Model.API;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Usuario : EnderecoBase, IDomain
+{
+ private string _nome;
+
+ private string _prefixo;
+
+ private string _telefone;
+
+ private string _prefixo2;
+
+ private string _telefone2;
+
+ private string _email;
+
+ private string _documento;
+
+ private string _identidade;
+
+ private string _estadoEmissor;
+
+ private string _agencia;
+
+ private string _conta;
+
+ private string _login;
+
+ private bool? _segunda;
+
+ private bool? _terca;
+
+ private bool? _quarta;
+
+ private bool? _quinta;
+
+ private bool? _sexta;
+
+ private bool? _sabado;
+
+ private bool? _domingo;
+
+ private bool? _dashboard;
+
+ private TipoTelaInicial? _telaInicial;
+
+ public long IdEmpresa { get; set; }
+
+ [Log(true)]
+ public TipoTelaInicial? TelaInicial
+ {
+ get
+ {
+ return _telaInicial.GetValueOrDefault();
+ }
+ set
+ {
+ _telaInicial = value.GetValueOrDefault();
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome;
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ public bool Selecionado { get; set; }
+
+ [Log(true)]
+ [Description("DATA DE NASCIMENTO")]
+ public DateTime? Nascimento { get; set; }
+
+ [Log(true)]
+ public Sexo Sexo { get; set; }
+
+ [Log(true)]
+ public string Login
+ {
+ get
+ {
+ return _login?.ToUpper();
+ }
+ set
+ {
+ _login = value;
+ }
+ }
+
+ public string SenhaAnterior { get; set; } = string.Empty;
+
+
+ public string Senha { get; set; }
+
+ [Log(true)]
+ [Description("TIPO DO TELEFONE 1")]
+ public TipoTelefone? TipoTelefone { get; set; }
+
+ [Log(true)]
+ [Description("PREFIXO TELEFONE 1")]
+ public string Prefixo
+ {
+ get
+ {
+ return _prefixo?.ToUpper().Trim();
+ }
+ set
+ {
+ _prefixo = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TELEFONE 1")]
+ public string Telefone
+ {
+ get
+ {
+ return _telefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TIPO DO TELEFONE 2")]
+ public TipoTelefone? TipoTelefone2 { get; set; }
+
+ [Log(true)]
+ [Description("PREFIXO TELEFONE 2")]
+ public string Prefixo2
+ {
+ get
+ {
+ return _prefixo2?.ToUpper().Trim();
+ }
+ set
+ {
+ _prefixo2 = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TELEFONE 2")]
+ public string Telefone2
+ {
+ get
+ {
+ return _telefone2?.ToUpper().Trim();
+ }
+ set
+ {
+ _telefone2 = value;
+ }
+ }
+
+ [Log(true)]
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower().Trim();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ [Log(true)]
+ public string Documento
+ {
+ get
+ {
+ return _documento?.ToUpper().Trim();
+ }
+ set
+ {
+ _documento = value;
+ }
+ }
+
+ [Log(true)]
+ public string Identidade
+ {
+ get
+ {
+ return _identidade?.ToUpper().Trim();
+ }
+ set
+ {
+ _identidade = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("ESTADO EMISSOR")]
+ public string EstadoEmissor
+ {
+ get
+ {
+ return _estadoEmissor?.ToUpper().Trim();
+ }
+ set
+ {
+ _estadoEmissor = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("DATA DE EXPEDIÇÃO")]
+ public DateTime? Expedicao { get; set; }
+
+ [Log(true)]
+ public Banco Banco { get; set; }
+
+ [Log(true)]
+ [Description("AGÊNCIA")]
+ public string Agencia
+ {
+ get
+ {
+ return _agencia?.ToUpper().Trim();
+ }
+ set
+ {
+ _agencia = value;
+ }
+ }
+
+ [Log(true)]
+ public string Conta
+ {
+ get
+ {
+ return _conta?.ToUpper().Trim();
+ }
+ set
+ {
+ _conta = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("ACESSO AO MOBILE")]
+ public bool Mobile { get; set; }
+
+ [Log(true)]
+ [Description("ACESSO AOS RESULTADOS MOBILE")]
+ public bool Resultados { get; set; }
+
+ public bool Aggilizador { get; set; }
+
+ public bool Excluido { get; set; }
+
+ [Log(true)]
+ [Description("PERMISSÃO ACESSO AGGILIZADOR")]
+ public long? PermissaoAggilizador { get; set; }
+
+ [Log(true)]
+ public bool Administrador { get; set; }
+
+ [Description("INÍCIO DO ACESSO")]
+ public DateTime? InicioAcesso { get; set; }
+
+ [Description("FIM DO ACESSO")]
+ public DateTime? FimAcesso { get; set; }
+
+ [Log(true)]
+ [Description("ACESSO ÀS SEGUNDAS-FEIRAS")]
+ public bool? Segunda
+ {
+ get
+ {
+ return _segunda;
+ }
+ set
+ {
+ _segunda = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ [Description("ACESSO ÀS TERÇAS-FEIRAS")]
+ public bool? Terca
+ {
+ get
+ {
+ return _terca;
+ }
+ set
+ {
+ _terca = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ [Description("ACESSO ÁS QUARTAS-FEIRAS")]
+ public bool? Quarta
+ {
+ get
+ {
+ return _quarta;
+ }
+ set
+ {
+ _quarta = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ [Description("ACESSO ÁS QUINTAS-FEIRAS")]
+ public bool? Quinta
+ {
+ get
+ {
+ return _quinta;
+ }
+ set
+ {
+ _quinta = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ [Description("ACESSO ÁS SEXTAS-FEIRAS")]
+ public bool? Sexta
+ {
+ get
+ {
+ return _sexta;
+ }
+ set
+ {
+ _sexta = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ [Description("ACESSO AOS SÁBADOS")]
+ public bool? Sabado
+ {
+ get
+ {
+ return _sabado;
+ }
+ set
+ {
+ _sabado = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ [Description("ACESSO AOS DOMINGOS")]
+ public bool? Domingo
+ {
+ get
+ {
+ return _domingo;
+ }
+ set
+ {
+ _domingo = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ public string Cargo { get; set; }
+
+ public string Visita { get; set; }
+
+ [Log(true)]
+ [Description("FILTRO INICIAL")]
+ public TipoFiltroCliente? FiltroInicial { get; set; }
+
+ [Log(true)]
+ [Description("ACESSO AO DASHBOARD")]
+ public bool? Dashboard
+ {
+ get
+ {
+ return _dashboard;
+ }
+ set
+ {
+ _dashboard = value.GetValueOrDefault(true);
+ }
+ }
+
+ [Log(true)]
+ [Description("PERMISSÃO ADMINISTRADOR CENTRAL SEGURADO")]
+ public bool AdministradorCentralSegurado { get; set; }
+
+ public string SsoId { get; set; }
+
+ public string TokenSso { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public UserSso ToUserSso(string serial, string documentoEmpresa, string ssoId = null)
+ {
+ return new UserSso
+ {
+ Id = ssoId,
+ Name = Nome,
+ Username = Login,
+ Password = Senha,
+ Serial = serial,
+ CustomerDocument = documentoEmpresa,
+ IdEmpresa = IdEmpresa,
+ Document = Documento,
+ IsDeleted = false,
+ Email = (Email ?? string.Empty),
+ Phone = ((string.IsNullOrEmpty(Prefixo) || string.IsNullOrEmpty(Telefone)) ? string.Empty : (Prefixo.Clear() + Telefone.Clear()))
+ };
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Expedicao.HasValue && (DateTime.Compare(Expedicao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Expedicao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Expedicao", string.Format(Messages.DataInvalida));
+ }
+ if (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Nascimento", string.Format(Messages.DataInvalida));
+ }
+ if (InicioAcesso.HasValue && FimAcesso.HasValue && InicioAcesso.Value.TimeOfDay > FimAcesso.Value.TimeOfDay)
+ {
+ list.AddValue("FimAcesso|FIM DO ACESSO", "O HORÁRIO DO FIM DO ACESSO NÃO PODE SER ANTERIOR AO HORÁRIO DO INICIO DO ACESSO");
+ }
+ if (string.IsNullOrEmpty(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 50)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (!string.IsNullOrEmpty(Documento) && !Documento.ValidacaoDocumento())
+ {
+ list.AddValue("Documento", Messages.Invalido);
+ }
+ if (string.IsNullOrEmpty(Login))
+ {
+ list.AddValue("Login", Messages.Obrigatorio);
+ }
+ else if (Login.Length > 30)
+ {
+ list.AddValue("Login", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (!string.IsNullOrEmpty(Login) && !Regex.IsMatch(Login, "^(?!.* {2})[a-zA-Z0-9](?:[a-zA-Z0-9 .]{0,49}[a-zA-Z0-9])?$"))
+ {
+ list.AddValue("Login|USUARIO", "USUARIO INVALIDO,\nUSUARIO SOMENTE DEVE CONTER LETRAS E NUMEROS,\nNÃO DEVE CONTER MAIS DE UM ESPAÇO,\nNÃO DEVE TER ESPAÇO NO INICIO E NO FIM.\nEXEMPLO VALIDO:\nUSUARIO01 OU USUARIO 02 OU USUARIO.03");
+ }
+ if (string.IsNullOrEmpty(Senha))
+ {
+ list.AddValue("Senha", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrEmpty(Email))
+ {
+ list.AddValue("Email", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrEmpty(EstadoEmissor) && !EstadoEmissor.ValidacaoEstado())
+ {
+ list.AddValue("EstadoEmissor", Messages.Invalido);
+ }
+ if (Expedicao.HasValue && !Expedicao.ValidacaoDataPassada())
+ {
+ list.AddValue("Expedicao", Messages.Invalido);
+ }
+ if (Nascimento.HasValue && !Nascimento.ValidacaoDataPassada())
+ {
+ list.AddValue("Nascimento", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(base.Cep) && !base.Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(base.Endereco) && base.Endereco.Length > 60)
+ {
+ list.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!string.IsNullOrEmpty(base.Numero) && base.Numero.Length > 5)
+ {
+ list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 5));
+ }
+ if (!string.IsNullOrEmpty(base.Bairro) && base.Bairro.Length > 60)
+ {
+ list.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (!string.IsNullOrEmpty(base.Cidade) && base.Cidade.Length > 30)
+ {
+ list.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (!string.IsNullOrEmpty(base.Estado) && !base.Estado.ValidacaoEstado())
+ {
+ list.AddValue("Estado", Messages.Invalido);
+ }
+ if (!string.IsNullOrEmpty(base.Cep) || !string.IsNullOrEmpty(base.Numero) || !string.IsNullOrEmpty(base.Complemento) || !string.IsNullOrEmpty(base.Endereco) || !string.IsNullOrEmpty(base.Bairro) || !string.IsNullOrEmpty(base.Cidade) || !string.IsNullOrEmpty(base.Estado))
+ {
+ if (string.IsNullOrEmpty(base.Cep))
+ {
+ list.AddValue("Cep", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrEmpty(base.Endereco))
+ {
+ list.AddValue("Endereco", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrEmpty(base.Numero))
+ {
+ list.AddValue("Numero", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrEmpty(base.Bairro))
+ {
+ list.AddValue("Bairro", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrEmpty(base.Cidade))
+ {
+ list.AddValue("Cidade", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrEmpty(base.Estado))
+ {
+ list.AddValue("Estado", Messages.Obrigatorio);
+ }
+ }
+ if (AdministradorCentralSegurado && string.IsNullOrEmpty(Documento))
+ {
+ list.AddValue("Documento", Messages.Obrigatorio);
+ }
+ if (AdministradorCentralSegurado && string.IsNullOrEmpty(Prefixo))
+ {
+ list.AddValue("Prefixo", Messages.Obrigatorio);
+ }
+ if (AdministradorCentralSegurado && string.IsNullOrEmpty(Telefone))
+ {
+ list.AddValue("Telefone", Messages.Obrigatorio);
+ }
+ if (AdministradorCentralSegurado && string.IsNullOrEmpty(Email))
+ {
+ list.AddValue("Email", Messages.Obrigatorio);
+ }
+ if (InicioAcesso.HasValue && FimAcesso.HasValue && FimAcesso.Value.TimeOfDay == InicioAcesso.Value.TimeOfDay)
+ {
+ list.AddValue("InicioAcesso", Messages.Invalido);
+ list.AddValue("FimAcesso", Messages.Invalido);
+ }
+ if (Documento == null || string.IsNullOrEmpty(Documento))
+ {
+ list.AddValue("Documento", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("CPF/CNPJ", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""),
+ new Tuple<string, string, string>("USUÁRIO", string.IsNullOrWhiteSpace(Login) ? "" : Login, ""),
+ new Tuple<string, string, string>("IDENTIDADE", string.IsNullOrWhiteSpace(Identidade) ? "" : Identidade, ""),
+ new Tuple<string, string, string>("ESTADO EMISSOR", string.IsNullOrWhiteSpace(EstadoEmissor) ? "" : EstadoEmissor, ""),
+ new Tuple<string, string, string>("DATA DE EXPEDIÇÃO", (!Expedicao.HasValue) ? "" : Expedicao?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("SEXO", Sexo.GetDescription(), ""),
+ new Tuple<string, string, string>("DATA DE NASCIMENTO", (!Nascimento.HasValue) ? "" : Nascimento?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("BANCO", (Banco == null) ? "" : Banco?.Nome, ""),
+ new Tuple<string, string, string>("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia, ""),
+ new Tuple<string, string, string>("CONTA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta, ""),
+ new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(base.Endereco) ? "" : base.Endereco, ""),
+ new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(base.Numero) ? "" : base.Numero, ""),
+ new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(base.Complemento) ? "" : base.Complemento, ""),
+ new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(base.Bairro) ? "" : base.Bairro, ""),
+ new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(base.Cidade) ? "" : base.Cidade, ""),
+ new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(base.Estado) ? "" : base.Estado, ""),
+ new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(base.Cep) ? "" : base.Cep, ""),
+ new Tuple<string, string, string>("TIPO TELEFONE", (!TipoTelefone.HasValue) ? "" : TipoTelefone.GetDescription(), ""),
+ new Tuple<string, string, string>("PRIMEIRO PREFIXO", string.IsNullOrWhiteSpace(Prefixo) ? "" : Prefixo, ""),
+ new Tuple<string, string, string>("PRIMEIRO TELEFONE", string.IsNullOrWhiteSpace(Telefone) ? "" : Telefone, ""),
+ new Tuple<string, string, string>("TIPO TELEFONE", (!TipoTelefone2.HasValue) ? "" : TipoTelefone2.GetDescription(), ""),
+ new Tuple<string, string, string>("SEGUNDO PREFIXO", string.IsNullOrWhiteSpace(Prefixo2) ? "" : Prefixo2, ""),
+ new Tuple<string, string, string>("SEGUNDO TELEFONE", string.IsNullOrWhiteSpace(Telefone2) ? "" : Telefone2, ""),
+ new Tuple<string, string, string>("EMAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""),
+ new Tuple<string, string, string>("ACESSO MOBILE", Mobile ? "SIM" : "NÃO", ""),
+ new Tuple<string, string, string>("ACESSO RESULTADOS", Resultados ? "SIM" : "NÃO", ""),
+ new Tuple<string, string, string>("ACESSO INDIVIDUAL AGGILIZADOR", Aggilizador ? "SIM" : "NÃO", ""),
+ new Tuple<string, string, string>("INÍCIO DO ACESSO", (!InicioAcesso.HasValue) ? "" : InicioAcesso?.ToShortTimeString(), ""),
+ new Tuple<string, string, string>("FIM DO ACESSO", (!FimAcesso.HasValue) ? "" : FimAcesso?.ToShortTimeString(), ""),
+ new Tuple<string, string, string>("ADMINISTRADOR CENTRAL SEGURADO", AdministradorCentralSegurado ? "SIM" : "NÃO", "")
+ }
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Vendedor.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Vendedor.cs
new file mode 100644
index 0000000..b9de3b4
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Vendedor.cs
@@ -0,0 +1,245 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Vendedor : EnderecoBase, IDomain, INotifyPropertyChanged
+{
+ private bool _selecionado;
+
+ private string _nome;
+
+ private string _documento;
+
+ private string _conta;
+
+ private string _agencia;
+
+ private string _observacao;
+
+ private string _titularConta;
+
+ private string _documentoTitular;
+
+ public bool Selecionado
+ {
+ get
+ {
+ return _selecionado;
+ }
+ set
+ {
+ if (value != _selecionado)
+ {
+ _selecionado = value;
+ OnPropertyChanged("Selecionado");
+ }
+ }
+ }
+
+ public Controle Controle { get; set; }
+
+ public long IdEmpresa { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ public TipoIncidenciaDesconto TipoIncidenciaDesconto { get; set; }
+
+ public decimal? Desconto { get; set; }
+
+ public string Documento
+ {
+ get
+ {
+ return _documento?.ToUpper().Trim();
+ }
+ set
+ {
+ _documento = value;
+ }
+ }
+
+ public string TitularConta
+ {
+ get
+ {
+ return _titularConta?.ToUpper();
+ }
+ set
+ {
+ _titularConta = value;
+ }
+ }
+
+ public string TitularDocumento
+ {
+ get
+ {
+ return _documentoTitular?.ToUpper().Trim();
+ }
+ set
+ {
+ _documentoTitular = value;
+ }
+ }
+
+ public Banco Banco { get; set; }
+
+ public TipoConta TipoConta { get; set; }
+
+ public string Conta
+ {
+ get
+ {
+ return _conta?.ToUpper().Trim();
+ }
+ set
+ {
+ _conta = value;
+ }
+ }
+
+ public string Agencia
+ {
+ get
+ {
+ return _agencia?.ToUpper().Trim();
+ }
+ set
+ {
+ _agencia = value;
+ }
+ }
+
+ public bool Corretora { get; set; }
+
+ public bool Ativo { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public List<VendedorTelefone> Telefones { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrEmpty(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrWhiteSpace(Documento) && !Documento.ValidacaoDocumento())
+ {
+ list.AddValue("Documento", Messages.Invalido);
+ }
+ if (!string.IsNullOrWhiteSpace(TitularDocumento) && !TitularDocumento.ValidacaoDocumento())
+ {
+ list.AddValue("TitularDocumento", Messages.Invalido);
+ }
+ if (Telefones == null)
+ {
+ return list;
+ }
+ foreach (VendedorTelefone telefone in Telefones)
+ {
+ list.AddRange(telefone.Validate());
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("CPF", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""),
+ new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", ""),
+ new Tuple<string, string, string>("BANCO", (Banco == null) ? "" : Banco.Nome, ""),
+ new Tuple<string, string, string>("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia, ""),
+ new Tuple<string, string, string>("CONTA CORRENTE/POUPANÇA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta, ""),
+ new Tuple<string, string, string>("TITULAR DA CONTA", string.IsNullOrWhiteSpace(TitularConta) ? "" : TitularConta, ""),
+ new Tuple<string, string, string>("DOCUMENTO TITULAR DA CONTA", string.IsNullOrWhiteSpace(TitularDocumento) ? "" : TitularDocumento, ""),
+ new Tuple<string, string, string>("TIPO CONTA", string.IsNullOrWhiteSpace(TipoConta.GetDescription()) ? "" : TipoConta.GetDescription(), ""),
+ new Tuple<string, string, string>("DESCONTO", (!Desconto.HasValue) ? "" : (Desconto / (decimal?)100)?.ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("CONTATOS$", "", "")
+ };
+ if (Telefones != null && Telefones.Count != 0)
+ {
+ foreach (VendedorTelefone telefone in Telefones)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" CONTATO {Telefones.IndexOf(telefone) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" NOME", string.IsNullOrWhiteSpace(telefone.Nome) ? "" : telefone.Nome, ""));
+ object item;
+ if (telefone.Tipo.HasValue)
+ {
+ TipoTelefone? tipo = telefone.Tipo;
+ item = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ observableCollection.Add(new Tuple<string, string, string>(" TIPO DE TELEFONE", (string)item, ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo, ""));
+ observableCollection.Add(new Tuple<string, string, string>(" NÚMERO DE TELEFONE", string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero, ""));
+ observableCollection.Add(new Tuple<string, string, string>(" E-MAIL", string.IsNullOrWhiteSpace(telefone.Email) ? "" : telefone.Email, ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcela.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcela.cs
new file mode 100644
index 0000000..b1b66ff
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcela.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class VendedorParcela : DomainBase, IDomain
+{
+ private string _vCondRep;
+
+ public bool Selecionado { get; set; }
+
+ [Log(true)]
+ public Vendedor Vendedor { get; set; }
+
+ [Log(false)]
+ public Documento Documento { get; set; }
+
+ [Log(false)]
+ public Parcela Parcela { get; set; }
+
+ public string VCondRep
+ {
+ get
+ {
+ return _vCondRep?.ToUpper();
+ }
+ set
+ {
+ _vCondRep = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("VALOR REPASSE")]
+ public decimal? ValorRepasse { get; set; }
+
+ [Log(true)]
+ [Description("PORCENTAGEM REPASSE")]
+ public decimal? PorcentagemRepasse { get; set; }
+
+ public decimal? ValorRepasseB { get; set; }
+
+ [Log(true)]
+ [Description("DATA DO PAGAMENTO")]
+ public DateTime? DataPagamento { get; set; }
+
+ public decimal? PorcentagemRepasseB { get; set; }
+
+ [Log(true)]
+ [Description("DATA PREVISÃO DE PAGAMENTO")]
+ public DateTime? DataPrePagamento { get; set; }
+
+ public decimal? ValorTotal { get; set; }
+
+ public decimal? ValorTotalPago { get; set; }
+
+ public Repasse Repasse { get; set; }
+
+ public CondicaoRepasse CondicaoRepasse { get; set; }
+
+ public TipoVendedor TipoVendedor { get; set; }
+
+ public bool CoCorretagem { get; set; }
+
+ public string RecebidoPorCompleto { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (DataPagamento.HasValue && (DateTime.Compare(DataPagamento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataPagamento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataPagamento", string.Format(Messages.DataInvalida));
+ }
+ if (DataPrePagamento.HasValue && (DateTime.Compare(DataPrePagamento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataPrePagamento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("DataPrePagamento", string.Format(Messages.DataInvalida));
+ }
+ if (Vendedor == null)
+ {
+ list.AddValue("Vendedor", Messages.Obrigatorio);
+ }
+ if (Documento == null)
+ {
+ list.AddValue("Documento", Messages.Obrigatorio);
+ }
+ if (Documento != null && Documento.Id > 0 && Parcela == null)
+ {
+ list.AddValue("Parcela", Messages.Obrigatorio);
+ }
+ if (Repasse == null)
+ {
+ list.AddValue("Repasse", Messages.Obrigatorio);
+ }
+ if (TipoVendedor == null && !CoCorretagem)
+ {
+ list.AddValue("TipoVendedor", Messages.Obrigatorio);
+ }
+ if (!PorcentagemRepasse.HasValue && !CoCorretagem)
+ {
+ list.AddValue("PorcentagemRepasse", Messages.Obrigatorio);
+ }
+ if (!ValorRepasse.HasValue)
+ {
+ list.AddValue("ValorRepasse", Messages.Obrigatorio);
+ }
+ if (Vendedor == null || Vendedor.Corretora)
+ {
+ return list;
+ }
+ if (PorcentagemRepasse.HasValue)
+ {
+ decimal? porcentagemRepasse = PorcentagemRepasse;
+ if ((porcentagemRepasse.GetValueOrDefault() <= default(decimal)) & porcentagemRepasse.HasValue)
+ {
+ list.AddValue("PorcentagemRepasse", Messages.Invalido);
+ }
+ }
+ if (ValorRepasse.HasValue)
+ {
+ decimal? porcentagemRepasse = ValorRepasse;
+ if (((porcentagemRepasse.GetValueOrDefault() == default(decimal)) & porcentagemRepasse.HasValue) && !CoCorretagem)
+ {
+ list.AddValue("ValorRepasse", Messages.Invalido);
+ }
+ }
+ if (Repasse != null && Documento != null && Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Parcela && Repasse.Base.GetValueOrDefault() == BaseRepasse.Transmissao && (!Documento.Remessa.HasValue || DateTime.Compare(Documento.Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Documento.Remessa.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida));
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcelas.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcelas.cs
new file mode 100644
index 0000000..dabb101
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorParcelas.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class VendedorParcelas : DomainBase
+{
+ public ObservableCollection<VendedorParcela> VendedorParcelasList { get; set; }
+
+ public List<TupleList> Log(bool restricaoComissao, bool restricaoComissaoPorcentagem)
+ {
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("VENDEDORES$", "", "")
+ };
+ if (VendedorParcelasList != null)
+ {
+ foreach (VendedorParcela vendedorParcelas in VendedorParcelasList)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" NOME", (vendedorParcelas.Vendedor == null) ? "" : vendedorParcelas.Vendedor.Nome.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" TIPO VENDEDOR", (vendedorParcelas.TipoVendedor == null) ? "" : vendedorParcelas.TipoVendedor.Descricao, ""));
+ if (!restricaoComissao)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" COMISSÃO", (!vendedorParcelas.PorcentagemRepasse.HasValue) ? "" : vendedorParcelas.PorcentagemRepasse?.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" REPASSE", (!vendedorParcelas.ValorRepasse.HasValue) ? "" : vendedorParcelas.ValorRepasse?.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ else if (restricaoComissaoPorcentagem)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" COMISSÃO", (!vendedorParcelas.PorcentagemRepasse.HasValue) ? "" : vendedorParcelas.PorcentagemRepasse?.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" REPASSE", "", ""));
+ }
+ else
+ {
+ observableCollection.Add(new Tuple<string, string, string>(" COMISSÃO", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" REPASSE", "", ""));
+ }
+ observableCollection.Add(new Tuple<string, string, string>(" DATA PRÉ PAGAMENTO", (!vendedorParcelas.DataPrePagamento.HasValue) ? "" : vendedorParcelas.DataPrePagamento?.ToShortDateString(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" DATA PAGAMENTO", (!vendedorParcelas.DataPagamento.HasValue) ? "" : vendedorParcelas.DataPagamento?.ToShortDateString(), ""));
+ }
+ }
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = observableCollection
+ }
+ };
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs
new file mode 100644
index 0000000..2eaa3f2
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class VendedorTelefone : TelefoneBase, IDomain
+{
+ private string _nome;
+
+ private string _email;
+
+ public Vendedor Vendedor { get; set; }
+
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower().Trim();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidateBase(obrigatorio: false);
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ if (!string.IsNullOrEmpty(Email) && Email.Length > 100)
+ {
+ list.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (!string.IsNullOrEmpty(Email) && !Email.ValidacaoEmail())
+ {
+ list.AddValue("Email|E-MAIL", Messages.Invalido);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorUsuario.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorUsuario.cs
new file mode 100644
index 0000000..efd1f3e
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorUsuario.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class VendedorUsuario : DomainBase, IDomain
+{
+ public Usuario Usuario { get; set; }
+
+ public Vendedor Vendedor { get; set; }
+
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (Usuario == null)
+ {
+ list.AddValue("Usuario", Messages.Obrigatorio);
+ }
+ if (Vendedor == null)
+ {
+ list.AddValue("Vendedor", Messages.Obrigatorio);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Vida.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Vida.cs
new file mode 100644
index 0000000..c9dc57d
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Vida.cs
@@ -0,0 +1,129 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Vida : DomainBase, IDomain
+{
+ private string _plano;
+
+ public Item Item { get; set; }
+
+ public string Plano
+ {
+ get
+ {
+ return _plano?.ToUpper();
+ }
+ set
+ {
+ _plano = value;
+ }
+ }
+
+ public int? Socios { get; set; }
+
+ public int? Funcionarios { get; set; }
+
+ public decimal? CapitalSocios { get; set; }
+
+ public decimal? CapitalFuncionarios { get; set; }
+
+ public string Observacao { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Plano))
+ {
+ list.AddValue("Plano", Messages.Obrigatorio);
+ }
+ if (Item?.Documento == null)
+ {
+ return list;
+ }
+ long id = Item.Documento.Controle.Ramo.Id;
+ if (id == 7 || id == 10 || id == 53)
+ {
+ if (!Socios.HasValue || Socios < 0)
+ {
+ list.AddValue("Socios|SÓCIOS", Messages.Obrigatorio);
+ }
+ if (!Funcionarios.HasValue || Funcionarios < 0)
+ {
+ list.AddValue("Funcionarios|FUNCIONÁRIOS", Messages.Obrigatorio);
+ }
+ if (CapitalSocios.HasValue)
+ {
+ decimal? capitalSocios = CapitalSocios;
+ if (!((capitalSocios.GetValueOrDefault() < default(decimal)) & capitalSocios.HasValue))
+ {
+ goto IL_0133;
+ }
+ }
+ list.AddValue("CapitalSocios|CAPITAL SÓCIO", Messages.Obrigatorio);
+ goto IL_0133;
+ }
+ goto IL_017e;
+ IL_017e:
+ return list;
+ IL_0133:
+ if (CapitalFuncionarios.HasValue)
+ {
+ decimal? capitalSocios = CapitalFuncionarios;
+ if (!((capitalSocios.GetValueOrDefault() < default(decimal)) & capitalSocios.HasValue))
+ {
+ goto IL_017e;
+ }
+ }
+ list.AddValue("CapitalFuncionarios|CAPITAL FUNCIONÁRIO", Messages.Obrigatorio);
+ goto IL_017e;
+ }
+
+ public static List<TupleList> Log(Item item)
+ {
+ List<TupleList> list = new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("PLANO", string.IsNullOrWhiteSpace(item.Vida.Plano) ? "" : item.Vida.Plano, ""),
+ new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(item.Descricao) ? "" : item.Descricao.ToUpper(), ""),
+ new Tuple<string, string, string>("SÓCIOS", (!item.Vida.Socios.HasValue) ? "" : item.Vida.Socios?.ToString(), ""),
+ new Tuple<string, string, string>("CAPITAL SÓCIO", (!item.Vida.CapitalSocios.HasValue) ? "" : item.Vida.CapitalSocios?.ToString(), ""),
+ new Tuple<string, string, string>("FUNCIONÁRIOS", (!item.Vida.Funcionarios.HasValue) ? "" : item.Vida.Funcionarios?.ToString(), ""),
+ new Tuple<string, string, string>("CAPITAL FUNCIONÁRIOS", (!item.Vida.CapitalFuncionarios.HasValue) ? "" : item.Vida.CapitalFuncionarios?.ToString(), ""),
+ new Tuple<string, string, string>("QUANTIDADE DE TITULARES", (!item.Vida.Socios.HasValue) ? "" : item.Vida.Socios?.ToString(), ""),
+ new Tuple<string, string, string>("QUANTIDADE DE BENEFICIÁRIOS", (!item.Vida.Funcionarios.HasValue) ? "" : item.Vida.Funcionarios?.ToString(), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("COBERTURAS$", "", "")
+ };
+ foreach (Cobertura cobertura in item.Coberturas)
+ {
+ observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", ""));
+ observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""));
+ }
+ list.Add(new TupleList
+ {
+ Tuples = observableCollection
+ });
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/VinculoRepasse.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/VinculoRepasse.cs
new file mode 100644
index 0000000..3543683
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/VinculoRepasse.cs
@@ -0,0 +1,74 @@
+using System.Collections.Generic;
+using System.Linq;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class VinculoRepasse : DomainBase
+{
+ public TipoVendedor TipoVendedor { get; set; }
+
+ public long IdRepasse { get; set; }
+
+ public TipoVendedor TipoVendedorVinculo { get; set; }
+
+ public Repasse RepasseVinculo { get; set; }
+
+ public List<KeyValuePair<string, string>> Validate(List<VinculoRepasse> vinculos, Repasse repasse)
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (TipoVendedor == null)
+ {
+ list.AddValue("TipoVendedor|TIPO VENDEDOR DO REPASSE", Messages.Obrigatorio);
+ }
+ if (IdRepasse == 0L)
+ {
+ list.AddValue("IdRepasse|REPASSE", Messages.Obrigatorio);
+ }
+ if (TipoVendedorVinculo == null)
+ {
+ list.AddValue("TipoVendedorVinculo|TIPO VENDEDOR DO VÍNCULO", Messages.Obrigatorio);
+ }
+ if (RepasseVinculo == null)
+ {
+ list.AddValue("RepasseVinculo|REPASSE DO VÍNCULO", Messages.Obrigatorio);
+ }
+ if (TipoVendedor != null && TipoVendedorVinculo != null && TipoVendedor.Id == TipoVendedorVinculo.Id)
+ {
+ list.AddValue("TipoVendedor", "TIPO VENDEDOR SELECIONADO NÃO PODE SER O MESMO TIPO VENDEDOR DO VINCULO");
+ }
+ if (IdRepasse > 0 && RepasseVinculo != null && IdRepasse == RepasseVinculo.Id)
+ {
+ list.AddValue("RepasseVinculo|REPASSE DO VÍNCULO", "NÃO É POSSÍVEL VINCULAR O MESMO REPASSE");
+ }
+ decimal num = ((RepasseVinculo == null) ? 0m : ((RepasseVinculo.Tipo.GetValueOrDefault() == TipoRepasse.Percentual && RepasseVinculo.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao) ? RepasseVinculo.ValorNovo : 0m));
+ decimal num2 = ((repasse.Tipo.GetValueOrDefault() == TipoRepasse.Percentual && repasse.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao) ? repasse.ValorNovo : 0m) + num;
+ num2 += ((TipoVendedor == null) ? 0m : (vinculos?.Where((VinculoRepasse x) => TipoVendedor.Id == x.TipoVendedor.Id && x.RepasseVinculo.Tipo.GetValueOrDefault() == TipoRepasse.Percentual && x.RepasseVinculo.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao).Sum((VinculoRepasse x) => x.RepasseVinculo.ValorNovo) ?? 0m));
+ decimal num3 = ((RepasseVinculo == null) ? 0m : ((RepasseVinculo.Tipo.GetValueOrDefault() == TipoRepasse.Percentual && RepasseVinculo.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao) ? RepasseVinculo.ValorRenovacao : 0m));
+ decimal num4 = ((repasse.Tipo.GetValueOrDefault() == TipoRepasse.Percentual && repasse.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao) ? repasse.ValorRenovacao : 0m) + num3 + ((TipoVendedor == null) ? 0m : (vinculos?.Where((VinculoRepasse x) => TipoVendedor.Id == x.TipoVendedor.Id && x.RepasseVinculo.Tipo.GetValueOrDefault() == TipoRepasse.Percentual && x.RepasseVinculo.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao).Sum((VinculoRepasse x) => x.RepasseVinculo.ValorRenovacao) ?? 0m));
+ if (num2 > 100m)
+ {
+ list.AddValue("RepasseVinculo|VALOR NOVO", "O VALOR DE REPASSE PARA SEGUROS NOVOS ULTRAPASSARÁ 100% DA COMISSÃO RECEBIDA");
+ }
+ if (num4 > 100m)
+ {
+ list.AddValue("RepasseVinculo|VALOR RENOVAÇÃO", "O VALOR DE REPASSE PARA RENOVAÇÕES ULTRAPASSARÁ 100% DA COMISSÃO RECEBIDA");
+ }
+ if (vinculos == null || vinculos.Count <= 0)
+ {
+ return list;
+ }
+ if (TipoVendedor != null && TipoVendedorVinculo != null && vinculos.Any((VinculoRepasse x) => x.TipoVendedor.Id == TipoVendedor.Id && x.TipoVendedorVinculo.Id == TipoVendedorVinculo.Id))
+ {
+ list.AddValue("TipoVendedorVinculo|TIPO VENDEDOR DO VÍNCULO", "JÁ EXISTE UM VINCULO DE REPASSE PARA " + TipoVendedorVinculo.Descricao);
+ }
+ if (TipoVendedor != null && RepasseVinculo != null && vinculos.Any((VinculoRepasse x) => x.TipoVendedor.Id == TipoVendedor.Id && x.RepasseVinculo.Vendedor.Id == RepasseVinculo.Vendedor.Id))
+ {
+ list.AddValue("TipoVendedorVinculo|VENDEDOR DO VÍNCULO", "JÁ EXISTE UM VINCULO DE REPASSE PARA PARA " + RepasseVinculo.Vendedor.Nome);
+ }
+ return list;
+ }
+}
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/VinculoVendedor.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/VinculoVendedor.cs
new file mode 100644
index 0000000..a474467
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/VinculoVendedor.cs
@@ -0,0 +1,10 @@
+using Gestor.Model.Domain.Generic;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class VinculoVendedor : DomainBase
+{
+ public Vendedor Vendedor { get; set; }
+
+ public bool Vinculado { get; set; }
+}