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 /Codemerx/Gestor.Model/Model.Domain.Seguros/Aeronautico.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Aeronautico.cs')
| -rw-r--r-- | Codemerx/Gestor.Model/Model.Domain.Seguros/Aeronautico.cs | 475 |
1 files changed, 475 insertions, 0 deletions
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<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Aeronautico aeronautico = this;
+ return new Func<List<KeyValuePair<string, string>>>(aeronautico.Validate);
+ }
+ }
+
+ public DateTime? Vistoria
+ {
+ get;
+ set;
+ }
+
+ public Aeronautico()
+ {
+ }
+
+ public static List<TupleList> Log(Gestor.Model.Domain.Seguros.Item item)
+ {
+ string str;
+ string str1;
+ string str2;
+ string str3;
+ string shortDateString;
+ 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>("TIPO DE AERONAVE", item.Aeronautico.Tipo.GetDescription(), ""),
+ new Tuple<string, string, string>("FABRICANTE", (string.IsNullOrWhiteSpace(item.Aeronautico.Fabricante) ? "" : item.Aeronautico.Fabricante.ToUpper()), ""),
+ new Tuple<string, string, string>("MODELO", (string.IsNullOrWhiteSpace(item.Aeronautico.Modelo) ? "" : item.Aeronautico.Modelo.ToUpper()), ""),
+ new Tuple<string, string, string>("REGISTRO", (string.IsNullOrWhiteSpace(item.Aeronautico.Serie) ? "" : item.Aeronautico.Serie.ToUpper()), ""),
+ new Tuple<string, string, string>("PREFIXO", (string.IsNullOrWhiteSpace(item.Aeronautico.Prefixo) ? "" : item.Aeronautico.Prefixo.ToUpper()), "")
+ };
+ 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<string, string, string>("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<string, string, string>("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<string, string, string>("PASSAGEIROS", str2, ""));
+ observableCollection.Add(new Tuple<string, string, string>("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<string, string, string>("PESO", str3, ""));
+ observableCollection.Add(new Tuple<string, string, string>("NAVEGAÇÃO", (string.IsNullOrWhiteSpace(item.Aeronautico.Navegacao) ? "" : item.Aeronautico.Navegacao.ToUpper()), ""));
+ observableCollection.Add(new Tuple<string, string, string>("CERTIFICADO", (string.IsNullOrWhiteSpace(item.Aeronautico.Certificado) ? "" : item.Aeronautico.Certificado.ToUpper()), ""));
+ observableCollection.Add(new Tuple<string, string, string>("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<string, string, string>("VALIDADE DA VISTORIA", shortDateString, ""));
+ observableCollection.Add(new Tuple<string, string, string>("OBSERVAÇÃO", (string.IsNullOrWhiteSpace(item.Aeronautico.Observacao) ? "" : item.Aeronautico.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()), ""));
+ decimal premio = cobertura.Premio;
+ observableCollection1.Add(new Tuple<string, string, string>(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ premio = cobertura.Franquia;
+ observableCollection1.Add(new Tuple<string, string, string>(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ premio = cobertura.Lmi;
+ observableCollection1.Add(new Tuple<string, string, string>(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ }
+ tupleLists1.Add(new TupleList()
+ {
+ Tuples = observableCollection1
+ });
+ return tupleLists1;
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(this.Fabricante))
+ {
+ keyValuePairs.AddValue<string, string>("Fabricante", Messages.Obrigatorio, true);
+ }
+ else if (this.Fabricante != null && this.Fabricante.Length > 60)
+ {
+ keyValuePairs.AddValue<string, string>("Fabricante", string.Format(Messages.MaiorQueLimite, 60), true);
+ }
+ if ((int)this.Tipo == 0)
+ {
+ keyValuePairs.AddValue<string, string>("Tipo", Messages.Obrigatorio, true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Modelo))
+ {
+ keyValuePairs.AddValue<string, string>("Modelo", Messages.Obrigatorio, true);
+ }
+ else if (this.Modelo.Length > 60)
+ {
+ keyValuePairs.AddValue<string, string>("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<string, string>("Vistoria", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Serie))
+ {
+ keyValuePairs.AddValue<string, string>("Serie", Messages.Obrigatorio, true);
+ }
+ else if (this.Serie.Length > 30)
+ {
+ keyValuePairs.AddValue<string, string>("Serie", string.Format(Messages.MaiorQueLimite, 30), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Prefixo))
+ {
+ keyValuePairs.AddValue<string, string>("Prefixo", Messages.Obrigatorio, true);
+ }
+ else if (this.Prefixo.Length > 30)
+ {
+ keyValuePairs.AddValue<string, string>("Prefixo", string.Format(Messages.MaiorQueLimite, 30), true);
+ }
+ if (!this.Fabricacao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Fabricacao", Messages.Obrigatorio, true);
+ }
+ else if (!this.Fabricacao.Value.ToString().ValidacaoFabricacao())
+ {
+ keyValuePairs.AddValue<string, string>("Fabricacao", Messages.Invalido, true);
+ }
+ if (!this.Tripulantes.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Tripulantes", Messages.Obrigatorio, true);
+ }
+ if (!this.Passageiros.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Passageiros", Messages.Obrigatorio, true);
+ }
+ if (string.IsNullOrWhiteSpace(this.MarinaAero))
+ {
+ keyValuePairs.AddValue<string, string>("MarinaAero", Messages.Obrigatorio, true);
+ }
+ else if (this.MarinaAero.Length > 60)
+ {
+ keyValuePairs.AddValue<string, string>("MarinaAero", string.Format(Messages.MaiorQueLimite, 60), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Certificado) && this.Certificado.Length > 60)
+ {
+ keyValuePairs.AddValue<string, string>("Certificado", string.Format(Messages.MaiorQueLimite, 60), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Casco) && this.Tipo.Categoria() == "Aero")
+ {
+ keyValuePairs.AddValue<string, string>("Casco", Messages.Obrigatorio, true);
+ }
+ else if (this.Tipo.Categoria() != "Aero" && this.Casco != null && this.Casco.Length > 60)
+ {
+ keyValuePairs.AddValue<string, string>("Casco", string.Format(Messages.MaiorQueLimite, 60), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Navegacao) && this.Tipo.Categoria() != "Aero" && this.Navegacao.Length > 60)
+ {
+ keyValuePairs.AddValue<string, string>("Navegacao", string.Format(Messages.MaiorQueLimite, 60), true);
+ }
+ if (!this.Vistoria.HasValue && this.Tipo.Categoria() == "Aero")
+ {
+ keyValuePairs.AddValue<string, string>("Vistoria", Messages.Obrigatorio, true);
+ }
+ if (!this.Peso.HasValue && this.Tipo.Categoria() == "Aero")
+ {
+ keyValuePairs.AddValue<string, string>("Peso", Messages.Obrigatorio, true);
+ }
+ return keyValuePairs;
+ }
+ }
+}
\ No newline at end of file |