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 --- Gestor.Model/Model.Domain.Seguros/Vida.cs | 306 ++++++++++++++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 Gestor.Model/Model.Domain.Seguros/Vida.cs (limited to 'Gestor.Model/Model.Domain.Seguros/Vida.cs') diff --git a/Gestor.Model/Model.Domain.Seguros/Vida.cs b/Gestor.Model/Model.Domain.Seguros/Vida.cs new file mode 100644 index 0000000..4d945c4 --- /dev/null +++ b/Gestor.Model/Model.Domain.Seguros/Vida.cs @@ -0,0 +1,306 @@ +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 Vida : DomainBase, IDomain + { + private string _plano; + + public decimal? CapitalFuncionarios + { + get; + set; + } + + public decimal? CapitalSocios + { + get; + set; + } + + public int? Funcionarios + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Item Item + { + get; + set; + } + + public string Observacao + { + get; + set; + } + + public string Plano + { + get + { + string str = this._plano; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._plano = value; + } + } + + public int? Socios + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Vida vida = this; + return new Func>>(vida.Validate); + } + } + + public Vida() + { + } + + public static List Log(Gestor.Model.Domain.Seguros.Item item) + { + string str; + string str1; + string str2; + string str3; + string str4; + string str5; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("PLANO", (string.IsNullOrWhiteSpace(item.Vida.Plano) ? "" : item.Vida.Plano), ""), + new Tuple("DESCRIÇÃO", (string.IsNullOrWhiteSpace(item.Descricao) ? "" : item.Descricao.ToUpper()), "") + }; + int? socios = item.Vida.Socios; + if (!socios.HasValue) + { + str = ""; + } + else + { + socios = item.Vida.Socios; + if (socios.HasValue) + { + str = socios.GetValueOrDefault().ToString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("SÓCIOS", str, "")); + decimal? capitalSocios = item.Vida.CapitalSocios; + if (!capitalSocios.HasValue) + { + str1 = ""; + } + else + { + capitalSocios = item.Vida.CapitalSocios; + if (capitalSocios.HasValue) + { + str1 = capitalSocios.GetValueOrDefault().ToString(); + } + else + { + str1 = null; + } + } + observableCollection.Add(new Tuple("CAPITAL SÓCIO", str1, "")); + socios = item.Vida.Funcionarios; + if (!socios.HasValue) + { + str2 = ""; + } + else + { + socios = item.Vida.Funcionarios; + if (socios.HasValue) + { + str2 = socios.GetValueOrDefault().ToString(); + } + else + { + str2 = null; + } + } + observableCollection.Add(new Tuple("FUNCIONÁRIOS", str2, "")); + capitalSocios = item.Vida.CapitalFuncionarios; + if (!capitalSocios.HasValue) + { + str3 = ""; + } + else + { + capitalSocios = item.Vida.CapitalFuncionarios; + if (capitalSocios.HasValue) + { + str3 = capitalSocios.GetValueOrDefault().ToString(); + } + else + { + str3 = null; + } + } + observableCollection.Add(new Tuple("CAPITAL FUNCIONÁRIOS", str3, "")); + socios = item.Vida.Socios; + if (!socios.HasValue) + { + str4 = ""; + } + else + { + socios = item.Vida.Socios; + if (socios.HasValue) + { + str4 = socios.GetValueOrDefault().ToString(); + } + else + { + str4 = null; + } + } + observableCollection.Add(new Tuple("QUANTIDADE DE TITULARES", str4, "")); + socios = item.Vida.Funcionarios; + if (!socios.HasValue) + { + str5 = ""; + } + else + { + socios = item.Vida.Funcionarios; + if (socios.HasValue) + { + str5 = socios.GetValueOrDefault().ToString(); + } + else + { + str5 = null; + } + } + observableCollection.Add(new Tuple("QUANTIDADE DE BENEFICIÁRIOS", str5, "")); + 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()), "")); + decimal premio = cobertura.Premio; + observableCollection1.Add(new Tuple(" PRÊMIO", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Franquia; + observableCollection1.Add(new Tuple(" FRANQUIA", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + premio = cobertura.Lmi; + observableCollection1.Add(new Tuple(" L.M.I.", premio.ToString("C", new CultureInfo("pt-BR", false)), "")); + } + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + return tupleLists1; + } + + public List> Validate() + { + decimal num; + bool documento; + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Plano)) + { + keyValuePairs.AddValue("Plano", Messages.Obrigatorio, true); + } + Gestor.Model.Domain.Seguros.Item item = this.Item; + if (item != null) + { + documento = item.Documento; + } + else + { + documento = false; + } + if (!documento) + { + return keyValuePairs; + } + long id = this.Item.Documento.Controle.Ramo.Id; + if (id == (long)7 || id == (long)10 || id == (long)53) + { + int? socios = this.Socios; + if (socios.HasValue) + { + socios = this.Socios; + if (!(socios.GetValueOrDefault() < 0 & socios.HasValue)) + { + goto Label0; + } + } + keyValuePairs.AddValue("Socios|SÓCIOS", Messages.Obrigatorio, true); + Label0: + socios = this.Funcionarios; + if (socios.HasValue) + { + socios = this.Funcionarios; + if (!(socios.GetValueOrDefault() < 0 & socios.HasValue)) + { + goto Label1; + } + } + keyValuePairs.AddValue("Funcionarios|FUNCIONÁRIOS", Messages.Obrigatorio, true); + Label1: + decimal? capitalSocios = this.CapitalSocios; + if (capitalSocios.HasValue) + { + capitalSocios = this.CapitalSocios; + num = new decimal(); + if (!((capitalSocios.GetValueOrDefault() < num) & capitalSocios.HasValue)) + { + goto Label2; + } + } + keyValuePairs.AddValue("CapitalSocios|CAPITAL SÓCIO", Messages.Obrigatorio, true); + Label2: + capitalSocios = this.CapitalFuncionarios; + if (capitalSocios.HasValue) + { + capitalSocios = this.CapitalFuncionarios; + num = new decimal(); + if (!((capitalSocios.GetValueOrDefault() < num) & capitalSocios.HasValue)) + { + return keyValuePairs; + } + } + keyValuePairs.AddValue("CapitalFuncionarios|CAPITAL FUNCIONÁRIO", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3