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 --- Gestor.Model/Model.Domain.Seguros/Auto.cs | 793 ------------------------------ 1 file changed, 793 deletions(-) delete mode 100644 Gestor.Model/Model.Domain.Seguros/Auto.cs (limited to 'Gestor.Model/Model.Domain.Seguros/Auto.cs') diff --git a/Gestor.Model/Model.Domain.Seguros/Auto.cs b/Gestor.Model/Model.Domain.Seguros/Auto.cs deleted file mode 100644 index 25b7903..0000000 --- a/Gestor.Model/Model.Domain.Seguros/Auto.cs +++ /dev/null @@ -1,793 +0,0 @@ -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 -- cgit v1.2.3