diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-master.tar.gz gestor-master.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs')
| -rw-r--r-- | Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs new file mode 100644 index 0000000..73c7e8e --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Consorcio.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Seguros; + +public class Consorcio : DomainBase, IDomain +{ + private string _bensConsorcio; + + private string _grupo; + + private string _cota; + + private decimal? _valorCredito; + + private string _observacao; + + public Item Item { get; set; } + + public string BensConsorcio + { + get + { + return _bensConsorcio?.ToUpper(); + } + set + { + _bensConsorcio = value; + } + } + + public string Grupo + { + get + { + return _grupo?.ToUpper(); + } + set + { + _grupo = value; + } + } + + public string Cota + { + get + { + return _cota?.ToUpper(); + } + set + { + _cota = value; + } + } + + public decimal? ValorCredito + { + get + { + return _valorCredito; + } + set + { + _valorCredito = value; + } + } + + public string Observacao + { + get + { + return _observacao?.ToUpper(); + } + set + { + _observacao = value; + } + } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(BensConsorcio)) + { + list.AddValue("BensConsorcio", Messages.Obrigatorio); + } + return list; + } + + public static List<TupleList> Log(Item item) + { + List<TupleList> list = new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(item.Consorcio.BensConsorcio) ? "" : item.Consorcio.BensConsorcio, ""), + new Tuple<string, string, string>("GRUPO", string.IsNullOrWhiteSpace(item.Consorcio.Grupo) ? "" : item.Consorcio.Grupo, ""), + new Tuple<string, string, string>("COTA", string.IsNullOrWhiteSpace(item.Consorcio.Cota) ? "" : item.Consorcio.Cota, ""), + new Tuple<string, string, string>("GRUPO", (!item.Consorcio.ValorCredito.HasValue) ? "" : item.Consorcio.ValorCredito?.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), "") + } + } + }; + ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("COBERTURAS$", "", "") + }; + foreach (Cobertura cobertura in item.Coberturas) + { + observableCollection.Add(new Tuple<string, string, string>($" COBERTURA {item.Coberturas.IndexOf(cobertura) + 1}$", "", "")); + observableCollection.Add(new Tuple<string, string, string>(" OBSERVAÇÃO", string.IsNullOrWhiteSpace(cobertura.Observacao) ? "" : cobertura.Observacao.ToUpper(), "")); + observableCollection.Add(new Tuple<string, string, string>(" PRÊMIO", cobertura.Premio.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), "")); + observableCollection.Add(new Tuple<string, string, string>(" FRANQUIA", cobertura.Franquia.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), "")); + observableCollection.Add(new Tuple<string, string, string>(" L.M.I.", cobertura.Lmi.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), "")); + } + list.Add(new TupleList + { + Tuples = observableCollection + }); + return list; + } +} |