diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Model/Model.Domain.Seguros/Auto.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Gestor.Model/Model.Domain.Seguros/Auto.cs')
| -rw-r--r-- | Gestor.Model/Model.Domain.Seguros/Auto.cs | 793 |
1 files changed, 0 insertions, 793 deletions
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<List<KeyValuePair<string, string>>> ValidationEvent
- {
- get
- {
- Auto auto = this;
- return new Func<List<KeyValuePair<string, string>>>(auto.Validate);
- }
- }
-
- public decimal ValorDeterminado
- {
- get;
- set;
- }
-
- public bool? ZeroKm
- {
- get;
- set;
- }
-
- public Auto()
- {
- }
-
- public static List<TupleList> 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<TupleList> tupleLists = new List<TupleList>();
- TupleList tupleList = new TupleList();
- ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>()
- {
- new Tuple<string, string, string>("CÓDIGO FIPE", (string.IsNullOrWhiteSpace(item.Auto.Fipe) ? "" : item.Auto.Fipe.ToUpper()), ""),
- new Tuple<string, string, string>("CHASSI", (string.IsNullOrWhiteSpace(item.Auto.Chassi) ? "" : item.Auto.Chassi.ToUpper()), ""),
- new Tuple<string, string, string>("PLACA", (string.IsNullOrWhiteSpace(item.Auto.Placa) ? "" : item.Auto.Placa.ToUpper()), ""),
- new Tuple<string, string, string>("FABRICANTE", (item.Auto.Fabricante == null ? "" : item.Auto.Fabricante.Descricao.ToUpper()), ""),
- new Tuple<string, string, string>("MODELO", (string.IsNullOrWhiteSpace(item.Auto.Modelo) ? "" : item.Auto.Modelo.ToUpper()), "")
- };
- 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<string, string, string>("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<string, string, string>("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<string, string, string>("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<string, string, string>("COR", str1, ""));
- observableCollection.Add(new Tuple<string, string, string>("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<string, string, string>("ZERO KM", str2, ""));
- observableCollection.Add(new Tuple<string, string, string>("ANO DE FABRICAÇÃO", (string.IsNullOrWhiteSpace(item.Auto.AnoFabricacao) ? "" : item.Auto.AnoFabricacao.ToUpper()), ""));
- observableCollection.Add(new Tuple<string, string, string>("ANO DO MODELO", (string.IsNullOrWhiteSpace(item.Auto.AnoModelo) ? "" : item.Auto.AnoModelo.ToUpper()), ""));
- observableCollection.Add(new Tuple<string, string, string>("PORTAS", (string.IsNullOrWhiteSpace(item.Auto.Portas) ? "" : item.Auto.Portas), ""));
- observableCollection.Add(new Tuple<string, string, string>("CAPACIDADE", (string.IsNullOrWhiteSpace(item.Auto.Capacidade) ? "" : item.Auto.Capacidade), ""));
- observableCollection.Add(new Tuple<string, string, string>("CEP DE CIRCULAÇÃO", (string.IsNullOrWhiteSpace(item.Auto.RegiaoCirculacao) ? "" : item.Auto.RegiaoCirculacao.ToUpper()), ""));
- observableCollection.Add(new Tuple<string, string, string>("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<string, string, string>("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<string, string, string>("REFERÊNCIA", description3, ""));
- decimal porcentagemReferencia = item.Auto.PorcentagemReferencia;
- observableCollection.Add(new Tuple<string, string, string>("PORCENTAGEM DE REFERÊNCIA", porcentagemReferencia.ToString(new CultureInfo("pt-BR")), ""));
- observableCollection.Add(new Tuple<string, string, string>("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<string, string, string>("FINANCEIRO/ALIENADO", str3, ""));
- if (!item.Auto.Pcd.HasValue)
- {
- str4 = "";
- }
- else
- {
- str4 = (item.Auto.Pcd.Value ? "SIM" : "NÃO");
- }
- observableCollection.Add(new Tuple<string, string, string>("PCD", str4, ""));
- if (!item.Auto.Blindagem.HasValue)
- {
- str5 = "";
- }
- else
- {
- str5 = (item.Auto.Blindagem.Value ? "SIM" : "NÃO");
- }
- observableCollection.Add(new Tuple<string, string, string>("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<string, string, string>("ISENÇÃO", description4, ""));
- observableCollection.Add(new Tuple<string, string, string>("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<string, string, string>("TIPO DE COBERTURA", description5, ""));
- if (!item.Auto.Pcd.HasValue)
- {
- str6 = "";
- }
- else
- {
- str6 = (item.Auto.KitGas.Value ? "SIM" : "NÃO");
- }
- observableCollection.Add(new Tuple<string, string, string>("KIT GÁS", str6, ""));
- observableCollection.Add(new Tuple<string, string, string>("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(item.Auto.Observacao) ? "" : item.Auto.Observacao.ToUpper()), ""));
- tupleList.Tuples = observableCollection;
- tupleLists.Add(tupleList);
- List<TupleList> tupleLists1 = tupleLists;
- ObservableCollection<Tuple<string, string, string>> observableCollection1 = new ObservableCollection<Tuple<string, string, string>>()
- {
- new Tuple<string, string, string>("COBERTURAS$", "", "")
- };
- foreach (Cobertura cobertura in item.Coberturas)
- {
- observableCollection1.Add(new Tuple<string, string, string>(string.Format(" COBERTURA {0}$", item.Coberturas.IndexOf(cobertura) + 1), "", ""));
- observableCollection1.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", (string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper()), ""));
- porcentagemReferencia = cobertura.Premio;
- observableCollection1.Add(new Tuple<string, string, string>(" PRÊMIO", porcentagemReferencia.ToString("C", new CultureInfo("pt-BR", false)), ""));
- porcentagemReferencia = cobertura.Franquia;
- observableCollection1.Add(new Tuple<string, string, string>(" FRANQUIA", porcentagemReferencia.ToString("C", new CultureInfo("pt-BR", false)), ""));
- porcentagemReferencia = cobertura.Lmi;
- observableCollection1.Add(new Tuple<string, string, string>(" L.M.I.", porcentagemReferencia.ToString("C", new CultureInfo("pt-BR", false)), ""));
- }
- tupleLists1.Add(new TupleList()
- {
- Tuples = observableCollection1
- });
- return tupleLists1;
- }
-
- public List<KeyValuePair<string, string>> Validate(bool chassiInvalido, bool fabricanteBranco)
- {
- this._chassiInvalido = chassiInvalido;
- this._fabricanteBranco = fabricanteBranco;
- return this.Validate();
- }
-
- public List<KeyValuePair<string, string>> Validate()
- {
- int num;
- int num1;
- List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
- if (string.IsNullOrWhiteSpace(this.Chassi))
- {
- keyValuePairs.AddValue<string, string>("Chassi", Messages.Obrigatorio, true);
- }
- else if (!this._chassiInvalido && !this.Chassi.ValidacaoChassi())
- {
- keyValuePairs.AddValue<string, string>("Chassi", Messages.Invalido, true);
- }
- if (!this._fabricanteBranco && (this.Fabricante == null || this.Fabricante.Id == 0))
- {
- keyValuePairs.AddValue<string, string>("Fabricante", Messages.Obrigatorio, true);
- }
- if (string.IsNullOrWhiteSpace(this.Modelo))
- {
- keyValuePairs.AddValue<string, string>("Modelo", Messages.Obrigatorio, true);
- }
- else if (this.Modelo.Length > 250)
- {
- keyValuePairs.AddValue<string, string>("Modelo", string.Format(Messages.MaiorQueLimite, 250), true);
- }
- if (!this.Categoria.HasValue)
- {
- keyValuePairs.AddValue<string, string>("Categoria", Messages.Obrigatorio, true);
- }
- if (!this.Combustivel.HasValue)
- {
- keyValuePairs.AddValue<string, string>("Combustivel|COMBUSTÍVEL", Messages.Obrigatorio, true);
- }
- if (!this.ZeroKm.HasValue)
- {
- keyValuePairs.AddValue<string, string>("ZeroKm|ZERO KM", Messages.Obrigatorio, true);
- }
- if (this.ZeroKm.HasValue && !this.ZeroKm.Value && string.IsNullOrWhiteSpace(this.Placa))
- {
- keyValuePairs.AddValue<string, string>("Placa", Messages.Obrigatorio, true);
- }
- else if (this.ZeroKm.HasValue && !this.ZeroKm.Value && !this.Placa.ValidacaoPlaca())
- {
- keyValuePairs.AddValue<string, string>("Placa", Messages.Invalido, true);
- }
- if (string.IsNullOrWhiteSpace(this.AnoFabricacao))
- {
- keyValuePairs.AddValue<string, string>("AnoFabricacao|ANO DE FABRICAÇÃO", Messages.Obrigatorio, true);
- }
- else if (!this.AnoFabricacao.ValidacaoFabricacao())
- {
- keyValuePairs.AddValue<string, string>("AnoFabricacao|ANO DE FABRICAÇÃO", Messages.Invalido, true);
- }
- if (string.IsNullOrWhiteSpace(this.AnoModelo))
- {
- keyValuePairs.AddValue<string, string>("AnoModelo|ANO DO MODELO", Messages.Obrigatorio, true);
- }
- else if (!this.AnoModelo.ValidacaoModelo())
- {
- keyValuePairs.AddValue<string, string>("AnoModelo|ANO DO MODELO", Messages.Invalido, true);
- }
- if (string.IsNullOrWhiteSpace(this.Portas))
- {
- if (this.Categoria.GetValueOrDefault() != Gestor.Model.Common.Categoria.Motocicleta)
- {
- keyValuePairs.AddValue<string, string>("Portas", Messages.Obrigatorio, true);
- }
- else
- {
- this.Portas = "0";
- }
- }
- else if (!int.TryParse(this.Portas, out num1))
- {
- keyValuePairs.AddValue<string, string>("Portas", Messages.Invalido, true);
- }
- if (string.IsNullOrWhiteSpace(this.Capacidade))
- {
- keyValuePairs.AddValue<string, string>("Capacidade", Messages.Obrigatorio, true);
- }
- else if (!int.TryParse(this.Capacidade, out num1))
- {
- keyValuePairs.AddValue<string, string>("Capacidade", Messages.Invalido, true);
- }
- if (!this.Financiado.HasValue)
- {
- keyValuePairs.AddValue<string, string>("Financiado", Messages.Obrigatorio, true);
- }
- if (!string.IsNullOrWhiteSpace(this.Ci) && this.Ci.Length > 20)
- {
- keyValuePairs.AddValue<string, string>("Ci|C.I.", string.Format(Messages.MaiorQueLimite, 20), true);
- }
- if (string.IsNullOrWhiteSpace(this.Fipe))
- {
- keyValuePairs.AddValue<string, string>("Fipe|CÓDIGO FIPE", Messages.Obrigatorio, true);
- }
- else if (!this.Fipe.ValidaFipe())
- {
- keyValuePairs.AddValue<string, string>("Fipe|CÓDIGO FIPE", Messages.Invalido, true);
- }
- if (int.TryParse(this.Capacidade, out num) && num > 99)
- {
- keyValuePairs.AddValue<string, string>("Capacidade", Messages.Invalido, true);
- }
- if (!this.UsoVeiculo.HasValue)
- {
- keyValuePairs.AddValue<string, string>("UsoVeiculo", Messages.Obrigatorio, true);
- }
- if (!string.IsNullOrEmpty(this.Renavam) && this.Renavam.Replace(".", "").Length > 11)
- {
- keyValuePairs.AddValue<string, string>("Renavam", Messages.Invalido, true);
- }
- return keyValuePairs;
- }
- }
-}
\ No newline at end of file |