From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- .../Model.Domain.Seguros/RiscosDiversos.cs | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs (limited to 'Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs') diff --git a/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs b/Gestor.Model/Model.Domain.Seguros/RiscosDiversos.cs new file mode 100644 index 0000000..1f8772f --- /dev/null +++ b/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 -- cgit v1.2.3