From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Model.Domain.Seguros/Adiantamento.cs | 145 ++ .../Model.Domain.Seguros/Aeronautico.cs | 475 ++++++ .../Model.Domain.Seguros/AggilizadorPermissao.cs | 25 + Codemerx/Gestor.Model/Model.Domain.Seguros/Auto.cs | 793 +++++++++ .../Gestor.Model/Model.Domain.Seguros/Cliente.cs | 1193 +++++++++++++ .../Model.Domain.Seguros/ClienteEmail.cs | 88 + .../Model.Domain.Seguros/ClienteEndereco.cs | 155 ++ .../Model.Domain.Seguros/ClienteTelefone.cs | 82 + .../Model.Domain.Seguros/ClienteVinculo.cs | 56 + .../Gestor.Model/Model.Domain.Seguros/Cobertura.cs | 86 + .../Model.Domain.Seguros/CoberturaGranizo.cs | 125 ++ .../Model.Domain.Seguros/CoberturaPadrao.cs | 67 + .../Model.Domain.Seguros/CondicaoRepasse.cs | 49 + .../Model.Domain.Seguros/ConfigExtratoImport.cs | 50 + .../Gestor.Model/Model.Domain.Seguros/Consorcio.cs | 191 +++ .../Gestor.Model/Model.Domain.Seguros/Controle.cs | 128 ++ .../Model.Domain.Seguros/ControleSinistro.cs | 118 ++ .../Model.Domain.Seguros/CriticaApolice.cs | 116 ++ .../Model.Domain.Seguros/DetalheExtrato.cs | 250 +++ .../Gestor.Model/Model.Domain.Seguros/Documento.cs | 1426 ++++++++++++++++ .../Model.Domain.Seguros/Estipulante.cs | 373 ++++ .../Gestor.Model/Model.Domain.Seguros/Expedicao.cs | 94 + .../Gestor.Model/Model.Domain.Seguros/Extrato.cs | 177 ++ .../Model.Domain.Seguros/Fabricante.cs | 62 + .../Gestor.Model/Model.Domain.Seguros/Granizo.cs | 247 +++ Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs | 505 ++++++ .../Model.Domain.Seguros/MaisContato.cs | 340 ++++ .../Model.Domain.Seguros/MetaSeguradora.cs | 60 + .../Model.Domain.Seguros/MetaVendedor.cs | 56 + .../Gestor.Model/Model.Domain.Seguros/Parceiro.cs | 528 ++++++ .../Gestor.Model/Model.Domain.Seguros/Parcela.cs | 789 +++++++++ .../Gestor.Model/Model.Domain.Seguros/Parcelas.cs | 204 +++ .../Model.Domain.Seguros/Patrimonial.cs | 574 +++++++ .../Gestor.Model/Model.Domain.Seguros/Perfil.cs | 275 +++ .../Model.Domain.Seguros/PerfilEmpresa.cs | 141 ++ .../PermissaoArquivoDigital.cs | 69 + .../Model.Domain.Seguros/PermissaoUsuario.cs | 57 + .../Gestor.Model/Model.Domain.Seguros/Produto.cs | 120 ++ .../Model.Domain.Seguros/Prospeccao.cs | 400 +++++ .../Model.Domain.Seguros/ProspeccaoToPrint.cs | 149 ++ .../Model.Domain.Seguros/Qualificacao.cs | 152 ++ Codemerx/Gestor.Model/Model.Domain.Seguros/Ramo.cs | 165 ++ .../Gestor.Model/Model.Domain.Seguros/Repasse.cs | 187 ++ .../Model.Domain.Seguros/ResponsavelAssinatura.cs | 109 ++ .../Model.Domain.Seguros/RestricaoUsuario.cs | 60 + .../RestricaoUsuarioCamposRelatorios.cs | 61 + .../Model.Domain.Seguros/RiscosDiversos.cs | 130 ++ .../Model.Domain.Seguros/Seguradora.cs | 1804 ++++++++++++++++++++ .../Model.Domain.Seguros/SeguradoraContato.cs | 90 + .../Model.Domain.Seguros/SeguradoraEndereco.cs | 115 ++ .../Gestor.Model/Model.Domain.Seguros/Sinistro.cs | 1132 ++++++++++++ .../Model.Domain.Seguros/SinistroAuto.cs | 284 +++ .../Model.Domain.Seguros/SinistroVida.cs | 138 ++ .../Gestor.Model/Model.Domain.Seguros/Status.cs | 86 + .../Model.Domain.Seguros/TipoVendedor.cs | 138 ++ .../Model.Domain.Seguros/TitularesVida.cs | 269 +++ .../Gestor.Model/Model.Domain.Seguros/TupleList.cs | 19 + .../Gestor.Model/Model.Domain.Seguros/Usuario.cs | 872 ++++++++++ .../Gestor.Model/Model.Domain.Seguros/Vendedor.cs | 375 ++++ .../Model.Domain.Seguros/VendedorParcela.cs | 235 +++ .../Model.Domain.Seguros/VendedorParcelas.cs | 162 ++ .../Model.Domain.Seguros/VendedorTelefone.cs | 89 + .../Model.Domain.Seguros/VendedorUsuario.cs | 51 + Codemerx/Gestor.Model/Model.Domain.Seguros/Vida.cs | 306 ++++ .../Model.Domain.Seguros/VinculoRepasse.cs | 159 ++ .../Model.Domain.Seguros/VinculoVendedor.cs | 25 + 66 files changed, 18051 insertions(+) create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Adiantamento.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Aeronautico.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/AggilizadorPermissao.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Auto.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Cliente.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEmail.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEndereco.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteTelefone.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteVinculo.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaGranizo.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaPadrao.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/CondicaoRepasse.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ConfigExtratoImport.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Consorcio.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Controle.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ControleSinistro.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/CriticaApolice.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/DetalheExtrato.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Expedicao.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Extrato.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Fabricante.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Granizo.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/MaisContato.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/MetaSeguradora.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/MetaVendedor.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Parceiro.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Parcela.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Parcelas.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Patrimonial.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/PerfilEmpresa.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoArquivoDigital.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoUsuario.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Produto.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ProspeccaoToPrint.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Qualificacao.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Ramo.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuario.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Seguradora.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraContato.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraEndereco.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Sinistro.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroAuto.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroVida.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Status.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/TipoVendedor.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/TitularesVida.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/TupleList.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Usuario.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcela.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcelas.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorTelefone.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorUsuario.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Vida.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoRepasse.cs create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoVendedor.cs (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros') diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Adiantamento.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Adiantamento.cs new file mode 100644 index 0000000..979ce16 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Adiantamento.cs @@ -0,0 +1,145 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Validation; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Adiantamento : DomainBase + { + private string _historico; + + public DateTime? Data + { + get; + set; + } + + public string Historico + { + get + { + string str = this._historico; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._historico = value; + } + } + + public DateTime? Pagamento + { + get; + set; + } + + public bool Pago + { + get; + set; + } + + public Gestor.Model.Common.TipoPagamento? TipoPagamento + { + get; + set; + } + + public decimal Valor + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public Adiantamento() + { + } + + public List Log() + { + string shortDateString; + string description; + string str; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("HISTÓRICO", (string.IsNullOrWhiteSpace(this.Historico) ? "" : this.Historico), "") + }; + DateTime? data = this.Data; + if (!data.HasValue) + { + shortDateString = ""; + } + else + { + data = this.Data; + if (data.HasValue) + { + shortDateString = data.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection.Add(new Tuple("DATA DO ADIANTAMENTO", shortDateString, "")); + decimal valor = this.Valor; + observableCollection.Add(new Tuple("VALOR DO ADIANTAMENTO", valor.ToString("c2"), "")); + Gestor.Model.Common.TipoPagamento? tipoPagamento = this.TipoPagamento; + if (!tipoPagamento.HasValue) + { + description = ""; + } + else + { + tipoPagamento = this.TipoPagamento; + if (tipoPagamento.HasValue) + { + description = tipoPagamento.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection.Add(new Tuple("TIPO DO PAGAMENTO", description, "")); + observableCollection.Add(new Tuple("PAGO", (this.Pago ? "SIM" : "NÃO"), "")); + data = this.Pagamento; + if (!data.HasValue) + { + str = ""; + } + else + { + data = this.Pagamento; + if (data.HasValue) + { + str = data.GetValueOrDefault().ToShortDateString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("DATA DO PAGAMENTO", str, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Aeronautico.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Aeronautico.cs new file mode 100644 index 0000000..09f19f9 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Aeronautico.cs @@ -0,0 +1,475 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +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 string Casco + { + get + { + string str = this._casco; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._casco = value; + } + } + + public string Certificado + { + get + { + string str = this._certificado; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._certificado = value; + } + } + + public int? Fabricacao + { + get; + set; + } + + public string Fabricante + { + get + { + string str = this._fabricante; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._fabricante = value; + } + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public string MarinaAero + { + get + { + string str = this._marinaAero; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._marinaAero = value; + } + } + + public string Modelo + { + get + { + string str = this._modelo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._modelo = value; + } + } + + public string Navegacao + { + get + { + string str = this._navegacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._navegacao = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public int? Passageiros + { + get; + set; + } + + public long? Peso + { + get; + set; + } + + public string Prefixo + { + get + { + string str = this._prefixo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._prefixo = value; + } + } + + public string Serie + { + get + { + string str = this._serie; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._serie = value; + } + } + + public TipoAeronautico Tipo + { + get; + set; + } + + public int? Tripulantes + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Aeronautico aeronautico = this; + return new Func>>(aeronautico.Validate); + } + } + + public DateTime? Vistoria + { + get; + set; + } + + public Aeronautico() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + string str; + string str1; + string str2; + string str3; + string shortDateString; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("TIPO DE AERONAVE", item.Aeronautico.Tipo.GetDescription(), ""), + new Tuple("FABRICANTE", (string.IsNullOrWhiteSpace(item.Aeronautico.Fabricante) ? "" : item.Aeronautico.Fabricante.ToUpper()), ""), + new Tuple("MODELO", (string.IsNullOrWhiteSpace(item.Aeronautico.Modelo) ? "" : item.Aeronautico.Modelo.ToUpper()), ""), + new Tuple("REGISTRO", (string.IsNullOrWhiteSpace(item.Aeronautico.Serie) ? "" : item.Aeronautico.Serie.ToUpper()), ""), + new Tuple("PREFIXO", (string.IsNullOrWhiteSpace(item.Aeronautico.Prefixo) ? "" : item.Aeronautico.Prefixo.ToUpper()), "") + }; + int? fabricacao = item.Aeronautico.Fabricacao; + if (!fabricacao.HasValue) + { + str = ""; + } + else + { + fabricacao = item.Aeronautico.Fabricacao; + if (fabricacao.HasValue) + { + str = fabricacao.GetValueOrDefault().ToString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("ANO DE FABRICAÇÃO", str, "")); + fabricacao = item.Aeronautico.Tripulantes; + if (!fabricacao.HasValue) + { + str1 = ""; + } + else + { + fabricacao = item.Aeronautico.Tripulantes; + if (fabricacao.HasValue) + { + str1 = fabricacao.GetValueOrDefault().ToString(); + } + else + { + str1 = null; + } + } + observableCollection.Add(new Tuple("TRIPULANTES", str1, "")); + fabricacao = item.Aeronautico.Passageiros; + if (!fabricacao.HasValue) + { + str2 = ""; + } + else + { + fabricacao = item.Aeronautico.Passageiros; + if (fabricacao.HasValue) + { + str2 = fabricacao.GetValueOrDefault().ToString(); + } + else + { + str2 = null; + } + } + observableCollection.Add(new Tuple("PASSAGEIROS", str2, "")); + observableCollection.Add(new Tuple("AERÓDROMO", (string.IsNullOrWhiteSpace(item.Aeronautico.MarinaAero) ? "" : item.Aeronautico.MarinaAero.ToUpper()), "")); + long? peso = item.Aeronautico.Peso; + if (!peso.HasValue) + { + str3 = ""; + } + else + { + peso = item.Aeronautico.Peso; + if (peso.HasValue) + { + str3 = peso.GetValueOrDefault().ToString(); + } + else + { + str3 = null; + } + } + observableCollection.Add(new Tuple("PESO", str3, "")); + observableCollection.Add(new Tuple("NAVEGAÇÃO", (string.IsNullOrWhiteSpace(item.Aeronautico.Navegacao) ? "" : item.Aeronautico.Navegacao.ToUpper()), "")); + observableCollection.Add(new Tuple("CERTIFICADO", (string.IsNullOrWhiteSpace(item.Aeronautico.Certificado) ? "" : item.Aeronautico.Certificado.ToUpper()), "")); + observableCollection.Add(new Tuple("MATERIAL DO CASCO", (string.IsNullOrWhiteSpace(item.Aeronautico.Casco) ? "" : item.Aeronautico.Casco.ToUpper()), "")); + DateTime? vistoria = item.Aeronautico.Vistoria; + if (!vistoria.HasValue) + { + shortDateString = ""; + } + else + { + vistoria = item.Aeronautico.Vistoria; + if (vistoria.HasValue) + { + shortDateString = vistoria.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection.Add(new Tuple("VALIDADE DA VISTORIA", shortDateString, "")); + observableCollection.Add(new Tuple("OBSERVAÇÃO", (string.IsNullOrWhiteSpace(item.Aeronautico.Observacao) ? "" : item.Aeronautico.Observacao.ToUpper()), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection1.Add(new Tuple(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", "")); + observableCollection1.Add(new Tuple(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), "")); + decimal premio = cobertura.Premio; + observableCollection1.Add(new Tuple(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Franquia; + observableCollection1.Add(new Tuple(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Lmi; + observableCollection1.Add(new Tuple(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists1; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Fabricante)) + { + keyValuePairs.AddValue("Fabricante", Messages.Obrigatorio, true); + } + else if (this.Fabricante != null && this.Fabricante.Length > 60) + { + keyValuePairs.AddValue("Fabricante", string.Format(Messages.MaiorQueLimite, 60), true); + } + if ((int)this.Tipo == 0) + { + keyValuePairs.AddValue("Tipo", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Modelo)) + { + keyValuePairs.AddValue("Modelo", Messages.Obrigatorio, true); + } + else if (this.Modelo.Length > 60) + { + keyValuePairs.AddValue("Modelo", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (this.Vistoria.HasValue && (DateTime.Compare(this.Vistoria.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Vistoria.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Vistoria", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Serie)) + { + keyValuePairs.AddValue("Serie", Messages.Obrigatorio, true); + } + else if (this.Serie.Length > 30) + { + keyValuePairs.AddValue("Serie", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (string.IsNullOrWhiteSpace(this.Prefixo)) + { + keyValuePairs.AddValue("Prefixo", Messages.Obrigatorio, true); + } + else if (this.Prefixo.Length > 30) + { + keyValuePairs.AddValue("Prefixo", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (!this.Fabricacao.HasValue) + { + keyValuePairs.AddValue("Fabricacao", Messages.Obrigatorio, true); + } + else if (!this.Fabricacao.Value.ToString().ValidacaoFabricacao()) + { + keyValuePairs.AddValue("Fabricacao", Messages.Invalido, true); + } + if (!this.Tripulantes.HasValue) + { + keyValuePairs.AddValue("Tripulantes", Messages.Obrigatorio, true); + } + if (!this.Passageiros.HasValue) + { + keyValuePairs.AddValue("Passageiros", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.MarinaAero)) + { + keyValuePairs.AddValue("MarinaAero", Messages.Obrigatorio, true); + } + else if (this.MarinaAero.Length > 60) + { + keyValuePairs.AddValue("MarinaAero", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!string.IsNullOrWhiteSpace(this.Certificado) && this.Certificado.Length > 60) + { + keyValuePairs.AddValue("Certificado", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (string.IsNullOrWhiteSpace(this.Casco) && this.Tipo.Categoria() == "Aero") + { + keyValuePairs.AddValue("Casco", Messages.Obrigatorio, true); + } + else if (this.Tipo.Categoria() != "Aero" && this.Casco != null && this.Casco.Length > 60) + { + keyValuePairs.AddValue("Casco", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!string.IsNullOrWhiteSpace(this.Navegacao) && this.Tipo.Categoria() != "Aero" && this.Navegacao.Length > 60) + { + keyValuePairs.AddValue("Navegacao", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!this.Vistoria.HasValue && this.Tipo.Categoria() == "Aero") + { + keyValuePairs.AddValue("Vistoria", Messages.Obrigatorio, true); + } + if (!this.Peso.HasValue && this.Tipo.Categoria() == "Aero") + { + keyValuePairs.AddValue("Peso", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/AggilizadorPermissao.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/AggilizadorPermissao.cs new file mode 100644 index 0000000..686e669 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/AggilizadorPermissao.cs @@ -0,0 +1,25 @@ +using Gestor.Model.Common; +using System; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class AggilizadorPermissao + { + public PermissaoAggilizador Aggilizador + { + get; + set; + } + + public bool Permissao + { + get; + set; + } + + public AggilizadorPermissao() + { + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Auto.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Auto.cs new file mode 100644 index 0000000..25b7903 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Auto.cs @@ -0,0 +1,793 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; + +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 Gestor.Model.Common.Categoria? _categoria; + + private bool _fabricanteBranco = true; + + private bool _chassiInvalido; + + public string AnoFabricacao + { + get + { + string str = this._anoFabricacao; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._anoFabricacao = value; + } + } + + public string AnoModelo + { + get + { + string str = this._anoModelo; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._anoModelo = value; + } + } + + public bool? Blindagem + { + get; + set; + } + + public int? Bonus + { + get; + set; + } + + public string Capacidade + { + get + { + string str = this._capacidade; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._capacidade = value; + } + } + + public Gestor.Model.Common.Categoria? Categoria + { + get + { + return this._categoria; + } + set + { + this._categoria = value; + if (value.GetValueOrDefault() == Gestor.Model.Common.Categoria.Motocicleta) + { + this.Portas = "0"; + } + } + } + + public string CepPernoite + { + get + { + if (this._cepPernoite == null || !Regex.IsMatch(this._cepPernoite, "[0-9]+")) + { + return string.Empty; + } + return this._cepPernoite.FormataCep().Trim(); + } + set + { + this._cepPernoite = value; + } + } + + public string Chassi + { + get + { + string str = this._chassi; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._chassi = value; + } + } + + public string Ci + { + get + { + string str = this._ci; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._ci = value; + } + } + + public Gestor.Model.Common.Combustivel? Combustivel + { + get; + set; + } + + public Gestor.Model.Common.Cor? Cor + { + get; + set; + } + + public Gestor.Model.Common.Correcao? Correcao + { + get; + set; + } + + public bool Excluido + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Fabricante Fabricante + { + get; + set; + } + + public bool? Financiado + { + get; + set; + } + + public string Fipe + { + get + { + if (this._fipe == null || !Regex.IsMatch(this._fipe, "[0-9]+")) + { + return ""; + } + return this._fipe.Trim(); + } + set + { + this._fipe = value; + } + } + + public Gestor.Model.Common.Isencao? Isencao + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public bool? KitGas + { + get; + set; + } + + public string Modelo + { + get + { + string str = this._modelo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._modelo = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public bool? Pcd + { + get; + set; + } + + public string Placa + { + get + { + string str = this._placa; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._placa = value; + } + } + + public decimal PorcentagemReferencia + { + get; + set; + } + + public string Portas + { + get + { + string str = this._portas; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._portas = value; + } + } + + public Gestor.Model.Common.Rastreador Rastreador + { + get; + set; + } + + public string RegiaoCirculacao + { + get + { + if (this._regiaoCirculacao == null || !Regex.IsMatch(this._regiaoCirculacao, "[0-9]+")) + { + return ""; + } + return this._regiaoCirculacao.FormataCep().Trim(); + } + set + { + this._regiaoCirculacao = value; + } + } + + public string Renavam + { + get + { + string str = this._renavam; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._renavam = value; + } + } + + public Gestor.Model.Common.TabelaReferencia? TabelaReferencia + { + get; + set; + } + + public Gestor.Model.Common.TipoCobertura? TipoCobertura + { + get; + set; + } + + public Gestor.Model.Common.UsoVeiculo? UsoVeiculo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Auto auto = this; + return new Func>>(auto.Validate); + } + } + + public decimal ValorDeterminado + { + get; + set; + } + + public bool? ZeroKm + { + get; + set; + } + + public Auto() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + string description; + string str; + string description1; + string str1; + string str2; + string description2; + string description3; + string str3; + string str4; + string str5; + string description4; + string description5; + string str6; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("CÓDIGO FIPE", (string.IsNullOrWhiteSpace(item.Auto.Fipe) ? "" : item.Auto.Fipe.ToUpper()), ""), + new Tuple("CHASSI", (string.IsNullOrWhiteSpace(item.Auto.Chassi) ? "" : item.Auto.Chassi.ToUpper()), ""), + new Tuple("PLACA", (string.IsNullOrWhiteSpace(item.Auto.Placa) ? "" : item.Auto.Placa.ToUpper()), ""), + new Tuple("FABRICANTE", (item.Auto.Fabricante == null ? "" : item.Auto.Fabricante.Descricao.ToUpper()), ""), + new Tuple("MODELO", (string.IsNullOrWhiteSpace(item.Auto.Modelo) ? "" : item.Auto.Modelo.ToUpper()), "") + }; + Gestor.Model.Common.UsoVeiculo? usoVeiculo = item.Auto.UsoVeiculo; + if (!usoVeiculo.HasValue) + { + description = ""; + } + else + { + Auto auto = item.Auto; + if (auto != null) + { + usoVeiculo = auto.UsoVeiculo; + if (usoVeiculo.HasValue) + { + description = usoVeiculo.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + else + { + description = null; + } + } + observableCollection.Add(new Tuple("USO VEICULO", description, "")); + Gestor.Model.Common.Categoria? categoria = item.Auto.Categoria; + if (!categoria.HasValue) + { + str = ""; + } + else + { + categoria = item.Auto.Categoria; + if (categoria.HasValue) + { + str = categoria.GetValueOrDefault().GetDescription(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("CATEGORIA", str, "")); + Gestor.Model.Common.Combustivel? combustivel = item.Auto.Combustivel; + if (!combustivel.HasValue) + { + description1 = ""; + } + else + { + combustivel = item.Auto.Combustivel; + if (combustivel.HasValue) + { + description1 = combustivel.GetValueOrDefault().GetDescription(); + } + else + { + description1 = null; + } + } + observableCollection.Add(new Tuple("COMBUSTÍVEL", description1, "")); + Gestor.Model.Common.Cor? cor = item.Auto.Cor; + if (!cor.HasValue) + { + str1 = ""; + } + else + { + cor = item.Auto.Cor; + if (cor.HasValue) + { + str1 = cor.GetValueOrDefault().GetDescription(); + } + else + { + str1 = null; + } + } + observableCollection.Add(new Tuple("COR", str1, "")); + observableCollection.Add(new Tuple("RENAVAM", (string.IsNullOrWhiteSpace(item.Auto.Renavam) ? "" : item.Auto.Renavam.ToUpper()), "")); + if (!item.Auto.ZeroKm.HasValue) + { + str2 = ""; + } + else + { + str2 = (item.Auto.ZeroKm.Value ? "SIM" : "NÃO"); + } + observableCollection.Add(new Tuple("ZERO KM", str2, "")); + observableCollection.Add(new Tuple("ANO DE FABRICAÇÃO", (string.IsNullOrWhiteSpace(item.Auto.AnoFabricacao) ? "" : item.Auto.AnoFabricacao.ToUpper()), "")); + observableCollection.Add(new Tuple("ANO DO MODELO", (string.IsNullOrWhiteSpace(item.Auto.AnoModelo) ? "" : item.Auto.AnoModelo.ToUpper()), "")); + observableCollection.Add(new Tuple("PORTAS", (string.IsNullOrWhiteSpace(item.Auto.Portas) ? "" : item.Auto.Portas), "")); + observableCollection.Add(new Tuple("CAPACIDADE", (string.IsNullOrWhiteSpace(item.Auto.Capacidade) ? "" : item.Auto.Capacidade), "")); + observableCollection.Add(new Tuple("CEP DE CIRCULAÇÃO", (string.IsNullOrWhiteSpace(item.Auto.RegiaoCirculacao) ? "" : item.Auto.RegiaoCirculacao.ToUpper()), "")); + observableCollection.Add(new Tuple("CEP PERNOITE", (string.IsNullOrWhiteSpace(item.Auto.CepPernoite) ? "" : item.Auto.CepPernoite.ToUpper()), "")); + Gestor.Model.Common.Correcao? correcao = item.Auto.Correcao; + if (!correcao.HasValue) + { + description2 = ""; + } + else + { + correcao = item.Auto.Correcao; + if (correcao.HasValue) + { + description2 = correcao.GetValueOrDefault().GetDescription(); + } + else + { + description2 = null; + } + } + observableCollection.Add(new Tuple("CORREÇÃO", description2, "")); + Gestor.Model.Common.TabelaReferencia? tabelaReferencia = item.Auto.TabelaReferencia; + if (!tabelaReferencia.HasValue) + { + description3 = ""; + } + else + { + tabelaReferencia = item.Auto.TabelaReferencia; + if (tabelaReferencia.HasValue) + { + description3 = tabelaReferencia.GetValueOrDefault().GetDescription(); + } + else + { + description3 = null; + } + } + observableCollection.Add(new Tuple("REFERÊNCIA", description3, "")); + decimal porcentagemReferencia = item.Auto.PorcentagemReferencia; + observableCollection.Add(new Tuple("PORCENTAGEM DE REFERÊNCIA", porcentagemReferencia.ToString(new CultureInfo("pt-BR")), "")); + observableCollection.Add(new Tuple("C.I.", (string.IsNullOrWhiteSpace(item.Auto.Ci) ? "" : item.Auto.Ci.ToUpper()), "")); + if (!item.Auto.Financiado.HasValue) + { + str3 = ""; + } + else + { + str3 = (item.Auto.Financiado.Value ? "SIM" : "NÃO"); + } + observableCollection.Add(new Tuple("FINANCEIRO/ALIENADO", str3, "")); + if (!item.Auto.Pcd.HasValue) + { + str4 = ""; + } + else + { + str4 = (item.Auto.Pcd.Value ? "SIM" : "NÃO"); + } + observableCollection.Add(new Tuple("PCD", str4, "")); + if (!item.Auto.Blindagem.HasValue) + { + str5 = ""; + } + else + { + str5 = (item.Auto.Blindagem.Value ? "SIM" : "NÃO"); + } + observableCollection.Add(new Tuple("BLINDAGEM", str5, "")); + Gestor.Model.Common.Isencao? isencao = item.Auto.Isencao; + if (!isencao.HasValue) + { + description4 = ""; + } + else + { + isencao = item.Auto.Isencao; + if (isencao.HasValue) + { + description4 = isencao.GetValueOrDefault().GetDescription(); + } + else + { + description4 = null; + } + } + observableCollection.Add(new Tuple("ISENÇÃO", description4, "")); + observableCollection.Add(new Tuple("BÔNUS", (!item.Auto.Bonus.HasValue ? "" : item.Auto.Bonus.Value.ToString()), "")); + Gestor.Model.Common.TipoCobertura? tipoCobertura = item.Auto.TipoCobertura; + if (!tipoCobertura.HasValue) + { + description5 = ""; + } + else + { + tipoCobertura = item.Auto.TipoCobertura; + if (tipoCobertura.HasValue) + { + description5 = tipoCobertura.GetValueOrDefault().GetDescription(); + } + else + { + description5 = null; + } + } + observableCollection.Add(new Tuple("TIPO DE COBERTURA", description5, "")); + if (!item.Auto.Pcd.HasValue) + { + str6 = ""; + } + else + { + str6 = (item.Auto.KitGas.Value ? "SIM" : "NÃO"); + } + observableCollection.Add(new Tuple("KIT GÁS", str6, "")); + observableCollection.Add(new Tuple("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(item.Auto.Observacao) ? "" : item.Auto.Observacao.ToUpper()), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection1.Add(new Tuple(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", "")); + observableCollection1.Add(new Tuple(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), "")); + porcentagemReferencia = cobertura.Premio; + observableCollection1.Add(new Tuple(" PRÊMIO", porcentagemReferencia.ToString("C", new CultureInfo("pt-BR", false)), "")); + porcentagemReferencia = cobertura.Franquia; + observableCollection1.Add(new Tuple(" FRANQUIA", porcentagemReferencia.ToString("C", new CultureInfo("pt-BR", false)), "")); + porcentagemReferencia = cobertura.Lmi; + observableCollection1.Add(new Tuple(" L.M.I.", porcentagemReferencia.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists1; + } + + public List> Validate(bool chassiInvalido, bool fabricanteBranco) + { + this._chassiInvalido = chassiInvalido; + this._fabricanteBranco = fabricanteBranco; + return this.Validate(); + } + + public List> Validate() + { + int num; + int num1; + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Chassi)) + { + keyValuePairs.AddValue("Chassi", Messages.Obrigatorio, true); + } + else if (!this._chassiInvalido && !this.Chassi.ValidacaoChassi()) + { + keyValuePairs.AddValue("Chassi", Messages.Invalido, true); + } + if (!this._fabricanteBranco && (this.Fabricante == null || this.Fabricante.Id == 0)) + { + keyValuePairs.AddValue("Fabricante", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Modelo)) + { + keyValuePairs.AddValue("Modelo", Messages.Obrigatorio, true); + } + else if (this.Modelo.Length > 250) + { + keyValuePairs.AddValue("Modelo", string.Format(Messages.MaiorQueLimite, 250), true); + } + if (!this.Categoria.HasValue) + { + keyValuePairs.AddValue("Categoria", Messages.Obrigatorio, true); + } + if (!this.Combustivel.HasValue) + { + keyValuePairs.AddValue("Combustivel|COMBUSTÍVEL", Messages.Obrigatorio, true); + } + if (!this.ZeroKm.HasValue) + { + keyValuePairs.AddValue("ZeroKm|ZERO KM", Messages.Obrigatorio, true); + } + if (this.ZeroKm.HasValue && !this.ZeroKm.Value && string.IsNullOrWhiteSpace(this.Placa)) + { + keyValuePairs.AddValue("Placa", Messages.Obrigatorio, true); + } + else if (this.ZeroKm.HasValue && !this.ZeroKm.Value && !this.Placa.ValidacaoPlaca()) + { + keyValuePairs.AddValue("Placa", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(this.AnoFabricacao)) + { + keyValuePairs.AddValue("AnoFabricacao|ANO DE FABRICAÇÃO", Messages.Obrigatorio, true); + } + else if (!this.AnoFabricacao.ValidacaoFabricacao()) + { + keyValuePairs.AddValue("AnoFabricacao|ANO DE FABRICAÇÃO", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(this.AnoModelo)) + { + keyValuePairs.AddValue("AnoModelo|ANO DO MODELO", Messages.Obrigatorio, true); + } + else if (!this.AnoModelo.ValidacaoModelo()) + { + keyValuePairs.AddValue("AnoModelo|ANO DO MODELO", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(this.Portas)) + { + if (this.Categoria.GetValueOrDefault() != Gestor.Model.Common.Categoria.Motocicleta) + { + keyValuePairs.AddValue("Portas", Messages.Obrigatorio, true); + } + else + { + this.Portas = "0"; + } + } + else if (!int.TryParse(this.Portas, out num1)) + { + keyValuePairs.AddValue("Portas", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(this.Capacidade)) + { + keyValuePairs.AddValue("Capacidade", Messages.Obrigatorio, true); + } + else if (!int.TryParse(this.Capacidade, out num1)) + { + keyValuePairs.AddValue("Capacidade", Messages.Invalido, true); + } + if (!this.Financiado.HasValue) + { + keyValuePairs.AddValue("Financiado", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Ci) && this.Ci.Length > 20) + { + keyValuePairs.AddValue("Ci|C.I.", string.Format(Messages.MaiorQueLimite, 20), true); + } + if (string.IsNullOrWhiteSpace(this.Fipe)) + { + keyValuePairs.AddValue("Fipe|CÓDIGO FIPE", Messages.Obrigatorio, true); + } + else if (!this.Fipe.ValidaFipe()) + { + keyValuePairs.AddValue("Fipe|CÓDIGO FIPE", Messages.Invalido, true); + } + if (int.TryParse(this.Capacidade, out num) && num > 99) + { + keyValuePairs.AddValue("Capacidade", Messages.Invalido, true); + } + if (!this.UsoVeiculo.HasValue) + { + keyValuePairs.AddValue("UsoVeiculo", Messages.Obrigatorio, true); + } + if (!string.IsNullOrEmpty(this.Renavam) && this.Renavam.Replace(".", "").Length > 11) + { + keyValuePairs.AddValue("Renavam", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Cliente.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Cliente.cs new file mode 100644 index 0000000..7da5b5d --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Cliente.cs @@ -0,0 +1,1193 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +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 = new bool?(true); + + private string _nomeSocialRg; + + [Description("AGÊNCIA")] + [Log(true)] + public string Agencia + { + get + { + string str = this._agencia; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._agencia = value; + } + } + + public Gestor.Model.Domain.Common.Atividade Atividade + { + get; + set; + } + + public Gestor.Model.Domain.Common.Banco Banco + { + get; + set; + } + + [Log(true)] + public string Caepf + { + get + { + string str = this._caepf; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._caepf = value; + } + } + + [Description("CATEGORIA HABILITAÇÃO")] + [Log(true)] + public string CategoriaHabilitacao + { + get + { + string str = this._categoriaHabilitacao; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._categoriaHabilitacao = value; + } + } + + [Log(true)] + public string Cei + { + get + { + string str = this._cei; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._cei = value; + } + } + + [Description("CLIENTE DESDE")] + [Log(true)] + public DateTime? ClienteDesde + { + get; + set; + } + + [Log(true)] + public string Conta + { + get + { + string str = this._conta; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._conta = value; + } + } + + public ObservableCollection Contatos + { + get; + set; + } + + [Log(true)] + public string Documento + { + get + { + string str = this._documento; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documento = value; + } + } + + [Description("DOCUMENTO PRINCIPAL")] + [Log(true)] + public TipoDocumento? DocumentoPrincipal + { + get; + set; + } + + public ObservableCollection Emails + { + get; + set; + } + + [Log(true)] + public string Emissor + { + get + { + string str = this._emissor; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._emissor = value; + } + } + + public ObservableCollection Enderecos + { + get; + set; + } + + [Description("ESTADO CIVIL")] + [Log(true)] + public Gestor.Model.Common.EstadoCivil? EstadoCivil + { + get; + set; + } + + [Description("ESTADO EMISSOR")] + [Log(true)] + public string EstadoEmissor + { + get + { + string str = this._estadoEmissor; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._estadoEmissor = value; + } + } + + public bool EstaNaCentralSegurado + { + get; + set; + } + + [Log(true)] + public bool Excluido + { + get; + set; + } + + [Description("EXPEDIÇÃO")] + [Log(true)] + public DateTime? Expedicao + { + get; + set; + } + + [Log(true)] + public bool Falecido + { + get; + set; + } + + [Description("HABILITAÇÃO")] + [Log(true)] + public string Habilitacao + { + get + { + string str = this._habilitacao; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._habilitacao = value; + } + } + + public long IdEmpresa + { + get; + set; + } + + [Log(true)] + public string Identidade + { + get + { + string str = this._identidade; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._identidade = value; + } + } + + [Description("DESEJA RECEBER MALA DIRETA")] + [Log(true)] + public bool? MalaDireta + { + get + { + return new bool?(this._malaDireta.GetValueOrDefault(true)); + } + set + { + this._malaDireta = new bool?(value.GetValueOrDefault(true)); + } + } + + [Log(true)] + public DateTime? Nascimento + { + get; + set; + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + object upper; + this._nome = value; + if (value != null) + { + upper = value.ToUpper(); + } + else + { + upper = null; + } + this.NomeSocial = string.Format("{0} - {1}", upper, base.Id); + } + } + + public string NomeSocial + { + get; + set; + } + + public string NomeSocialRg + { + get + { + string str = this._nomeSocialRg; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nomeSocialRg = value; + } + } + + [Description("OBSERVAÇÃO")] + [Log(true)] + public string Observacao + { + get; + set; + } + + public List Origens + { + get; + set; + } + + [Log(true)] + public string Pasta + { + get + { + string str = this._pasta; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._pasta = value; + } + } + + public bool PessoaFisica + { + get + { + return this.Documento.Clear().Length < 12; + } + } + + [Description("PRIMEIRA HABILITAÇÃO")] + [Log(true)] + public DateTime? PrimeiraHabilitacao + { + get; + set; + } + + [Description("PROFISSÃO")] + public Gestor.Model.Domain.Common.Profissao Profissao + { + get; + set; + } + + [Description("RENDA MENSAL")] + [Log(true)] + public decimal RendaMensal + { + get; + set; + } + + [Log(true)] + public Gestor.Model.Domain.Seguros.ResponsavelAssinatura ResponsavelAssinatura + { + get; + set; + } + + [Log(true)] + public string Rne + { + get + { + string str = this._rne; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._rne = value; + } + } + + [Log(true)] + public Gestor.Model.Common.Sexo? Sexo + { + get; + set; + } + + [Log(true)] + public string Status + { + get; + set; + } + + public ObservableCollection Telefones + { + get; + set; + } + + [Description("TIPO CONTA")] + [Log(true)] + public string TipoConta + { + get + { + string str = this._tipoConta; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._tipoConta = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Cliente cliente = this; + return new Func>>(cliente.Validate); + } + } + + [Description("VENCIMENTO HABILITAÇÃO")] + [Log(true)] + public DateTime? VencimentoHabilitacao + { + get; + set; + } + + public ObservableCollection Vinculos + { + get; + set; + } + + public Cliente() + { + } + + public List Log() + { + TipoTelefone? tipo; + string description; + string str; + string shortDateString; + string shortDateString1; + string str1; + string shortDateString2; + string description1; + string description2; + string str2; + string shortDateString3; + string description3; + string str3; + string description4; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>(); + TipoDocumento? documentoPrincipal = this.DocumentoPrincipal; + if (!documentoPrincipal.HasValue) + { + description = ""; + } + else + { + documentoPrincipal = this.DocumentoPrincipal; + if (documentoPrincipal.HasValue) + { + description = documentoPrincipal.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection.Add(new Tuple("TIPO DO DOCUMENTO PRINCIPAL", description, "")); + observableCollection.Add(new Tuple("DOCUMENTO PRINCIPAL", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), "")); + observableCollection.Add(new Tuple("CLIENTE", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome.ToUpper()), "")); + str = (this.Documento.OnlyNumber().Length > 11 ? "FUNDAÇÃO" : "NASCIMENTO"); + DateTime? nascimento = this.Nascimento; + if (!nascimento.HasValue) + { + shortDateString = ""; + } + else + { + nascimento = this.Nascimento; + if (nascimento.HasValue) + { + shortDateString = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection.Add(new Tuple(str, shortDateString, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + if (this.Documento == null || this.Documento.OnlyNumber().Length <= 11) + { + tupleLists1[0].Tuples.Add(new Tuple("IDENTIDADE", (string.IsNullOrWhiteSpace(this.Identidade) ? "" : this.Identidade), "")); + tupleLists1[0].Tuples.Add(new Tuple("ÓRGÃO EMISSOR", (string.IsNullOrWhiteSpace(this.Emissor) ? "" : this.Emissor.ToUpper()), "")); + tupleLists1[0].Tuples.Add(new Tuple("ESTADO EMISSOR", (string.IsNullOrWhiteSpace(this.EstadoEmissor) ? "" : this.EstadoEmissor.ToUpper()), "")); + ObservableCollection> tuples = tupleLists1[0].Tuples; + nascimento = this.Expedicao; + if (!nascimento.HasValue) + { + shortDateString1 = ""; + } + else + { + nascimento = this.Expedicao; + if (nascimento.HasValue) + { + shortDateString1 = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString1 = null; + } + } + tuples.Add(new Tuple("DATA DE EXPEDIÇÃO", shortDateString1, "")); + tupleLists1[0].Tuples.Add(new Tuple("HABILITAÇÃO", (string.IsNullOrWhiteSpace(this.Habilitacao) ? "" : this.Habilitacao.ToUpper()), "")); + tupleLists1[0].Tuples.Add(new Tuple("CATEGORIA", (string.IsNullOrWhiteSpace(this.CategoriaHabilitacao) ? "" : this.CategoriaHabilitacao.ToUpper()), "")); + ObservableCollection> tuples1 = tupleLists1[0].Tuples; + nascimento = this.PrimeiraHabilitacao; + if (!nascimento.HasValue) + { + str1 = ""; + } + else + { + nascimento = this.PrimeiraHabilitacao; + if (nascimento.HasValue) + { + str1 = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + str1 = null; + } + } + tuples1.Add(new Tuple("PRIMEIRA HABILITAÇÃO", str1, "")); + ObservableCollection> observableCollection1 = tupleLists1[0].Tuples; + nascimento = this.VencimentoHabilitacao; + if (!nascimento.HasValue) + { + shortDateString2 = ""; + } + else + { + nascimento = this.VencimentoHabilitacao; + if (nascimento.HasValue) + { + shortDateString2 = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString2 = null; + } + } + observableCollection1.Add(new Tuple("VENCIMENTO DA HABILITAÇÃO", shortDateString2, "")); + ObservableCollection> tuples2 = tupleLists1[0].Tuples; + Gestor.Model.Common.Sexo? sexo = this.Sexo; + if (!sexo.HasValue) + { + description1 = ""; + } + else + { + sexo = this.Sexo; + if (sexo.HasValue) + { + description1 = sexo.GetValueOrDefault().GetDescription(); + } + else + { + description1 = null; + } + } + tuples2.Add(new Tuple("SEXO", description1, "")); + ObservableCollection> observableCollection2 = tupleLists1[0].Tuples; + Gestor.Model.Common.EstadoCivil? estadoCivil = this.EstadoCivil; + if (!estadoCivil.HasValue) + { + description2 = ""; + } + else + { + estadoCivil = this.EstadoCivil; + if (estadoCivil.HasValue) + { + description2 = estadoCivil.GetValueOrDefault().GetDescription(); + } + else + { + description2 = null; + } + } + observableCollection2.Add(new Tuple("ESTADO CIVIL", description2, "")); + tupleLists1[0].Tuples.Add(new Tuple("PROFISSÃO DO CLIENTE", (this.Profissao == null ? "" : this.Profissao.Nome.ToUpper()), "")); + } + else + { + tupleLists1[0].Tuples.Add(new Tuple("RAMO DE ATIVIDADE", (string.IsNullOrWhiteSpace(this.Atividade.Nome) ? "" : this.Atividade.Nome), "")); + } + ObservableCollection> tuples3 = tupleLists1[0].Tuples; + nascimento = this.ClienteDesde; + if (!nascimento.HasValue) + { + str2 = ""; + } + else + { + nascimento = this.ClienteDesde; + if (nascimento.HasValue) + { + str2 = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + str2 = null; + } + } + tuples3.Add(new Tuple("CLIENTE DESDE", str2, "")); + tupleLists1[0].Tuples.Add(new Tuple("PASTA", (string.IsNullOrWhiteSpace(this.Pasta) ? "" : this.Pasta.ToUpper()), "")); + tupleLists1[0].Tuples.Add(new Tuple("BANCO", (this.Banco == null ? "" : this.Banco.Nome.ToUpper()), "")); + tupleLists1[0].Tuples.Add(new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia.ToUpper()), "")); + tupleLists1[0].Tuples.Add(new Tuple("TIPO DE CONTA", (string.IsNullOrWhiteSpace(this.TipoConta) ? "" : this.TipoConta.ToUpper()), "")); + tupleLists1[0].Tuples.Add(new Tuple("NÚMERO DA CONTA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta.ToUpper()), "")); + tupleLists1[0].Tuples.Add(new Tuple("FALECIDO", (this.Falecido ? "SIM" : "NÃO"), "")); + tupleLists1[0].Tuples.Add(new Tuple("ÓRGÃO EMISSOR", (string.IsNullOrWhiteSpace(this.Emissor) ? "" : this.Emissor.ToUpper()), "")); + ObservableCollection> observableCollection3 = tupleLists1[0].Tuples; + decimal rendaMensal = this.RendaMensal; + observableCollection3.Add(new Tuple("RENDA MENSAL", rendaMensal.ToString("C", new CultureInfo("pt-BR", false)), "")); + ObservableCollection> observableCollection4 = new ObservableCollection>() + { + new Tuple("TELEFONES$", "", "") + }; + if (this.Telefones != null && this.Telefones.Count > 0) + { + foreach (ClienteTelefone telefone in this.Telefones) + { + observableCollection4.Add(new Tuple(string.Format(" TELEFONE {0}$", this.Telefones.IndexOf(telefone) + 1), "", "")); + ObservableCollection> observableCollection5 = observableCollection4; + tipo = telefone.Tipo; + if (!tipo.HasValue) + { + description4 = ""; + } + else + { + tipo = telefone.Tipo; + if (tipo.HasValue) + { + description4 = tipo.GetValueOrDefault().GetDescription(); + } + else + { + description4 = null; + } + } + observableCollection5.Add(new Tuple(" TIPO", description4, "")); + observableCollection4.Add(new Tuple(" PREFIXO", (string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo.ToUpper()), "")); + observableCollection4.Add(new Tuple(" NÚMERO", (string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero), "")); + observableCollection4.Add(new Tuple(" ORDEM", (!telefone.Ordem.HasValue ? "" : telefone.Ordem.ToString()), "")); + } + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection4 + }); + ObservableCollection> observableCollection6 = new ObservableCollection>() + { + new Tuple("EMAILS$", "", "") + }; + if (this.Emails != null && this.Emails.Count > 0) + { + foreach (ClienteEmail email in this.Emails) + { + observableCollection6.Add(new Tuple(string.Format(" EMAIL {0}$", this.Emails.IndexOf(email) + 1), "", "")); + observableCollection6.Add(new Tuple(" ENDEREÇO DE EMAIL", (string.IsNullOrWhiteSpace(email.Email) ? "" : email.Email), "")); + observableCollection6.Add(new Tuple(" ORDEM", (!email.Ordem.HasValue ? "" : email.Ordem.ToString()), "")); + } + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection6 + }); + ObservableCollection> observableCollection7 = new ObservableCollection>() + { + new Tuple("ENDEREÇOS$", "", "") + }; + if (this.Enderecos != null && this.Enderecos.Count > 0) + { + foreach (ClienteEndereco endereco in this.Enderecos) + { + observableCollection7.Add(new Tuple(string.Format(" ENDEREÇO {0}$", this.Enderecos.IndexOf(endereco) + 1), "", "")); + observableCollection7.Add(new Tuple(" LOGRADOURO", (string.IsNullOrWhiteSpace(endereco.Endereco) ? "" : endereco.Endereco), "")); + observableCollection7.Add(new Tuple(" NÚMERO", (string.IsNullOrWhiteSpace(endereco.Numero) ? "" : endereco.Numero), "")); + observableCollection7.Add(new Tuple(" COMPLEMENTO", (string.IsNullOrWhiteSpace(endereco.Complemento) ? "" : endereco.Complemento), "")); + observableCollection7.Add(new Tuple(" BAIRRO", (string.IsNullOrWhiteSpace(endereco.Bairro) ? "" : endereco.Bairro), "")); + observableCollection7.Add(new Tuple(" CIDADE", (string.IsNullOrWhiteSpace(endereco.Cidade) ? "" : endereco.Cidade), "")); + observableCollection7.Add(new Tuple(" ESTADO", (string.IsNullOrWhiteSpace(endereco.Estado) ? "" : endereco.Estado), "")); + observableCollection7.Add(new Tuple(" CEP", (string.IsNullOrWhiteSpace(endereco.Cep) ? "" : endereco.Cep), "")); + observableCollection7.Add(new Tuple(" ORDEM", (!endereco.Ordem.HasValue ? "" : endereco.Ordem.ToString()), "")); + } + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection7 + }); + ObservableCollection> observableCollection8 = new ObservableCollection>() + { + new Tuple("CONTATOS$", "", "") + }; + if (this.Contatos != null && this.Contatos.Count > 0) + { + foreach (MaisContato contato in this.Contatos) + { + observableCollection8.Add(new Tuple(string.Format(" CONTATO {0}$", this.Contatos.IndexOf(contato) + 1), "", "")); + observableCollection8.Add(new Tuple(" DOCUMENTO", (string.IsNullOrWhiteSpace(contato.Documento) ? "" : contato.Documento), "")); + ObservableCollection> observableCollection9 = observableCollection8; + nascimento = contato.Nascimento; + if (!nascimento.HasValue) + { + shortDateString3 = ""; + } + else + { + nascimento = contato.Nascimento; + if (nascimento.HasValue) + { + shortDateString3 = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString3 = null; + } + } + observableCollection9.Add(new Tuple(" NASCIMENTO", shortDateString3, "")); + ObservableCollection> observableCollection10 = observableCollection8; + Parentesco? parentesco = contato.Parentesco; + if (!parentesco.HasValue) + { + description3 = ""; + } + else + { + parentesco = contato.Parentesco; + if (parentesco.HasValue) + { + description3 = parentesco.GetValueOrDefault().GetDescription(); + } + else + { + description3 = null; + } + } + observableCollection10.Add(new Tuple(" PARENTESCO", description3, "")); + observableCollection8.Add(new Tuple(" BANCO", (string.IsNullOrWhiteSpace(contato.Banco) ? "" : contato.Banco), "")); + observableCollection8.Add(new Tuple(" AGÊNCIA", (string.IsNullOrWhiteSpace(contato.Agencia) ? "" : contato.Agencia), "")); + observableCollection8.Add(new Tuple(" CONTA", (string.IsNullOrWhiteSpace(contato.Conta) ? "" : contato.Conta), "")); + ObservableCollection> observableCollection11 = observableCollection8; + tipo = contato.Tipo; + if (!tipo.HasValue) + { + str3 = ""; + } + else + { + tipo = contato.Tipo; + if (tipo.HasValue) + { + str3 = tipo.GetValueOrDefault().GetDescription(); + } + else + { + str3 = null; + } + } + observableCollection11.Add(new Tuple(" TIPO DO TELEFONE", str3, "")); + observableCollection8.Add(new Tuple(" PREFIXO", (string.IsNullOrWhiteSpace(contato.Prefixo) ? "" : contato.Prefixo), "")); + observableCollection8.Add(new Tuple(" NÚMERO", (string.IsNullOrWhiteSpace(contato.Telefone) ? "" : contato.Telefone), "")); + observableCollection8.Add(new Tuple(" EMAIL", (string.IsNullOrWhiteSpace(contato.Email) ? "" : contato.Email), "")); + } + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection8 + }); + ObservableCollection> observableCollection12 = new ObservableCollection>() + { + new Tuple("VÍNCULOS$", "", "") + }; + if (this.Vinculos == null) + { + this.Vinculos = new ObservableCollection(); + } + if (this.Vinculos != null && this.Vinculos.Count > 0) + { + foreach (ClienteVinculo vinculo in this.Vinculos) + { + observableCollection12.Add(new Tuple(string.Format(" VÍNCULO {0}$", this.Vinculos.IndexOf(vinculo) + 1), "", "")); + observableCollection12.Add(new Tuple(" COM CLIENTE", (vinculo.Cliente1.Id != base.Id ? vinculo.Cliente1.Nome : vinculo.Cliente2.Nome), "")); + observableCollection12.Add(new Tuple(" PARENTESCO", (vinculo.Cliente1.Id == base.Id ? vinculo.Parentesco.GetDescription() : Funcoes.ParentescoInverso(vinculo.Parentesco).GetDescription()), "")); + } + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection12 + }); + return tupleLists1; + } + + public List> Validate() + { + int? nullable; + DateTime? primeiraHabilitacao; + int? nullable1; + List> keyValuePairs = ValidationHelper.AddValue(); + string nome = this.Nome; + if (nome != null) + { + nullable1 = new int?((int)nome.Trim().Split(new char[] { ' ' }).Length); + } + else + { + nullable = null; + nullable1 = nullable; + } + int? nullable2 = nullable1; + if (nullable2.HasValue) + { + nullable = nullable2; + if (nullable.GetValueOrDefault() <= 1 & nullable.HasValue) + { + keyValuePairs.AddValue("Nome", Messages.NomeInvalido, true); + } + } + else + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + TipoDocumento? documentoPrincipal = this.DocumentoPrincipal; + if (!documentoPrincipal.HasValue) + { + keyValuePairs.AddValue("DocumentoPrincipal|DOCUMENTO PRINCIPAL", string.Format(Messages.Obrigatorio, Array.Empty()), true); + } + DateTime? clienteDesde = this.ClienteDesde; + if (clienteDesde.HasValue) + { + clienteDesde = this.ClienteDesde; + if (DateTime.Compare(clienteDesde.Value, new DateTime(1753, 1, 1)) >= 0) + { + clienteDesde = this.ClienteDesde; + if (DateTime.Compare(clienteDesde.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label0; + } + } + keyValuePairs.AddValue("ClienteDesde|CLIENTE DESDE", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label0: + DateTime networkTime = Funcoes.GetNetworkTime(); + DateTime date = networkTime.Date; + clienteDesde = this.Nascimento; + if (clienteDesde.HasValue) + { + clienteDesde = this.Nascimento; + networkTime = date; + if ((clienteDesde.HasValue ? clienteDesde.GetValueOrDefault() > networkTime : false)) + { + keyValuePairs.AddValue(string.Concat("Nascimento|", (this.Documento.OnlyNumber().Length > 11 ? "FUNDAÇÃO" : "NASCIMENTO")), Messages.Invalido, true); + } + } + clienteDesde = this.Nascimento; + if (clienteDesde.HasValue) + { + clienteDesde = this.Nascimento; + if (DateTime.Compare(clienteDesde.Value, new DateTime(1753, 1, 1)) >= 0) + { + clienteDesde = this.Nascimento; + if (DateTime.Compare(clienteDesde.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label1; + } + } + keyValuePairs.AddValue(string.Concat("Nascimento|", (this.Documento.OnlyNumber().Length > 11 ? "FUNDAÇÃO" : "NASCIMENTO")), string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Documento)) + { + keyValuePairs.AddValue("Documento", Messages.Obrigatorio, true); + } + else if (!this.Documento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Documento", Messages.Invalido, true); + } + documentoPrincipal = this.DocumentoPrincipal; + if (documentoPrincipal.HasValue) + { + switch (documentoPrincipal.GetValueOrDefault()) + { + case TipoDocumento.Rne: + { + if (!string.IsNullOrWhiteSpace(this.Rne)) + { + if (this.Rne.ValidacaoRne()) + { + break; + } + keyValuePairs.AddValue("Rne", Messages.Invalido, true); + break; + } + else + { + keyValuePairs.AddValue("Rne", Messages.Obrigatorio, true); + break; + } + } + case TipoDocumento.Cei: + { + if (!string.IsNullOrWhiteSpace(this.Cei)) + { + if (this.Cei.ValidacaoCei()) + { + break; + } + keyValuePairs.AddValue("Cei", Messages.Invalido, true); + break; + } + else + { + keyValuePairs.AddValue("Cei", Messages.Obrigatorio, true); + break; + } + } + case TipoDocumento.Caepf: + { + if (!string.IsNullOrWhiteSpace(this.Caepf)) + { + if (this.Caepf.ValidateCaepf()) + { + break; + } + keyValuePairs.AddValue("Caepf", Messages.Invalido, true); + break; + } + else + { + keyValuePairs.AddValue("Caepf", Messages.Obrigatorio, true); + break; + } + } + } + } + if (this.Documento == null || this.Documento.OnlyNumber().Length <= 11) + { + clienteDesde = this.PrimeiraHabilitacao; + if (clienteDesde.HasValue) + { + clienteDesde = this.PrimeiraHabilitacao; + networkTime = date; + if ((clienteDesde.HasValue ? clienteDesde.GetValueOrDefault() > networkTime : false)) + { + keyValuePairs.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", Messages.Invalido, true); + } + } + clienteDesde = this.PrimeiraHabilitacao; + if (clienteDesde.HasValue) + { + clienteDesde = this.PrimeiraHabilitacao; + if (DateTime.Compare(clienteDesde.Value, new DateTime(1753, 1, 1)) >= 0) + { + clienteDesde = this.PrimeiraHabilitacao; + if (DateTime.Compare(clienteDesde.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label2; + } + } + keyValuePairs.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label2: + clienteDesde = this.VencimentoHabilitacao; + if (clienteDesde.HasValue) + { + clienteDesde = this.VencimentoHabilitacao; + primeiraHabilitacao = this.PrimeiraHabilitacao; + if ((clienteDesde.HasValue & primeiraHabilitacao.HasValue ? clienteDesde.GetValueOrDefault() <= primeiraHabilitacao.GetValueOrDefault() : false)) + { + keyValuePairs.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", Messages.Invalido, true); + } + } + primeiraHabilitacao = this.VencimentoHabilitacao; + if (primeiraHabilitacao.HasValue) + { + primeiraHabilitacao = this.VencimentoHabilitacao; + if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(1753, 1, 1)) >= 0) + { + primeiraHabilitacao = this.VencimentoHabilitacao; + if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label3; + } + } + keyValuePairs.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label3: + primeiraHabilitacao = this.Expedicao; + if (primeiraHabilitacao.HasValue) + { + primeiraHabilitacao = this.Expedicao; + if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(1753, 1, 1)) >= 0) + { + primeiraHabilitacao = this.Expedicao; + if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label4; + } + } + keyValuePairs.AddValue("Expedicao|EXPEDIÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label4: + primeiraHabilitacao = this.Expedicao; + if (primeiraHabilitacao.HasValue) + { + primeiraHabilitacao = this.Expedicao; + networkTime = date; + if ((primeiraHabilitacao.HasValue ? primeiraHabilitacao.GetValueOrDefault() > networkTime : false)) + { + keyValuePairs.AddValue("Expedicao|EXPEDIÇÃO", Messages.Invalido, true); + } + } + if (!string.IsNullOrWhiteSpace(this.Identidade) && this.Identidade.Length > 14) + { + keyValuePairs.AddValue("Identidade", string.Format(Messages.MaiorQueLimite, 14), true); + } + if (!string.IsNullOrWhiteSpace(this.Habilitacao) && this.Habilitacao.Length > 15) + { + keyValuePairs.AddValue("Habilitacao|HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 15), true); + } + if (!string.IsNullOrWhiteSpace(this.CategoriaHabilitacao) && this.CategoriaHabilitacao.Length > 10) + { + keyValuePairs.AddValue("CategoriaHabilitacao|CATEGORIA HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 10), true); + } + if (!string.IsNullOrWhiteSpace(this.Emissor) && !this.Emissor.ValidacaoOrgao()) + { + keyValuePairs.AddValue("Emissor|EMISSOR", string.Format(Messages.MaiorQueLimite, 6), true); + } + if (!string.IsNullOrWhiteSpace(this.EstadoEmissor) && !this.EstadoEmissor.ValidacaoEstado()) + { + keyValuePairs.AddValue("EstadoEmissor|ESTADO EMISSOR", Messages.Invalido, true); + } + } + if (!string.IsNullOrWhiteSpace(this.Pasta) && this.Pasta.Length > 8) + { + keyValuePairs.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 8), true); + } + if (!string.IsNullOrWhiteSpace(this.Agencia) && this.Agencia.Length > 8) + { + keyValuePairs.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 8), true); + } + if (!string.IsNullOrWhiteSpace(this.TipoConta) && this.TipoConta.Length > 20) + { + keyValuePairs.AddValue("TipoConta|TIPO CONTA", string.Format(Messages.MaiorQueLimite, 20), true); + } + if (!string.IsNullOrWhiteSpace(this.Conta) && this.Conta.Length > 12) + { + keyValuePairs.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 12), true); + } + if (this.ResponsavelAssinatura != null) + { + keyValuePairs.AddRange(this.ResponsavelAssinatura.Validate()); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEmail.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEmail.cs new file mode 100644 index 0000000..0175f31 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEmail.cs @@ -0,0 +1,88 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class ClienteEmail : EmailBase, IDomain + { + private string _observacao; + + public Gestor.Model.Domain.Seguros.Cliente Cliente + { + get; + set; + } + + [Log(true)] + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public int? Ordem + { + get; + set; + } + + public bool Selecionado + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + ClienteEmail clienteEmail = this; + return new Func>>(clienteEmail.Validate); + } + } + + public ClienteEmail() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(base.Email)) + { + keyValuePairs.AddValue("Email", Messages.Obrigatorio, true); + } + else if (base.Email.Length > 80) + { + keyValuePairs.AddValue("Email", string.Format(Messages.MaiorQueLimite, 80), true); + } + else if (!base.Email.ValidacaoEmail()) + { + keyValuePairs.AddValue("Email", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Observacao) && this.Observacao.Length > 255) + { + keyValuePairs.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 255), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEndereco.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEndereco.cs new file mode 100644 index 0000000..5085632 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteEndereco.cs @@ -0,0 +1,155 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Model.Domain.Seguros +{ + public class ClienteEndereco : EnderecoBase, IDomain, INotifyPropertyChanged + { + private bool _selecionado; + + private string _observacao; + + public Gestor.Model.Domain.Seguros.Cliente Cliente + { + get; + set; + } + + [Log(true)] + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public int? Ordem + { + get; + set; + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + ClienteEndereco clienteEndereco = this; + return new Func>>(clienteEndereco.Validate); + } + } + + public ClienteEndereco() + { + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(base.Cep)) + { + keyValuePairs.AddValue("Cep", Messages.Obrigatorio, true); + } + else if (!base.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(base.Endereco)) + { + keyValuePairs.AddValue("Endereco", Messages.Obrigatorio, true); + } + else if (base.Endereco.Length > 150) + { + keyValuePairs.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 150), true); + } + if (string.IsNullOrWhiteSpace(base.Numero)) + { + keyValuePairs.AddValue("Numero", Messages.Obrigatorio, true); + } + else if (base.Numero.Length > 6) + { + keyValuePairs.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 6), true); + } + if (!string.IsNullOrWhiteSpace(base.Complemento) && base.Complemento.Length > 45) + { + keyValuePairs.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 45), true); + } + if (string.IsNullOrWhiteSpace(base.Bairro)) + { + keyValuePairs.AddValue("Bairro", Messages.Obrigatorio, true); + } + else if (base.Bairro.Length > 100) + { + keyValuePairs.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (string.IsNullOrWhiteSpace(base.Cidade)) + { + keyValuePairs.AddValue("Cidade", Messages.Obrigatorio, true); + } + else if (base.Cidade.Length > 50) + { + keyValuePairs.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 50), true); + } + if (string.IsNullOrWhiteSpace(base.Estado)) + { + keyValuePairs.AddValue("Estado", Messages.Obrigatorio, true); + } + else if (!base.Estado.ValidacaoEstado()) + { + keyValuePairs.AddValue("Estado", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Observacao) && this.Observacao.Length > 255) + { + keyValuePairs.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 255), true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteTelefone.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteTelefone.cs new file mode 100644 index 0000000..794790b --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteTelefone.cs @@ -0,0 +1,82 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class ClienteTelefone : TelefoneBase, IDomain + { + private string _observacao; + + public Gestor.Model.Domain.Seguros.Cliente Cliente + { + get; + set; + } + + [Log(true)] + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public int? Ordem + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + ClienteTelefone clienteTelefone = this; + return new Func>>(clienteTelefone.Validate); + } + } + + public ClienteTelefone() + { + } + + public List> Validate() + { + List> keyValuePairs = base.ValidateBase(true); + if (!string.IsNullOrWhiteSpace(this.Observacao) && this.Observacao.Length > 30) + { + keyValuePairs.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (string.IsNullOrWhiteSpace(base.Numero)) + { + keyValuePairs.AddValue("Numero", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Prefixo)) + { + keyValuePairs.AddValue("Prefixo", Messages.Obrigatorio, true); + } + if (!base.Tipo.HasValue) + { + keyValuePairs.AddValue("Tipo", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteVinculo.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteVinculo.cs new file mode 100644 index 0000000..c8065fe --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ClienteVinculo.cs @@ -0,0 +1,56 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +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>> ValidationEvent + { + get + { + ClienteVinculo clienteVinculo = this; + return new Func>>(clienteVinculo.Validate); + } + } + + public ClienteVinculo() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!this.Parentesco.HasValue) + { + keyValuePairs.AddValue("Parentesco", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs new file mode 100644 index 0000000..f0b8c66 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Cobertura.cs @@ -0,0 +1,86 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Cobertura : DomainBase, IDomain + { + private string _observacao; + + public Gestor.Model.Domain.Seguros.CoberturaPadrao CoberturaPadrao + { + get; + set; + } + + public decimal Franquia + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public decimal Lmi + { + get; + set; + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = (!string.IsNullOrWhiteSpace(value) || this.CoberturaPadrao == null ? value : this.CoberturaPadrao.Descricao); + } + } + + public decimal Premio + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Cobertura cobertura = this; + return new Func>>(cobertura.Validate); + } + } + + public Cobertura() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if ((this.Lmi != decimal.Zero || this.Premio != decimal.Zero || this.Franquia != decimal.Zero) && string.IsNullOrWhiteSpace(this.Observacao)) + { + keyValuePairs.AddValue("Observacao", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaGranizo.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaGranizo.cs new file mode 100644 index 0000000..c2af1c3 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaGranizo.cs @@ -0,0 +1,125 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class CoberturaGranizo : DomainBase, IDomain + { + private string _variedade; + + private string _quadra; + + public decimal? Area + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Granizo Granizo + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public decimal? Lmi + { + get; + set; + } + + public DateTime? Plantio + { + get; + set; + } + + public decimal? Premio + { + get; + set; + } + + public decimal? Produtividade + { + get; + set; + } + + public string Quadra + { + get + { + string str = this._quadra; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._quadra = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + CoberturaGranizo coberturaGranizo = this; + return new Func>>(coberturaGranizo.Validate); + } + } + + public string Variedade + { + get + { + string str = this._variedade; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._variedade = value; + } + } + + public CoberturaGranizo() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Plantio.HasValue && (DateTime.Compare(this.Plantio.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Plantio.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Plantio", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Variedade) && this.Variedade.Length > 60) + { + keyValuePairs.AddValue("Variedade", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (string.IsNullOrWhiteSpace(this.Quadra) && this.Quadra.Length > 30) + { + keyValuePairs.AddValue("Quadra", string.Format(Messages.MaiorQueLimite, 30), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaPadrao.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaPadrao.cs new file mode 100644 index 0000000..81a4e23 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/CoberturaPadrao.cs @@ -0,0 +1,67 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; + +namespace Gestor.Model.Domain.Seguros +{ + public class CoberturaPadrao : DomainBase, IDomain + { + private string _descricao; + + public string Descricao + { + get + { + if (!string.IsNullOrWhiteSpace(this._descricao)) + { + this._descricao = Regex.Replace(this._descricao, "[\n\r]", ""); + } + string str = this._descricao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._descricao = value; + } + } + + public long IdRamo + { + get; + set; + } + + public bool Padrao + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + CoberturaPadrao coberturaPadrao = this; + return new Func>>(coberturaPadrao.Validate); + } + } + + public CoberturaPadrao() + { + } + + public List> Validate() + { + return ValidationHelper.AddValue(); + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/CondicaoRepasse.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/CondicaoRepasse.cs new file mode 100644 index 0000000..c921485 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/CondicaoRepasse.cs @@ -0,0 +1,49 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class CondicaoRepasse : DomainBase, IDomain + { + public int Parcela + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Ramo Ramo + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Seguradora Seguradora + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + CondicaoRepasse condicaoRepasse = this; + return new Func>>(condicaoRepasse.Validate); + } + } + + public CondicaoRepasse() + { + } + + public List> Validate() + { + return ValidationHelper.AddValue(); + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ConfigExtratoImport.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ConfigExtratoImport.cs new file mode 100644 index 0000000..8a4cbbf --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ConfigExtratoImport.cs @@ -0,0 +1,50 @@ +using Gestor.Model.Domain.Generic; +using System; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class ConfigExtratoImport : DomainBase + { + private string _descricao; + + public bool Ativo + { + get; + set; + } + + public string Codigo + { + get; + set; + } + + public string Descricao + { + get + { + string str = this._descricao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._descricao = value; + } + } + + public long IdSeguradora + { + get; + set; + } + + public ConfigExtratoImport() + { + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Consorcio.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Consorcio.cs new file mode 100644 index 0000000..3efd5ad --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Consorcio.cs @@ -0,0 +1,191 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +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 string BensConsorcio + { + get + { + string str = this._bensConsorcio; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._bensConsorcio = value; + } + } + + public string Cota + { + get + { + string str = this._cota; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cota = value; + } + } + + public string Grupo + { + get + { + string str = this._grupo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._grupo = value; + } + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Consorcio consorcio = this; + return new Func>>(consorcio.Validate); + } + } + + public decimal? ValorCredito + { + get + { + return this._valorCredito; + } + set + { + this._valorCredito = value; + } + } + + public Consorcio() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + decimal valueOrDefault; + string str; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("DESCRIÇÃO", (string.IsNullOrWhiteSpace(item.Consorcio.BensConsorcio) ? "" : item.Consorcio.BensConsorcio), ""), + new Tuple("GRUPO", (string.IsNullOrWhiteSpace(item.Consorcio.Grupo) ? "" : item.Consorcio.Grupo), ""), + new Tuple("COTA", (string.IsNullOrWhiteSpace(item.Consorcio.Cota) ? "" : item.Consorcio.Cota), "") + }; + decimal? valorCredito = item.Consorcio.ValorCredito; + if (!valorCredito.HasValue) + { + str = ""; + } + else + { + valorCredito = item.Consorcio.ValorCredito; + if (valorCredito.HasValue) + { + valueOrDefault = valorCredito.GetValueOrDefault(); + str = valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("GRUPO", str, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection1.Add(new Tuple(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", "")); + observableCollection1.Add(new Tuple(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), "")); + valueOrDefault = cobertura.Premio; + observableCollection1.Add(new Tuple(" PRÊMIO", valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)), "")); + valueOrDefault = cobertura.Franquia; + observableCollection1.Add(new Tuple(" FRANQUIA", valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)), "")); + valueOrDefault = cobertura.Lmi; + observableCollection1.Add(new Tuple(" L.M.I.", valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists1; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.BensConsorcio)) + { + keyValuePairs.AddValue("BensConsorcio", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Controle.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Controle.cs new file mode 100644 index 0000000..3ae91c6 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Controle.cs @@ -0,0 +1,128 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Controle : DomainBase, IDomain + { + private long _idEmpresa; + + public string AssistenciaId + { + get; + set; + } + + [Log(false)] + public Gestor.Model.Domain.Seguros.Cliente Cliente + { + get; + set; + } + + [Log(false)] + public IList Documentos + { + get; + set; + } + + public long IdEmpresa + { + get + { + return this._idEmpresa; + } + set + { + this._idEmpresa = (value == 0 ? (long)1 : value); + } + } + + [Log(false)] + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + [Description("PRODUTO")] + [Log(true)] + [Name(true)] + public Gestor.Model.Domain.Seguros.Produto Produto + { + get; + set; + } + + [Description("RAMO")] + [Log(true)] + [Name(true)] + public Gestor.Model.Domain.Seguros.Ramo Ramo + { + get; + set; + } + + [Description("SEGURADORA")] + [Log(true)] + [Name(true)] + public Gestor.Model.Domain.Seguros.Seguradora Seguradora + { + get; + set; + } + + [Description("SEGURADORA ANTERIOR")] + [Log(true)] + [Name(true)] + public Gestor.Model.Domain.Seguros.Seguradora SeguradoraAnterior + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Controle controle = this; + return new Func>>(controle.Validate); + } + } + + public Controle() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Cliente == null || this.Cliente.Id == 0) + { + keyValuePairs.AddValue("Cliente", Messages.Obrigatorio, true); + } + if (this.Seguradora == null || this.Seguradora.Id == 0) + { + keyValuePairs.AddValue("Seguradora", Messages.Obrigatorio, true); + } + if (this.Ramo == null || this.Ramo.Id == 0) + { + keyValuePairs.AddValue("Ramo", Messages.Obrigatorio, true); + } + if (this.IdEmpresa == 0) + { + keyValuePairs.AddValue("Empresa", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ControleSinistro.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ControleSinistro.cs new file mode 100644 index 0000000..13207b6 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ControleSinistro.cs @@ -0,0 +1,118 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class ControleSinistro : DomainBase, IDomain + { + private DateTime? _dataSinistro; + + private DateTime? _horaSinistro; + + [Description("DATA SINISTRO")] + [Log(true)] + [Name(true)] + public DateTime? DataSinistro + { + get + { + return this._dataSinistro; + } + set + { + if (!value.HasValue) + { + this._dataSinistro = null; + return; + } + if (!this.HoraSinistro.HasValue) + { + this.HoraSinistro = value; + } + object obj = value.Value; + DateTime? horaSinistro = this.HoraSinistro; + this._dataSinistro = new DateTime?(DateTime.Parse(string.Format("{0:d} {1:T}", obj, horaSinistro.Value))); + } + } + + public DateTime? HoraSinistro + { + get + { + return this._horaSinistro; + } + set + { + DateTime? nullable; + this._horaSinistro = value; + if (!value.HasValue) + { + return; + } + DateTime? dataSinistro = this.DataSinistro; + if (!dataSinistro.HasValue || !value.HasValue) + { + dataSinistro = null; + nullable = dataSinistro; + } + else + { + dataSinistro = this.DataSinistro; + nullable = new DateTime?(DateTime.Parse(string.Format("{0:d} {1:T}", dataSinistro.Value, value))); + } + this.DataSinistro = nullable; + } + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public List Sinistros + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + ControleSinistro controleSinistro = this; + return new Func>>(controleSinistro.Validate); + } + } + + public ControleSinistro() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!this.DataSinistro.HasValue) + { + keyValuePairs.AddValue("DataSinistro", Messages.Obrigatorio, true); + } + if (this.DataSinistro.HasValue && (DateTime.Compare(this.DataSinistro.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataSinistro.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("DataSinistro", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.HoraSinistro.HasValue && (DateTime.Compare(this.HoraSinistro.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.HoraSinistro.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("HoraSinistro", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/CriticaApolice.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/CriticaApolice.cs new file mode 100644 index 0000000..efdfa8c --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/CriticaApolice.cs @@ -0,0 +1,116 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class CriticaApolice : DomainBase, IDomain + { + private string _naoEncontrados; + + private bool? _critica; + + public bool? Aggilizador + { + get; + set; + } + + public bool? Critica + { + get + { + return this._critica; + } + set + { + this._critica = new bool?(value.GetValueOrDefault()); + } + } + + public DateTime? DataCritica + { + get; + set; + } + + public DateTime? DataImportacao + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Documento Documento + { + get; + set; + } + + public string NaoEncontrados + { + get + { + string str = this._naoEncontrados; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._naoEncontrados = value; + } + } + + public string Tipo + { + get; + set; + } + + public long? UsuarioCritica + { + get; + set; + } + + public Usuario UsuarioImportacao + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + CriticaApolice criticaApolouse = this; + return new Func>>(criticaApolouse.Validate); + } + } + + public CriticaApolice() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.DataImportacao.HasValue && (DateTime.Compare(this.DataImportacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataImportacao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("DataImportacao", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.DataCritica.HasValue && (DateTime.Compare(this.DataCritica.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataCritica.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("DataCritica", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/DetalheExtrato.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/DetalheExtrato.cs new file mode 100644 index 0000000..c03bd40 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/DetalheExtrato.cs @@ -0,0 +1,250 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +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 string Apolice + { + get + { + string str = this._apolice; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._apolice = value; + } + } + + public string Cliente + { + get + { + string str = this._cliente; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cliente = value; + } + } + + public decimal? Comissao + { + get; + set; + } + + public bool Corrigir + { + get; + set; + } + + public DateTime? Credito + { + get; + set; + } + + public long? Documento + { + get; + set; + } + + public string Endosso + { + get + { + string str = this._endosso; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._endosso = value; + } + } + + public Gestor.Model.Domain.Seguros.Extrato Extrato + { + get; + set; + } + + public string Historico + { + get + { + string str = this._historico; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._historico = value; + } + } + + public string NumeroParcela + { + get + { + string str = this._numeroParcela; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._numeroParcela = value; + } + } + + public long? Parcela + { + get; + set; + } + + public DateTime? Recebimento + { + get; + set; + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + public StatusParcela? Status + { + get; + set; + } + + public Gestor.Model.Common.SubTipo? SubTipo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + DetalheExtrato detalheExtrato = this; + return new Func>>(detalheExtrato.Validate); + } + } + + public decimal? Valor + { + get; + set; + } + + public decimal? ValorComissao + { + get; + set; + } + + public DetalheExtrato() + { + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Recebimento.HasValue && (DateTime.Compare(this.Recebimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Recebimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Recebimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Credito.HasValue && (DateTime.Compare(this.Credito.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Credito.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Credito", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Cliente) && this.Cliente.Length > 100) + { + keyValuePairs.AddValue("Cliente", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (string.IsNullOrWhiteSpace(this.Apolice) && this.Apolice.Length > 30) + { + keyValuePairs.AddValue("Apolice", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (string.IsNullOrWhiteSpace(this.Endosso) && this.Endosso.Length > 20) + { + keyValuePairs.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 20), true); + } + if (string.IsNullOrWhiteSpace(this.NumeroParcela) && this.NumeroParcela.Length > 4) + { + keyValuePairs.AddValue("NumeroParcela", string.Format(Messages.MaiorQueLimite, 4), true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs new file mode 100644 index 0000000..00ae7de --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs @@ -0,0 +1,1426 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Threading; + +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; + + [Description("ADICIONAL DE COMISSÃO")] + [Log(true)] + public bool AdicionalComiss + { + get; + set; + } + + [Description("AGÊNCIA")] + [Log(true)] + public string Agencia + { + get + { + string str = this._agencia; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._agencia = value; + } + } + + [Description("APÓLICE")] + [Log(true)] + public string Apolice + { + get + { + string str = this._apolice; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._apolice = value; + } + } + + [Description("APÓLICE ANTERIOR")] + [Log(true)] + public string ApoliceAnterior + { + get + { + string str = this._apoliceAnterior; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._apoliceAnterior = value; + } + } + + [Description("APÓLICE CONFERIDA")] + [Log(true)] + public bool ApoliceConferida + { + get; + set; + } + + public bool AssinadaSiggner + { + get; + set; + } + + [Log(false)] + public List Assinaturas + { + get; + set; + } + + [Log(true)] + public Gestor.Model.Domain.Common.Banco Banco + { + get; + set; + } + + [Log(true)] + public BandeiraCartao? Bandeira + { + get; + set; + } + + [Log(false)] + public List Calculos + { + get; + set; + } + + [Description("COMISSÃO")] + [Log(true)] + public decimal Comissao + { + get; + set; + } + + public decimal? ComissaoTotal + { + get; + set; + } + + [Log(true)] + public string Conta + { + get + { + string str = this._conta; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._conta = value; + } + } + + public Gestor.Model.Domain.Seguros.Controle Controle + { + get; + set; + } + + [Description("CUSTO DE EMISSÃO")] + [Log(true)] + public decimal Custo + { + get; + set; + } + + [Description("DATA DE CONTROLE")] + [Log(true)] + public DateTime? DataControle + { + get; + set; + } + + public DateTime? DataCriacao + { + get; + set; + } + + [Description("DIFERENÇA")] + [Log(true)] + public decimal Diferenca + { + get; + set; + } + + [Description("EMISSÃO")] + [Log(true)] + public DateTime? Emissao + { + get; + set; + } + + [Log(true)] + public string Endosso + { + get + { + string str = this._endosso; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._endosso = value; + } + } + + [Description("ESTIPULANTE 1")] + [Log(true)] + public Estipulante Estipulante1 + { + get; + set; + } + + [Description("ESTIPULANTE 2")] + [Log(true)] + public Estipulante Estipulante2 + { + get; + set; + } + + [Description("ESTIPULANTE 3")] + [Log(true)] + public Estipulante Estipulante3 + { + get; + set; + } + + [Description("ESTIPULANTE 4")] + [Log(true)] + public Estipulante Estipulante4 + { + get; + set; + } + + [Description("ESTIPULANTE 5")] + [Log(true)] + public Estipulante Estipulante5 + { + get; + set; + } + + public string Estipulantes + { + get; + set; + } + + public bool Excluido + { + get; + set; + } + + public bool FinalVigencia + { + get; + set; + } + + [Description("FORMA DE PAGAMENTO")] + [Log(true)] + public Gestor.Model.Common.FormaPagamento? FormaPagamento + { + get; + set; + } + + [Description("IOF")] + [Log(true)] + public decimal Iof + { + get; + set; + } + + [Log(false)] + public List ItensAtivo + { + get; + set; + } + + [Log(false)] + public Gestor.Model.Common.Negocio? Negocio + { + get; + set; + } + + [Description("NEGÓCIO CORRETORA")] + [Log(true)] + public Gestor.Model.Common.NegocioCorretora? NegocioCorretora + { + get; + set; + } + + [Description("PROPONENTE")] + [Log(true)] + public string NomeProponente + { + get + { + string str = this._nomeProponente; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nomeProponente = value; + } + } + + [Description("NÚMERO CARTÃO")] + [Log(true)] + public string NumeroCartao + { + get + { + string str = this._numeroCartao; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._numeroCartao = value; + } + } + + [Description("QUANTIDADE DE PARCELAS")] + [Log(true)] + public decimal NumeroParcelas + { + get; + set; + } + + [Log(true)] + public string Observacao + { + get; + set; + } + + public string ObsProtocolo + { + get; + set; + } + + public int Ordem + { + get; + set; + } + + [Log(false)] + public List Pagamentos + { + get; + set; + } + + [Log(false)] + public ObservableCollection Parcelas + { + get; + set; + } + + [Log(true)] + public string Pasta + { + get + { + string str = this._pasta; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._pasta = value; + } + } + + [Log(false)] + public decimal? PercentualRepasse + { + get; + set; + } + + [Description("PRÊMIO ADICIONAL")] + [Log(true)] + public decimal PremioAdicional + { + get; + set; + } + + [Description("PRÊMIO LÍQUIDO")] + [Log(true)] + public decimal PremioLiquido + { + get; + set; + } + + [Description("PRÊMIO TOTAL")] + [Log(true)] + public decimal PremioTotal + { + get; + set; + } + + [Log(true)] + public string Proposta + { + get + { + string str = this._proposta; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._proposta = value; + } + } + + [Log(true)] + public bool PropostaAssinada + { + get; + set; + } + + [Description("PROPOSTA DE ENDOSSO")] + [Log(true)] + public string PropostaEndosso + { + get + { + string str = this._propostaEndosso; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._propostaEndosso = value; + } + } + + public bool ProtocoloEmail + { + get; + set; + } + + public bool ProtocoloEndereco + { + get; + set; + } + + public bool ProtocoloParcela + { + get; + set; + } + + public bool ProtocoloTelefone + { + get; + set; + } + + public bool ProtocoloVendedor + { + get; + set; + } + + [Description("TRANSMISSÃO DA PROPOSTA")] + [Log(true)] + public DateTime? Remessa + { + get; + set; + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + [Log(false)] + public bool Sinistro + { + get; + set; + } + + [Description("SITUAÇÃO")] + [Log(true)] + public TipoSeguro Situacao + { + get; + set; + } + + [Log(false)] + public TipoSeguro? SituacaoAnterior + { + get; + set; + } + + [Description("STATUS INTERNO")] + [Log(true)] + public Gestor.Model.Domain.Seguros.Status Status + { + get; + set; + } + + public Gestor.Model.Common.StatusAssinatura StatusAssinatura + { + get; + set; + } + + [Log(false)] + public bool TemEndosso + { + get; + set; + } + + public int Tipo + { + get; + set; + } + + [Description("TIPO DO ENDOSSO")] + [Log(true)] + public Gestor.Model.Common.TipoEndosso? TipoEndosso + { + get; + set; + } + + [Description("TIPO RECEBIMENTO")] + [Log(true)] + public Gestor.Model.Common.TipoRecebimento? TipoRecebimento + { + get; + set; + } + + [Log(false)] + public Usuario UsuarioCriacao + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Documento documento = this; + return new Func>>(documento.Validate); + } + } + + [Description("VENCIMENTO CARTÃO")] + [Log(true)] + public string VencimentoCartao + { + get + { + string str = this._vencimentoCartao; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._vencimentoCartao = value; + } + } + + [Log(false)] + public List Vendedores + { + get; + set; + } + + [Log(false)] + public Vendedor VendedorPrincipal + { + get; + set; + } + + [Description("VIGÊNCIA INICIAL")] + [Log(true)] + public DateTime Vigencia1 + { + get; + set; + } + + [Description("VIGÊNCIA FINAL")] + [Log(true)] + public DateTime? Vigencia2 + { + get; + set; + } + + [Log(false)] + public VinculoDocumento Vinculo + { + get; + set; + } + + public Documento() + { + } + + public Documento DeepCopy() + { + return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(this)); + } + + public List Log(bool restricaoComissao) + { + decimal comissao; + string nome; + string str; + string nome1; + string description; + string description1; + string str1; + string shortDateString; + string shortDateString1; + string shortDateString2; + string nome2; + string description2; + string str2; + string str3; + string shortDateString3; + List> tuples = new List>(); + Gestor.Model.Domain.Seguros.Controle controle = this.Controle; + if (controle != null) + { + Seguradora seguradora = controle.Seguradora; + if (seguradora != null) + { + nome = seguradora.Nome; + } + else + { + nome = null; + } + } + else + { + nome = null; + } + tuples.Add(new Tuple("SEGURADORA", (string.IsNullOrWhiteSpace(nome) ? "" : this.Controle.Seguradora.Nome.ToUpper()), "")); + Gestor.Model.Domain.Seguros.Controle controle1 = this.Controle; + if (controle1 != null) + { + Ramo ramo = controle1.Ramo; + if (ramo != null) + { + str = ramo.Nome; + } + else + { + str = null; + } + } + else + { + str = null; + } + tuples.Add(new Tuple("RAMO", (string.IsNullOrWhiteSpace(str) ? "" : this.Controle.Ramo.Nome.ToUpper()), "")); + Gestor.Model.Domain.Seguros.Controle controle2 = this.Controle; + if (controle2 != null) + { + Produto produto = controle2.Produto; + if (produto != null) + { + nome1 = produto.Nome; + } + else + { + nome1 = null; + } + } + else + { + nome1 = null; + } + tuples.Add(new Tuple("PRODUTO", (string.IsNullOrWhiteSpace(nome1) ? "" : this.Controle.Produto.Nome.ToUpper()), "")); + Gestor.Model.Common.NegocioCorretora? negocioCorretora = this.NegocioCorretora; + if (!negocioCorretora.HasValue) + { + description = ""; + } + else + { + negocioCorretora = this.NegocioCorretora; + if (negocioCorretora.HasValue) + { + description = negocioCorretora.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + tuples.Add(new Tuple("NEGÓCIO CORRETORA", description, "")); + tuples.Add(new Tuple("STATUS DO SEGURO", this.Situacao.GetDescription(), "")); + Gestor.Model.Common.TipoRecebimento? tipoRecebimento = this.TipoRecebimento; + if (!tipoRecebimento.HasValue) + { + description1 = ""; + } + else + { + tipoRecebimento = this.TipoRecebimento; + if (tipoRecebimento.HasValue) + { + description1 = tipoRecebimento.GetValueOrDefault().GetDescription(); + } + else + { + description1 = null; + } + } + tuples.Add(new Tuple("TIPO DE RECEBIMENTO", description1, "")); + Gestor.Model.Common.TipoEndosso? tipoEndosso = this.TipoEndosso; + if (!tipoEndosso.HasValue) + { + str1 = ""; + } + else + { + tipoEndosso = this.TipoEndosso; + if (tipoEndosso.HasValue) + { + str1 = tipoEndosso.GetValueOrDefault().GetDescription(); + } + else + { + str1 = null; + } + } + tuples.Add(new Tuple("TIPO ENDOSSO", str1, "")); + tuples.Add(new Tuple("PROPOSTA", (string.IsNullOrWhiteSpace(this.Proposta) ? "" : this.Proposta.ToUpper()), "")); + tuples.Add(new Tuple("PROPOSTA ENDOSSO", (string.IsNullOrWhiteSpace(this.PropostaEndosso) ? "" : this.PropostaEndosso.ToUpper()), "")); + tuples.Add(new Tuple("APÓLICE", (string.IsNullOrWhiteSpace(this.Apolice) ? "" : this.Apolice.ToUpper()), "")); + tuples.Add(new Tuple("ENDOSSO", (string.IsNullOrWhiteSpace(this.Endosso) ? "" : this.Endosso.ToUpper()), "")); + DateTime vigencia1 = this.Vigencia1; + tuples.Add(new Tuple("VIGÊNCIA INICIAL", vigencia1.ToShortDateString(), "")); + DateTime? vigencia2 = this.Vigencia2; + if (!vigencia2.HasValue) + { + shortDateString = ""; + } + else + { + vigencia2 = this.Vigencia2; + if (vigencia2.HasValue) + { + shortDateString = vigencia2.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + tuples.Add(new Tuple("VIGÊNCIA FINAL", shortDateString, "")); + vigencia2 = this.Remessa; + if (!vigencia2.HasValue) + { + shortDateString1 = ""; + } + else + { + vigencia2 = this.Remessa; + if (vigencia2.HasValue) + { + shortDateString1 = vigencia2.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString1 = null; + } + } + tuples.Add(new Tuple("TRANSMISSÃO DA PROPOSTA", shortDateString1, "")); + vigencia2 = this.Emissao; + if (!vigencia2.HasValue) + { + shortDateString2 = ""; + } + else + { + vigencia2 = this.Emissao; + if (vigencia2.HasValue) + { + shortDateString2 = vigencia2.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString2 = null; + } + } + tuples.Add(new Tuple("EMISSÃO DA APÓLICE", shortDateString2, "")); + Gestor.Model.Domain.Seguros.Controle controle3 = this.Controle; + if (controle3 != null) + { + Seguradora seguradoraAnterior = controle3.SeguradoraAnterior; + if (seguradoraAnterior != null) + { + nome2 = seguradoraAnterior.Nome; + } + else + { + nome2 = null; + } + } + else + { + nome2 = null; + } + tuples.Add(new Tuple("SEGURADORA ANTERIOR", (string.IsNullOrWhiteSpace(nome2) ? "" : this.Controle.SeguradoraAnterior.Nome.ToUpper()), "")); + tuples.Add(new Tuple("APÓLICE ANTERIOR", (string.IsNullOrWhiteSpace(this.ApoliceAnterior) ? "" : this.ApoliceAnterior.ToUpper()), "")); + Gestor.Model.Common.FormaPagamento? formaPagamento = this.FormaPagamento; + if (!formaPagamento.HasValue) + { + description2 = ""; + } + else + { + formaPagamento = this.FormaPagamento; + if (formaPagamento.HasValue) + { + description2 = formaPagamento.GetValueOrDefault().GetDescription(); + } + else + { + description2 = null; + } + } + tuples.Add(new Tuple("FORMA DE PAGAMENTO", description2, "")); + tuples.Add(new Tuple("PROPOSTA ASSINADA", (this.PropostaAssinada ? "SIM" : "NÃO"), "")); + tuples.Add(new Tuple("APÓLICE CONFERIDA", (this.ApoliceConferida ? "SIM" : "NÃO"), "")); + tuples.Add(new Tuple("ADICIONAL DE COMISSÃO", (this.AdicionalComiss ? "SIM" : "NÃO"), "")); + List> tuples1 = tuples; + if (!restricaoComissao) + { + comissao = this.Comissao / new decimal(100); + tuples1.Add(new Tuple("COMISSÃO", comissao.ToString("P", new CultureInfo("pt-BR", false)), "")); + } + List> tuples2 = tuples1; + List> tuples3 = new List>(); + comissao = this.Comissao / new decimal(100); + tuples3.Add(new Tuple("COMISSÃO", comissao.ToString("P", new CultureInfo("pt-BR", false)), "")); + comissao = this.PremioLiquido; + tuples3.Add(new Tuple("PRÊMIO LÍQUIDO", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); + comissao = this.PremioAdicional; + tuples3.Add(new Tuple("PRÊMIO ADICIONAL", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); + comissao = this.Iof; + tuples3.Add(new Tuple("I.O.F.", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); + comissao = this.Diferenca; + tuples3.Add(new Tuple("DIFERENÇA", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); + comissao = this.PremioTotal; + tuples3.Add(new Tuple("PRÊMIO TOTAL", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); + int num = decimal.ToInt32(this.NumeroParcelas); + tuples3.Add(new Tuple("NÚMERO DE PARCELAS", num.ToString(), "")); + tuples3.Add(new Tuple("BANCO", (this.Banco == null ? "" : this.Banco.Nome.ToUpper()), "")); + tuples3.Add(new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia.ToUpper()), "")); + tuples3.Add(new Tuple("CONTA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta.ToUpper()), "")); + tuples3.Add(new Tuple("CARTÃO DE CRÉDITO", (string.IsNullOrWhiteSpace(this.NumeroCartao) ? "" : this.NumeroCartao.ToUpper()), "")); + BandeiraCartao? bandeira = this.Bandeira; + if (!bandeira.HasValue) + { + str2 = ""; + } + else + { + bandeira = this.Bandeira; + if (bandeira.HasValue) + { + str2 = bandeira.GetValueOrDefault().GetDescription(); + } + else + { + str2 = null; + } + } + tuples3.Add(new Tuple("BANDEIRA", str2, "")); + tuples3.Add(new Tuple("PROPONENTE", (string.IsNullOrWhiteSpace(this.NomeProponente) ? "" : this.NomeProponente.ToUpper()), "")); + string vencimentoCartao = this.VencimentoCartao; + if (vencimentoCartao != null) + { + str3 = vencimentoCartao.Replace("/", ""); + } + else + { + str3 = null; + } + tuples3.Add(new Tuple("VENCIMENTO DO CARTÃO", (string.IsNullOrWhiteSpace(str3) ? "" : this.VencimentoCartao.ToUpper()), "")); + tuples3.Add(new Tuple("PASTA", (string.IsNullOrWhiteSpace(this.Pasta) ? "" : this.Pasta.ToUpper()), "")); + tuples3.Add(new Tuple("ESTIPULANTE 1", (this.Estipulante1 == null ? "" : this.Estipulante1.Nome.ToUpper()), "")); + tuples3.Add(new Tuple("ESTIPULANTE 2", (this.Estipulante2 == null ? "" : this.Estipulante2.Nome.ToUpper()), "")); + tuples3.Add(new Tuple("ESTIPULANTE 3", (this.Estipulante3 == null ? "" : this.Estipulante3.Nome.ToUpper()), "")); + tuples3.Add(new Tuple("ESTIPULANTE 4", (this.Estipulante4 == null ? "" : this.Estipulante4.Nome.ToUpper()), "")); + tuples3.Add(new Tuple("ESTIPULANTE 5", (this.Estipulante5 == null ? "" : this.Estipulante5.Nome.ToUpper()), "")); + tuples3.Add(new Tuple("STATUS", (this.Status == null ? "" : this.Status.Nome.ToUpper()), "")); + vigencia2 = this.DataControle; + if (!vigencia2.HasValue) + { + shortDateString3 = ""; + } + else + { + vigencia2 = this.DataControle; + if (vigencia2.HasValue) + { + shortDateString3 = vigencia2.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString3 = null; + } + } + tuples3.Add(new Tuple("DATA DE CONTROLE", shortDateString3, "")); + tuples3.Add(new Tuple("ANOTAÇÕES", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao.ToUpper()), "")); + tuples2.AddRange(tuples3); + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>(tuples1) + } + }; + } + + private List> ObrigarValores(bool valores = true) + { + DateTime dateTime; + List> keyValuePairs = ValidationHelper.AddValue(); + if (valores) + { + if (this.Comissao <= decimal.Zero) + { + keyValuePairs.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio, true); + } + if (this.PremioLiquido == decimal.Zero) + { + keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Obrigatorio, true); + } + if (this.PremioTotal == decimal.Zero) + { + keyValuePairs.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Obrigatorio, true); + } + if (this.NumeroParcelas <= decimal.Zero) + { + keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio, true); + } + if (!this._vencimentoParcela) + { + if (this.NumeroParcelas > decimal.Zero && this.NumeroParcelas < new decimal(998)) + { + DateTime vigencia1 = this.Vigencia1; + if (this.NumeroParcelas == decimal.One || vigencia1 == DateTime.MinValue) + { + dateTime = vigencia1; + } + else + { + decimal numeroParcelas = this.NumeroParcelas; + dateTime = vigencia1.AddMonths(int.Parse(numeroParcelas.ToString(new CultureInfo("pt-BR"))) - 1); + } + DateTime dateTime1 = dateTime; + DateTime? vigencia2 = this.Vigencia2; + if ((vigencia2.HasValue ? dateTime1 > vigencia2.GetValueOrDefault() : false) && (this.Controle.Ramo == null || this.Controle.Ramo.Id != (long)23)) + { + keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.VencimentoParcela, true); + } + } + else if (this.NumeroParcelas > new decimal(1000)) + { + keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO", true); + } + } + } + if (!valores) + { + if (this.PremioLiquido != decimal.Zero) + { + keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido, true); + } + if (this.PremioAdicional != decimal.Zero) + { + keyValuePairs.AddValue("PremioAdicional|PRÊMIO ADICIONAL", Messages.Invalido, true); + } + if (this.Iof != decimal.Zero) + { + keyValuePairs.AddValue("Iof", Messages.Invalido, true); + } + if (this.Diferenca != decimal.Zero) + { + keyValuePairs.AddValue("Diferenca|DIFERÊNÇA", Messages.Invalido, true); + } + if (this.PremioTotal != decimal.Zero) + { + keyValuePairs.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido, true); + } + if (this.NumeroParcelas != decimal.Zero) + { + keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Invalido, true); + } + } + return keyValuePairs; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate(bool isEndosso, bool vencimentoParcela) + { + this._isEndosso = isEndosso; + this._vencimentoParcela = vencimentoParcela; + return this.Validate(); + } + + public List> Validate() + { + Gestor.Model.Common.TipoEndosso? tipoEndosso; + Gestor.Model.Common.TipoEndosso valueOrDefault; + List> keyValuePairs = ValidationHelper.AddValue(); + keyValuePairs.AddRange(this.Controle.Validate()); + if (!this.NegocioCorretora.HasValue) + { + keyValuePairs.AddValue("NegocioCorretora|NEGÓCIO CORRETORA", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Proposta) && !this._isEndosso) + { + keyValuePairs.AddValue("Proposta", Messages.Obrigatorio, true); + } + else if (!string.IsNullOrEmpty(this.Proposta) && this.Proposta.Length > 50) + { + keyValuePairs.AddValue("Proposta", string.Format(Messages.MaiorQueLimite, 50), true); + } + if (!string.IsNullOrWhiteSpace(this.PropostaEndosso) && this.PropostaEndosso.Length > 50) + { + keyValuePairs.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 50), true); + } + if (!string.IsNullOrWhiteSpace(this.ApoliceAnterior) && this.ApoliceAnterior.Length > 50) + { + keyValuePairs.AddValue("ApoliceAnterior|APÓLICE ANTERIOR", string.Format(Messages.MaiorQueLimite, 50), true); + } + if (!string.IsNullOrWhiteSpace(this.Endosso) && this.Endosso.Length > 30) + { + keyValuePairs.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (!string.IsNullOrWhiteSpace(this.Pasta) && this.Pasta.Length > 15) + { + keyValuePairs.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 15), true); + } + if (!string.IsNullOrWhiteSpace(this.Agencia) && this.Agencia.Length > 10) + { + keyValuePairs.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 10), true); + } + if (!string.IsNullOrWhiteSpace(this.Conta) && this.Conta.Length > 15) + { + keyValuePairs.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 15), true); + } + if (!string.IsNullOrWhiteSpace(this.NumeroCartao) && this.NumeroCartao.Length > 20) + { + keyValuePairs.AddValue("NumeroCartao|NÚMERO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 20), true); + } + if (!string.IsNullOrWhiteSpace(this.VencimentoCartao) && this.VencimentoCartao.Length > 5) + { + keyValuePairs.AddValue("VencimentoCartao|VENCIMENTO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 5), true); + } + if (!string.IsNullOrWhiteSpace(this.NomeProponente) && this.NomeProponente.Length > 100) + { + keyValuePairs.AddValue("NomeProponente|PROPONENTE", string.Format(Messages.MaiorQueLimite, 100), true); + } + DateTime? emissao = this.Emissao; + if (emissao.HasValue) + { + emissao = this.Emissao; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.Emissao; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label0; + } + } + keyValuePairs.AddValue(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label0: + emissao = this.Remessa; + if (emissao.HasValue) + { + emissao = this.Remessa; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.Remessa; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label1; + } + } + keyValuePairs.AddValue(string.Concat("Remessa|", (this._isEndosso ? "TRANSMISSÃO DA PROPOSTA DE ENDOSSO" : "TRANSMISSÃO DA PROPOSTA")), string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label1: + DateTime vigencia1 = this.Vigencia1; + if (DateTime.Compare(this.Vigencia1, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Vigencia1, new DateTime(9999, 12, 31)) > 0) + { + keyValuePairs.AddValue("Vigencia1|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + emissao = this.Vigencia2; + if (emissao.HasValue) + { + emissao = this.Vigencia2; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.Vigencia2; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label2; + } + } + keyValuePairs.AddValue("Vigencia2|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label2: + DateTime dateTime = this.Vigencia1; + emissao = this.Vigencia2; + if (emissao.HasValue) + { + DateTime vigencia11 = this.Vigencia1; + emissao = this.Vigencia2; + if ((emissao.HasValue ? vigencia11 > emissao.GetValueOrDefault() : false)) + { + keyValuePairs.AddValue("Vigencia2|VIGÊNCIA FINAL", "A DATA DE VIGÊNCIA FINAL NÃO PODE SER ANTERIOR A DATA DE VIGÊNCIA INCIAL", true); + } + } + if (this.Tipo == 0) + { + if (string.IsNullOrWhiteSpace(this.Apolice)) + { + emissao = this.Emissao; + if (emissao.HasValue) + { + keyValuePairs.AddValue("Apolice|APÓLICE", Messages.Obrigatorio, true); + } + } + if (!string.IsNullOrWhiteSpace(this.Apolice)) + { + emissao = this.Emissao; + if (!emissao.HasValue) + { + keyValuePairs.AddValue(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), Messages.Obrigatorio, true); + } + } + if (!string.IsNullOrWhiteSpace(this.Apolice) && this.Apolice.Length > 50) + { + keyValuePairs.AddValue("Apolice|APÓLICE", string.Format(Messages.MaiorQueLimite, 50), true); + } + } + if (this.Tipo > 0) + { + if (string.IsNullOrWhiteSpace(this.PropostaEndosso)) + { + keyValuePairs.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", Messages.Obrigatorio, true); + } + else if (this.PropostaEndosso.Length > 30) + { + keyValuePairs.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (!string.IsNullOrWhiteSpace(this.Endosso)) + { + if (this.Endosso.Length > 30) + { + keyValuePairs.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30), true); + } + emissao = this.Emissao; + if (!emissao.HasValue && this.Tipo > 0) + { + keyValuePairs.AddValue(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), Messages.Obrigatorio, true); + } + } + else + { + emissao = this.Emissao; + if (emissao.HasValue) + { + keyValuePairs.AddValue("Endosso", Messages.Obrigatorio, true); + } + } + } + if (this.Tipo > 0) + { + tipoEndosso = this.TipoEndosso; + if (!tipoEndosso.HasValue) + { + keyValuePairs.AddValue("TipoEndosso|TIPO DE ENDOSSO", Messages.Obrigatorio, true); + } + } + if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela) + { + emissao = this.Vigencia2; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("Vigencia2|VIGÊNCIA FINAL", Messages.Obrigatorio, true); + } + } + if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela && this.Tipo == 0) + { + keyValuePairs.AddRange(this.ObrigarValores(true)); + } + if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Fatura && this.Tipo == 0) + { + keyValuePairs.AddRange(this.ObrigarValores(false)); + } + tipoEndosso = this.TipoEndosso; + if (tipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (this.PremioLiquido != decimal.Zero || this.Comissao != decimal.Zero) && this.NumeroParcelas == decimal.Zero) + { + keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio, true); + } + tipoEndosso = this.TipoEndosso; + if (tipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (this.PremioLiquido != new decimal(0, 0, 0, false, 1) || this.NumeroParcelas != decimal.Zero)) + { + if (this.Comissao == decimal.Zero) + { + keyValuePairs.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio, true); + } + if (this.NumeroParcelas == decimal.Zero) + { + keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio, true); + } + if (this.PremioLiquido == decimal.Zero) + { + keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUID", Messages.Obrigatorio, true); + } + } + long num = 10000000000L; + if (this.PremioTotal > num) + { + keyValuePairs.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido, true); + } + if (this.PremioLiquido > num) + { + keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido, true); + } + if (this.NumeroParcelas > new decimal(1000)) + { + keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO", true); + } + if (this.Tipo > 0) + { + tipoEndosso = this.TipoEndosso; + if (tipoEndosso.HasValue) + { + valueOrDefault = tipoEndosso.GetValueOrDefault(); + if (valueOrDefault != Gestor.Model.Common.TipoEndosso.ComMovimento) + { + goto Label4; + } + keyValuePairs.AddRange(this.ObrigarValores(true)); + return keyValuePairs; + } + Label5: + if (this.PremioTotal == decimal.Zero && this.Comissao == decimal.Zero) + { + return keyValuePairs; + } + keyValuePairs.AddRange(this.ObrigarValores(true)); + } + return keyValuePairs; + Label4: + if ((int)valueOrDefault - (int)Gestor.Model.Common.TipoEndosso.SemMovimento <= (int)Gestor.Model.Common.TipoEndosso.SemMovimento) + { + return keyValuePairs; + } + else + { + goto Label5; + } + } + + public List> ValidateEndossar() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Proposta)) + { + keyValuePairs.AddValue("Proposta", Messages.Obrigatorio, true); + } + if (this.Emissao.HasValue && (DateTime.Compare(this.Emissao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Emissao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Emissao|EMISSÃO DA APÓLICE", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Remessa.HasValue && (DateTime.Compare(this.Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Remessa.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Remessa|TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Apolice) && this.Emissao.HasValue) + { + keyValuePairs.AddValue("Apolice|APÓLICE", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Apolice) && !this.Emissao.HasValue) + { + keyValuePairs.AddValue(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Apolice) && !this.Emissao.HasValue) + { + keyValuePairs.AddValue("Apolice|EMISSÃO DA APÓLICE", "NÃO É POSSÍVEL ENDOSSAR UM DOCUMENTO SEM EMISSÃO DE APÓLICE", true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs new file mode 100644 index 0000000..76976ea --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs @@ -0,0 +1,373 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +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; + + [Log(true)] + public bool Ativo + { + get; + set; + } + + [Log(true)] + public string Documento + { + get + { + string str = this._documento; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documento = value; + } + } + + [Log(true)] + public string Email + { + get + { + string str = this._email; + if (str == null) + { + return null; + } + return str.ToLower().Trim(); + } + set + { + this._email = value; + } + } + + public long IdEmpresa + { + get; + set; + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + [Log(true)] + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + [Description("PREFIXO")] + [Log(true)] + public string PrimeiroPrefixo + { + get + { + string str = this._primeiroPrefixo; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._primeiroPrefixo = value; + } + } + + [Description("TELEFONE")] + [Log(true)] + public string PrimeiroTelefone + { + get + { + string str = this._primeiroTelefone; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._primeiroTelefone = value; + } + } + + [Description("TIPO TELEFONE")] + [Log(true)] + public TipoTelefone? PrimeiroTipo + { + get; + set; + } + + [Description("PREFIXO")] + [Log(true)] + public string SegundoPrefixo + { + get + { + string str = this._segundoPrefixo; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._segundoPrefixo = value; + } + } + + [Description("TELEFONE")] + [Log(true)] + public string SegundoTelefone + { + get + { + string str = this._segundoTelefone; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._segundoTelefone = value; + } + } + + [Description("TIPO TELEFONE")] + [Log(true)] + public TipoTelefone? SegundoTipo + { + get; + set; + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Estipulante estipulante = this; + return new Func>>(estipulante.Validate); + } + } + + public Estipulante() + { + } + + public List Log() + { + string description; + string str; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("CPF", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""), + new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "") + }; + TipoTelefone? primeiroTipo = this.PrimeiroTipo; + if (!primeiroTipo.HasValue) + { + description = ""; + } + else + { + primeiroTipo = this.PrimeiroTipo; + if (primeiroTipo.HasValue) + { + description = primeiroTipo.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection.Add(new Tuple("PRIMEIRO TIPO", description, "")); + observableCollection.Add(new Tuple("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.PrimeiroPrefixo) ? "" : this.PrimeiroPrefixo), "")); + observableCollection.Add(new Tuple("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.PrimeiroTelefone) ? "" : this.PrimeiroTelefone), "")); + primeiroTipo = this.SegundoTipo; + if (!primeiroTipo.HasValue) + { + str = ""; + } + else + { + primeiroTipo = this.SegundoTipo; + if (primeiroTipo.HasValue) + { + str = primeiroTipo.GetValueOrDefault().GetDescription(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("SEGUNDO TIPO", str, "")); + observableCollection.Add(new Tuple("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.SegundoPrefixo) ? "" : this.SegundoPrefixo), "")); + observableCollection.Add(new Tuple("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.SegundoTelefone) ? "" : this.SegundoTelefone), "")); + observableCollection.Add(new Tuple("E-MAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), "")); + observableCollection.Add(new Tuple("CEP", (string.IsNullOrWhiteSpace(base.Cep) ? "" : base.Cep), "")); + observableCollection.Add(new Tuple("ENDEREÇO", (string.IsNullOrWhiteSpace(base.Endereco) ? "" : base.Endereco), "")); + observableCollection.Add(new Tuple("NÚMERO", (string.IsNullOrWhiteSpace(base.Numero) ? "" : base.Numero), "")); + observableCollection.Add(new Tuple("COMPLEMENTO", (string.IsNullOrWhiteSpace(base.Complemento) ? "" : base.Complemento), "")); + observableCollection.Add(new Tuple("BAIRRO", (string.IsNullOrWhiteSpace(base.Bairro) ? "" : base.Bairro), "")); + observableCollection.Add(new Tuple("CIDADE", (string.IsNullOrWhiteSpace(base.Cidade) ? "" : base.Cidade), "")); + observableCollection.Add(new Tuple("ESTADO", (string.IsNullOrWhiteSpace(base.Estado) ? "" : base.Estado), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrEmpty(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 100) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrEmpty(this.Documento) && !this.Documento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Documento", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrimeiroPrefixo) && !this.PrimeiroPrefixo.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("PrimeiroPrefixo|PRIMEIRO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrimeiroTelefone) && !this.PrimeiroTelefone.ValidacaoTelefone()) + { + keyValuePairs.AddValue("PrimeiroTelefone|PRIMEIRO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.SegundoPrefixo) && !this.SegundoPrefixo.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("SegundoPrefixo|SEGUNDO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.SegundoTelefone) && !this.SegundoTelefone.ValidacaoTelefone()) + { + keyValuePairs.AddValue("SegundoTelefone|SEGUNDO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Email) && this.Email.Length > 100) + { + keyValuePairs.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrEmpty(this.Email) && !this.Email.ValidacaoEmail()) + { + keyValuePairs.AddValue("Email|E-MAIL", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(base.Cep) && !base.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep|CEP", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(base.Estado) && !base.Estado.ValidacaoEstado()) + { + keyValuePairs.AddValue("Estado|ESTADO", Messages.Invalido, true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Expedicao.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Expedicao.cs new file mode 100644 index 0000000..5dbd8f3 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Expedicao.cs @@ -0,0 +1,94 @@ +using Gestor.Model.Domain.Generic; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Expedicao : DomainBase + { + public Gestor.Model.Domain.Seguros.Documento Apolice + { + get; + set; + } + + public DateTime? DataAlteracao + { + get; + set; + } + + public DateTime? DataCriacao + { + get; + set; + } + + public DateTime? DataEnvio + { + get; + set; + } + + public DateTime? DataRecebimento + { + get; + set; + } + + public string Destino + { + get; + set; + } + + public string Documento + { + get; + set; + } + + public string Responsavel + { + get; + set; + } + + public long? UsuarioAlteracao + { + get; + set; + } + + public long? UsuarioCriacao + { + get; + set; + } + + public Expedicao() + { + } + + public List Log() + { + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("DOCUMENTO", this.Documento, ""), + new Tuple("DESTINO", this.Destino, "") + }; + DateTime? dataEnvio = this.DataEnvio; + observableCollection.Add(new Tuple("DATA ENVIO", dataEnvio.ToString(), "")); + dataEnvio = this.DataRecebimento; + observableCollection.Add(new Tuple("DATA RECEBIMENTO", dataEnvio.ToString(), "")); + observableCollection.Add(new Tuple("RESPONSÁVEL", this.Responsavel, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Extrato.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Extrato.cs new file mode 100644 index 0000000..fcf3ccd --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Extrato.cs @@ -0,0 +1,177 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Extrato : DomainBase, IDomain + { + private string _numero; + + private string _historico; + + private string _observacao; + + public decimal? Bruto + { + get; + set; + } + + public bool Completo + { + get; + set; + } + + public DateTime? Data + { + get; + set; + } + + public DateTime? DataCredito + { + get; + set; + } + + public string Historico + { + get + { + string str = this._historico; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._historico = value; + } + } + + public long IdEmpresa + { + get; + set; + } + + public virtual long IdUsuario + { + get; + set; + } + + public decimal? Ir + { + get; + set; + } + + public decimal? Iss + { + get; + set; + } + + public decimal? Liquido + { + get; + set; + } + + public string Numero + { + get + { + string str = this._numero; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._numero = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public decimal? Outro + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Seguradora Seguradora + { + get; + set; + } + + public bool Selecionado + { + get; + set; + } + + public StatusExtrato Status + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Extrato extrato = this; + return new Func>>(extrato.Validate); + } + } + + public Extrato() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!string.IsNullOrWhiteSpace(this.Numero) && this.Numero.Length > 50) + { + keyValuePairs.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 50), true); + } + if (this.Data.HasValue && (DateTime.Compare(this.Data.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Data.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Data", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Fabricante.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Fabricante.cs new file mode 100644 index 0000000..b20207d --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Fabricante.cs @@ -0,0 +1,62 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Fabricante : IDomain + { + private string _descricao; + + public string Descricao + { + get + { + string str = this._descricao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._descricao = value; + } + } + + public int Id + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Fabricante fabricante = this; + return new Func>>(fabricante.Validate); + } + } + + public Fabricante() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!string.IsNullOrWhiteSpace(this.Descricao) && this.Descricao.Length > 150) + { + keyValuePairs.AddValue("Descricao", string.Format(Messages.MaiorQueLimite, 150), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Granizo.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Granizo.cs new file mode 100644 index 0000000..8f6036c --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Granizo.cs @@ -0,0 +1,247 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Granizo : EnderecoBase, IDomain + { + private string _cultura; + + private string _sitio; + + private string _observacao; + + public string Area + { + get; + set; + } + + public string Cultura + { + get + { + string str = this._cultura; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cultura = value; + } + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public string Sitio + { + get + { + string str = this._sitio; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._sitio = value; + } + } + + public decimal? SubsidioEstadual + { + get; + set; + } + + public decimal? SubsidioFederal + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Granizo granizo = this; + return new Func>>(granizo.Validate); + } + } + + public Granizo() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + decimal valueOrDefault; + string str; + string str1; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("CEP", (string.IsNullOrWhiteSpace(item.Granizo.Cep) ? "" : item.Granizo.Cep), ""), + new Tuple("ENDEREÇO", (string.IsNullOrWhiteSpace(item.Granizo.Endereco) ? "" : item.Granizo.Endereco.ToUpper()), ""), + new Tuple("NÚMERO", (string.IsNullOrWhiteSpace(item.Granizo.Numero) ? "" : item.Granizo.Numero), ""), + new Tuple("COMPLEMENTO", (string.IsNullOrWhiteSpace(item.Granizo.Complemento) ? "" : item.Granizo.Complemento.ToUpper()), ""), + new Tuple("BAIRRO", (string.IsNullOrWhiteSpace(item.Granizo.Bairro) ? "" : item.Granizo.Bairro.ToUpper()), ""), + new Tuple("CIDADE", (string.IsNullOrWhiteSpace(item.Granizo.Cidade) ? "" : item.Granizo.Cidade.ToUpper()), ""), + new Tuple("ESTADO", (string.IsNullOrWhiteSpace(item.Granizo.Estado) ? "" : item.Granizo.Estado.ToUpper()), ""), + new Tuple("CULTURA", (string.IsNullOrWhiteSpace(item.Granizo.Cultura) ? "" : item.Granizo.Cultura.ToUpper()), ""), + new Tuple("SÍTIO", (string.IsNullOrWhiteSpace(item.Granizo.Sitio) ? "" : item.Granizo.Sitio.ToUpper()), "") + }; + decimal? subsidioFederal = item.Granizo.SubsidioFederal; + if (!subsidioFederal.HasValue) + { + str = ""; + } + else + { + subsidioFederal = item.Granizo.SubsidioFederal; + if (subsidioFederal.HasValue) + { + valueOrDefault = subsidioFederal.GetValueOrDefault(); + str = valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("SUBSÍDIO FEDERAL", str, "")); + subsidioFederal = item.Granizo.SubsidioEstadual; + if (!subsidioFederal.HasValue) + { + str1 = ""; + } + else + { + subsidioFederal = item.Granizo.SubsidioEstadual; + if (subsidioFederal.HasValue) + { + valueOrDefault = subsidioFederal.GetValueOrDefault(); + str1 = valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)); + } + else + { + str1 = null; + } + } + observableCollection.Add(new Tuple("SUBSÍDIO ESTADUAL", str1, "")); + observableCollection.Add(new Tuple("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(item.Granizo.Observacao) ? "" : item.Granizo.Observacao.ToUpper()), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection1.Add(new Tuple(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", "")); + observableCollection1.Add(new Tuple(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), "")); + valueOrDefault = cobertura.Premio; + observableCollection1.Add(new Tuple(" PRÊMIO", valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)), "")); + valueOrDefault = cobertura.Franquia; + observableCollection1.Add(new Tuple(" FRANQUIA", valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)), "")); + valueOrDefault = cobertura.Lmi; + observableCollection1.Add(new Tuple(" L.M.I.", valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists1; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(base.Cep)) + { + keyValuePairs.AddValue("Cep", Messages.Obrigatorio, true); + } + else if (!base.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(this.Cultura)) + { + keyValuePairs.AddValue("Cultura", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Cultura) && this.Cultura.Length > 60) + { + keyValuePairs.AddValue("Cultura", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (string.IsNullOrWhiteSpace(this.Sitio)) + { + keyValuePairs.AddValue("Sitio", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Sitio) && this.Sitio.Length > 100) + { + keyValuePairs.AddValue("Sitio", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (string.IsNullOrWhiteSpace(base.Endereco)) + { + keyValuePairs.AddValue("Endereco", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Numero)) + { + keyValuePairs.AddValue("Numero", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Bairro)) + { + keyValuePairs.AddValue("Bairro", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Cidade)) + { + keyValuePairs.AddValue("Cidade", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Estado)) + { + keyValuePairs.AddValue("Estado", Messages.Obrigatorio, true); + } + else if (!base.Estado.ValidacaoEstado()) + { + keyValuePairs.AddValue("Estado", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs new file mode 100644 index 0000000..7adcea9 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Item.cs @@ -0,0 +1,505 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Model.Domain.Seguros +{ + public class Item : DomainBase, IDomain, INotifyPropertyChanged + { + private bool _selecionado; + + private string _descricao; + + private string _status; + + private string _statusInclusao; + + private string _observacao; + + private string _valorCredito; + + private bool _config = true; + + private bool _fabricanteBranco; + + public Gestor.Model.Domain.Seguros.Aeronautico Aeronautico + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Auto Auto + { + get; + set; + } + + public bool Cancelado + { + get; + set; + } + + public IList Coberturas + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Consorcio Consorcio + { + get; + set; + } + + public string Descricao + { + get + { + string str = this._descricao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._descricao = value; + } + } + + public Gestor.Model.Domain.Seguros.Documento Documento + { + get; + set; + } + + public long? Endosso + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Granizo Granizo + { + get; + set; + } + + public long? IdDocumentoCancelado + { + get; + set; + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public int? Ordem + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Patrimonial Patrimonial + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.RiscosDiversos RiscosDiversos + { + get; + set; + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + public bool Sinistrado + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Sinistro Sinistro + { + get; + set; + } + + public IList Sinistros + { + get; + set; + } + + public string Status + { + get + { + string str = this._status; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._status = value; + } + } + + public string StatusInclusao + { + get + { + string str = this._statusInclusao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._statusInclusao = value; + } + } + + public long? Substituicao + { + get; + set; + } + + public long? Substituido + { + get; + set; + } + + public Gestor.Model.Common.TipoEndosso? TipoEndosso + { + get; + set; + } + + public IList Titulares + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Item item = this; + return new Func>>(item.Validate); + } + } + + public Gestor.Model.Domain.Seguros.Vida Vida + { + get; + set; + } + + public Item() + { + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate(bool config, bool fabricanteBranco = false) + { + this._config = config; + this._fabricanteBranco = fabricanteBranco; + return this.Validate(); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + int? ordem = this.Ordem; + if (ordem.HasValue) + { + ordem = this.Ordem; + if (!(ordem.GetValueOrDefault() == 0 & ordem.HasValue)) + { + goto Label0; + } + } + keyValuePairs.AddValue("Ordem", Messages.Invalido, true); + if (string.IsNullOrWhiteSpace(this.Descricao)) + { + keyValuePairs.AddValue("Descricao", Messages.Obrigatorio, true); + } + else if (this.Descricao.Length > 250) + { + keyValuePairs.AddValue("Descricao", string.Format(Messages.MaiorQueLimite, 250), true); + } + if (this.Documento == null) + { + return keyValuePairs; + } + long id = this.Documento.Controle.Ramo.Id; + if (id > (long)38) + { + if (id == (long)47 || id == (long)53 || id == (long)66) + { + goto Label1; + } + goto Label2; + } + else + { + long num = id - (long)1; + if (num <= (long)19) + { + switch ((uint)num) + { + case 0: + case 1: + case 2: + case 14: + case 17: + { + goto Label4; + } + case 3: + case 7: + case 10: + case 11: + case 13: + case 15: + case 16: + case 18: + { + goto Label2; + } + case 4: + { + goto Label5; + } + case 5: + case 6: + case 8: + case 9: + { + goto Label1; + } + case 12: + { + if (this.Aeronautico != null) + { + keyValuePairs.AddRange(this.Aeronautico.Validate()); + return keyValuePairs; + } + else + { + keyValuePairs.AddValue("Aeronautico", Messages.Obrigatorio, true); + return keyValuePairs; + } + } + case 19: + { + if (this.Granizo != null) + { + keyValuePairs.AddRange(this.Granizo.Validate()); + return keyValuePairs; + } + else + { + keyValuePairs.AddValue("Granizo", Messages.Obrigatorio, true); + return keyValuePairs; + } + } + } + } + else + { + } + long num1 = id - (long)30; + if (num1 <= (long)8) + { + switch ((uint)num1) + { + case 0: + { + break; + } + case 1: + { + if (this.RiscosDiversos != null) + { + keyValuePairs.AddRange(this.RiscosDiversos.Validate()); + } + else + { + keyValuePairs.AddValue("RiscosDiversos", Messages.Obrigatorio, true); + } + if (this.Titulares == null || this.Titulares.Count <= 0) + { + return keyValuePairs; + } + using (IEnumerator enumerator = this.Titulares.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + keyValuePairs.AddRange(enumerator.Current.Validate()); + } + return keyValuePairs; + } + break; + } + case 6: + { + if (this.Consorcio != null) + { + keyValuePairs.AddRange(this.Consorcio.Validate()); + return keyValuePairs; + } + else + { + keyValuePairs.AddValue("Consorcio", Messages.Obrigatorio, true); + return keyValuePairs; + } + } + case 7: + { + goto Label5; + } + case 8: + { + if (this.Patrimonial != null) + { + keyValuePairs.AddRange(this.Patrimonial.ValidateGarantia()); + return keyValuePairs; + } + else + { + keyValuePairs.AddValue("Patrimonial", Messages.Obrigatorio, true); + return keyValuePairs; + } + } + default: + { + goto Label2; + } + } + } + else + { + goto Label2; + } + Label4: + if (this.Patrimonial != null) + { + keyValuePairs.AddRange(this.Patrimonial.Validate()); + } + else + { + keyValuePairs.AddValue("Patrimonial", Messages.Obrigatorio, true); + } + } + return keyValuePairs; + Label1: + if (this.Vida != null) + { + keyValuePairs.AddRange(this.Vida.Validate()); + } + else + { + keyValuePairs.AddValue("Vida", Messages.Obrigatorio, true); + } + if (this.Titulares != null && this.Titulares.Count > 0 && this.Documento.Controle.Ramo.Id != (long)6) + { + using (enumerator = this.Titulares.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + keyValuePairs.AddRange(enumerator.Current.Validate()); + } + return keyValuePairs; + } + } + else + { + return keyValuePairs; + } + Label2: + if (this.RiscosDiversos != null) + { + keyValuePairs.AddRange(this.RiscosDiversos.Validate()); + return keyValuePairs; + } + else + { + keyValuePairs.AddValue("RiscosDiversos", Messages.Obrigatorio, true); + return keyValuePairs; + } + Label5: + if (this.Auto != null) + { + keyValuePairs.AddRange(this.Auto.Validate(this._config, this._fabricanteBranco)); + return keyValuePairs; + } + else + { + keyValuePairs.AddValue("Auto", Messages.Obrigatorio, true); + return keyValuePairs; + } + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/MaisContato.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/MaisContato.cs new file mode 100644 index 0000000..6266547 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/MaisContato.cs @@ -0,0 +1,340 @@ +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; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +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; + + [Log(true)] + public string Agencia + { + get + { + string str = this._agencia; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._agencia = value; + } + } + + public string Banco + { + get + { + string str = this._banco; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._banco = value; + } + } + + public Gestor.Model.Domain.Seguros.Cliente Cliente + { + get; + set; + } + + [Log(true)] + public string Conta + { + get + { + string str = this._conta; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._conta = value; + } + } + + [Log(true)] + public string Documento + { + get + { + string str = this._documento; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documento = value; + } + } + + [Log(true)] + public string Email + { + get + { + string str = this._email; + if (str == null) + { + return null; + } + return str.ToLower().Trim(); + } + set + { + this._email = value; + } + } + + public bool Excluido + { + get; + set; + } + + [Log(true)] + public DateTime? Expedicao + { + get; + set; + } + + [Log(true)] + public string Habilitacao + { + get + { + string str = this._habilitacao; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._habilitacao = value; + } + } + + [Log(true)] + public string Identidade + { + get + { + string str = this._identidade; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._identidade = value; + } + } + + [Log(true)] + public DateTime? Nascimento + { + get; + set; + } + + [Log(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + [Log(true)] + public Gestor.Model.Common.Parentesco? Parentesco + { + get; + set; + } + + [Log(true)] + public string Prefixo + { + get + { + string str = this._prefixo; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._prefixo = value; + } + } + + [Log(true)] + public DateTime? PrimeiraHabilitacao + { + get; + set; + } + + [Log(true)] + public Gestor.Model.Domain.Common.Profissao Profissao + { + get; + set; + } + + [Log(true)] + public string Telefone + { + get + { + string str = this._telefone; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone = value; + } + } + + public TipoTelefone? Tipo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + MaisContato maisContato = this; + return new Func>>(maisContato.Validate); + } + } + + public MaisContato() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!string.IsNullOrWhiteSpace(this.Nome) && this.Nome.Length > 90) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 90), true); + } + if (this.PrimeiraHabilitacao.HasValue && (DateTime.Compare(this.PrimeiraHabilitacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.PrimeiraHabilitacao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Expedicao.HasValue && (DateTime.Compare(this.Expedicao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Expedicao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Expedicao|EXPEDIÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Nascimento.HasValue && (DateTime.Compare(this.Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Nascimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Nascimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (!string.IsNullOrWhiteSpace(this.Documento) && this.Documento.Length > 30) + { + keyValuePairs.AddValue("Documento", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (!string.IsNullOrWhiteSpace(this.Identidade) && this.Identidade.Length > 40) + { + keyValuePairs.AddValue("Identidade", string.Format(Messages.MaiorQueLimite, 40), true); + } + if (!string.IsNullOrWhiteSpace(this.Prefixo) && this.Prefixo.Length > 6) + { + keyValuePairs.AddValue("Prefixo", string.Format(Messages.MaiorQueLimite, 6), true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone) && this.Telefone.Length > 11) + { + keyValuePairs.AddValue("Telefone", string.Format(Messages.MaiorQueLimite, 11), true); + } + if (!string.IsNullOrWhiteSpace(this.Email) && this.Email.Length > 80) + { + keyValuePairs.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 80), true); + } + if (!string.IsNullOrWhiteSpace(this.Habilitacao) && this.Habilitacao.Length > 40) + { + keyValuePairs.AddValue("Habilitacao|HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 40), true); + } + if (!string.IsNullOrWhiteSpace(this.Banco) && this.Banco.Length > 15) + { + keyValuePairs.AddValue("Banco", string.Format(Messages.MaiorQueLimite, 15), true); + } + if (!string.IsNullOrWhiteSpace(this.Agencia) && this.Agencia.Length > 15) + { + keyValuePairs.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 15), true); + } + if (!string.IsNullOrWhiteSpace(this.Conta) && this.Conta.Length > 20) + { + keyValuePairs.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 20), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/MetaSeguradora.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/MetaSeguradora.cs new file mode 100644 index 0000000..4b628e7 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/MetaSeguradora.cs @@ -0,0 +1,60 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class MetaSeguradora : DomainBase + { + public long Ano + { + get; + set; + } + + public Gestor.Model.Common.Mes Mes + { + get; + set; + } + + public bool Recorrente { get; set; } = true; + + public Gestor.Model.Domain.Seguros.Seguradora Seguradora + { + get; + set; + } + + public int TipoCalculo { get; set; } = 1; + + public decimal Valor + { + get; + set; + } + + public MetaSeguradora() + { + } + + public List Log() + { + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>(); + decimal valor = this.Valor; + observableCollection.Add(new Tuple("VALOR DA META", valor.ToString(), "")); + Gestor.Model.Common.Mes mes = this.Mes; + observableCollection.Add(new Tuple("MÊS", mes.ToString(), "")); + long ano = this.Ano; + observableCollection.Add(new Tuple("ANO", ano.ToString(), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/MetaVendedor.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/MetaVendedor.cs new file mode 100644 index 0000000..6483feb --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/MetaVendedor.cs @@ -0,0 +1,56 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class MetaVendedor : DomainBase + { + public long Ano + { + get; + set; + } + + public Gestor.Model.Common.Mes Mes + { + get; + set; + } + + public decimal Valor + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public MetaVendedor() + { + } + + public List Log() + { + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>(); + decimal valor = this.Valor; + observableCollection.Add(new Tuple("VALOR DA META", valor.ToString("c2"), "")); + Gestor.Model.Common.Mes mes = this.Mes; + observableCollection.Add(new Tuple("MÊS", mes.ToString(), "")); + long ano = this.Ano; + observableCollection.Add(new Tuple("ANO", ano.ToString(), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Parceiro.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Parceiro.cs new file mode 100644 index 0000000..16bbdaf --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Parceiro.cs @@ -0,0 +1,528 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; + +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; + + [Log(true)] + public string Bairro + { + get + { + string str = this._bairro; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._bairro = value; + } + } + + [Log(true)] + public string Cep + { + get + { + if (this._cep == null || !Regex.IsMatch(this._cep, "[0-9]+")) + { + return ""; + } + return this._cep.Trim(); + } + set + { + this._cep = value; + } + } + + [Description("DOCUMENTO")] + [Log(true)] + public string Cgccpf + { + get + { + string str = this._cgccpf; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._cgccpf = value; + } + } + + [Log(true)] + public string Cidade + { + get + { + string str = this._cidade; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cidade = value; + } + } + + [Log(true)] + public string Complemento + { + get + { + string str = this._complemento; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._complemento = value; + } + } + + [Log(true)] + public string Contato + { + get + { + string str = this._contato; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._contato = value; + } + } + + [Description("PREFIXO 1")] + [Log(true)] + public string Ddd1 + { + get + { + string str = this._ddd1; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._ddd1 = value; + } + } + + [Description("PREFIXO 2")] + [Log(true)] + public string Ddd2 + { + get + { + string str = this._ddd2; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._ddd2 = value; + } + } + + [Description("PREFIXO 3")] + [Log(true)] + public string Ddd3 + { + get + { + string str = this._ddd3; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._ddd3 = value; + } + } + + [Log(true)] + public string Email + { + get + { + string str = this._email; + if (str == null) + { + return null; + } + return str.ToLower().Trim(); + } + set + { + this._email = value; + } + } + + [Log(true)] + public string Endereco + { + get + { + string str = this._endereco; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._endereco = value; + } + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + [Description("NÚMERO")] + [Log(true)] + public string Numero + { + get + { + string str = this._numero; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._numero = value; + } + } + + [Description("OBSERVAÇÃO")] + [Log(true)] + public string Obs + { + get + { + string str = this._obs; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._obs = value; + } + } + + [Description("TELEFONE 1")] + [Log(true)] + public string Telefone1 + { + get + { + string str = this._telefone1; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone1 = value; + } + } + + [Description("TELEFONE 2")] + [Log(true)] + public string Telefone2 + { + get + { + string str = this._telefone2; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone2 = value; + } + } + + [Description("TELEFONE 3")] + [Log(true)] + public string Telefone3 + { + get + { + string str = this._telefone3; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone3 = value; + } + } + + public Gestor.Model.Common.TipoPerda? TipoPerda + { + get; + set; + } + + [Description("ESTADO")] + [Log(true)] + public string Uf + { + get + { + string str = this._uf; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._uf = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Parceiro parceiro = this; + return new Func>>(parceiro.Validate); + } + } + + public Parceiro() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("DOCUMENTO", (string.IsNullOrWhiteSpace(this.Cgccpf) ? "" : this.Cgccpf), ""), + new Tuple("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd1) ? "" : this.Ddd1), ""), + new Tuple("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone1) ? "" : this.Telefone1), ""), + new Tuple("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd2) ? "" : this.Ddd2), ""), + new Tuple("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone2) ? "" : this.Telefone2), ""), + new Tuple("TERCEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd3) ? "" : this.Ddd3), ""), + new Tuple("TERCEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone3) ? "" : this.Telefone3), ""), + new Tuple("E-MAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), ""), + new Tuple("CEP", (string.IsNullOrWhiteSpace(this.Cep) ? "" : this.Cep), ""), + new Tuple("ENDEREÇO", (string.IsNullOrWhiteSpace(this.Endereco) ? "" : this.Endereco), ""), + new Tuple("NÚMERO", (string.IsNullOrWhiteSpace(this.Numero) ? "" : this.Numero), ""), + new Tuple("COMPLEMENTO", (string.IsNullOrWhiteSpace(this.Complemento) ? "" : this.Complemento), ""), + new Tuple("BAIRRO", (string.IsNullOrWhiteSpace(this.Bairro) ? "" : this.Bairro), ""), + new Tuple("CIDADE", (string.IsNullOrWhiteSpace(this.Cidade) ? "" : this.Cidade), ""), + new Tuple("ESTADO", (string.IsNullOrWhiteSpace(this.Uf) ? "" : this.Uf), "") + } + } + }; + } + + public List> Validate() + { + int num; + int? nullable; + bool flag; + List> keyValuePairs = ValidationHelper.AddValue(); + string nome = this.Nome; + if (nome != null) + { + nullable = new int?((int)nome.Trim().Split(new char[] { ' ' }).Length); + } + else + { + nullable = null; + } + if (!nullable.HasValue) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 100) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrEmpty(this.Cgccpf) && !this.Cgccpf.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Cgccpf", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Ddd1) && !this.Ddd1.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("Ddd1|PRIMEIRO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone1) && !this.Telefone1.ValidacaoTelefone()) + { + keyValuePairs.AddValue("Telefone1|PRIMEIRO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Ddd2) && !this.Ddd2.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("Ddd2|SEGUNDO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone2) && !this.Telefone2.ValidacaoTelefone()) + { + keyValuePairs.AddValue("Telefone2|SEGUNDO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Ddd3) && !this.Ddd3.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("Ddd3|TERCEIRO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone3) && !this.Telefone3.ValidacaoTelefone()) + { + keyValuePairs.AddValue("Telefone3|TERCEIRO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Email) && this.Email.Length > 100) + { + keyValuePairs.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrEmpty(this.Email) && !this.Email.ValidacaoEmail()) + { + keyValuePairs.AddValue("Email|E-MAIL", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Cep) && !this.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep|CEP", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Uf) && !this.Uf.ValidacaoEstado()) + { + keyValuePairs.AddValue("Uf|ESTADO", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Numero) && !int.TryParse(this.Numero, out num)) + { + keyValuePairs.AddValue("Numero|NÚMERO", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Numero)) + { + string numero = this.Numero; + if (numero != null) + { + flag = numero.Count() > 5; + } + else + { + flag = false; + } + if (flag) + { + keyValuePairs.AddValue("Numero|NÚMERO", Messages.Invalido, true); + } + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Parcela.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Parcela.cs new file mode 100644 index 0000000..d97f5c8 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Parcela.cs @@ -0,0 +1,789 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Parcela : DomainBase, IDomain + { + private string _extrato; + + private string _fatura; + + [Description("STATUS PAGAMENTO")] + [ForceLog(true)] + [Log(true)] + private Gestor.Model.Common.StatusPagamento? _statusPagamento; + + private bool _percentualmaiorque100; + + private bool _alteracao; + + private bool _permitirVencimentoMenor; + + private bool _permitirVencimentoMaior; + + public bool Baixando + { + get; + set; + } + + [Description("COMISSÃO")] + [ForceLog(true)] + [Log(true)] + public decimal Comissao + { + get; + set; + } + + [Description("CONTROLE")] + [ForceLog(true)] + [Log(true)] + public DateTime? DataControle + { + get; + set; + } + + [Description("CRÉDITO")] + [ForceLog(true)] + [Log(true)] + public DateTime? DataCredito + { + get; + set; + } + + [Log(false)] + public DateTime? DataCriacao + { + get; + set; + } + + [Description("QUITAÇÃO")] + [ForceLog(true)] + [Log(true)] + public DateTime? DataQuitacao + { + get; + set; + } + + [Description("RECEBIMENTO")] + [ForceLog(true)] + [Log(true)] + public DateTime? DataRecebimento + { + get; + set; + } + + [Description("DESCONTO")] + [ForceLog(true)] + [Log(true)] + public decimal Desconto + { + get; + set; + } + + [ForceLog(true)] + [Log(false)] + public Gestor.Model.Domain.Seguros.Documento Documento + { + get; + set; + } + + [Description("EMISSÃO FATURA")] + [ForceLog(true)] + [Log(true)] + public DateTime? Emissao + { + get; + set; + } + + [Description("EXTRATO")] + [ForceLog(true)] + [Log(true)] + public string Extrato + { + get + { + string str = this._extrato; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._extrato = value; + } + } + + [Description("FATURA")] + [ForceLog(true)] + [Log(true)] + public string Fatura + { + get + { + string str = this._fatura; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._fatura = value; + } + } + + public long IdEmpresa + { + get; + set; + } + + [Log(false)] + public long IdParcelaPendente + { + get; + set; + } + + [Description("IR")] + [ForceLog(true)] + [Log(true)] + public decimal Irr + { + get; + set; + } + + [Description("ISS")] + [ForceLog(true)] + [Log(true)] + public decimal Iss + { + get; + set; + } + + [Description("PARCELA")] + [ForceLog(true)] + [Log(true)] + public int NumeroParcela + { + get; + set; + } + + public string Observacao + { + get; + set; + } + + [Description("OUTROS")] + [ForceLog(true)] + [Log(true)] + public decimal Outros + { + get; + set; + } + + [Log(false)] + public Gestor.Model.Common.StatusPagamento? StatusPagamento + { + get + { + return this._statusPagamento; + } + set + { + this._statusPagamento = new Gestor.Model.Common.StatusPagamento?(value.GetValueOrDefault()); + } + } + + [Description("TIPO DA PARCELA")] + [ForceLog(true)] + [Log(true)] + public Gestor.Model.Common.SubTipo SubTipo + { + get; + set; + } + + public Gestor.Model.Common.TipoPagamento TipoPagamento + { + get; + set; + } + + [Log(false)] + public long UsuarioCriacao + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Parcela parcela = this; + return new Func>>(parcela.Validate); + } + } + + [Description("VALOR")] + [ForceLog(true)] + [Log(true)] + public decimal Valor + { + get; + set; + } + + [Description("COMISSÃO LÍQUIDA")] + [ForceLog(true)] + [Log(true)] + public decimal ValorComDesconto + { + get; + set; + } + + [Description("VALOR DE COMISSÃO")] + [ForceLog(true)] + [Log(true)] + public decimal ValorComissao + { + get; + set; + } + + public decimal ValorExtrato + { + get; + set; + } + + [Description("VALOR LÍQUIDO FATURA")] + [ForceLog(true)] + [Log(true)] + public decimal ValorLiquidoFatura + { + get; + set; + } + + public decimal ValorPago + { + get; + set; + } + + [Description("VALOR PARCELA EXTRATO")] + [ForceLog(true)] + [Log(true)] + public decimal ValorRealizado + { + get; + set; + } + + [Description("VENCIMENTO")] + [ForceLog(true)] + [Log(true)] + public DateTime Vencimento + { + get; + set; + } + + [Log(false)] + public ObservableCollection Vendedores + { + get; + set; + } + + [Description("FIM FATURA")] + [ForceLog(true)] + [Log(true)] + public DateTime? VigenciaFinal + { + get; + set; + } + + [Description("INÍCIO FATURA")] + [ForceLog(true)] + [Log(true)] + public DateTime? VigenciaIncial + { + get; + set; + } + + public Parcela() + { + } + + public List> Validate(bool permitirVencimentoMenor, bool permitirVencimentoMaior, bool alteracao = false, bool percentualmaiorque100 = false) + { + this._permitirVencimentoMenor = permitirVencimentoMenor; + this._permitirVencimentoMaior = permitirVencimentoMaior; + this._alteracao = alteracao; + this._percentualmaiorque100 = percentualmaiorque100; + return this.Validate(); + } + + public List> Validate() + { + decimal? nullable; + decimal numeroParcelas; + decimal? nullable1; + decimal? nullable2; + decimal? nullable3; + DateTime vencimento; + DateTime? vigencia2; + int num; + decimal? tolerancia; + decimal? tolerancia1; + decimal? nullable4; + decimal? nullable5; + decimal? tolerancia2; + decimal? tolerancia3; + decimal? nullable6; + List> keyValuePairs = ValidationHelper.AddValue(); + DateTime? emissao = this.Emissao; + if (emissao.HasValue) + { + emissao = this.Emissao; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.Emissao; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label0; + } + } + keyValuePairs.AddValue("Emissao|EMISSÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label0: + emissao = this.VigenciaFinal; + if (emissao.HasValue) + { + emissao = this.VigenciaFinal; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.VigenciaFinal; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label1; + } + } + keyValuePairs.AddValue("VigenciaFinal|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label1: + emissao = this.VigenciaIncial; + if (emissao.HasValue) + { + emissao = this.VigenciaIncial; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.VigenciaIncial; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label2; + } + } + keyValuePairs.AddValue("VigenciaIncial|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label2: + emissao = this.DataCredito; + if (emissao.HasValue) + { + emissao = this.DataCredito; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.DataCredito; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label3; + } + } + keyValuePairs.AddValue("DataCredito|DATA DE CRÉDITO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label3: + emissao = this.DataRecebimento; + if (emissao.HasValue) + { + emissao = this.DataRecebimento; + if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0) + { + emissao = this.DataRecebimento; + if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0) + { + goto Label4; + } + } + keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + Label4: + if (DateTime.Compare(this.Vencimento, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Vencimento, new DateTime(9999, 12, 31)) > 0) + { + keyValuePairs.AddValue("Vencimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.NumeroParcela == 0) + { + keyValuePairs.AddValue("NumeroParcela|NÚMERO DA PARCELA", Messages.Obrigatorio, true); + } + if (this.Valor == decimal.Zero) + { + keyValuePairs.AddValue("Valor", Messages.Obrigatorio, true); + } + if (this.Comissao == decimal.Zero && this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura) + { + keyValuePairs.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio, true); + } + if (this.Comissao > new decimal(100) && (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura || !this._percentualmaiorque100)) + { + keyValuePairs.AddValue("Comissao|% COMISSÃO", "MAIOR QUE 100%", true); + } + emissao = this.DataRecebimento; + if (emissao.HasValue) + { + emissao = this.DataCredito; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("DataCredito|DATA DE CRÉDITO", Messages.Obrigatorio, true); + } + } + emissao = this.DataCredito; + if (emissao.HasValue) + { + emissao = this.DataRecebimento; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.Obrigatorio, true); + } + } + if (this.Baixando) + { + emissao = this.DataRecebimento; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("DataRecebimento|DATA DE RECEBIMENTO", Messages.Obrigatorio, true); + } + emissao = this.DataCredito; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("DataCredito|DATA DE CRÉDITO", Messages.Obrigatorio, true); + } + } + if (!this._alteracao) + { + emissao = this.DataCredito; + if (!emissao.HasValue) + { + emissao = this.DataRecebimento; + if (!emissao.HasValue) + { + goto Label5; + } + } + if (this.ValorRealizado == decimal.Zero) + { + keyValuePairs.AddValue("ValorRealizado|VALOR REALIZADO", Messages.Obrigatorio, true); + } + } + Label5: + if (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && this.SubTipo == Gestor.Model.Common.SubTipo.ParcelaNormal) + { + if (this.Documento.NumeroParcelas != decimal.One) + { + decimal num1 = Math.Abs(this.Valor); + decimal num2 = Math.Abs(this.Documento.PremioTotal); + Controle controle = this.Documento.Controle; + if (controle != null) + { + Seguradora seguradora = controle.Seguradora; + if (seguradora != null) + { + tolerancia1 = seguradora.Tolerancia; + } + else + { + nullable3 = null; + tolerancia1 = nullable3; + } + } + else + { + nullable3 = null; + tolerancia1 = nullable3; + } + nullable2 = tolerancia1; + if (nullable2.HasValue) + { + nullable4 = new decimal?(num2 + nullable2.GetValueOrDefault()); + } + else + { + nullable3 = null; + nullable4 = nullable3; + } + nullable1 = nullable4; + numeroParcelas = this.Documento.NumeroParcelas; + if (nullable1.HasValue) + { + nullable5 = new decimal?(nullable1.GetValueOrDefault() - numeroParcelas); + } + else + { + nullable2 = null; + nullable5 = nullable2; + } + nullable = nullable5; + if ((num1 > nullable.GetValueOrDefault()) & nullable.HasValue) + { + decimal valor = this.Valor; + Controle controle1 = this.Documento.Controle; + if (controle1 != null) + { + Seguradora seguradora1 = controle1.Seguradora; + if (seguradora1 != null) + { + tolerancia2 = seguradora1.Tolerancia; + } + else + { + nullable1 = null; + tolerancia2 = nullable1; + } + } + else + { + nullable1 = null; + tolerancia2 = nullable1; + } + nullable = tolerancia2; + if ((valor > nullable.GetValueOrDefault()) & nullable.HasValue) + { + keyValuePairs.AddValue("Valor", Messages.ValorParcelaInvalido, true); + } + } + } + else + { + decimal num3 = Math.Abs(this.Valor); + numeroParcelas = Math.Abs(this.Documento.PremioTotal); + Controle controle2 = this.Documento.Controle; + if (controle2 != null) + { + Seguradora seguradora2 = controle2.Seguradora; + if (seguradora2 != null) + { + tolerancia3 = seguradora2.Tolerancia; + } + else + { + nullable2 = null; + tolerancia3 = nullable2; + } + } + else + { + nullable2 = null; + tolerancia3 = nullable2; + } + nullable1 = tolerancia3; + if (nullable1.HasValue) + { + nullable6 = new decimal?(numeroParcelas + nullable1.GetValueOrDefault()); + } + else + { + nullable2 = null; + nullable6 = nullable2; + } + nullable = nullable6; + if ((num3 > nullable.GetValueOrDefault()) & nullable.HasValue) + { + keyValuePairs.AddValue("Valor", Messages.ValorParcelaInvalido, true); + } + } + } + if (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && this.SubTipo == Gestor.Model.Common.SubTipo.ParcelaNormal && this.Documento.Parcelas != null && this.Documento.NumeroParcelas == this.Documento.Parcelas.Count) + { + decimal num4 = Math.Abs(( + from x in this.Documento.Parcelas + where x.SubTipo == Gestor.Model.Common.SubTipo.ParcelaNormal + select x).Sum((Parcela x) => x.Valor)); + decimal num5 = Math.Abs(this.Documento.PremioTotal); + Controle controle3 = this.Documento.Controle; + if (controle3 != null) + { + Seguradora seguradora3 = controle3.Seguradora; + if (seguradora3 != null) + { + tolerancia = seguradora3.Tolerancia; + } + else + { + nullable = null; + tolerancia = nullable; + } + } + else + { + nullable = null; + tolerancia = nullable; + } + nullable = tolerancia; + if (num4 > (num5 + nullable.GetValueOrDefault()) && this.NumeroParcela == this.Documento.NumeroParcelas) + { + keyValuePairs.AddValue("Valor", Messages.ValorParcelaInvalido, true); + } + } + if (!this._permitirVencimentoMaior) + { + emissao = this.Documento.Vigencia2; + if (emissao.HasValue) + { + vencimento = this.Vencimento; + emissao = this.Documento.Vigencia2; + if ((emissao.HasValue ? vencimento > emissao.GetValueOrDefault() : false) && this.Documento.Controle.Ramo.Id != (long)23) + { + keyValuePairs.AddValue("Vencimento", Messages.VencimentoMaior, true); + } + } + } + if (!this._permitirVencimentoMenor) + { + if (this.Documento.Vigencia1 > DateTime.MinValue && this.NumeroParcela == 1) + { + DateTime dateTime = this.Vencimento; + vencimento = this.Documento.Vigencia1; + if (dateTime < vencimento.AddDays(-30)) + { + goto Label6; + } + } + if (this.NumeroParcela == 1 || !(this.Vencimento < this.Documento.Vigencia1)) + { + goto Label7; + } + Label6: + keyValuePairs.AddValue("Vencimento", Messages.VencimentoMenor, true); + } + Label7: + if (this.Documento == null || this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura) + { + return keyValuePairs; + } + if (string.IsNullOrWhiteSpace(this.Fatura)) + { + keyValuePairs.AddValue("Fatura", Messages.Obrigatorio, true); + } + else if (this.Fatura.Length > 50) + { + keyValuePairs.AddValue("Fatura", string.Format(Messages.MaiorQueLimite, 255), true); + } + if (this.ValorLiquidoFatura == decimal.Zero) + { + keyValuePairs.AddValue("ValorLiquidoFatura|VALOR LÍQUIDO DA FATURA", Messages.Obrigatorio, true); + } + emissao = this.VigenciaIncial; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("VigenciaIncial|VIGÊNCIA INICIAL", Messages.Obrigatorio, true); + } + emissao = this.VigenciaFinal; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("VigenciaFinal|VIGÊNCIA FINAL", Messages.Obrigatorio, true); + } + emissao = this.Emissao; + if (!emissao.HasValue) + { + keyValuePairs.AddValue("Emissao|EMISSÃO", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Extrato) && this.Extrato.Length > 50) + { + keyValuePairs.AddValue("Extrato", string.Format(Messages.MaiorQueLimite, 50), true); + } + emissao = this.VigenciaFinal; + if (emissao.HasValue) + { + emissao = this.Documento.Vigencia2; + if (emissao.HasValue) + { + emissao = this.VigenciaFinal; + vigencia2 = this.Documento.Vigencia2; + if ((emissao.HasValue & vigencia2.HasValue ? emissao.GetValueOrDefault() > vigencia2.GetValueOrDefault() : false) && !this._permitirVencimentoMaior) + { + keyValuePairs.AddValue("VigenciaFinal|VIGÊNCIA FINAL", Messages.VencimentoMaior, true); + } + } + } + vigencia2 = this.DataRecebimento; + if (!vigencia2.HasValue && this.ValorComissao != decimal.Zero && this.Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Fatura) + { + keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.Obrigatorio, true); + } + if (this.Documento.TipoRecebimento.GetValueOrDefault() != TipoRecebimento.Fatura && this.Documento.Parcelas != null && this.Documento.Parcelas.Any((Parcela x) => { + if (x.NumeroParcela >= this.NumeroParcela) + { + return false; + } + return !x.DataRecebimento.HasValue; + })) + { + keyValuePairs.AddValue("DataRecebimento|DATA RECEBIMENTO", Messages.BaixaInvalida, true); + } + vigencia2 = this.DataRecebimento; + if (vigencia2.HasValue && this.ValorComissao != decimal.Zero && this.Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Fatura) + { + decimal num6 = (this.ValorExtrato == decimal.Zero ? this.ValorLiquidoFatura : this.ValorExtrato); + if (num6 > decimal.Zero) + { + num = num6.CompareTo(this.ValorComissao); + } + else + { + numeroParcelas = this.ValorComissao; + num = numeroParcelas.CompareTo(num6); + } + if (num < 0) + { + keyValuePairs.AddValue("ValorComissao|RECEBIDO", "VALOR RECEBIDO MAIOR QUE VALOR PARCELA", true); + } + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Parcelas.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Parcelas.cs new file mode 100644 index 0000000..aa31cbb --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Parcelas.cs @@ -0,0 +1,204 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Parcelas : DomainBase + { + public ObservableCollection ParcelasList + { + get; + set; + } + + public Gestor.Model.Common.TipoRecebimento? TipoRecebimento + { + get; + set; + } + + public Parcelas() + { + } + + public List Log(bool restricaoComissao, bool restricaoComissaoPorcentagem) + { + DateTime? vigenciaIncial; + string shortDateString; + string str; + string shortDateString1; + string str1; + string shortDateString2; + string str2; + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("PARCELAS$", "", "") + }; + if (this.ParcelasList != null) + { + foreach (Parcela parcelasList in this.ParcelasList) + { + observableCollection.Add(new Tuple(string.Format(" PARCELA {0}$", parcelasList.NumeroParcela), "", "")); + if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Fatura) + { + observableCollection.Add(new Tuple(" FATURA", (string.IsNullOrWhiteSpace(parcelasList.Fatura) ? "" : parcelasList.Fatura.ToUpper()), "")); + ObservableCollection> observableCollection1 = observableCollection; + vigenciaIncial = parcelasList.VigenciaIncial; + if (!vigenciaIncial.HasValue) + { + str1 = ""; + } + else + { + vigenciaIncial = parcelasList.VigenciaIncial; + if (vigenciaIncial.HasValue) + { + str1 = vigenciaIncial.GetValueOrDefault().ToShortDateString(); + } + else + { + str1 = null; + } + } + observableCollection1.Add(new Tuple(" INÍCIO", str1, "")); + ObservableCollection> observableCollection2 = observableCollection; + vigenciaIncial = parcelasList.VigenciaFinal; + if (!vigenciaIncial.HasValue) + { + shortDateString2 = ""; + } + else + { + vigenciaIncial = parcelasList.VigenciaFinal; + if (vigenciaIncial.HasValue) + { + shortDateString2 = vigenciaIncial.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString2 = null; + } + } + observableCollection2.Add(new Tuple(" FIM", shortDateString2, "")); + ObservableCollection> observableCollection3 = observableCollection; + vigenciaIncial = parcelasList.Emissao; + if (!vigenciaIncial.HasValue) + { + str2 = ""; + } + else + { + vigenciaIncial = parcelasList.Emissao; + if (vigenciaIncial.HasValue) + { + str2 = vigenciaIncial.GetValueOrDefault().ToShortDateString(); + } + else + { + str2 = null; + } + } + observableCollection3.Add(new Tuple(" EMISSÃO", str2, "")); + } + DateTime vencimento = parcelasList.Vencimento; + observableCollection.Add(new Tuple(" VENCIMENTO", vencimento.ToShortDateString(), "")); + ObservableCollection> observableCollection4 = observableCollection; + vigenciaIncial = parcelasList.DataRecebimento; + if (!vigenciaIncial.HasValue) + { + shortDateString = ""; + } + else + { + vigenciaIncial = parcelasList.DataRecebimento; + if (vigenciaIncial.HasValue) + { + shortDateString = vigenciaIncial.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection4.Add(new Tuple(" RECEBIMENTO", shortDateString, "")); + ObservableCollection> observableCollection5 = observableCollection; + vigenciaIncial = parcelasList.DataQuitacao; + if (!vigenciaIncial.HasValue) + { + str = ""; + } + else + { + vigenciaIncial = parcelasList.DataQuitacao; + if (vigenciaIncial.HasValue) + { + str = vigenciaIncial.GetValueOrDefault().ToShortDateString(); + } + else + { + str = null; + } + } + observableCollection5.Add(new Tuple(" QUITAÇÃO", str, "")); + ObservableCollection> observableCollection6 = observableCollection; + vigenciaIncial = parcelasList.DataControle; + if (!vigenciaIncial.HasValue) + { + shortDateString1 = ""; + } + else + { + vigenciaIncial = parcelasList.DataControle; + if (vigenciaIncial.HasValue) + { + shortDateString1 = vigenciaIncial.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString1 = null; + } + } + observableCollection6.Add(new Tuple(" DATA PARCELA CONTROLE", shortDateString1, "")); + decimal valor = parcelasList.Valor; + observableCollection.Add(new Tuple(" VALOR", valor.ToString("C", new CultureInfo("pt-BR", false)), "")); + valor = parcelasList.ValorLiquidoFatura; + observableCollection.Add(new Tuple(" LÍQUIDO", valor.ToString("C", new CultureInfo("pt-BR", false)), "")); + if (!restricaoComissao) + { + valor = parcelasList.ValorRealizado; + observableCollection.Add(new Tuple(" REALIZADO", valor.ToString("C", new CultureInfo("pt-BR", false)), "")); + valor = parcelasList.Comissao / new decimal(100); + observableCollection.Add(new Tuple(" COMISSÃO", valor.ToString("P", new CultureInfo("pt-BR", false)), "")); + valor = parcelasList.ValorComissao; + observableCollection.Add(new Tuple(" RECEBIDO", valor.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + else if (!restricaoComissaoPorcentagem) + { + observableCollection.Add(new Tuple(" REALIZADO", "", "")); + observableCollection.Add(new Tuple(" COMISSÃO", "", "")); + observableCollection.Add(new Tuple(" RECEBIDO", "", "")); + } + else + { + observableCollection.Add(new Tuple(" REALIZADO", "", "")); + valor = parcelasList.Comissao / new decimal(100); + observableCollection.Add(new Tuple(" COMISSÃO", valor.ToString("P", new CultureInfo("pt-BR", false)), "")); + observableCollection.Add(new Tuple(" RECEBIDO", "", "")); + } + } + } + return new List() + { + new TupleList() + { + Tuples = observableCollection + } + }; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Patrimonial.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Patrimonial.cs new file mode 100644 index 0000000..c54f32b --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Patrimonial.cs @@ -0,0 +1,574 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +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 Gestor.Model.Common.TipoMoradia _tipoResidencia; + + public string Bens + { + get + { + string str = this._bens; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._bens = value; + } + } + + public string Contato + { + get + { + string str = this._contato; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._contato = value; + } + } + + public string CpfLocatario1 + { + get + { + string str = this._cpfLocatario1; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cpfLocatario1 = value; + } + } + + public string CpfLocatario2 + { + get + { + string str = this._cpfLocatario2; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cpfLocatario2 = value; + } + } + + public string CpfLocatario3 + { + get + { + string str = this._cpfLocatario3; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cpfLocatario3 = value; + } + } + + public string Imobiliaria + { + get + { + string str = this._imobiliaria; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._imobiliaria = value; + } + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public string Locatario1 + { + get + { + string str = this._locatario; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._locatario = value; + } + } + + public string Locatario2 + { + get + { + string str = this._locatario2; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._locatario2 = value; + } + } + + public string Locatario3 + { + get + { + string str = this._locatario3; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._locatario3 = value; + } + } + + public string Prefixo + { + get + { + string str = this._prefixo; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._prefixo = value; + } + } + + public string PrefixoLocatario1 + { + get; + set; + } + + public string PrefixoLocatario2 + { + get; + set; + } + + public string PrefixoLocatario3 + { + get; + set; + } + + public string Telefone + { + get + { + string str = this._telefone; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone = value; + } + } + + public string TelefoneLocatario1 + { + get; + set; + } + + public string TelefoneLocatario2 + { + get; + set; + } + + public string TelefoneLocatario3 + { + get; + set; + } + + public TipoTelefone? Tipo + { + get; + set; + } + + public Gestor.Model.Common.TipoMoradia TipoMoradia + { + get + { + return this._tipoResidencia; + } + set + { + this._tipoResidencia = value; + } + } + + public Gestor.Model.Common.Utilizacao? Utilizacao + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Patrimonial patrimonial = this; + return new Func>>(patrimonial.Validate); + } + } + + public Patrimonial() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + string description; + string str; + List tupleLists = new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("CEP", (string.IsNullOrWhiteSpace(item.Patrimonial.Cep) ? "" : item.Patrimonial.Cep), ""), + new Tuple("ENDEREÇO", (string.IsNullOrWhiteSpace(item.Patrimonial.Endereco) ? "" : item.Patrimonial.Endereco.ToUpper()), ""), + new Tuple("NÚMERO", (string.IsNullOrWhiteSpace(item.Patrimonial.Numero) ? "" : item.Patrimonial.Numero), ""), + new Tuple("COMPLEMENTO", (string.IsNullOrWhiteSpace(item.Patrimonial.Complemento) ? "" : item.Patrimonial.Complemento.ToUpper()), ""), + new Tuple("BAIRRO", (string.IsNullOrWhiteSpace(item.Patrimonial.Bairro) ? "" : item.Patrimonial.Bairro.ToUpper()), ""), + new Tuple("CIDADE", (string.IsNullOrWhiteSpace(item.Patrimonial.Cidade) ? "" : item.Patrimonial.Cidade.ToUpper()), ""), + new Tuple("ESTADO", (string.IsNullOrWhiteSpace(item.Patrimonial.Estado) ? "" : item.Patrimonial.Estado.ToUpper()), ""), + new Tuple("BENS", (string.IsNullOrWhiteSpace(item.Patrimonial.Bens) ? "" : item.Patrimonial.Bens.ToUpper()), ""), + new Tuple("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(item.Patrimonial.Item.Observacao) ? "" : item.Patrimonial.Item.Observacao.ToUpper()), "") + } + } + }; + if (item.Documento.Controle.Ramo.Id == (long)15) + { + ObservableCollection> tuples = tupleLists[0].Tuples; + Gestor.Model.Common.Utilizacao? utilizacao = item.Patrimonial.Utilizacao; + if (!utilizacao.HasValue) + { + description = ""; + } + else + { + utilizacao = item.Patrimonial.Utilizacao; + if (utilizacao.HasValue) + { + description = utilizacao.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + tuples.Add(new Tuple("UTILIZAÇÃO", description, "")); + tupleLists[0].Tuples.Add(new Tuple("IMOBILIÁRIA", (string.IsNullOrWhiteSpace(item.Patrimonial.Imobiliaria) ? "" : item.Patrimonial.Imobiliaria.ToUpper()), "")); + tupleLists[0].Tuples.Add(new Tuple("CONTATO", (string.IsNullOrWhiteSpace(item.Patrimonial.Contato) ? "" : item.Patrimonial.Contato.ToUpper()), "")); + ObservableCollection> observableCollection = tupleLists[0].Tuples; + TipoTelefone? tipo = item.Patrimonial.Tipo; + if (!tipo.HasValue) + { + str = ""; + } + else + { + tipo = item.Patrimonial.Tipo; + if (tipo.HasValue) + { + str = tipo.GetValueOrDefault().GetDescription(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("TIPO TELEFONE", str, "")); + tupleLists[0].Tuples.Add(new Tuple("PREFIXO", (string.IsNullOrWhiteSpace(item.Patrimonial.Prefixo) ? "" : item.Patrimonial.Prefixo.ToUpper()), "")); + tupleLists[0].Tuples.Add(new Tuple("NÚMERO", (string.IsNullOrWhiteSpace(item.Patrimonial.Telefone) ? "" : item.Patrimonial.Telefone.ToUpper()), "")); + tupleLists[0].Tuples.Add(new Tuple("LOCATÁRIO 1", (string.IsNullOrWhiteSpace(item.Patrimonial.Locatario1) ? "" : item.Patrimonial.Locatario1.ToUpper()), "")); + tupleLists[0].Tuples.Add(new Tuple("PREFIXO LOCATÁRIO 1", (string.IsNullOrWhiteSpace(item.Patrimonial.PrefixoLocatario1) ? "" : item.Patrimonial.PrefixoLocatario1), "")); + tupleLists[0].Tuples.Add(new Tuple("NÚMERO LOCATÁRIO 1", (string.IsNullOrWhiteSpace(item.Patrimonial.TelefoneLocatario1) ? "" : item.Patrimonial.TelefoneLocatario1), "")); + tupleLists[0].Tuples.Add(new Tuple("LOCATÁRIO 2", (string.IsNullOrWhiteSpace(item.Patrimonial.Locatario2) ? "" : item.Patrimonial.Locatario2.ToUpper()), "")); + tupleLists[0].Tuples.Add(new Tuple("PREFIXO LOCATÁRIO 2", (string.IsNullOrWhiteSpace(item.Patrimonial.PrefixoLocatario2) ? "" : item.Patrimonial.PrefixoLocatario2), "")); + tupleLists[0].Tuples.Add(new Tuple("NÚMERO LOCATÁRIO 2", (string.IsNullOrWhiteSpace(item.Patrimonial.TelefoneLocatario2) ? "" : item.Patrimonial.TelefoneLocatario2), "")); + tupleLists[0].Tuples.Add(new Tuple("LOCATÁRIO 3", (string.IsNullOrWhiteSpace(item.Patrimonial.Locatario3) ? "" : item.Patrimonial.Locatario3.ToUpper()), "")); + tupleLists[0].Tuples.Add(new Tuple("PREFIXO LOCATÁRIO 3", (string.IsNullOrWhiteSpace(item.Patrimonial.PrefixoLocatario3) ? "" : item.Patrimonial.PrefixoLocatario3), "")); + tupleLists[0].Tuples.Add(new Tuple("NÚMERO LOCATÁRIO 3", (string.IsNullOrWhiteSpace(item.Patrimonial.TelefoneLocatario3) ? "" : item.Patrimonial.TelefoneLocatario3), "")); + } + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection1.Add(new Tuple(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", "")); + observableCollection1.Add(new Tuple(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), "")); + decimal premio = cobertura.Premio; + observableCollection1.Add(new Tuple(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Franquia; + observableCollection1.Add(new Tuple(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Lmi; + observableCollection1.Add(new Tuple(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!string.IsNullOrWhiteSpace(this.Imobiliaria) && this.Imobiliaria.Length > 60) + { + keyValuePairs.AddValue("Imobiliaria", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!string.IsNullOrWhiteSpace(this.Locatario1) && this.Locatario1.Length > 100) + { + keyValuePairs.AddValue("Locatario1", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrWhiteSpace(this.Locatario2) && this.Locatario2.Length > 100) + { + keyValuePairs.AddValue("Locatario2", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrWhiteSpace(this.Locatario3) && this.Locatario3.Length > 100) + { + keyValuePairs.AddValue("Locatario3", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrWhiteSpace(this.CpfLocatario1) && !this.CpfLocatario1.ValidacaoDocumento()) + { + keyValuePairs.AddValue("CpfLocatario1", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.CpfLocatario2) && !this.CpfLocatario2.ValidacaoDocumento()) + { + keyValuePairs.AddValue("CpfLocatario2", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.CpfLocatario3) && !this.CpfLocatario3.ValidacaoDocumento()) + { + keyValuePairs.AddValue("CpfLocatario3", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Contato) && this.Contato.Length > 60) + { + keyValuePairs.AddValue("Contato", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!string.IsNullOrWhiteSpace(this.Prefixo) && !this.Prefixo.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("Prefixo", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone) && !this.Telefone.ValidacaoTelefone()) + { + keyValuePairs.AddValue("Telefone", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrefixoLocatario1) && !this.PrefixoLocatario1.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("PrefixoLocatario1", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TelefoneLocatario1) && !this.TelefoneLocatario1.ValidacaoTelefone()) + { + keyValuePairs.AddValue("TelefoneLocatario1", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrefixoLocatario2) && !this.PrefixoLocatario2.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("PrefixoLocatario2", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TelefoneLocatario2) && !this.TelefoneLocatario2.ValidacaoTelefone()) + { + keyValuePairs.AddValue("TelefoneLocatario2", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrefixoLocatario3) && !this.PrefixoLocatario3.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("PrefixoLocatario3", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TelefoneLocatario3) && !this.TelefoneLocatario3.ValidacaoTelefone()) + { + keyValuePairs.AddValue("TelefoneLocatario3", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(base.Bairro) && base.Bairro.Length > 60) + { + keyValuePairs.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!string.IsNullOrWhiteSpace(base.Cidade) && base.Cidade.Length > 30) + { + keyValuePairs.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (!string.IsNullOrWhiteSpace(base.Numero) && base.Numero.Length > 10) + { + keyValuePairs.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 10), true); + } + if (string.IsNullOrWhiteSpace(base.Cep)) + { + keyValuePairs.AddValue("Cep", Messages.Obrigatorio, true); + } + else if (!base.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(base.Endereco)) + { + keyValuePairs.AddValue("Endereco", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Numero)) + { + keyValuePairs.AddValue("Numero", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Bairro)) + { + keyValuePairs.AddValue("Bairro", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Cidade)) + { + keyValuePairs.AddValue("Cidade", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(base.Estado)) + { + keyValuePairs.AddValue("Estado", Messages.Obrigatorio, true); + } + else if (!base.Estado.ValidacaoEstado()) + { + keyValuePairs.AddValue("Estado", Messages.Invalido, true); + } + return keyValuePairs; + } + + public List> ValidateGarantia() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!string.IsNullOrWhiteSpace(this.Locatario1) && this.Locatario1.Length > 100) + { + keyValuePairs.AddValue("Locatario1", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrWhiteSpace(this.Locatario2) && this.Locatario2.Length > 100) + { + keyValuePairs.AddValue("Locatario2", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrWhiteSpace(this.Locatario3) && this.Locatario3.Length > 100) + { + keyValuePairs.AddValue("Locatario3", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrWhiteSpace(this.CpfLocatario1) && !this.CpfLocatario1.ValidacaoDocumento()) + { + keyValuePairs.AddValue("CpfLocatario1", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.CpfLocatario2) && !this.CpfLocatario2.ValidacaoDocumento()) + { + keyValuePairs.AddValue("CpfLocatario2", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.CpfLocatario3) && !this.CpfLocatario3.ValidacaoDocumento()) + { + keyValuePairs.AddValue("CpfLocatario3", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrefixoLocatario1) && !this.PrefixoLocatario1.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("PrefixoLocatario1", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TelefoneLocatario1) && !this.TelefoneLocatario1.ValidacaoTelefone()) + { + keyValuePairs.AddValue("TelefoneLocatario1", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrefixoLocatario2) && !this.PrefixoLocatario2.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("PrefixoLocatario2", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TelefoneLocatario2) && !this.TelefoneLocatario2.ValidacaoTelefone()) + { + keyValuePairs.AddValue("TelefoneLocatario2", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.PrefixoLocatario3) && !this.PrefixoLocatario3.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("PrefixoLocatario3", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TelefoneLocatario3) && !this.TelefoneLocatario3.ValidacaoTelefone()) + { + keyValuePairs.AddValue("TelefoneLocatario3", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs new file mode 100644 index 0000000..e9113b8 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs @@ -0,0 +1,275 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Perfil : DomainBase, IDomain + { + private string _nome; + + private string _cepCirculacao; + + private string _cepPernoite; + + public Antifurto? AntiFurto + { + get; + set; + } + + public string CepCirculacao + { + get + { + return this._cepCirculacao; + } + set + { + this._cepCirculacao = value; + } + } + + public string CepPernoite + { + get + { + return this._cepPernoite; + } + set + { + this._cepPernoite = value; + } + } + + public Gestor.Model.Domain.Seguros.Cliente Cliente + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Controle Controle + { + get; + set; + } + + public string Cpf + { + get; + set; + } + + public DistanciaTrabalho? DistanciaResidenciaTrabalho + { + get; + set; + } + + public Gestor.Model.Common.EstadoCivil? EstadoCivil + { + get; + set; + } + + public bool? EstenderCobertura + { + get; + set; + } + + public GaragemTrabalhoEstudo? GaragemEstudo + { + get; + set; + } + + public Gestor.Model.Common.GaragemResidencia? GaragemResidencia + { + get; + set; + } + + public GaragemTrabalhoEstudo? GaragemTrabalho + { + get; + set; + } + + public string Habilitacao + { + get; + set; + } + + public bool? Isencao + { + get; + set; + } + + public string KmMensal + { + get; + set; + } + + public DateTime? Nascimento + { + get; + set; + } + + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public Gestor.Model.Common.Ocupacao? Ocupacao + { + get; + set; + } + + public Gestor.Model.Common.Relacao? Relacao + { + get; + set; + } + + public bool? SeguroVida + { + get; + set; + } + + public Gestor.Model.Common.Sexo? Sexo + { + get; + set; + } + + public Gestor.Model.Common.TempoHabilitacao? TempoHabilitacao + { + get; + set; + } + + public Gestor.Model.Common.TipoResidencia? TipoResidencia + { + get; + set; + } + + public UsoDependetes? UsoDependentes + { + get; + set; + } + + public bool? UsoProfissional + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Perfil perfil = this; + return new Func>>(perfil.Validate); + } + } + + public int? VeiculoResidencia + { + get; + set; + } + + public Perfil() + { + } + + public List> Validate() + { + bool length; + bool flag; + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Nascimento.HasValue && (DateTime.Compare(this.Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Nascimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Nascimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 255) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 255), true); + } + string kmMensal = this.KmMensal; + if (kmMensal != null) + { + length = kmMensal.Length > 5; + } + else + { + length = false; + } + if (length) + { + keyValuePairs.AddValue("KmMensal", string.Format(Messages.MaiorQueLimite, 5), true); + } + string habilitacao = this.Habilitacao; + if (habilitacao != null) + { + flag = habilitacao.Length > 15; + } + else + { + flag = false; + } + if (flag) + { + keyValuePairs.AddValue("Habilitacao", string.Format(Messages.MaiorQueLimite, 15), true); + } + if (!this.Relacao.HasValue) + { + keyValuePairs.AddValue("Relacao", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Cpf) && !this.Cpf.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Cpf", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.CepPernoite) && !this.CepPernoite.FormataCep().ValidacaoCep()) + { + keyValuePairs.AddValue("CepPernoite", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.CepCirculacao) && !this.CepCirculacao.FormataCep().ValidacaoCep()) + { + keyValuePairs.AddValue("CepCirculacao", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/PerfilEmpresa.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/PerfilEmpresa.cs new file mode 100644 index 0000000..e772c5d --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/PerfilEmpresa.cs @@ -0,0 +1,141 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class PerfilEmpresa : DomainBase, IDomain + { + public DateTime? AnoConstrucao + { + get; + set; + } + + public Gestor.Model.Common.AtividadeEmpresa? AtividadeEmpresa + { + get; + set; + } + + public string AtividadePrincipal + { + get; + set; + } + + public bool? CaixasEletronicos + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Cliente Cliente + { + get; + set; + } + + public bool? ConstrucaoReforma + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Controle Controle + { + get; + set; + } + + public bool? DivisaTerrenoBaldio + { + get; + set; + } + + public string EquipamentoIncendio + { + get; + set; + } + + public string EquipamentoSeguranca + { + get; + set; + } + + public bool? ExclusivoDeposito + { + get; + set; + } + + public bool? Isopainel + { + get; + set; + } + + public Gestor.Model.Common.Localizacao? Localizacao + { + get; + set; + } + + public bool? PatrimonioHistorio + { + get; + set; + } + + public bool? PossuiTelhado + { + get; + set; + } + + public Gestor.Model.Common.TipoConstrucao? TipoConstrucao + { + get; + set; + } + + public TipoPavimentacao? TipoPavimento + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + PerfilEmpresa perfilEmpresa = this; + return new Func>>(perfilEmpresa.Validate); + } + } + + public PerfilEmpresa() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + Gestor.Model.Common.AtividadeEmpresa? atividadeEmpresa = this.AtividadeEmpresa; + if (atividadeEmpresa.GetValueOrDefault() == Gestor.Model.Common.AtividadeEmpresa.Outro & atividadeEmpresa.HasValue && (this.AtividadePrincipal == null || this.AtividadePrincipal == "")) + { + keyValuePairs.AddValue("Atividade Empresa", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoArquivoDigital.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoArquivoDigital.cs new file mode 100644 index 0000000..39ab35a --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoArquivoDigital.cs @@ -0,0 +1,69 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Validation; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class PermissaoArquivoDigital : DomainBase + { + [Log(true)] + public bool Consultar + { + get; + set; + } + + [Log(true)] + public bool Excluir + { + get; + set; + } + + [Log(true)] + public bool Incluir + { + get; + set; + } + + [ForceLog(true)] + [Log(true)] + public TipoArquivoDigital Tela + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Usuario Usuario + { + get; + set; + } + + public PermissaoArquivoDigital() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("$TELA", this.Tela.GetDescription(), ""), + new Tuple(" INCLUIR", (this.Incluir ? "SIM" : "NÃO"), ""), + new Tuple(" EXCLUIR", (this.Excluir ? "SIM" : "NÃO"), "") + } + } + }; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoUsuario.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoUsuario.cs new file mode 100644 index 0000000..92ea6f6 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/PermissaoUsuario.cs @@ -0,0 +1,57 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using System; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class PermissaoUsuario : DomainBase + { + [Log(true)] + public bool Alterar + { + get; + set; + } + + [Log(true)] + public bool Consultar + { + get; + set; + } + + [Log(true)] + public bool Excluir + { + get; + set; + } + + [Log(true)] + public bool Incluir + { + get; + set; + } + + [ForceLog(true)] + [Log(true)] + public TipoTela Tela + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Usuario Usuario + { + get; + set; + } + + public PermissaoUsuario() + { + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Produto.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Produto.cs new file mode 100644 index 0000000..85f07c5 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Produto.cs @@ -0,0 +1,120 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Model.Domain.Seguros +{ + public class Produto : DomainBase, IDomain, INotifyPropertyChanged + { + private bool _selecionado; + + private string _nome; + + [Log(true)] + public bool Ativo + { + get; + set; + } + + [Description("PRODUTO")] + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Produto produto = this; + return new Func>>(produto.Validate); + } + } + + public Produto() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "") + } + } + }; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 60) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60), true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs new file mode 100644 index 0000000..059b612 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs @@ -0,0 +1,400 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Prospeccao : DomainBase, IDomain + { + private string _nome; + + private string _item; + + private string _observacao; + + public bool AbrirTarefa + { + get; + set; + } + + public List Anexos + { + get; + set; + } + + public bool CriarTarefa + { + get; + set; + } + + public DateTime? DataCriacao + { + get; + set; + } + + [Description("DOCUMENTO")] + public string Documento + { + get; + set; + } + + [Description("E-MAIL")] + public string Email + { + get; + set; + } + + public bool Excluido + { + get; + set; + } + + public long IdEmpresa + { + get; + set; + } + + [Description("ITEM")] + public string Item + { + get + { + string str = this._item; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._item = value; + } + } + + [Description("NASCIMENTO")] + [Tipo("DATA?")] + public DateTime? Nascimento + { + get; + set; + } + + [Description("CLIENTE")] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + [Description("DDD")] + public string Prefixo1 + { + get; + set; + } + + [Description("DDD")] + public string Prefixo2 + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Produto Produto + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Ramo Ramo + { + get; + set; + } + + public bool Renovacao + { + get; + set; + } + + [Description("STATUS")] + [Tipo("ENUM?")] + public StatusProspeccao? Status + { + get; + set; + } + + [Description("STATUS PERSONALIZADO")] + public StatusDeProspeccao StatusPersonalizado + { + get; + set; + } + + public Gestor.Model.Domain.Ferramentas.Tarefa Tarefa + { + get; + set; + } + + [Description("TELEFONE")] + public string Telefone1 + { + get; + set; + } + + [Description("TELEFONE")] + public string Telefone2 + { + get; + set; + } + + [Description("TIPO")] + public string Tipo + { + get; + set; + } + + public long UsuarioCriacao + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Prospeccao prospeccao = this; + return new Func>>(prospeccao.Validate); + } + } + + [Description("VALOR")] + public decimal Valor + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + [Description("VIGÊNCIA FINAL")] + [Tipo("DATA?")] + public DateTime? VigenciaFinal + { + get; + set; + } + + public Prospeccao() + { + } + + public List Log() + { + string shortDateString; + string nome; + string str; + string nome1; + string description; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("DOCUMENTO", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), "") + }; + DateTime? nascimento = this.Nascimento; + if (!nascimento.HasValue) + { + shortDateString = ""; + } + else + { + nascimento = this.Nascimento; + if (nascimento.HasValue) + { + shortDateString = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection.Add(new Tuple("NASCIMENTO", shortDateString, "")); + observableCollection.Add(new Tuple("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Prefixo1) ? "" : this.Prefixo1), "")); + observableCollection.Add(new Tuple("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone1) ? "" : this.Telefone1), "")); + observableCollection.Add(new Tuple("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.Prefixo2) ? "" : this.Prefixo2), "")); + observableCollection.Add(new Tuple("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone2) ? "" : this.Telefone2), "")); + observableCollection.Add(new Tuple("E-MAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), "")); + observableCollection.Add(new Tuple("ITEM", (string.IsNullOrWhiteSpace(this.Item) ? "" : this.Item), "")); + Gestor.Model.Domain.Seguros.Produto produto = this.Produto; + if (produto != null) + { + nome = produto.Nome; + } + else + { + nome = null; + } + observableCollection.Add(new Tuple("PRODUTO", (string.IsNullOrWhiteSpace(nome) ? "" : this.Produto.Nome), "")); + nascimento = this.VigenciaFinal; + if (!nascimento.HasValue) + { + str = ""; + } + else + { + nascimento = this.VigenciaFinal; + if (nascimento.HasValue) + { + str = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("VENCIMENTO", str, "")); + Gestor.Model.Domain.Seguros.Vendedor vendedor = this.Vendedor; + if (vendedor != null) + { + nome1 = vendedor.Nome; + } + else + { + nome1 = null; + } + observableCollection.Add(new Tuple("VENDEDOR", (string.IsNullOrWhiteSpace(nome1) ? "" : this.Vendedor.Nome), "")); + StatusProspeccao? status = this.Status; + if (!status.HasValue) + { + description = ""; + } + else + { + status = this.Status; + if (status.HasValue) + { + description = status.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection.Add(new Tuple("STATUS", description, "")); + observableCollection.Add(new Tuple("STATUS PERSONALIZADO", (this.StatusPersonalizado == null ? "" : this.StatusPersonalizado.Nome), "")); + observableCollection.Add(new Tuple("OBSERVAÇÃO", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + if (this.Tarefa != null) + { + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("TAREFA$", "", ""), + new Tuple(" RESPONSÁVEL", (string.IsNullOrWhiteSpace(this.Tarefa.Usuario.Nome) ? "" : this.Tarefa.Usuario.Nome), "") + }; + DateTime agendamento = this.Tarefa.Agendamento; + observableCollection1.Add(new Tuple(" DATA DO AGENDAMENTO", agendamento.ToShortDateString(), "")); + agendamento = this.Tarefa.Agendamento; + observableCollection1.Add(new Tuple(" HORA DO AGENDAMENTO", agendamento.ToShortTimeString(), "")); + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + } + return tupleLists1; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Nascimento.HasValue && (DateTime.Compare(this.Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Nascimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Nascimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.VigenciaFinal.HasValue && (DateTime.Compare(this.VigenciaFinal.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.VigenciaFinal.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("VigenciaFinal|VENCIMENTO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Telefone1) && string.IsNullOrWhiteSpace(this.Telefone2) && string.IsNullOrWhiteSpace(this.Email)) + { + keyValuePairs.AddValue("Telefone1|TELEFONE 1", Messages.Obrigatorio, true); + } + if (!this.VigenciaFinal.HasValue) + { + keyValuePairs.AddValue("VigenciaFinal|VENCIMENTO", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Item)) + { + keyValuePairs.AddValue("Item", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ProspeccaoToPrint.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ProspeccaoToPrint.cs new file mode 100644 index 0000000..389234b --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ProspeccaoToPrint.cs @@ -0,0 +1,149 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class ProspeccaoToPrint + { + private string _nome; + + private string _item; + + [Description("DOCUMENTO")] + public string Documento + { + get; + set; + } + + [Description("E-MAIL")] + public string Email + { + get; + set; + } + + [Description("ITEM")] + public string Item + { + get + { + string str = this._item; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._item = value; + } + } + + [Description("NASCIMENTO")] + [Tipo("DATA?")] + public DateTime? Nascimento + { + get; + set; + } + + [Description("CLIENTE")] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + [Description("DDD")] + public string Prefixo1 + { + get; + set; + } + + [Description("DDD")] + public string Prefixo2 + { + get; + set; + } + + [Description("STATUS")] + [Tipo("ENUM?")] + public StatusProspeccao? Status + { + get; + set; + } + + [Description("STATUS PERSONALIZADO")] + public string StatusPersonalizadotoPrint + { + get; + set; + } + + [Description("TELEFONE")] + public string Telefone1 + { + get; + set; + } + + [Description("TELEFONE")] + public string Telefone2 + { + get; + set; + } + + [Description("TIPO")] + public string Tipo + { + get; + set; + } + + [Description("VALOR")] + public decimal Valor + { + get; + set; + } + + [Description("VENDEDOR")] + public string Vendedor + { + get; + set; + } + + [Description("VIGÊNCIA FINAL")] + [Tipo("DATA?")] + public DateTime? VigenciaFinal + { + get; + set; + } + + public ProspeccaoToPrint() + { + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Qualificacao.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Qualificacao.cs new file mode 100644 index 0000000..06e84ed --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Qualificacao.cs @@ -0,0 +1,152 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Qualificacao : DomainBase, IDomain + { + [Description("MÉDIA DE COMISSÃO BRONZE")] + [Log(true)] + public decimal Comissao1 + { + get; + set; + } + + [Description("MÉDIA DE COMISSÃO PRATA")] + [Log(true)] + public decimal Comissao2 + { + get; + set; + } + + [Description("MÉDIA DE COMISSÃO OURO")] + [Log(true)] + public decimal Comissao3 + { + get; + set; + } + + [Description("PRÊMIO LÍQUIDO BROZE")] + [Log(true)] + public decimal Liquido1 + { + get; + set; + } + + [Description("PRÊMIO LÍQUIDO PRATA")] + [Log(true)] + public decimal Liquido2 + { + get; + set; + } + + [Description("PRÊMIO LÍQUIDO OURO")] + [Log(true)] + public decimal Liquido3 + { + get; + set; + } + + [Description("RESULTADO BRONZE")] + [Log(true)] + public decimal Resultado1 + { + get; + set; + } + + [Description("RESULTADO PRATA")] + [Log(true)] + public decimal Resultado2 + { + get; + set; + } + + [Description("RESULTADO OURO")] + [Log(true)] + public decimal Resultado3 + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Qualificacao qualificacao = this; + return new Func>>(qualificacao.Validate); + } + } + + public Qualificacao() + { + } + + public List Log() + { + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("PRÊMIO LÍQUIDO$", "", "") + }; + decimal liquido1 = this.Liquido1; + observableCollection.Add(new Tuple(" BRONZE", liquido1.ToString(new CultureInfo("pt-BR")), "")); + liquido1 = this.Liquido2; + observableCollection.Add(new Tuple(" PRATA", liquido1.ToString(new CultureInfo("pt-BR")), "")); + liquido1 = this.Liquido3; + observableCollection.Add(new Tuple(" OURO", liquido1.ToString(new CultureInfo("pt-BR")), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + TupleList tupleList1 = new TupleList(); + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("MÉDIA DE COMISSÃO$", "", "") + }; + liquido1 = this.Comissao1; + observableCollection1.Add(new Tuple(" BRONZE", liquido1.ToString(new CultureInfo("pt-BR")), "")); + liquido1 = this.Comissao2; + observableCollection1.Add(new Tuple(" PRATA", liquido1.ToString(new CultureInfo("pt-BR")), "")); + liquido1 = this.Comissao3; + observableCollection1.Add(new Tuple(" OURO", liquido1.ToString(new CultureInfo("pt-BR")), "")); + tupleList1.Tuples = observableCollection1; + tupleLists.Add(tupleList1); + TupleList tupleList2 = new TupleList(); + ObservableCollection> observableCollection2 = new ObservableCollection>() + { + new Tuple("RESULTADO$", "", "") + }; + liquido1 = this.Resultado1; + observableCollection2.Add(new Tuple(" BRONZE", liquido1.ToString(new CultureInfo("pt-BR")), "")); + liquido1 = this.Resultado2; + observableCollection2.Add(new Tuple(" PRATA", liquido1.ToString(new CultureInfo("pt-BR")), "")); + liquido1 = this.Resultado3; + observableCollection2.Add(new Tuple(" OURO", liquido1.ToString(new CultureInfo("pt-BR")), "")); + tupleList2.Tuples = observableCollection2; + tupleLists.Add(tupleList2); + return tupleLists; + } + + public List> Validate() + { + return ValidationHelper.AddValue(); + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Ramo.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Ramo.cs new file mode 100644 index 0000000..32f3099 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Ramo.cs @@ -0,0 +1,165 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Model.Domain.Seguros +{ + public class Ramo : DomainBase, IDomain, INotifyPropertyChanged + { + private bool _selecionado; + + private string _nome; + + private string _ramoSusep; + + [Log(true)] + public bool Ativo + { + get; + set; + } + + public long CodigoSusep + { + get; + set; + } + + public bool Fatura + { + get; + set; + } + + [Log(true)] + public decimal Iof + { + get; + set; + } + + [Description("RAMO")] + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public string RamoSusep + { + get + { + string str = this._ramoSusep; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._ramoSusep = value; + } + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Ramo ramo = this; + return new Func>>(ramo.Validate); + } + } + + public Ramo() + { + } + + public List Log(List listCoberturas) + { + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), "") + }; + decimal iof = this.Iof / new decimal(100); + observableCollection.Add(new Tuple("I.O.F.", iof.ToString("P", new CultureInfo("pt-BR", false)), "")); + observableCollection.Add(new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (CoberturaPadrao listCobertura in listCoberturas) + { + observableCollection1.Add(new Tuple(string.Format(" COBERTURA {0}$", listCoberturas.IndexOf(listCobertura) + 1), "", "")); + observableCollection1.Add(new Tuple(" DESCRIÇÃO", (string.IsNullOrWhiteSpace(listCobertura.Descricao) ? "" : listCobertura.Descricao.ToUpper()), "")); + observableCollection1.Add(new Tuple(" PADRÃO", (listCobertura.Padrao ? "SIM" : "NÃO"), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists1; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + return ValidationHelper.AddValue(); + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs new file mode 100644 index 0000000..691586a --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs @@ -0,0 +1,187 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Repasse : DomainBase, IDomain + { + private string _incidenciaVendedor = ""; + + private string _pgtoVendedor = ""; + + public bool Ativo + { + get; + set; + } + + public BaseRepasse? Base + { + get; + set; + } + + public FormaRepasse? Forma + { + get; + set; + } + + public TipoIncidencia? Incidencia + { + get; + set; + } + + public string IncidenciaVendedor + { + get + { + string description = this.Incidencia.GetDescription(); + string str = description; + this._incidenciaVendedor = description; + return str; + } + } + + public string PagtoVendedor + { + get + { + string description = this.Forma.GetDescription(); + string str = description; + this._pgtoVendedor = description; + return str; + } + } + + public Gestor.Model.Domain.Seguros.Ramo Ramo + { + get; + set; + } + + public long? Seguradora + { + get; + set; + } + + public TipoRepasse? Tipo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Repasse repasse = this; + return new Func>>(repasse.Validate); + } + } + + public decimal ValorNovo + { + get; + set; + } + + public decimal ValorRenovacao + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public List Vinculo + { + get; + set; + } + + public Repasse() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("TIPO", this.Tipo.GetDescription(), ""), + new Tuple("VALOR NOVO", string.Format("{0:##.00}", this.ValorNovo), ""), + new Tuple("VALOR RENOVAÇÃO", string.Format("{0:##.00}", this.ValorRenovacao), ""), + new Tuple("INCIDÊNCIA", this.Incidencia.GetDescription(), ""), + new Tuple("FORMA PAGAMENTO", this.Forma.GetDescription(), ""), + new Tuple("BASE PAGAMENTO", this.Base.GetDescription(), ""), + new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "") + } + } + }; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Vendedor == null) + { + keyValuePairs.AddValue("Vendedor", Messages.Obrigatorio, true); + } + if (TipoRepasse.CoCorretagem != this.Tipo.GetValueOrDefault() && this.ValorNovo == decimal.Zero) + { + keyValuePairs.AddValue("ValorNovo", Messages.Obrigatorio, true); + } + if (TipoRepasse.CoCorretagem != this.Tipo.GetValueOrDefault() && this.ValorRenovacao == decimal.Zero) + { + keyValuePairs.AddValue("ValorRenovacao", Messages.Obrigatorio, true); + } + if (!this.Tipo.HasValue) + { + keyValuePairs.AddValue("Tipo", Messages.Obrigatorio, true); + } + if (!this.Incidencia.HasValue && this.Forma.HasValue && this.Forma.GetValueOrDefault() == FormaRepasse.Recebimento) + { + keyValuePairs.AddValue("Incidencia", Messages.Obrigatorio, true); + } + if (!this.Forma.HasValue) + { + keyValuePairs.AddValue("Forma", Messages.Obrigatorio, true); + } + if (this.Forma.HasValue && this.Forma.GetValueOrDefault() != FormaRepasse.Recebimento) + { + if (!this.Base.HasValue) + { + keyValuePairs.AddValue("Base", Messages.Obrigatorio, true); + } + if (this.Forma.GetValueOrDefault() == FormaRepasse.Prazo && this.Base.GetValueOrDefault() != BaseRepasse.Vencimento) + { + keyValuePairs.AddValue("Base", Messages.Invalido, true); + } + } + if (this.Forma.HasValue && this.Forma.GetValueOrDefault() == FormaRepasse.Recebimento && this.Base.HasValue) + { + keyValuePairs.AddValue("Base", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs new file mode 100644 index 0000000..6896680 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs @@ -0,0 +1,109 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class ResponsavelAssinatura : DomainBase, IDomain + { + public string DocumentoResponsavel + { + get; + set; + } + + public string EmailResponsavel + { + get; + set; + } + + public long IdCliente + { + get; + set; + } + + public string NomeResponsavel + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + ResponsavelAssinatura responsavelAssinatura = this; + return new Func>>(responsavelAssinatura.Validate); + } + } + + public ResponsavelAssinatura() + { + } + + public List> Validate() + { + int? nullable; + int? nullable1; + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.NomeResponsavel)) + { + nullable = null; + nullable1 = nullable; + } + else + { + string nomeResponsavel = this.NomeResponsavel; + if (nomeResponsavel != null) + { + nullable1 = new int?((int)nomeResponsavel.Trim().Split(new char[] { ' ' }).Length); + } + else + { + nullable = null; + nullable1 = nullable; + } + } + int? nullable2 = nullable1; + if (nullable2.HasValue) + { + nullable = nullable2; + if (nullable.GetValueOrDefault() <= 1 & nullable.HasValue) + { + keyValuePairs.AddValue("NomeResponsavel", Messages.NomeInvalido, true); + } + } + if (!string.IsNullOrWhiteSpace(this.DocumentoResponsavel) && !this.DocumentoResponsavel.ValidacaoDocumento()) + { + keyValuePairs.AddValue("DocumentoResponsavel", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.EmailResponsavel) && !this.EmailResponsavel.ValidacaoEmail()) + { + keyValuePairs.AddValue("EmailResponsavel", Messages.Invalido, true); + } + if (nullable2.HasValue || !string.IsNullOrWhiteSpace(this.DocumentoResponsavel) || !string.IsNullOrWhiteSpace(this.EmailResponsavel)) + { + if (!nullable2.HasValue) + { + keyValuePairs.AddValue("NomeResponsavel", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.DocumentoResponsavel)) + { + keyValuePairs.AddValue("DocumentoResponsavel", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.EmailResponsavel)) + { + keyValuePairs.AddValue("EmailResponsavel", Messages.Obrigatorio, true); + } + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuario.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuario.cs new file mode 100644 index 0000000..0912cb2 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuario.cs @@ -0,0 +1,60 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Validation; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class RestricaoUsuario : DomainBase + { + public string Ajuda + { + get; + set; + } + + [Log(true)] + public bool Restricao + { + get; + set; + } + + [ForceLog(true)] + [Log(true)] + public TipoRestricao Tipo + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Usuario Usuario + { + get; + set; + } + + public RestricaoUsuario() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("$TIPO DE RESTRIÇÃO", this.Tipo.GetDescription(), ""), + new Tuple(" RESTRIÇÃO ATIVA?", (this.Restricao ? "SIM" : "NÃO"), "") + } + } + }; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs new file mode 100644 index 0000000..450780e --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/RestricaoUsuarioCamposRelatorios.cs @@ -0,0 +1,61 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class RestricaoUsuarioCamposRelatorios : DomainBase + { + [ForceLog(true)] + [Log(true)] + public string Campo + { + get; + set; + } + + [ForceLog(true)] + [Log(true)] + public Gestor.Model.Common.Relatorio Relatorio + { + get; + set; + } + + [Log(true)] + public bool Restricao + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Usuario Usuario + { + get; + set; + } + + public RestricaoUsuarioCamposRelatorios() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("$TIPO DE RESTRIÇÃO", this.Campo, ""), + new Tuple(" RESTRIÇÃO ATIVA?", (this.Restricao ? "SIM" : "NÃO"), "") + } + } + }; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs new file mode 100644 index 0000000..1f8772f --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs @@ -0,0 +1,130 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class RiscosDiversos : DomainBase, IDomain + { + private string _observacao; + + public string Area + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public decimal? SubsidioEstadual + { + get; + set; + } + + public decimal? SubsidioFederal + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + RiscosDiversos riscosDiverso = this; + return new Func>>(riscosDiverso.Validate); + } + } + + public RiscosDiversos() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + List tupleLists = new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("DESCRIÇÃO", (string.IsNullOrWhiteSpace(item.Descricao) ? "" : item.Descricao), ""), + new Tuple("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(item.RiscosDiversos.Observacao) ? "" : item.RiscosDiversos.Observacao.ToUpper()), "") + } + } + }; + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection.Add(new Tuple(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", "")); + observableCollection.Add(new Tuple(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), "")); + decimal premio = cobertura.Premio; + observableCollection.Add(new Tuple(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Franquia; + observableCollection.Add(new Tuple(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Lmi; + observableCollection.Add(new Tuple(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists.Add(new TupleList() + { + Tuples = observableCollection + }); + return tupleLists; + } + + public List> Validate() + { + bool id; + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Observacao)) + { + Gestor.Model.Domain.Seguros.Item item = this.Item; + if (item != null) + { + id = item.Documento.Controle.Ramo.Id != (long)23; + } + else + { + id = true; + } + if (id) + { + keyValuePairs.AddValue("Observacao", Messages.Obrigatorio, true); + } + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Seguradora.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Seguradora.cs new file mode 100644 index 0000000..d036a66 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Seguradora.cs @@ -0,0 +1,1804 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +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; + + [Log(true)] + public string Assistencia + { + get + { + string str = this._assistencia; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._assistencia = value; + } + } + + [Log(true)] + public bool Ativo + { + get; + set; + } + + public string Codigo + { + get + { + string str = this._codigo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._codigo = value; + } + } + + public string CodigoSeguradora + { + get + { + string str = this._codigoSeguradora; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._codigoSeguradora = value; + } + } + + public string CodigoSusep + { + get + { + string str = this._codigoSusep; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._codigoSusep = value; + } + } + + public List Contatos + { + get; + set; + } + + public string CustomId + { + get; + set; + } + + [Log(true)] + public string Documento + { + get + { + string str = this._documento; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._documento = value; + } + } + + public List Enderecos + { + get; + set; + } + + public long? IdAggilizador + { + get; + set; + } + + [Description("LINK APP ANDROID")] + [Log(true)] + public string LinkAppAndroid + { + get; + set; + } + + [Description("LINK APP IOS")] + [Log(true)] + public string LinkAppIos + { + get; + set; + } + + [Description("SEGURADORA")] + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public string NomeSocial + { + get + { + string str = this._nomeSocial; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + string str; + string nome; + this._nomeSocial = value; + if (!string.IsNullOrWhiteSpace(value)) + { + this.NomeSocialBanco = (this.NomeSocialBanco == " " ? "" : value); + return; + } + long id = base.Id; + if (id <= (long)694) + { + if (id <= (long)678) + { + long num = id - (long)1; + if (num <= (long)606) + { + switch ((uint)num) + { + case 0: + { + this.NomeSocial = "ABSOLUTA"; + return; + } + case 1: + case 2: + case 3: + case 4: + { + this.NomeSocial = "ACE"; + return; + } + case 5: + case 6: + case 7: + case 19: + case 20: + case 21: + case 22: + case 23: + case 28: + case 29: + case 30: + case 31: + case 35: + case 36: + case 37: + case 38: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 49: + case 50: + case 51: + case 57: + case 58: + case 61: + case 62: + case 66: + case 67: + case 68: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 97: + case 101: + case 102: + case 103: + case 104: + case 109: + case 110: + case 113: + case 114: + case 118: + case 121: + case 122: + case 123: + case 124: + case 127: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 146: + case 147: + case 148: + case 149: + case 150: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 162: + case 163: + case 164: + case 165: + case 166: + case 167: + case 168: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 179: + case 182: + case 183: + case 186: + case 187: + case 189: + case 190: + case 191: + case 192: + case 193: + case 194: + case 195: + case 198: + case 199: + case 202: + case 203: + case 204: + case 207: + case 208: + case 209: + case 210: + case 211: + case 214: + case 219: + case 220: + case 223: + case 224: + case 227: + case 228: + case 229: + case 233: + case 234: + case 237: + case 238: + case 239: + case 240: + case 244: + case 245: + case 246: + case 247: + case 250: + case 252: + case 253: + case 256: + case 261: + case 262: + case 263: + case 270: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 286: + case 287: + case 288: + case 300: + case 301: + case 302: + case 303: + case 304: + case 305: + case 306: + case 312: + case 313: + case 314: + case 315: + case 316: + case 329: + case 331: + case 332: + case 333: + case 334: + case 335: + case 338: + case 339: + case 341: + case 342: + case 343: + case 344: + case 350: + case 357: + case 358: + case 359: + case 360: + case 361: + case 362: + case 363: + case 366: + case 367: + case 368: + case 369: + case 370: + case 371: + case 373: + case 376: + case 377: + case 381: + case 382: + case 383: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + case 396: + case 397: + case 402: + case 403: + case 404: + case 405: + case 406: + case 407: + case 408: + case 409: + case 410: + case 413: + case 414: + case 415: + case 419: + case 420: + case 421: + case 422: + case 425: + case 433: + case 434: + case 442: + case 443: + case 444: + case 451: + case 452: + case 453: + case 454: + case 457: + case 460: + case 461: + case 462: + case 463: + case 464: + case 467: + case 468: + case 469: + case 470: + case 472: + case 473: + case 488: + case 495: + case 496: + case 502: + case 504: + case 505: + case 506: + case 510: + case 511: + case 512: + case 519: + case 524: + case 525: + case 526: + case 529: + case 530: + case 531: + case 532: + case 533: + case 534: + case 535: + case 536: + case 552: + case 555: + case 562: + case 563: + case 564: + case 565: + case 566: + case 567: + case 568: + case 575: + case 576: + case 577: + case 578: + case 580: + case 585: + case 586: + case 587: + case 588: + case 589: + case 592: + case 596: + case 598: + case 599: + case 600: + case 601: + { + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + return; + } + case 8: + case 9: + case 517: + case 518: + { + this.NomeSocial = "AIG"; + return; + } + case 10: + { + this.NomeSocial = "AJAX"; + return; + } + case 11: + case 12: + case 13: + { + this.NomeSocial = "ALFA"; + return; + } + case 14: + case 15: + case 16: + case 176: + case 177: + { + this.NomeSocial = "ALIANÇA"; + return; + } + case 17: + case 18: + { + this.NomeSocial = "ALLIANZ"; + return; + } + case 24: + case 25: + case 26: + case 180: + { + this.NomeSocial = "ALLSEG"; + return; + } + case 27: + case 590: + case 591: + case 593: + { + this.NomeSocial = "AMIL"; + return; + } + case 32: + case 33: + case 34: + { + this.NomeSocial = "APLUB"; + return; + } + case 39: + case 40: + { + this.NomeSocial = "ARCH"; + return; + } + case 41: + { + this.NomeSocial = "ARGO"; + return; + } + case 48: + case 243: + { + this.NomeSocial = "GENERALI"; + return; + } + case 52: + case 53: + case 54: + case 55: + case 56: + { + this.NomeSocial = "ATLANTICA"; + return; + } + case 59: + case 60: + { + this.NomeSocial = "AUSTRAL"; + return; + } + case 63: + case 64: + case 65: + case 602: + { + this.NomeSocial = "AXA"; + return; + } + case 69: + { + this.NomeSocial = "AZUL"; + return; + } + case 88: + case 89: + case 90: + case 91: + case 92: + case 583: + { + this.NomeSocial = "BRADESCO"; + return; + } + case 93: + { + this.NomeSocial = "BRASIL LIBANO"; + return; + } + case 94: + { + this.NomeSocial = "BRASILCAP"; + return; + } + case 95: + case 96: + { + this.NomeSocial = "BRASILPREV"; + return; + } + case 98: + case 100: + { + this.NomeSocial = "BRASILUSITANA"; + return; + } + case 99: + { + this.NomeSocial = "BRASIL VEÍCULOS"; + return; + } + case 105: + case 106: + case 107: + case 108: + case 372: + { + this.NomeSocial = "CAIXA"; + return; + } + case 111: + case 112: + { + this.NomeSocial = "CAPEMISA"; + return; + } + case 115: + case 116: + case 117: + { + this.NomeSocial = "CARDIF"; + return; + } + case 119: + case 120: + { + this.NomeSocial = "CASTELLO"; + return; + } + case 125: + case 126: + { + this.NomeSocial = "CESCEBRASIL"; + return; + } + case 128: + case 129: + { + this.NomeSocial = "CHARTIS"; + return; + } + case 130: + { + this.NomeSocial = "CHUBB"; + return; + } + case 144: + case 184: + case 185: + { + this.NomeSocial = "INTERNACIONAL"; + return; + } + case 145: + case 289: + case 292: + case 293: + case 294: + { + this.NomeSocial = "ITAÉ"; + return; + } + case 151: + case 152: + case 188: + case 416: + case 417: + case 418: + { + this.NomeSocial = "REAL"; + return; + } + case 160: + case 161: + { + this.NomeSocial = "URBANIA"; + return; + } + case 178: + case 251: + { + this.NomeSocial = "GRALHA AZUL"; + return; + } + case 181: + { + this.NomeSocial = "EXCELSIOR"; + return; + } + case 196: + case 197: + { + this.NomeSocial = "CREDITO Y CAUCIAN"; + return; + } + case 200: + case 201: + { + this.NomeSocial = "CRUZEIRO DO SUL"; + return; + } + case 205: + case 206: + { + this.NomeSocial = "ECC"; + return; + } + case 212: + case 213: + { + this.NomeSocial = "EQUITATIVA"; + return; + } + case 215: + { + this.NomeSocial = "ESSOR"; + return; + } + case 216: + case 217: + case 218: + { + this.NomeSocial = "EULER HERMES"; + return; + } + case 221: + case 222: + { + this.NomeSocial = "EVEREST"; + return; + } + case 225: + case 226: + { + this.NomeSocial = "FACTORY"; + return; + } + case 230: + case 231: + case 232: + { + this.NomeSocial = "FEDERAL"; + return; + } + case 235: + case 236: + { + this.NomeSocial = "FINANCIAL"; + return; + } + case 241: + case 242: + { + this.NomeSocial = "GENERAL"; + return; + } + case 248: + case 249: + { + this.NomeSocial = "GNPP"; + return; + } + case 254: + case 255: + { + this.NomeSocial = "HANNOVER"; + return; + } + case 257: + case 258: + case 259: + case 260: + case 569: + case 597: + { + this.NomeSocial = "HDI"; + return; + } + case 264: + case 265: + case 266: + case 267: + case 268: + case 269: + { + this.NomeSocial = "HSBC"; + return; + } + case 271: + case 272: + { + this.NomeSocial = "ICATU"; + return; + } + case 273: + case 274: + { + this.NomeSocial = "IF P&C INSURANCE"; + return; + } + case 275: + { + this.NomeSocial = "INDIANA"; + return; + } + case 283: + case 284: + case 285: + case 603: + { + this.NomeSocial = "KOVR"; + return; + } + case 290: + case 291: + case 295: + case 296: + { + this.NomeSocial = "ITAÚ"; + return; + } + case 297: + case 298: + case 299: + { + this.NomeSocial = "J. MALUCELLI"; + return; + } + case 307: + case 308: + case 309: + { + this.NomeSocial = "YELUM"; + return; + } + case 310: + case 311: + { + this.NomeSocial = "LIDERANÇA"; + return; + } + case 317: + case 318: + case 319: + case 320: + case 321: + case 322: + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + { + this.NomeSocial = "MAPFRE"; + return; + } + case 330: + case 542: + case 561: + { + this.NomeSocial = "YASUDA MARITIMA"; + return; + } + case 336: + case 337: + { + this.NomeSocial = "MBM"; + return; + } + case 340: + { + this.NomeSocial = "METLIFE"; + return; + } + case 345: + case 346: + case 347: + { + this.NomeSocial = "MITSUI"; + return; + } + case 348: + case 349: + { + this.NomeSocial = "MONGERAL"; + return; + } + case 351: + case 352: + case 353: + case 354: + case 355: + case 356: + { + this.NomeSocial = "MONTEPIO"; + return; + } + case 364: + case 365: + case 380: + { + this.NomeSocial = "NATIONAL"; + return; + } + case 374: + case 375: + { + this.NomeSocial = "NOVA YORK"; + return; + } + case 378: + case 379: + { + this.NomeSocial = "ODYSSEY"; + return; + } + case 384: + case 385: + { + this.NomeSocial = "PARANÁ"; + return; + } + case 386: + case 387: + { + this.NomeSocial = "PARIS"; + return; + } + case 394: + case 395: + { + this.NomeSocial = "PLANALTO"; + return; + } + case 398: + case 399: + case 400: + case 401: + case 553: + case 554: + case 573: + { + this.NomeSocial = "PORTO SEGURO"; + return; + } + case 411: + case 412: + { + this.NomeSocial = "PRUDENTIAL"; + return; + } + case 423: + case 424: + { + this.NomeSocial = "ROYAL & SUN ALLIANCE"; + return; + } + case 426: + case 427: + case 428: + { + this.NomeSocial = "SABEMI"; + return; + } + case 429: + case 430: + case 431: + case 432: + { + this.NomeSocial = "SAFRA"; + return; + } + case 435: + case 436: + case 437: + { + this.NomeSocial = "SANTANDER"; + return; + } + case 438: + case 439: + { + this.NomeSocial = "SANTOS"; + return; + } + case 440: + case 441: + { + this.NomeSocial = "SANTOS"; + return; + } + case 445: + case 446: + case 447: + case 448: + { + this.NomeSocial = "SCOR"; + return; + } + case 449: + case 450: + { + this.NomeSocial = "SDB"; + return; + } + case 455: + case 456: + { + this.NomeSocial = "MINEIRA"; + return; + } + case 458: + case 459: + { + this.NomeSocial = "PONTUAL"; + return; + } + case 465: + case 466: + { + this.NomeSocial = "SIRIUS"; + return; + } + case 471: + case 594: + { + this.NomeSocial = "SOMPO"; + return; + } + case 474: + case 475: + case 476: + case 477: + case 478: + case 479: + case 480: + case 481: + case 482: + case 483: + case 484: + case 485: + case 486: + case 487: + case 557: + case 579: + { + this.NomeSocial = "SULAMERICA"; + return; + } + case 489: + case 490: + case 491: + case 492: + case 493: + case 494: + { + this.NomeSocial = "SWISS"; + return; + } + case 497: + case 498: + case 499: + case 500: + case 501: + { + this.NomeSocial = "TOKIO"; + return; + } + case 503: + { + this.NomeSocial = "TOTAL"; + return; + } + case 507: + case 508: + case 509: + { + this.NomeSocial = "TREVO"; + return; + } + case 513: + case 514: + case 515: + case 516: + { + this.NomeSocial = "UNIÃO"; + return; + } + case 520: + case 521: + case 584: + case 595: + { + this.NomeSocial = "UNIMED"; + return; + } + case 522: + case 523: + { + this.NomeSocial = "UNIVERSAL"; + return; + } + case 527: + case 528: + { + this.NomeSocial = "VALOR CAPITALIZAÇÃO"; + return; + } + case 537: + case 538: + case 539: + case 540: + case 541: + { + this.NomeSocial = "XL"; + return; + } + case 543: + case 544: + case 545: + case 546: + case 547: + case 548: + case 549: + case 550: + case 551: + { + this.NomeSocial = "ZURICH"; + return; + } + case 556: + { + this.NomeSocial = "SUHAI"; + return; + } + case 558: + { + this.NomeSocial = "SANCOR"; + return; + } + case 559: + { + this.NomeSocial = "AGROBRASIL"; + return; + } + case 560: + case 570: + { + this.NomeSocial = "SURA"; + return; + } + case 571: + case 572: + case 574: + case 605: + case 606: + { + this.NomeSocial = "SÃO FRANCISCO"; + return; + } + case 581: + { + this.NomeSocial = "SANTA CASA"; + return; + } + case 582: + { + this.NomeSocial = "AMEX"; + return; + } + case 604: + { + this.NomeSocial = "BANCO DO BRASIL"; + return; + } + } + } + else + { + } + long num1 = id - (long)621; + if (num1 <= (long)57) + { + switch ((uint)num1) + { + case 0: + case 3: + case 24: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 41: + case 42: + { + this.NomeSocial = "UNIMED"; + return; + } + case 1: + case 2: + case 4: + case 5: + case 6: + case 7: + case 8: + case 12: + case 13: + case 16: + case 17: + case 19: + case 23: + case 25: + case 26: + case 27: + case 30: + case 31: + case 38: + case 39: + case 40: + case 44: + case 47: + case 48: + case 49: + case 50: + case 51: + case 54: + { + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + return; + } + case 9: + case 18: + { + this.NomeSocial = "ALIRO"; + return; + } + case 10: + { + break; + } + case 11: + { + this.NomeSocial = "VR"; + return; + } + case 14: + { + this.NomeSocial = "ALLIANZ"; + return; + } + case 15: + { + this.NomeSocial = "HS"; + return; + } + case 20: + case 22: + case 53: + { + this.NomeSocial = "PORTO SEGURO"; + return; + } + case 21: + { + this.NomeSocial = "SURA"; + return; + } + case 28: + { + this.NomeSocial = "AMIL"; + return; + } + case 29: + { + this.NomeSocial = "YELUM"; + return; + } + case 43: + { + this.NomeSocial = "SULAMERICA"; + return; + } + case 45: + { + this.NomeSocial = "AFFINITY"; + return; + } + case 46: + { + this.NomeSocial = "BR"; + return; + } + case 52: + { + this.NomeSocial = "YAMAHA"; + return; + } + case 55: + { + this.NomeSocial = "SÃO FRANCISCO"; + return; + } + case 56: + { + this.NomeSocial = "EMBRACON"; + return; + } + case 57: + { + this.NomeSocial = "MAPFRE"; + return; + } + default: + { + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + return; + } + } + } + else + { + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + return; + } + this.NomeSocial = "METLIFE"; + return; + } + else if (id != (long)683) + { + long num2 = id - (long)687; + if (num2 <= (long)3) + { + switch ((uint)num2) + { + case 0: + { + this.NomeSocial = "ITAÚ"; + return; + } + case 1: + { + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + return; + } + case 2: + { + this.NomeSocial = "SÃO LUCAS"; + return; + } + case 3: + { + this.NomeSocial = "UNIMED"; + return; + } + } + } + else + { + } + if (id == (long)694) + { + this.NomeSocial = "PORTO SEGURO"; + return; + } + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + return; + } + else + { + this.NomeSocial = "UNIMED"; + return; + } + this.NomeSocial = "PORTO SEGURO"; + return; + } + else if (id > (long)716) + { + if (id == (long)717) + { + this.NomeSocial = "CHUBB"; + return; + } + if (id == (long)734) + { + this.NomeSocial = "RC"; + return; + } + if (id == (long)741) + { + this.NomeSocial = "SOMPO"; + return; + } + } + else + { + long num3 = id - (long)703; + if (num3 <= (long)8) + { + switch ((uint)num3) + { + case 0: + case 6: + { + this.NomeSocial = "UNIMED"; + return; + } + case 1: + case 4: + case 8: + { + this.NomeSocial = "MAPFRE"; + return; + } + case 2: + case 3: + case 5: + case 7: + { + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + return; + } + } + } + else + { + } + if (id == (long)716) + { + this.NomeSocial = "UNIMED"; + return; + } + } + str = (base.Id == 0 ? " " : this.NomeSocial); + this.NomeSocialBanco = str; + nome = this.Nome ?? ""; + this.NomeSocial = nome; + } + } + + [Description("APELIDO")] + [Log(true)] + public string NomeSocialBanco + { + get + { + string str = this._nomeSocialBanco; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nomeSocialBanco = value; + } + } + + [Log(true)] + public string Observacao + { + get + { + return this._observacao; + } + set + { + this._observacao = value; + } + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + public string Senha + { + get; + set; + } + + [Log(true)] + public string Susep + { + get + { + string str = this._susep; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._susep = value; + } + } + + [Log(true)] + public decimal? Tolerancia + { + get; + set; + } + + [Log(true)] + public decimal? ToleranciaPremio + { + get; + set; + } + + public string Usuario + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Seguradora seguradora = this; + return new Func>>(seguradora.Validate); + } + } + + public Seguradora() + { + } + + public List Log() + { + string str; + string str1; + string description; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("SEGURADORA", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("CNPJ", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""), + new Tuple("ASSISTÊNCIA 24 HORAS", (string.IsNullOrWhiteSpace(this.Assistencia) ? "" : this.Assistencia), ""), + new Tuple("SUSEP", (string.IsNullOrWhiteSpace(this.Susep) ? "" : this.Susep), ""), + new Tuple("CÓDIGO COMPANHIA", (string.IsNullOrWhiteSpace(this.Codigo) ? "" : this.Codigo), "") + }; + decimal? tolerancia = this.Tolerancia; + if (!tolerancia.HasValue) + { + str = ""; + } + else + { + tolerancia = this.Tolerancia; + if (tolerancia.HasValue) + { + str = tolerancia.GetValueOrDefault().ToString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("TOLERÂNCIA DE COMISSÃO", str, "")); + tolerancia = this.ToleranciaPremio; + if (!tolerancia.HasValue) + { + str1 = ""; + } + else + { + tolerancia = this.ToleranciaPremio; + if (tolerancia.HasValue) + { + str1 = tolerancia.GetValueOrDefault().ToString(); + } + else + { + str1 = null; + } + } + observableCollection.Add(new Tuple("TOLERÂNCIA DE PRÊMIO", str1, "")); + observableCollection.Add(new Tuple("SEGURADORA ATIVA", (this.Ativo ? "SIM" : "NÃO"), "")); + observableCollection.Add(new Tuple("OBSERVAÇÃO", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + if (this.Contatos != null) + { + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("CONTATOS$", "", "") + }; + foreach (SeguradoraContato contato in this.Contatos) + { + observableCollection1.Add(new Tuple(string.Format(" CONTATO {0}$", this.Contatos.IndexOf(contato) + 1), "", "")); + observableCollection1.Add(new Tuple(" NOME", (string.IsNullOrWhiteSpace(contato.NomeContato) ? "" : contato.NomeContato.ToUpper()), "")); + ObservableCollection> observableCollection2 = observableCollection1; + TipoTelefone? tipo = contato.Tipo; + if (!tipo.HasValue) + { + description = ""; + } + else + { + tipo = contato.Tipo; + if (tipo.HasValue) + { + description = tipo.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection2.Add(new Tuple(" TIPO TELEFONE", description, "")); + observableCollection1.Add(new Tuple(" PREFIXO", (string.IsNullOrWhiteSpace(contato.Prefixo) ? "" : contato.Prefixo), "")); + observableCollection1.Add(new Tuple(" TELEFONE", (string.IsNullOrWhiteSpace(contato.Numero) ? "" : contato.Numero), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + } + if (this.Enderecos != null) + { + ObservableCollection> observableCollection3 = new ObservableCollection>() + { + new Tuple("ENDEREÇOS$", "", "") + }; + foreach (SeguradoraEndereco endereco in this.Enderecos) + { + observableCollection3.Add(new Tuple(string.Format(" ENDEREÇO {0}$", this.Enderecos.IndexOf(endereco) + 1), "", "")); + observableCollection3.Add(new Tuple(" TIPO DO ENDEREÇO", endereco.Tipo.GetDescription(), "")); + observableCollection3.Add(new Tuple(" CEP", (string.IsNullOrWhiteSpace(endereco.Cep) ? "" : endereco.Cep), "")); + observableCollection3.Add(new Tuple(" ENDEREÇO", (string.IsNullOrWhiteSpace(endereco.Endereco) ? "" : endereco.Endereco), "")); + observableCollection3.Add(new Tuple(" NÚMERO", (string.IsNullOrWhiteSpace(endereco.Numero) ? "" : endereco.Numero), "")); + observableCollection3.Add(new Tuple(" COMPLEMENTO", (string.IsNullOrWhiteSpace(endereco.Complemento) ? "" : endereco.Complemento), "")); + observableCollection3.Add(new Tuple(" BAIRRO", (string.IsNullOrWhiteSpace(endereco.Bairro) ? "" : endereco.Bairro), "")); + observableCollection3.Add(new Tuple(" CIDADE", (string.IsNullOrWhiteSpace(endereco.Cidade) ? "" : endereco.Cidade), "")); + observableCollection3.Add(new Tuple(" ESTADO", (string.IsNullOrWhiteSpace(endereco.Estado) ? "" : endereco.Estado), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection3 + }); + } + return tupleLists1; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (!string.IsNullOrWhiteSpace(this.Documento) && !this.Documento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Documento", Messages.Invalido, true); + } + decimal? tolerancia = this.Tolerancia; + decimal num = 999; + if ((tolerancia.GetValueOrDefault() > num) & tolerancia.HasValue) + { + keyValuePairs.AddValue("Tolerancia", Messages.Invalido, true); + } + tolerancia = this.ToleranciaPremio; + num = 999999; + if ((tolerancia.GetValueOrDefault() > num) & tolerancia.HasValue) + { + keyValuePairs.AddValue("ToleranciaPremio", Messages.Invalido, true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraContato.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraContato.cs new file mode 100644 index 0000000..61caa17 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraContato.cs @@ -0,0 +1,90 @@ +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; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class SeguradoraContato : TelefoneBase, IDomain + { + private string _nome; + + private string _email; + + public string Email + { + get + { + string str = this._email; + if (str != null) + { + return str.ToLower(); + } + return null; + } + set + { + this._email = value; + } + } + + public Gestor.Model.Domain.Common.Empresa Empresa + { + get; + set; + } + + public string NomeContato + { + get + { + return this._nome; + } + set + { + this._nome = value; + } + } + + public Gestor.Model.Domain.Seguros.Seguradora Seguradora + { + get; + set; + } + + public TipoContatoSeguradora TipoContato + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + SeguradoraContato seguradoraContato = this; + return new Func>>(seguradoraContato.Validate); + } + } + + public SeguradoraContato() + { + } + + public List> Validate() + { + List> keyValuePairs = base.ValidateBase(true); + if (string.IsNullOrWhiteSpace(this.NomeContato) && this.TipoContato == TipoContatoSeguradora.Contato) + { + keyValuePairs.AddValue("NomeContato|NOME CONTATO", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraEndereco.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraEndereco.cs new file mode 100644 index 0000000..f103e05 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/SeguradoraEndereco.cs @@ -0,0 +1,115 @@ +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; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class SeguradoraEndereco : EnderecoBase, IDomain + { + public Gestor.Model.Domain.Common.Empresa Empresa + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Seguradora Seguradora + { + get; + set; + } + + public TipoEndereco Tipo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + SeguradoraEndereco seguradoraEndereco = this; + return new Func>>(seguradoraEndereco.Validate); + } + } + + public SeguradoraEndereco() + { + } + + public List> Validate() + { + bool length; + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(base.Cep)) + { + keyValuePairs.AddValue("Cep", Messages.Obrigatorio, true); + } + else if (!base.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(base.Estado)) + { + keyValuePairs.AddValue("Estado", Messages.Obrigatorio, true); + } + else if (!base.Estado.ValidacaoEstado()) + { + keyValuePairs.AddValue("Estado", Messages.Invalido, true); + } + if (string.IsNullOrWhiteSpace(base.Endereco)) + { + keyValuePairs.AddValue("Endereco", Messages.Obrigatorio, true); + } + else if (base.Endereco.Length > 60) + { + keyValuePairs.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (string.IsNullOrWhiteSpace(base.Numero)) + { + keyValuePairs.AddValue("Numero", Messages.Obrigatorio, true); + } + else if (base.Numero.Length > 5) + { + keyValuePairs.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 5), true); + } + if (string.IsNullOrWhiteSpace(base.Bairro)) + { + keyValuePairs.AddValue("Bairro", Messages.Obrigatorio, true); + } + else if (base.Bairro.Length > 60) + { + keyValuePairs.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (string.IsNullOrWhiteSpace(base.Cidade)) + { + keyValuePairs.AddValue("Cidade", Messages.Obrigatorio, true); + } + else if (base.Cidade.Length > 30) + { + keyValuePairs.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30), true); + } + string complemento = base.Complemento; + if (complemento != null) + { + length = complemento.Length > 30; + } + else + { + length = false; + } + if (length) + { + keyValuePairs.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 30), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Sinistro.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Sinistro.cs new file mode 100644 index 0000000..21cb5c2 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Sinistro.cs @@ -0,0 +1,1132 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +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 bool Ativo + { + get; + set; + } + + [Description("AUXILIAR")] + [Log(true)] + public string Auxiliar + { + get + { + string str = this._auxiliar; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._auxiliar = value; + } + } + + public Gestor.Model.Domain.Seguros.ControleSinistro ControleSinistro + { + get; + set; + } + + [Description("DATA CRIAÇÃO")] + [Log(true)] + public DateTime? DataAlteracao + { + get; + set; + } + + [Description("DATA CRIACAO")] + [Log(true)] + public DateTime? DataCriacao + { + get; + set; + } + + [Description("DATA LIQUIDAÇÃO")] + [Log(true)] + public DateTime? DataLiquidacao + { + get; + set; + } + + [Description("DATA RECLAMAÇÃO")] + [Log(true)] + public DateTime? DataReclamacao + { + get + { + return this._dataReclamacao; + } + set + { + if (!value.HasValue) + { + this._dataReclamacao = null; + return; + } + if (!this.HoraReclamacao.HasValue) + { + this.HoraReclamacao = value; + } + object obj = value.Value; + DateTime? horaReclamacao = this.HoraReclamacao; + this._dataReclamacao = new DateTime?(DateTime.Parse(string.Format("{0:d} {1:T}", obj, horaReclamacao.Value))); + } + } + + [Description("DESCRIÇÃO")] + [Log(true)] + public string Descricao + { + get + { + string str = this._descricao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._descricao = value; + } + } + + public DateTime? HoraReclamacao + { + get + { + return this._horaReclamacao; + } + set + { + DateTime? nullable; + this._horaReclamacao = value; + if (!value.HasValue) + { + return; + } + DateTime? dataReclamacao = this.DataReclamacao; + if (dataReclamacao.HasValue) + { + dataReclamacao = this.DataReclamacao; + nullable = new DateTime?(DateTime.Parse(string.Format("{0:d} {1:T}", dataReclamacao.Value, value))); + } + else + { + dataReclamacao = null; + nullable = dataReclamacao; + } + this.DataReclamacao = nullable; + } + } + + [Description("USUARIO ALTERACAO")] + [Log(true)] + public long IdUsuarioAlteracao + { + get; + set; + } + + [Description("USUARIO CRIACAO")] + [Log(true)] + public long IdUsuarioCriacao + { + get; + set; + } + + [Description("ITEM SINISTRADO")] + [Log(true)] + public string ItemSinistrado + { + get + { + string str = this._itemSinistrado; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._itemSinistrado = value; + } + } + + [Description("MOTIVO")] + [Log(true)] + public string Motivo + { + get + { + string str = this._motivo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._motivo = value; + } + } + + [Log(true)] + public string Numero + { + get + { + string str = this._numero; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._numero = value; + } + } + + public string Observacao + { + get + { + return this._observacao; + } + set + { + this._observacao = value; + } + } + + public string ObservacaoInterna + { + get + { + return this._observacaoInterna; + } + set + { + this._observacaoInterna = value; + } + } + + [Log(true)] + public Gestor.Model.Domain.Seguros.SinistroAuto SinistroAuto + { + get; + set; + } + + [Log(true)] + public Gestor.Model.Domain.Seguros.SinistroVida SinistroVida + { + get; + set; + } + + [Description("STATUS PERSONALIZADO")] + [Log(true)] + public string StatusPersonalizado + { + get; + set; + } + + [Description("STATUS")] + [Log(true)] + public Gestor.Model.Common.StatusSinistro? StatusSinistro + { + get; + set; + } + + [Description("TIPO")] + [Log(true)] + public Gestor.Model.Common.TipoSinistro? TipoSinistro + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Sinistro sinistro = this; + return new Func>>(sinistro.Validate); + } + } + + [Description("VALOR")] + [Log(true)] + public decimal Valor + { + get; + set; + } + + [Description("VALOR FRANQUIA")] + [Log(true)] + public decimal ValorFranquia + { + get; + set; + } + + [Description("VALOR LIBERADO")] + [Log(true)] + public decimal ValorLiberado + { + get; + set; + } + + [Description("VALOR ORÇADO")] + [Log(true)] + public decimal ValorOrcado + { + get; + set; + } + + [Description("VALOR PAGO")] + [Log(true)] + public decimal ValorPago + { + get; + set; + } + + [Description("VALOR SALVADO")] + [Log(true)] + public decimal? ValorSalvado + { + get; + set; + } + + public Sinistro() + { + } + + public List Log() + { + DateTime? dataSinistro; + TipoPerda? tipoPerda; + bool? culpado; + EstadoCivil? estadoCivil; + string description; + string shortDateString; + string shortTimeString; + string str; + string shortTimeString1; + string shortDateString1; + string description1; + bool hasValue; + string str1; + bool flag; + string str2; + bool hasValue1; + string description2; + string certObito; + string certObito1; + string beneficiario; + string beneficiario1; + bool? nullable; + string numeroBo; + string numeroBo1; + string description3; + string str3; + string shortDateString2; + string endereco; + string endereco1; + string envolvido; + string envolvido1; + string motorista; + string motorista1; + string ddd; + string ddd1; + string telefone; + string telefone1; + string email; + string email1; + string str4; + bool parceiroMecanica; + string nome; + string str5; + bool parceiroFunilaria; + string nome1; + bool valueOrDefault; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>(); + Gestor.Model.Common.TipoSinistro? tipoSinistro = this.TipoSinistro; + if (!tipoSinistro.HasValue) + { + description = ""; + } + else + { + tipoSinistro = this.TipoSinistro; + if (tipoSinistro.HasValue) + { + description = tipoSinistro.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection.Add(new Tuple("TIPO DO SINISTRO", description, "")); + observableCollection.Add(new Tuple("ITEM SINISTRADO", (string.IsNullOrWhiteSpace(this.ItemSinistrado) ? "" : this.ItemSinistrado), "")); + observableCollection.Add(new Tuple("NÚMERO DO SINISTRO", (string.IsNullOrWhiteSpace(this.Numero) ? "" : this.Numero), "")); + if (this.ControleSinistro == null) + { + shortDateString = ""; + } + else + { + Gestor.Model.Domain.Seguros.ControleSinistro controleSinistro = this.ControleSinistro; + if (controleSinistro != null) + { + dataSinistro = controleSinistro.DataSinistro; + if (dataSinistro.HasValue) + { + shortDateString = dataSinistro.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + else + { + shortDateString = null; + } + } + observableCollection.Add(new Tuple("DATA DO SINISTRO", shortDateString, "")); + if (this.ControleSinistro == null) + { + shortTimeString = ""; + } + else + { + Gestor.Model.Domain.Seguros.ControleSinistro controleSinistro1 = this.ControleSinistro; + if (controleSinistro1 != null) + { + dataSinistro = controleSinistro1.HoraSinistro; + if (dataSinistro.HasValue) + { + shortTimeString = dataSinistro.GetValueOrDefault().ToShortTimeString(); + } + else + { + shortTimeString = null; + } + } + else + { + shortTimeString = null; + } + } + observableCollection.Add(new Tuple("HORA DO SINISTRO", shortTimeString, "")); + dataSinistro = this.DataReclamacao; + if (!dataSinistro.HasValue) + { + str = ""; + } + else + { + dataSinistro = this.DataReclamacao; + if (dataSinistro.HasValue) + { + str = dataSinistro.GetValueOrDefault().ToShortDateString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("DATA DA RECLAMAÇÃO", str, "")); + dataSinistro = this.HoraReclamacao; + if (!dataSinistro.HasValue) + { + shortTimeString1 = ""; + } + else + { + dataSinistro = this.HoraReclamacao; + if (dataSinistro.HasValue) + { + shortTimeString1 = dataSinistro.GetValueOrDefault().ToShortTimeString(); + } + else + { + shortTimeString1 = null; + } + } + observableCollection.Add(new Tuple("HORA DA RECLAMAÇÃO", shortTimeString1, "")); + dataSinistro = this.DataLiquidacao; + if (!dataSinistro.HasValue) + { + shortDateString1 = ""; + } + else + { + dataSinistro = this.DataLiquidacao; + if (dataSinistro.HasValue) + { + shortDateString1 = dataSinistro.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString1 = null; + } + } + observableCollection.Add(new Tuple("DATA DE LIQUIDAÇÃO", shortDateString1, "")); + Gestor.Model.Common.StatusSinistro? statusSinistro = this.StatusSinistro; + if (!statusSinistro.HasValue) + { + description1 = ""; + } + else + { + statusSinistro = this.StatusSinistro; + if (statusSinistro.HasValue) + { + description1 = statusSinistro.GetValueOrDefault().GetDescription(); + } + else + { + description1 = null; + } + } + observableCollection.Add(new Tuple("SITUAÇÃO", description1, "")); + decimal valor = this.Valor; + observableCollection.Add(new Tuple("VALOR", valor.ToString(new CultureInfo("pt-BR")), "")); + valor = this.ValorOrcado; + observableCollection.Add(new Tuple("VALOR ORÇADO", valor.ToString(new CultureInfo("pt-BR")), "")); + valor = this.ValorLiberado; + observableCollection.Add(new Tuple("VALOR LIBERADO", valor.ToString(new CultureInfo("pt-BR")), "")); + valor = this.ValorPago; + observableCollection.Add(new Tuple("VALOR PAGO", valor.ToString(new CultureInfo("pt-BR")), "")); + decimal? valorSalvado = this.ValorSalvado; + observableCollection.Add(new Tuple("VALOR SALVADO", valorSalvado.ToString(), "")); + valor = this.ValorFranquia; + observableCollection.Add(new Tuple("VALOR FRANQUIA", valor.ToString(new CultureInfo("pt-BR")), "")); + observableCollection.Add(new Tuple("MOTIVO", (string.IsNullOrWhiteSpace(this.Motivo) ? "" : this.Motivo), "")); + observableCollection.Add(new Tuple("AUXILIAR", (string.IsNullOrWhiteSpace(this.Auxiliar) ? "" : this.Auxiliar), "")); + observableCollection.Add(new Tuple("DESCRIÇÃO", (string.IsNullOrWhiteSpace(this.Descricao) ? "" : this.Descricao), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + if (this.SinistroAuto != null) + { + ObservableCollection> tuples = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto = this.SinistroAuto; + if (sinistroAuto != null) + { + numeroBo = sinistroAuto.NumeroBo; + } + else + { + numeroBo = null; + } + if (string.IsNullOrWhiteSpace(numeroBo)) + { + numeroBo1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto1 = this.SinistroAuto; + if (sinistroAuto1 != null) + { + numeroBo1 = sinistroAuto1.NumeroBo; + } + else + { + numeroBo1 = null; + } + } + tuples.Add(new Tuple("NÚMERO DO B.O.", numeroBo1, "")); + ObservableCollection> tuples1 = tupleLists1[0].Tuples; + tipoPerda = this.SinistroAuto.TipoPerda; + if (!tipoPerda.HasValue) + { + description3 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto2 = this.SinistroAuto; + if (sinistroAuto2 != null) + { + tipoPerda = sinistroAuto2.TipoPerda; + if (tipoPerda.HasValue) + { + description3 = tipoPerda.GetValueOrDefault().GetDescription(); + } + else + { + description3 = null; + } + } + else + { + description3 = null; + } + } + tuples1.Add(new Tuple("TIPO DE PERDA", description3, "")); + ObservableCollection> observableCollection1 = tupleLists1[0].Tuples; + culpado = this.SinistroAuto.Culpado; + if (culpado.HasValue) + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto3 = this.SinistroAuto; + if (sinistroAuto3 != null) + { + culpado = sinistroAuto3.Culpado; + bool flag1 = false; + valueOrDefault = culpado.GetValueOrDefault() == flag1 & culpado.HasValue; + } + else + { + valueOrDefault = false; + } + if (valueOrDefault) + { + goto Label1; + } + str3 = "SIM"; + goto Label0; + } + Label1: + str3 = "NÃO"; + Label0: + observableCollection1.Add(new Tuple("CONSIDERA-SE CULPADO?", str3, "")); + ObservableCollection> tuples2 = tupleLists1[0].Tuples; + dataSinistro = this.SinistroAuto.UltimoDocEnviado; + if (!dataSinistro.HasValue) + { + shortDateString2 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto4 = this.SinistroAuto; + if (sinistroAuto4 != null) + { + dataSinistro = sinistroAuto4.UltimoDocEnviado; + if (dataSinistro.HasValue) + { + shortDateString2 = dataSinistro.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString2 = null; + } + } + else + { + shortDateString2 = null; + } + } + tuples2.Add(new Tuple("ÚLTIMO DOC. ENVIADO", shortDateString2, "")); + ObservableCollection> observableCollection2 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto5 = this.SinistroAuto; + if (sinistroAuto5 != null) + { + endereco = sinistroAuto5.Endereco; + } + else + { + endereco = null; + } + if (string.IsNullOrWhiteSpace(endereco)) + { + endereco1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto6 = this.SinistroAuto; + if (sinistroAuto6 != null) + { + endereco1 = sinistroAuto6.Endereco; + } + else + { + endereco1 = null; + } + } + observableCollection2.Add(new Tuple("ENDEREÇO", endereco1, "")); + ObservableCollection> tuples3 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto7 = this.SinistroAuto; + if (sinistroAuto7 != null) + { + envolvido = sinistroAuto7.Envolvido; + } + else + { + envolvido = null; + } + if (string.IsNullOrWhiteSpace(envolvido)) + { + envolvido1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto8 = this.SinistroAuto; + if (sinistroAuto8 != null) + { + envolvido1 = sinistroAuto8.Envolvido; + } + else + { + envolvido1 = null; + } + } + tuples3.Add(new Tuple("ENVOLVIDO/PROPRIETÁRIO", envolvido1, "")); + ObservableCollection> observableCollection3 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto9 = this.SinistroAuto; + if (sinistroAuto9 != null) + { + motorista = sinistroAuto9.Motorista; + } + else + { + motorista = null; + } + if (string.IsNullOrWhiteSpace(motorista)) + { + motorista1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto10 = this.SinistroAuto; + if (sinistroAuto10 != null) + { + motorista1 = sinistroAuto10.Motorista; + } + else + { + motorista1 = null; + } + } + observableCollection3.Add(new Tuple("MOTORISTA", motorista1, "")); + ObservableCollection> tuples4 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto11 = this.SinistroAuto; + if (sinistroAuto11 != null) + { + ddd = sinistroAuto11.Ddd; + } + else + { + ddd = null; + } + if (string.IsNullOrWhiteSpace(ddd)) + { + ddd1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto12 = this.SinistroAuto; + if (sinistroAuto12 != null) + { + ddd1 = sinistroAuto12.Ddd; + } + else + { + ddd1 = null; + } + } + tuples4.Add(new Tuple("DDD", ddd1, "")); + ObservableCollection> observableCollection4 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto13 = this.SinistroAuto; + if (sinistroAuto13 != null) + { + telefone = sinistroAuto13.Telefone; + } + else + { + telefone = null; + } + if (string.IsNullOrWhiteSpace(telefone)) + { + telefone1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto14 = this.SinistroAuto; + if (sinistroAuto14 != null) + { + telefone1 = sinistroAuto14.Telefone; + } + else + { + telefone1 = null; + } + } + observableCollection4.Add(new Tuple("TELEFONE", telefone1, "")); + ObservableCollection> tuples5 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto15 = this.SinistroAuto; + if (sinistroAuto15 != null) + { + email = sinistroAuto15.Email; + } + else + { + email = null; + } + if (string.IsNullOrWhiteSpace(email)) + { + email1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto16 = this.SinistroAuto; + if (sinistroAuto16 != null) + { + email1 = sinistroAuto16.Email; + } + else + { + email1 = null; + } + } + tuples5.Add(new Tuple("E-MAIL", email1, "")); + ObservableCollection> observableCollection5 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto17 = this.SinistroAuto; + if (sinistroAuto17 != null) + { + valor = sinistroAuto17.ValorMecanica; + str4 = valor.ToString(new CultureInfo("pt-BR")); + } + else + { + str4 = null; + } + observableCollection5.Add(new Tuple("VALOR MECÂNICA", str4, "")); + ObservableCollection> tuples6 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto18 = this.SinistroAuto; + if (sinistroAuto18 != null) + { + parceiroMecanica = sinistroAuto18.ParceiroMecanica; + } + else + { + parceiroMecanica = false; + } + if (!parceiroMecanica) + { + nome = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto19 = this.SinistroAuto; + if (sinistroAuto19 != null) + { + Parceiro parceiro = sinistroAuto19.ParceiroMecanica; + if (parceiro != null) + { + nome = parceiro.Nome; + } + else + { + nome = null; + } + } + else + { + nome = null; + } + } + tuples6.Add(new Tuple("PARCEIRO MECÂNICA", nome, "")); + ObservableCollection> observableCollection6 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto20 = this.SinistroAuto; + if (sinistroAuto20 != null) + { + valor = sinistroAuto20.ValorFunilaria; + str5 = valor.ToString(new CultureInfo("pt-BR")); + } + else + { + str5 = null; + } + observableCollection6.Add(new Tuple("VALOR FUNILARIA", str5, "")); + ObservableCollection> tuples7 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto21 = this.SinistroAuto; + if (sinistroAuto21 != null) + { + parceiroFunilaria = sinistroAuto21.ParceiroFunilaria; + } + else + { + parceiroFunilaria = false; + } + if (!parceiroFunilaria) + { + nome1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroAuto sinistroAuto22 = this.SinistroAuto; + if (sinistroAuto22 != null) + { + Parceiro parceiroFunilaria1 = sinistroAuto22.ParceiroFunilaria; + if (parceiroFunilaria1 != null) + { + nome1 = parceiroFunilaria1.Nome; + } + else + { + nome1 = null; + } + } + else + { + nome1 = null; + } + } + tuples7.Add(new Tuple("PARCEIRO FUNILARIA", nome1, "")); + } + if (this.SinistroVida != null) + { + ObservableCollection> observableCollection7 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida = this.SinistroVida; + if (sinistroVida != null) + { + tipoPerda = sinistroVida.TipoPerda; + hasValue = !tipoPerda.HasValue; + } + else + { + hasValue = true; + } + if (hasValue) + { + str1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida1 = this.SinistroVida; + if (sinistroVida1 != null) + { + tipoPerda = sinistroVida1.TipoPerda; + if (tipoPerda.HasValue) + { + str1 = tipoPerda.GetValueOrDefault().GetDescription(); + } + else + { + str1 = null; + } + } + else + { + str1 = null; + } + } + observableCollection7.Add(new Tuple("TIPO DE PERDA", str1, "")); + ObservableCollection> tuples8 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida2 = this.SinistroVida; + if (sinistroVida2 != null) + { + culpado = sinistroVida2.AuxFuneral; + flag = !culpado.HasValue; + } + else + { + flag = true; + } + if (flag) + { + str2 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida3 = this.SinistroVida; + if (sinistroVida3 != null) + { + culpado = sinistroVida3.AuxFuneral; + nullable = new bool?(culpado.Value); + } + else + { + culpado = null; + nullable = culpado; + } + culpado = nullable; + str2 = (culpado.Value ? "SIM" : "NÃO"); + } + tuples8.Add(new Tuple("AUXÍLIO FUNERAL", str2, "")); + ObservableCollection> observableCollection8 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida4 = this.SinistroVida; + if (sinistroVida4 != null) + { + estadoCivil = sinistroVida4.EstadoCivil; + hasValue1 = !estadoCivil.HasValue; + } + else + { + hasValue1 = true; + } + if (hasValue1) + { + description2 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida5 = this.SinistroVida; + if (sinistroVida5 != null) + { + estadoCivil = sinistroVida5.EstadoCivil; + if (estadoCivil.HasValue) + { + description2 = estadoCivil.GetValueOrDefault().GetDescription(); + } + else + { + description2 = null; + } + } + else + { + description2 = null; + } + } + observableCollection8.Add(new Tuple("ESTADO CIVIL", description2, "")); + ObservableCollection> tuples9 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida6 = this.SinistroVida; + if (sinistroVida6 != null) + { + certObito = sinistroVida6.CertObito; + } + else + { + certObito = null; + } + if (string.IsNullOrWhiteSpace(certObito)) + { + certObito1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida7 = this.SinistroVida; + if (sinistroVida7 != null) + { + certObito1 = sinistroVida7.CertObito; + } + else + { + certObito1 = null; + } + } + tuples9.Add(new Tuple("CERTIDÃO DE ÓBITO", certObito1, "")); + ObservableCollection> observableCollection9 = tupleLists1[0].Tuples; + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida8 = this.SinistroVida; + if (sinistroVida8 != null) + { + beneficiario = sinistroVida8.Beneficiario; + } + else + { + beneficiario = null; + } + if (string.IsNullOrWhiteSpace(beneficiario)) + { + beneficiario1 = ""; + } + else + { + Gestor.Model.Domain.Seguros.SinistroVida sinistroVida9 = this.SinistroVida; + if (sinistroVida9 != null) + { + beneficiario1 = sinistroVida9.Beneficiario; + } + else + { + beneficiario1 = null; + } + } + observableCollection9.Add(new Tuple("BENEFICIÁRIO", beneficiario1, "")); + } + return tupleLists1; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.DataReclamacao.HasValue && (DateTime.Compare(this.DataReclamacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataReclamacao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("DataReclamacao", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.HoraReclamacao.HasValue && (DateTime.Compare(this.HoraReclamacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.HoraReclamacao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("HoraReclamacao", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.DataLiquidacao.HasValue && (DateTime.Compare(this.DataLiquidacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataLiquidacao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("DataLiquidacao", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.ControleSinistro != null) + { + keyValuePairs.AddRange(this.ControleSinistro.Validate()); + } + if (!this.DataReclamacao.HasValue) + { + keyValuePairs.AddValue("DataReclamacao", Messages.Obrigatorio, true); + } + if (this.StatusSinistro.GetValueOrDefault() != Gestor.Model.Common.StatusSinistro.EmAndamento && !this.DataLiquidacao.HasValue) + { + keyValuePairs.AddValue("DataLiquidacao", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroAuto.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroAuto.cs new file mode 100644 index 0000000..65cc4cd --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroAuto.cs @@ -0,0 +1,284 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +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; + + [Log(true)] + [Name(true)] + public string Cnh + { + get + { + string str = this._cnh; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._cnh = value; + } + } + + [Description("DECLARA-SE CULPADO")] + [Log(true)] + [Name(true)] + public bool? Culpado + { + get; + set; + } + + [Description("PREFIXO")] + [Log(true)] + [Name(true)] + public string Ddd + { + get + { + string str = this._ddd; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._ddd = value; + } + } + + [Description("E-MAIL")] + [Log(true)] + [Name(true)] + public string Email + { + get + { + string str = this._email; + if (str == null) + { + return null; + } + return str.ToLower().Trim(); + } + set + { + this._email = value; + } + } + + [Description("ENDEREÇO")] + [Log(true)] + [Name(true)] + public string Endereco + { + get + { + string str = this._endereco; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._endereco = value; + } + } + + [Log(true)] + [Name(true)] + public string Envolvido + { + get + { + string str = this._envolvido; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._envolvido = value; + } + } + + [Log(true)] + [Name(true)] + public string Motorista + { + get + { + string str = this._motorista; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._motorista = value; + } + } + + [Description("NUMERO B.O.")] + [Log(true)] + [Name(true)] + public string NumeroBo + { + get + { + string str = this._numeroBo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._numeroBo = value; + } + } + + [Description("FUNILARIA")] + [Log(true)] + public Parceiro ParceiroFunilaria + { + get; + set; + } + + [Description("MECÂNICA")] + [Log(true)] + public Parceiro ParceiroMecanica + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Sinistro Sinistro + { + get; + set; + } + + [Description("TELEFONE")] + [Log(true)] + [Name(true)] + public string Telefone + { + get + { + string str = this._telefone; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone = value; + } + } + + [Description("TIPO PERDA")] + [Log(true)] + [Name(true)] + public Gestor.Model.Common.TipoPerda? TipoPerda + { + get; + set; + } + + [Description("DATA ÚLTIMO DOC. ENVIADO")] + [Log(true)] + [Name(true)] + public DateTime? UltimoDocEnviado + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + SinistroAuto sinistroAuto = this; + return new Func>>(sinistroAuto.Validate); + } + } + + [Description("VALOR FINILARIA")] + [Log(true)] + [Name(true)] + public decimal ValorFunilaria + { + get; + set; + } + + [Description("VALOR MECÂNICA")] + [Log(true)] + [Name(true)] + public decimal ValorMecanica + { + get; + set; + } + + public SinistroAuto() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Sinistro != null) + { + keyValuePairs.AddRange(this.Sinistro.Validate()); + } + if (this.UltimoDocEnviado.HasValue && (DateTime.Compare(this.UltimoDocEnviado.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.UltimoDocEnviado.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("UltimoDocEnviado", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroVida.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroVida.cs new file mode 100644 index 0000000..bdd167c --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/SinistroVida.cs @@ -0,0 +1,138 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class SinistroVida : DomainBase, IDomain + { + private string _certObito; + + private string _beneficiario; + + private string _observacao; + + [Description("AUXÍLIO FUNERAL")] + [Log(true)] + [Name(true)] + public bool? AuxFuneral + { + get; + set; + } + + [Description("BENEFICIÁRIO")] + [Log(true)] + [Name(true)] + public string Beneficiario + { + get + { + string str = this._beneficiario; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._beneficiario = value; + } + } + + [Description("CERT. ÓBITO")] + [Log(true)] + [Name(true)] + public string CertObito + { + get + { + string str = this._certObito; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._certObito = value; + } + } + + [Description("ESTADO CÍVIL")] + [Log(true)] + [Name(true)] + public Gestor.Model.Common.EstadoCivil? EstadoCivil + { + get; + set; + } + + [Description("OBSERVAÇÃO")] + [Log(true)] + [Name(true)] + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public Gestor.Model.Domain.Seguros.Sinistro Sinistro + { + get; + set; + } + + [Description("TIPO PERDA")] + [Log(true)] + [Name(true)] + public Gestor.Model.Common.TipoPerda? TipoPerda + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + SinistroVida sinistroVida = this; + return new Func>>(sinistroVida.Validate); + } + } + + public SinistroVida() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Sinistro != null) + { + keyValuePairs.AddRange(this.Sinistro.Validate()); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Status.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Status.cs new file mode 100644 index 0000000..3649416 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Status.cs @@ -0,0 +1,86 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Status : DomainBase, IDomain + { + private string _nome; + + [Log(true)] + public bool Ativo + { + get; + set; + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Status statu = this; + return new Func>>(statu.Validate); + } + } + + public Status() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "") + } + } + }; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 60) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/TipoVendedor.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/TipoVendedor.cs new file mode 100644 index 0000000..47d2048 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/TipoVendedor.cs @@ -0,0 +1,138 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Model.Domain.Seguros +{ + public class TipoVendedor : DomainBase, IDomain + { + private bool _selecionado; + + private string _descricao; + + private bool? _ativo; + + [Log(true)] + public bool? Ativo + { + get + { + return this._ativo; + } + set + { + this._ativo = new bool?(value.GetValueOrDefault(true)); + } + } + + [Description("DESCRIÇÃO")] + [Log(true)] + [Name(true)] + public string Descricao + { + get + { + string str = this._descricao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._descricao = value; + } + } + + public bool? Inserido + { + get; + set; + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + TipoVendedor tipoVendedor = this; + return new Func>>(tipoVendedor.Validate); + } + } + + public TipoVendedor() + { + } + + public List Log() + { + string str; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("DESCRIÇÃO", (string.IsNullOrWhiteSpace(this.Descricao) ? "" : this.Descricao), "") + }; + if (!this.Ativo.HasValue) + { + str = ""; + } + else + { + str = (this.Ativo.Value ? "SIM" : "NÃO"); + } + observableCollection.Add(new Tuple("ATIVO", str, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Descricao)) + { + keyValuePairs.AddValue("Descricao", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/TitularesVida.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/TitularesVida.cs new file mode 100644 index 0000000..3956270 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/TitularesVida.cs @@ -0,0 +1,269 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +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 decimal? Capital + { + get + { + return new decimal?(this._capital.GetValueOrDefault()); + } + set + { + this._capital = value; + } + } + + public string Codigo + { + get + { + string str = this._codigo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._codigo = value; + } + } + + public string Cpf + { + get; + set; + } + + public TitularesVida Dependente + { + get; + set; + } + + public string Fatura + { + get + { + string str = this._fatura; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._fatura = value; + } + } + + public DateTime? Fim + { + get; + set; + } + + public long IdItem + { + get; + set; + } + + public DateTime? Inicio + { + get; + set; + } + + public string Matricula + { + get + { + string str = this._matricula; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._matricula = value; + } + } + + public DateTime? Nascimento + { + get; + set; + } + + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public decimal? Premio + { + get + { + return new decimal?(this._premio.GetValueOrDefault()); + } + set + { + this._premio = value; + } + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + public TipoTitular? Tipo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + TitularesVida titularesVida = this; + return new Func>>(titularesVida.Validate); + } + } + + public TitularesVida() + { + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 150) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 150), true); + } + if (!this.Inicio.HasValue) + { + keyValuePairs.AddValue("Inicio|INÍCIO", Messages.Obrigatorio, true); + } + else if (DateTime.Compare(this.Inicio.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Inicio.Value, new DateTime(9999, 12, 31)) > 0) + { + keyValuePairs.AddValue("Inicio|INÍCIO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Fim.HasValue && (DateTime.Compare(this.Fim.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Fim.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Fim", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Nascimento.HasValue && (DateTime.Compare(this.Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Nascimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Nascimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if ((!this.Nascimento.HasValue || Funcoes.GetAge(this.Nascimento.Value) >= 18) && !string.IsNullOrWhiteSpace(this.Cpf) && !this.Cpf.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Cpf", Messages.Invalido, true); + } + if (!this.Tipo.HasValue) + { + keyValuePairs.AddValue("Tipo", Messages.Obrigatorio, true); + } + if (this.Tipo.GetValueOrDefault() == TipoTitular.Dependente && this.Dependente == null) + { + keyValuePairs.AddValue("Dependente", "OBRIGATÓRIO. PESQUISE POR UM DOS TITULARES\nQUE SEJA DO TIPO SÓCIO OU FUNCIONÁRIO", true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/TupleList.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/TupleList.cs new file mode 100644 index 0000000..406b072 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/TupleList.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class TupleList + { + public ObservableCollection> Tuples + { + get; + set; + } + + public TupleList() + { + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Usuario.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Usuario.cs new file mode 100644 index 0000000..39c6cc1 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Usuario.cs @@ -0,0 +1,872 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; + +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; + + [Log(true)] + public bool Administrador + { + get; + set; + } + + [Description("PERMISSÃO ADMINISTRADOR CENTRAL SEGURADO")] + [Log(true)] + public bool AdministradorCentralSegurado + { + get; + set; + } + + [Description("AGÊNCIA")] + [Log(true)] + public string Agencia + { + get + { + string str = this._agencia; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._agencia = value; + } + } + + public bool Aggilizador + { + get; + set; + } + + [Log(true)] + public Gestor.Model.Domain.Common.Banco Banco + { + get; + set; + } + + [Log(true)] + public string Cargo + { + get; + set; + } + + [Log(true)] + public string Conta + { + get + { + string str = this._conta; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._conta = value; + } + } + + [Description("ACESSO AO DASHBOARD")] + [Log(true)] + public bool? Dashboard + { + get + { + return this._dashboard; + } + set + { + this._dashboard = new bool?(value.GetValueOrDefault(true)); + } + } + + [Log(true)] + public string Documento + { + get + { + string str = this._documento; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documento = value; + } + } + + [Description("ACESSO AOS DOMINGOS")] + [Log(true)] + public bool? Domingo + { + get + { + return this._domingo; + } + set + { + this._domingo = new bool?(value.GetValueOrDefault(true)); + } + } + + [Log(true)] + public string Email + { + get + { + string str = this._email; + if (str == null) + { + return null; + } + return str.ToLower().Trim(); + } + set + { + this._email = value; + } + } + + [Description("ESTADO EMISSOR")] + [Log(true)] + public string EstadoEmissor + { + get + { + string str = this._estadoEmissor; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._estadoEmissor = value; + } + } + + public bool Excluido + { + get; + set; + } + + [Description("DATA DE EXPEDIÇÃO")] + [Log(true)] + public DateTime? Expedicao + { + get; + set; + } + + [Description("FILTRO INICIAL")] + [Log(true)] + public TipoFiltroCliente? FiltroInicial + { + get; + set; + } + + [Description("FIM DO ACESSO")] + public DateTime? FimAcesso + { + get; + set; + } + + public long IdEmpresa + { + get; + set; + } + + [Log(true)] + public string Identidade + { + get + { + string str = this._identidade; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._identidade = value; + } + } + + [Description("INÍCIO DO ACESSO")] + public DateTime? InicioAcesso + { + get; + set; + } + + [Log(true)] + public string Login + { + get + { + string str = this._login; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._login = value; + } + } + + [Description("ACESSO AO MOBILE")] + [Log(true)] + public bool Mobile + { + get; + set; + } + + [Description("DATA DE NASCIMENTO")] + [Log(true)] + public DateTime? Nascimento + { + get; + set; + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + return this._nome; + } + set + { + this._nome = value; + } + } + + [Description("PERMISSÃO ACESSO AGGILIZADOR")] + [Log(true)] + public long? PermissaoAggilizador + { + get; + set; + } + + [Description("PREFIXO TELEFONE 1")] + [Log(true)] + public string Prefixo + { + get + { + string str = this._prefixo; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._prefixo = value; + } + } + + [Description("PREFIXO TELEFONE 2")] + [Log(true)] + public string Prefixo2 + { + get + { + string str = this._prefixo2; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._prefixo2 = value; + } + } + + [Description("ACESSO ÁS QUARTAS-FEIRAS")] + [Log(true)] + public bool? Quarta + { + get + { + return this._quarta; + } + set + { + this._quarta = new bool?(value.GetValueOrDefault(true)); + } + } + + [Description("ACESSO ÁS QUINTAS-FEIRAS")] + [Log(true)] + public bool? Quinta + { + get + { + return this._quinta; + } + set + { + this._quinta = new bool?(value.GetValueOrDefault(true)); + } + } + + [Description("ACESSO AOS RESULTADOS MOBILE")] + [Log(true)] + public bool Resultados + { + get; + set; + } + + [Description("ACESSO AOS SÁBADOS")] + [Log(true)] + public bool? Sabado + { + get + { + return this._sabado; + } + set + { + this._sabado = new bool?(value.GetValueOrDefault(true)); + } + } + + [Description("ACESSO ÀS SEGUNDAS-FEIRAS")] + [Log(true)] + public bool? Segunda + { + get + { + return this._segunda; + } + set + { + this._segunda = new bool?(value.GetValueOrDefault(true)); + } + } + + public bool Selecionado + { + get; + set; + } + + public string Senha + { + get; + set; + } + + public string SenhaAnterior { get; set; } = string.Empty; + + [Log(true)] + public Gestor.Model.Common.Sexo Sexo + { + get; + set; + } + + [Description("ACESSO ÁS SEXTAS-FEIRAS")] + [Log(true)] + public bool? Sexta + { + get + { + return this._sexta; + } + set + { + this._sexta = new bool?(value.GetValueOrDefault(true)); + } + } + + public string SsoId + { + get; + set; + } + + [Log(true)] + public TipoTelaInicial? TelaInicial + { + get + { + return new TipoTelaInicial?(this._telaInicial.GetValueOrDefault()); + } + set + { + this._telaInicial = new TipoTelaInicial?(value.GetValueOrDefault()); + } + } + + [Description("TELEFONE 1")] + [Log(true)] + public string Telefone + { + get + { + string str = this._telefone; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone = value; + } + } + + [Description("TELEFONE 2")] + [Log(true)] + public string Telefone2 + { + get + { + string str = this._telefone2; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone2 = value; + } + } + + [Description("ACESSO ÀS TERÇAS-FEIRAS")] + [Log(true)] + public bool? Terca + { + get + { + return this._terca; + } + set + { + this._terca = new bool?(value.GetValueOrDefault(true)); + } + } + + [Description("TIPO DO TELEFONE 1")] + [Log(true)] + public Gestor.Model.Common.TipoTelefone? TipoTelefone + { + get; + set; + } + + [Description("TIPO DO TELEFONE 2")] + [Log(true)] + public Gestor.Model.Common.TipoTelefone? TipoTelefone2 + { + get; + set; + } + + public string TokenSso + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Usuario usuario = this; + return new Func>>(usuario.Validate); + } + } + + public string Visita + { + get; + set; + } + + public Usuario() + { + } + + public List Log() + { + string shortDateString; + string str; + string nome; + string shortTimeString; + string shortTimeString1; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("CPF/CNPJ", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""), + new Tuple("USUÁRIO", (string.IsNullOrWhiteSpace(this.Login) ? "" : this.Login), ""), + new Tuple("IDENTIDADE", (string.IsNullOrWhiteSpace(this.Identidade) ? "" : this.Identidade), ""), + new Tuple("ESTADO EMISSOR", (string.IsNullOrWhiteSpace(this.EstadoEmissor) ? "" : this.EstadoEmissor), "") + }; + DateTime? expedicao = this.Expedicao; + if (!expedicao.HasValue) + { + shortDateString = ""; + } + else + { + expedicao = this.Expedicao; + if (expedicao.HasValue) + { + shortDateString = expedicao.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection.Add(new Tuple("DATA DE EXPEDIÇÃO", shortDateString, "")); + observableCollection.Add(new Tuple("SEXO", this.Sexo.GetDescription(), "")); + expedicao = this.Nascimento; + if (!expedicao.HasValue) + { + str = ""; + } + else + { + expedicao = this.Nascimento; + if (expedicao.HasValue) + { + str = expedicao.GetValueOrDefault().ToShortDateString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("DATA DE NASCIMENTO", str, "")); + if (this.Banco == null) + { + nome = ""; + } + else + { + Gestor.Model.Domain.Common.Banco banco = this.Banco; + if (banco != null) + { + nome = banco.Nome; + } + else + { + nome = null; + } + } + observableCollection.Add(new Tuple("BANCO", nome, "")); + observableCollection.Add(new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia), "")); + observableCollection.Add(new Tuple("CONTA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta), "")); + observableCollection.Add(new Tuple("ENDEREÇO", (string.IsNullOrWhiteSpace(base.Endereco) ? "" : base.Endereco), "")); + observableCollection.Add(new Tuple("NÚMERO", (string.IsNullOrWhiteSpace(base.Numero) ? "" : base.Numero), "")); + observableCollection.Add(new Tuple("COMPLEMENTO", (string.IsNullOrWhiteSpace(base.Complemento) ? "" : base.Complemento), "")); + observableCollection.Add(new Tuple("BAIRRO", (string.IsNullOrWhiteSpace(base.Bairro) ? "" : base.Bairro), "")); + observableCollection.Add(new Tuple("CIDADE", (string.IsNullOrWhiteSpace(base.Cidade) ? "" : base.Cidade), "")); + observableCollection.Add(new Tuple("ESTADO", (string.IsNullOrWhiteSpace(base.Estado) ? "" : base.Estado), "")); + observableCollection.Add(new Tuple("CEP", (string.IsNullOrWhiteSpace(base.Cep) ? "" : base.Cep), "")); + observableCollection.Add(new Tuple("TIPO TELEFONE", (!this.TipoTelefone.HasValue ? "" : this.TipoTelefone.GetDescription()), "")); + observableCollection.Add(new Tuple("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Prefixo) ? "" : this.Prefixo), "")); + observableCollection.Add(new Tuple("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone) ? "" : this.Telefone), "")); + observableCollection.Add(new Tuple("TIPO TELEFONE", (!this.TipoTelefone2.HasValue ? "" : this.TipoTelefone2.GetDescription()), "")); + observableCollection.Add(new Tuple("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.Prefixo2) ? "" : this.Prefixo2), "")); + observableCollection.Add(new Tuple("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone2) ? "" : this.Telefone2), "")); + observableCollection.Add(new Tuple("EMAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), "")); + observableCollection.Add(new Tuple("ACESSO MOBILE", (this.Mobile ? "SIM" : "NÃO"), "")); + observableCollection.Add(new Tuple("ACESSO RESULTADOS", (this.Resultados ? "SIM" : "NÃO"), "")); + observableCollection.Add(new Tuple("ACESSO INDIVIDUAL AGGILIZADOR", (this.Aggilizador ? "SIM" : "NÃO"), "")); + expedicao = this.InicioAcesso; + if (!expedicao.HasValue) + { + shortTimeString = ""; + } + else + { + expedicao = this.InicioAcesso; + if (expedicao.HasValue) + { + shortTimeString = expedicao.GetValueOrDefault().ToShortTimeString(); + } + else + { + shortTimeString = null; + } + } + observableCollection.Add(new Tuple("INÍCIO DO ACESSO", shortTimeString, "")); + expedicao = this.FimAcesso; + if (!expedicao.HasValue) + { + shortTimeString1 = ""; + } + else + { + expedicao = this.FimAcesso; + if (expedicao.HasValue) + { + shortTimeString1 = expedicao.GetValueOrDefault().ToShortTimeString(); + } + else + { + shortTimeString1 = null; + } + } + observableCollection.Add(new Tuple("FIM DO ACESSO", shortTimeString1, "")); + observableCollection.Add(new Tuple("ADMINISTRADOR CENTRAL SEGURADO", (this.AdministradorCentralSegurado ? "SIM" : "NÃO"), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + + public UserSso ToUserSso(string serial, string documentoEmpresa, string ssoId = null) + { + return new UserSso() + { + Id = ssoId, + Name = this.Nome, + Username = this.Login, + Password = this.Senha, + Serial = serial, + CustomerDocument = documentoEmpresa, + IdEmpresa = this.IdEmpresa, + Document = this.Documento, + IsDeleted = false, + Email = this.Email ?? string.Empty, + Phone = (string.IsNullOrEmpty(this.Prefixo) || string.IsNullOrEmpty(this.Telefone) ? string.Empty : string.Concat(this.Prefixo.Clear(), this.Telefone.Clear())) + }; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Expedicao.HasValue && (DateTime.Compare(this.Expedicao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Expedicao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Expedicao", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Nascimento.HasValue && (DateTime.Compare(this.Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Nascimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Nascimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.InicioAcesso.HasValue && this.FimAcesso.HasValue && this.InicioAcesso.Value.TimeOfDay > this.FimAcesso.Value.TimeOfDay) + { + keyValuePairs.AddValue("FimAcesso|FIM DO ACESSO", "O HORÁRIO DO FIM DO ACESSO NÃO PODE SER ANTERIOR AO HORÁRIO DO INICIO DO ACESSO", true); + } + if (string.IsNullOrEmpty(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 50) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 50), true); + } + if (!string.IsNullOrEmpty(this.Documento) && !this.Documento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Documento", Messages.Invalido, true); + } + if (string.IsNullOrEmpty(this.Login)) + { + keyValuePairs.AddValue("Login", Messages.Obrigatorio, true); + } + else if (this.Login.Length > 30) + { + keyValuePairs.AddValue("Login", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (!string.IsNullOrEmpty(this.Login) && !Regex.IsMatch(this.Login, "^(?!.* {2})[a-zA-Z0-9](?:[a-zA-Z0-9 .]{0,49}[a-zA-Z0-9])?$")) + { + keyValuePairs.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", true); + } + if (string.IsNullOrEmpty(this.Senha)) + { + keyValuePairs.AddValue("Senha", Messages.Obrigatorio, true); + } + if (string.IsNullOrEmpty(this.Email)) + { + keyValuePairs.AddValue("Email", Messages.Obrigatorio, true); + } + if (!string.IsNullOrEmpty(this.EstadoEmissor) && !this.EstadoEmissor.ValidacaoEstado()) + { + keyValuePairs.AddValue("EstadoEmissor", Messages.Invalido, true); + } + if (this.Expedicao.HasValue && !this.Expedicao.ValidacaoDataPassada()) + { + keyValuePairs.AddValue("Expedicao", Messages.Invalido, true); + } + if (this.Nascimento.HasValue && !this.Nascimento.ValidacaoDataPassada()) + { + keyValuePairs.AddValue("Nascimento", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(base.Cep) && !base.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(base.Endereco) && base.Endereco.Length > 60) + { + keyValuePairs.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!string.IsNullOrEmpty(base.Numero) && base.Numero.Length > 5) + { + keyValuePairs.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 5), true); + } + if (!string.IsNullOrEmpty(base.Bairro) && base.Bairro.Length > 60) + { + keyValuePairs.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 60), true); + } + if (!string.IsNullOrEmpty(base.Cidade) && base.Cidade.Length > 30) + { + keyValuePairs.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30), true); + } + if (!string.IsNullOrEmpty(base.Estado) && !base.Estado.ValidacaoEstado()) + { + keyValuePairs.AddValue("Estado", Messages.Invalido, true); + } + 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)) + { + keyValuePairs.AddValue("Cep", Messages.Obrigatorio, true); + } + if (string.IsNullOrEmpty(base.Endereco)) + { + keyValuePairs.AddValue("Endereco", Messages.Obrigatorio, true); + } + if (string.IsNullOrEmpty(base.Numero)) + { + keyValuePairs.AddValue("Numero", Messages.Obrigatorio, true); + } + if (string.IsNullOrEmpty(base.Bairro)) + { + keyValuePairs.AddValue("Bairro", Messages.Obrigatorio, true); + } + if (string.IsNullOrEmpty(base.Cidade)) + { + keyValuePairs.AddValue("Cidade", Messages.Obrigatorio, true); + } + if (string.IsNullOrEmpty(base.Estado)) + { + keyValuePairs.AddValue("Estado", Messages.Obrigatorio, true); + } + } + if (this.AdministradorCentralSegurado && string.IsNullOrEmpty(this.Documento)) + { + keyValuePairs.AddValue("Documento", Messages.Obrigatorio, true); + } + if (this.AdministradorCentralSegurado && string.IsNullOrEmpty(this.Prefixo)) + { + keyValuePairs.AddValue("Prefixo", Messages.Obrigatorio, true); + } + if (this.AdministradorCentralSegurado && string.IsNullOrEmpty(this.Telefone)) + { + keyValuePairs.AddValue("Telefone", Messages.Obrigatorio, true); + } + if (this.AdministradorCentralSegurado && string.IsNullOrEmpty(this.Email)) + { + keyValuePairs.AddValue("Email", Messages.Obrigatorio, true); + } + if (this.InicioAcesso.HasValue && this.FimAcesso.HasValue && this.FimAcesso.Value.TimeOfDay == this.InicioAcesso.Value.TimeOfDay) + { + keyValuePairs.AddValue("InicioAcesso", Messages.Invalido, true); + keyValuePairs.AddValue("FimAcesso", Messages.Invalido, true); + } + if (this.Documento == null || string.IsNullOrEmpty(this.Documento)) + { + keyValuePairs.AddValue("Documento", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs new file mode 100644 index 0000000..200f397 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Vendedor.cs @@ -0,0 +1,375 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Threading; + +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 string Agencia + { + get + { + string str = this._agencia; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._agencia = value; + } + } + + public bool Ativo + { + get; + set; + } + + public Gestor.Model.Domain.Common.Banco Banco + { + get; + set; + } + + public string Conta + { + get + { + string str = this._conta; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._conta = value; + } + } + + public Gestor.Model.Domain.Seguros.Controle Controle + { + get; + set; + } + + public bool Corretora + { + get; + set; + } + + public decimal? Desconto + { + get; + set; + } + + public string Documento + { + get + { + string str = this._documento; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documento = value; + } + } + + public long IdEmpresa + { + get; + set; + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + public List Telefones + { + get; + set; + } + + public Gestor.Model.Common.TipoConta TipoConta + { + get; + set; + } + + public Gestor.Model.Common.TipoIncidenciaDesconto TipoIncidenciaDesconto + { + get; + set; + } + + public string TitularConta + { + get + { + string str = this._titularConta; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._titularConta = value; + } + } + + public string TitularDocumento + { + get + { + string str = this._documentoTitular; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._documentoTitular = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Vendedor vendedor = this; + return new Func>>(vendedor.Validate); + } + } + + public Vendedor() + { + } + + public List Log() + { + decimal? nullable; + string str; + string description; + decimal? nullable1; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("CPF", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""), + new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), ""), + new Tuple("BANCO", (this.Banco == null ? "" : this.Banco.Nome), ""), + new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia), ""), + new Tuple("CONTA CORRENTE/POUPANÇA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta), ""), + new Tuple("TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularConta) ? "" : this.TitularConta), ""), + new Tuple("DOCUMENTO TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularDocumento) ? "" : this.TitularDocumento), ""), + new Tuple("TIPO CONTA", (string.IsNullOrWhiteSpace(this.TipoConta.GetDescription()) ? "" : this.TipoConta.GetDescription()), "") + }; + decimal? desconto = this.Desconto; + if (!desconto.HasValue) + { + str = ""; + } + else + { + desconto = this.Desconto; + decimal num = 100; + if (desconto.HasValue) + { + nullable1 = new decimal?(desconto.GetValueOrDefault() / num); + } + else + { + nullable = null; + nullable1 = nullable; + } + nullable = nullable1; + if (nullable.HasValue) + { + decimal valueOrDefault = nullable.GetValueOrDefault(); + str = valueOrDefault.ToString("P", new CultureInfo("pt-BR", false)); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("DESCONTO", str, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("CONTATOS$", "", "") + }; + if (this.Telefones != null && this.Telefones.Count != 0) + { + foreach (VendedorTelefone telefone in this.Telefones) + { + observableCollection1.Add(new Tuple(string.Format(" CONTATO {0}$", this.Telefones.IndexOf(telefone) + 1), "", "")); + observableCollection1.Add(new Tuple(" NOME", (string.IsNullOrWhiteSpace(telefone.Nome) ? "" : telefone.Nome), "")); + ObservableCollection> observableCollection2 = observableCollection1; + TipoTelefone? tipo = telefone.Tipo; + if (!tipo.HasValue) + { + description = ""; + } + else + { + tipo = telefone.Tipo; + if (tipo.HasValue) + { + description = tipo.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection2.Add(new Tuple(" TIPO DE TELEFONE", description, "")); + observableCollection1.Add(new Tuple(" PREFIXO", (string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo), "")); + observableCollection1.Add(new Tuple(" NÚMERO DE TELEFONE", (string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero), "")); + observableCollection1.Add(new Tuple(" E-MAIL", (string.IsNullOrWhiteSpace(telefone.Email) ? "" : telefone.Email), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + } + return tupleLists1; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrEmpty(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + if (!string.IsNullOrWhiteSpace(this.Documento) && !this.Documento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Documento", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.TitularDocumento) && !this.TitularDocumento.ValidacaoDocumento()) + { + keyValuePairs.AddValue("TitularDocumento", Messages.Invalido, true); + } + if (this.Telefones == null) + { + return keyValuePairs; + } + foreach (VendedorTelefone telefone in this.Telefones) + { + keyValuePairs.AddRange(telefone.Validate()); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcela.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcela.cs new file mode 100644 index 0000000..8d40450 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcela.cs @@ -0,0 +1,235 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class VendedorParcela : DomainBase, IDomain + { + private string _vCondRep; + + public bool CoCorretagem + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.CondicaoRepasse CondicaoRepasse + { + get; + set; + } + + [Description("DATA DO PAGAMENTO")] + [Log(true)] + public DateTime? DataPagamento + { + get; + set; + } + + [Description("DATA PREVISÃO DE PAGAMENTO")] + [Log(true)] + public DateTime? DataPrePagamento + { + get; + set; + } + + [Log(false)] + public Gestor.Model.Domain.Seguros.Documento Documento + { + get; + set; + } + + [Log(false)] + public Gestor.Model.Domain.Seguros.Parcela Parcela + { + get; + set; + } + + [Description("PORCENTAGEM REPASSE")] + [Log(true)] + public decimal? PorcentagemRepasse + { + get; + set; + } + + public decimal? PorcentagemRepasseB + { + get; + set; + } + + public string RecebidoPorCompleto + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Repasse Repasse + { + get; + set; + } + + public bool Selecionado + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.TipoVendedor TipoVendedor + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + VendedorParcela vendedorParcela = this; + return new Func>>(vendedorParcela.Validate); + } + } + + [Description("VALOR REPASSE")] + [Log(true)] + public decimal? ValorRepasse + { + get; + set; + } + + public decimal? ValorRepasseB + { + get; + set; + } + + public decimal? ValorTotal + { + get; + set; + } + + public decimal? ValorTotalPago + { + get; + set; + } + + public string VCondRep + { + get + { + string str = this._vCondRep; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._vCondRep = value; + } + } + + [Log(true)] + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public VendedorParcela() + { + } + + public List> Validate() + { + decimal num; + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.DataPagamento.HasValue && (DateTime.Compare(this.DataPagamento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataPagamento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("DataPagamento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.DataPrePagamento.HasValue && (DateTime.Compare(this.DataPrePagamento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataPrePagamento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("DataPrePagamento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Vendedor == null) + { + keyValuePairs.AddValue("Vendedor", Messages.Obrigatorio, true); + } + if (this.Documento == null) + { + keyValuePairs.AddValue("Documento", Messages.Obrigatorio, true); + } + if (this.Documento != null && this.Documento.Id > (long)0 && this.Parcela == null) + { + keyValuePairs.AddValue("Parcela", Messages.Obrigatorio, true); + } + if (this.Repasse == null) + { + keyValuePairs.AddValue("Repasse", Messages.Obrigatorio, true); + } + if (this.TipoVendedor == null && !this.CoCorretagem) + { + keyValuePairs.AddValue("TipoVendedor", Messages.Obrigatorio, true); + } + decimal? porcentagemRepasse = this.PorcentagemRepasse; + if (!porcentagemRepasse.HasValue && !this.CoCorretagem) + { + keyValuePairs.AddValue("PorcentagemRepasse", Messages.Obrigatorio, true); + } + porcentagemRepasse = this.ValorRepasse; + if (!porcentagemRepasse.HasValue) + { + keyValuePairs.AddValue("ValorRepasse", Messages.Obrigatorio, true); + } + if (this.Vendedor == null || this.Vendedor.Corretora) + { + return keyValuePairs; + } + porcentagemRepasse = this.PorcentagemRepasse; + if (porcentagemRepasse.HasValue) + { + porcentagemRepasse = this.PorcentagemRepasse; + num = new decimal(); + if ((porcentagemRepasse.GetValueOrDefault() <= num) & porcentagemRepasse.HasValue) + { + keyValuePairs.AddValue("PorcentagemRepasse", Messages.Invalido, true); + } + } + porcentagemRepasse = this.ValorRepasse; + if (porcentagemRepasse.HasValue) + { + porcentagemRepasse = this.ValorRepasse; + num = new decimal(); + if ((porcentagemRepasse.GetValueOrDefault() == num) & porcentagemRepasse.HasValue && !this.CoCorretagem) + { + keyValuePairs.AddValue("ValorRepasse", Messages.Invalido, true); + } + } + if (this.Repasse != null && this.Documento != null && this.Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Parcela && this.Repasse.Base.GetValueOrDefault() == BaseRepasse.Transmissao && (!this.Documento.Remessa.HasValue || DateTime.Compare(this.Documento.Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Documento.Remessa.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcelas.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcelas.cs new file mode 100644 index 0000000..c3a7261 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorParcelas.cs @@ -0,0 +1,162 @@ +using Gestor.Model.Domain.Generic; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class VendedorParcelas : DomainBase + { + public ObservableCollection VendedorParcelasList + { + get; + set; + } + + public VendedorParcelas() + { + } + + public List Log(bool restricaoComissao, bool restricaoComissaoPorcentagem) + { + decimal? porcentagemRepasse; + decimal valueOrDefault; + string shortDateString; + string str; + string str1; + string str2; + string str3; + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("VENDEDORES$", "", "") + }; + if (this.VendedorParcelasList != null) + { + foreach (VendedorParcela vendedorParcelasList in this.VendedorParcelasList) + { + observableCollection.Add(new Tuple(" NOME", (vendedorParcelasList.Vendedor == null ? "" : vendedorParcelasList.Vendedor.Nome.ToUpper()), "")); + observableCollection.Add(new Tuple(" TIPO VENDEDOR", (vendedorParcelasList.TipoVendedor == null ? "" : vendedorParcelasList.TipoVendedor.Descricao), "")); + if (!restricaoComissao) + { + ObservableCollection> observableCollection1 = observableCollection; + porcentagemRepasse = vendedorParcelasList.PorcentagemRepasse; + if (!porcentagemRepasse.HasValue) + { + str2 = ""; + } + else + { + porcentagemRepasse = vendedorParcelasList.PorcentagemRepasse; + if (porcentagemRepasse.HasValue) + { + valueOrDefault = porcentagemRepasse.GetValueOrDefault(); + str2 = valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)); + } + else + { + str2 = null; + } + } + observableCollection1.Add(new Tuple(" COMISSÃO", str2, "")); + ObservableCollection> observableCollection2 = observableCollection; + porcentagemRepasse = vendedorParcelasList.ValorRepasse; + if (!porcentagemRepasse.HasValue) + { + str3 = ""; + } + else + { + porcentagemRepasse = vendedorParcelasList.ValorRepasse; + if (porcentagemRepasse.HasValue) + { + valueOrDefault = porcentagemRepasse.GetValueOrDefault(); + str3 = valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)); + } + else + { + str3 = null; + } + } + observableCollection2.Add(new Tuple(" REPASSE", str3, "")); + } + else if (!restricaoComissaoPorcentagem) + { + observableCollection.Add(new Tuple(" COMISSÃO", "", "")); + observableCollection.Add(new Tuple(" REPASSE", "", "")); + } + else + { + ObservableCollection> observableCollection3 = observableCollection; + porcentagemRepasse = vendedorParcelasList.PorcentagemRepasse; + if (!porcentagemRepasse.HasValue) + { + str1 = ""; + } + else + { + porcentagemRepasse = vendedorParcelasList.PorcentagemRepasse; + if (porcentagemRepasse.HasValue) + { + valueOrDefault = porcentagemRepasse.GetValueOrDefault(); + str1 = valueOrDefault.ToString("C", new CultureInfo("pt-BR", false)); + } + else + { + str1 = null; + } + } + observableCollection3.Add(new Tuple(" COMISSÃO", str1, "")); + observableCollection.Add(new Tuple(" REPASSE", "", "")); + } + ObservableCollection> observableCollection4 = observableCollection; + DateTime? dataPrePagamento = vendedorParcelasList.DataPrePagamento; + if (!dataPrePagamento.HasValue) + { + shortDateString = ""; + } + else + { + dataPrePagamento = vendedorParcelasList.DataPrePagamento; + if (dataPrePagamento.HasValue) + { + shortDateString = dataPrePagamento.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection4.Add(new Tuple(" DATA PRÉ PAGAMENTO", shortDateString, "")); + ObservableCollection> observableCollection5 = observableCollection; + dataPrePagamento = vendedorParcelasList.DataPagamento; + if (!dataPrePagamento.HasValue) + { + str = ""; + } + else + { + dataPrePagamento = vendedorParcelasList.DataPagamento; + if (dataPrePagamento.HasValue) + { + str = dataPrePagamento.GetValueOrDefault().ToShortDateString(); + } + else + { + str = null; + } + } + observableCollection5.Add(new Tuple(" DATA PAGAMENTO", str, "")); + } + } + return new List() + { + new TupleList() + { + Tuples = observableCollection + } + }; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorTelefone.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorTelefone.cs new file mode 100644 index 0000000..7117ff5 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorTelefone.cs @@ -0,0 +1,89 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class VendedorTelefone : TelefoneBase, IDomain + { + private string _nome; + + private string _email; + + public string Email + { + get + { + string str = this._email; + if (str == null) + { + return null; + } + return str.ToLower().Trim(); + } + set + { + this._email = value; + } + } + + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + VendedorTelefone vendedorTelefone = this; + return new Func>>(vendedorTelefone.Validate); + } + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public VendedorTelefone() + { + } + + public List> Validate() + { + List> keyValuePairs = base.ValidateBase(false); + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + if (!string.IsNullOrEmpty(this.Email) && this.Email.Length > 100) + { + keyValuePairs.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrEmpty(this.Email) && !this.Email.ValidacaoEmail()) + { + keyValuePairs.AddValue("Email|E-MAIL", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorUsuario.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorUsuario.cs new file mode 100644 index 0000000..a53782f --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/VendedorUsuario.cs @@ -0,0 +1,51 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class VendedorUsuario : DomainBase, IDomain + { + public Gestor.Model.Domain.Seguros.Usuario Usuario + { + get; + set; + } + + public Func>> ValidationEvent + { + get + { + VendedorUsuario vendedorUsuario = this; + return new Func>>(vendedorUsuario.Validate); + } + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public VendedorUsuario() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Usuario == null) + { + keyValuePairs.AddValue("Usuario", Messages.Obrigatorio, true); + } + if (this.Vendedor == null) + { + keyValuePairs.AddValue("Vendedor", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Vida.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Vida.cs new file mode 100644 index 0000000..4d945c4 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Vida.cs @@ -0,0 +1,306 @@ +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Vida : DomainBase, IDomain + { + private string _plano; + + public decimal? CapitalFuncionarios + { + get; + set; + } + + public decimal? CapitalSocios + { + get; + set; + } + + public int? Funcionarios + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public string Observacao + { + get; + set; + } + + public string Plano + { + get + { + string str = this._plano; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._plano = value; + } + } + + public int? Socios + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Vida vida = this; + return new Func>>(vida.Validate); + } + } + + public Vida() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + string str; + string str1; + string str2; + string str3; + string str4; + string str5; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("PLANO", (string.IsNullOrWhiteSpace(item.Vida.Plano) ? "" : item.Vida.Plano), ""), + new Tuple("DESCRIÇÃO", (string.IsNullOrWhiteSpace(item.Descricao) ? "" : item.Descricao.ToUpper()), "") + }; + int? socios = item.Vida.Socios; + if (!socios.HasValue) + { + str = ""; + } + else + { + socios = item.Vida.Socios; + if (socios.HasValue) + { + str = socios.GetValueOrDefault().ToString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("SÓCIOS", str, "")); + decimal? capitalSocios = item.Vida.CapitalSocios; + if (!capitalSocios.HasValue) + { + str1 = ""; + } + else + { + capitalSocios = item.Vida.CapitalSocios; + if (capitalSocios.HasValue) + { + str1 = capitalSocios.GetValueOrDefault().ToString(); + } + else + { + str1 = null; + } + } + observableCollection.Add(new Tuple("CAPITAL SÓCIO", str1, "")); + socios = item.Vida.Funcionarios; + if (!socios.HasValue) + { + str2 = ""; + } + else + { + socios = item.Vida.Funcionarios; + if (socios.HasValue) + { + str2 = socios.GetValueOrDefault().ToString(); + } + else + { + str2 = null; + } + } + observableCollection.Add(new Tuple("FUNCIONÁRIOS", str2, "")); + capitalSocios = item.Vida.CapitalFuncionarios; + if (!capitalSocios.HasValue) + { + str3 = ""; + } + else + { + capitalSocios = item.Vida.CapitalFuncionarios; + if (capitalSocios.HasValue) + { + str3 = capitalSocios.GetValueOrDefault().ToString(); + } + else + { + str3 = null; + } + } + observableCollection.Add(new Tuple("CAPITAL FUNCIONÁRIOS", str3, "")); + socios = item.Vida.Socios; + if (!socios.HasValue) + { + str4 = ""; + } + else + { + socios = item.Vida.Socios; + if (socios.HasValue) + { + str4 = socios.GetValueOrDefault().ToString(); + } + else + { + str4 = null; + } + } + observableCollection.Add(new Tuple("QUANTIDADE DE TITULARES", str4, "")); + socios = item.Vida.Funcionarios; + if (!socios.HasValue) + { + str5 = ""; + } + else + { + socios = item.Vida.Funcionarios; + if (socios.HasValue) + { + str5 = socios.GetValueOrDefault().ToString(); + } + else + { + str5 = null; + } + } + observableCollection.Add(new Tuple("QUANTIDADE DE BENEFICIÁRIOS", str5, "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection1.Add(new Tuple(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", "")); + observableCollection1.Add(new Tuple(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), "")); + decimal premio = cobertura.Premio; + observableCollection1.Add(new Tuple(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Franquia; + observableCollection1.Add(new Tuple(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Lmi; + observableCollection1.Add(new Tuple(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists1; + } + + public List> Validate() + { + decimal num; + bool documento; + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Plano)) + { + keyValuePairs.AddValue("Plano", Messages.Obrigatorio, true); + } + Gestor.Model.Domain.Seguros.Item item = this.Item; + if (item != null) + { + documento = item.Documento; + } + else + { + documento = false; + } + if (!documento) + { + return keyValuePairs; + } + long id = this.Item.Documento.Controle.Ramo.Id; + if (id == (long)7 || id == (long)10 || id == (long)53) + { + int? socios = this.Socios; + if (socios.HasValue) + { + socios = this.Socios; + if (!(socios.GetValueOrDefault() < 0 & socios.HasValue)) + { + goto Label0; + } + } + keyValuePairs.AddValue("Socios|SÓCIOS", Messages.Obrigatorio, true); + Label0: + socios = this.Funcionarios; + if (socios.HasValue) + { + socios = this.Funcionarios; + if (!(socios.GetValueOrDefault() < 0 & socios.HasValue)) + { + goto Label1; + } + } + keyValuePairs.AddValue("Funcionarios|FUNCIONÁRIOS", Messages.Obrigatorio, true); + Label1: + decimal? capitalSocios = this.CapitalSocios; + if (capitalSocios.HasValue) + { + capitalSocios = this.CapitalSocios; + num = new decimal(); + if (!((capitalSocios.GetValueOrDefault() < num) & capitalSocios.HasValue)) + { + goto Label2; + } + } + keyValuePairs.AddValue("CapitalSocios|CAPITAL SÓCIO", Messages.Obrigatorio, true); + Label2: + capitalSocios = this.CapitalFuncionarios; + if (capitalSocios.HasValue) + { + capitalSocios = this.CapitalFuncionarios; + num = new decimal(); + if (!((capitalSocios.GetValueOrDefault() < num) & capitalSocios.HasValue)) + { + return keyValuePairs; + } + } + keyValuePairs.AddValue("CapitalFuncionarios|CAPITAL FUNCIONÁRIO", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoRepasse.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoRepasse.cs new file mode 100644 index 0000000..002f83e --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoRepasse.cs @@ -0,0 +1,159 @@ +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class VinculoRepasse : DomainBase + { + public long IdRepasse + { + get; + set; + } + + public Repasse RepasseVinculo + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.TipoVendedor TipoVendedor + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.TipoVendedor TipoVendedorVinculo + { + get; + set; + } + + public VinculoRepasse() + { + } + + public List> Validate(List vinculos, Repasse repasse) + { + decimal zero; + decimal num; + decimal zero1; + decimal num1; + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.TipoVendedor == null) + { + keyValuePairs.AddValue("TipoVendedor|TIPO VENDEDOR DO REPASSE", Messages.Obrigatorio, true); + } + if (this.IdRepasse == 0) + { + keyValuePairs.AddValue("IdRepasse|REPASSE", Messages.Obrigatorio, true); + } + if (this.TipoVendedorVinculo == null) + { + keyValuePairs.AddValue("TipoVendedorVinculo|TIPO VENDEDOR DO VÍNCULO", Messages.Obrigatorio, true); + } + if (this.RepasseVinculo == null) + { + keyValuePairs.AddValue("RepasseVinculo|REPASSE DO VÍNCULO", Messages.Obrigatorio, true); + } + if (this.TipoVendedor != null && this.TipoVendedorVinculo != null && this.TipoVendedor.Id == this.TipoVendedorVinculo.Id) + { + keyValuePairs.AddValue("TipoVendedor", "TIPO VENDEDOR SELECIONADO NÃO PODE SER O MESMO TIPO VENDEDOR DO VINCULO", true); + } + if (this.IdRepasse > (long)0 && this.RepasseVinculo != null && this.IdRepasse == this.RepasseVinculo.Id) + { + keyValuePairs.AddValue("RepasseVinculo|REPASSE DO VÍNCULO", "NÃO É POSSÍVEL VINCULAR O MESMO REPASSE", true); + } + if (this.RepasseVinculo == null) + { + zero = decimal.Zero; + } + else + { + zero = (this.RepasseVinculo.Tipo.GetValueOrDefault() != TipoRepasse.Percentual || this.RepasseVinculo.Incidencia.GetValueOrDefault() != TipoIncidencia.SobreComissao ? decimal.Zero : this.RepasseVinculo.ValorNovo); + } + decimal num2 = zero; + decimal num3 = (repasse.Tipo.GetValueOrDefault() != TipoRepasse.Percentual || repasse.Incidencia.GetValueOrDefault() != TipoIncidencia.SobreComissao ? decimal.Zero : repasse.ValorNovo) + num2; + decimal num4 = num3; + if (this.TipoVendedor == null) + { + num = decimal.Zero; + } + else + { + num = (vinculos != null ? vinculos.Where((VinculoRepasse x) => { + if (this.TipoVendedor.Id != x.TipoVendedor.Id || x.RepasseVinculo.Tipo.GetValueOrDefault() != TipoRepasse.Percentual) + { + return false; + } + return x.RepasseVinculo.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao; + }).Sum((VinculoRepasse x) => x.RepasseVinculo.ValorNovo) : decimal.Zero); + } + num3 = num4 + num; + if (this.RepasseVinculo == null) + { + zero1 = decimal.Zero; + } + else + { + zero1 = (this.RepasseVinculo.Tipo.GetValueOrDefault() != TipoRepasse.Percentual || this.RepasseVinculo.Incidencia.GetValueOrDefault() != TipoIncidencia.SobreComissao ? decimal.Zero : this.RepasseVinculo.ValorRenovacao); + } + decimal num5 = zero1; + decimal num6 = (repasse.Tipo.GetValueOrDefault() != TipoRepasse.Percentual || repasse.Incidencia.GetValueOrDefault() != TipoIncidencia.SobreComissao ? decimal.Zero : repasse.ValorRenovacao) + num5; + if (this.TipoVendedor == null) + { + num1 = decimal.Zero; + } + else + { + num1 = (vinculos != null ? vinculos.Where((VinculoRepasse x) => { + if (this.TipoVendedor.Id != x.TipoVendedor.Id || x.RepasseVinculo.Tipo.GetValueOrDefault() != TipoRepasse.Percentual) + { + return false; + } + return x.RepasseVinculo.Incidencia.GetValueOrDefault() == TipoIncidencia.SobreComissao; + }).Sum((VinculoRepasse x) => x.RepasseVinculo.ValorRenovacao) : decimal.Zero); + } + decimal num7 = num6 + num1; + if (num3 > new decimal(100)) + { + keyValuePairs.AddValue("RepasseVinculo|VALOR NOVO", "O VALOR DE REPASSE PARA SEGUROS NOVOS ULTRAPASSARÁ 100% DA COMISSÃO RECEBIDA", true); + } + if (num7 > new decimal(100)) + { + keyValuePairs.AddValue("RepasseVinculo|VALOR RENOVAÇÃO", "O VALOR DE REPASSE PARA RENOVAÇÕES ULTRAPASSARÁ 100% DA COMISSÃO RECEBIDA", true); + } + if (vinculos == null || vinculos.Count <= 0) + { + return keyValuePairs; + } + if (this.TipoVendedor != null && this.TipoVendedorVinculo != null && vinculos.Any((VinculoRepasse x) => { + if (x.TipoVendedor.Id != this.TipoVendedor.Id) + { + return false; + } + return x.TipoVendedorVinculo.Id == this.TipoVendedorVinculo.Id; + })) + { + keyValuePairs.AddValue("TipoVendedorVinculo|TIPO VENDEDOR DO VÍNCULO", string.Concat("JÁ EXISTE UM VINCULO DE REPASSE PARA ", this.TipoVendedorVinculo.Descricao), true); + } + if (this.TipoVendedor != null && this.RepasseVinculo != null && vinculos.Any((VinculoRepasse x) => { + if (x.TipoVendedor.Id != this.TipoVendedor.Id) + { + return false; + } + return x.RepasseVinculo.Vendedor.Id == this.RepasseVinculo.Vendedor.Id; + })) + { + keyValuePairs.AddValue("TipoVendedorVinculo|VENDEDOR DO VÍNCULO", string.Concat("JÁ EXISTE UM VINCULO DE REPASSE PARA PARA ", this.RepasseVinculo.Vendedor.Nome), true); + } + return keyValuePairs; + } + } +} \ No newline at end of file diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoVendedor.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoVendedor.cs new file mode 100644 index 0000000..03ef440 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/VinculoVendedor.cs @@ -0,0 +1,25 @@ +using Gestor.Model.Domain.Generic; +using System; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class VinculoVendedor : DomainBase + { + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public bool Vinculado + { + get; + set; + } + + public VinculoVendedor() + { + } + } +} \ No newline at end of file -- cgit v1.2.3