From 0440c722a221b8068bbf388c1c0c51f0faff0451 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 14:17:46 -0300 Subject: some dlls --- .../Gestor.Model.Domain.Seguros/Repasse.cs | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs') diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs new file mode 100644 index 0000000..4beadaf --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Repasse.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Seguros; + +public class Repasse : DomainBase, IDomain +{ + private string _incidenciaVendedor = ""; + + private string _pgtoVendedor = ""; + + public Vendedor Vendedor { get; set; } + + public long? Seguradora { get; set; } + + public Ramo Ramo { get; set; } + + public decimal ValorNovo { get; set; } + + public decimal ValorRenovacao { get; set; } + + public TipoRepasse? Tipo { get; set; } + + public TipoIncidencia? Incidencia { get; set; } + + public FormaRepasse? Forma { get; set; } + + public BaseRepasse? Base { get; set; } + + public bool Ativo { get; set; } + + public List Vinculo { get; set; } + + public string IncidenciaVendedor => _incidenciaVendedor = Incidencia.GetDescription(); + + public string PagtoVendedor => _pgtoVendedor = Forma.GetDescription(); + + [JsonIgnore] + public Func>> ValidationEvent => Validate; + + public List> Validate() + { + List> list = ValidationHelper.AddValue(); + if (Vendedor == null) + { + list.AddValue("Vendedor", Messages.Obrigatorio); + } + if (TipoRepasse.CoCorretagem != Tipo.GetValueOrDefault() && ValorNovo == 0m) + { + list.AddValue("ValorNovo", Messages.Obrigatorio); + } + if (TipoRepasse.CoCorretagem != Tipo.GetValueOrDefault() && ValorRenovacao == 0m) + { + list.AddValue("ValorRenovacao", Messages.Obrigatorio); + } + if (!Tipo.HasValue) + { + list.AddValue("Tipo", Messages.Obrigatorio); + } + if (!Incidencia.HasValue && Forma.HasValue && Forma.GetValueOrDefault() == FormaRepasse.Recebimento) + { + list.AddValue("Incidencia", Messages.Obrigatorio); + } + if (!Forma.HasValue) + { + list.AddValue("Forma", Messages.Obrigatorio); + } + if (Forma.HasValue && Forma.GetValueOrDefault() != FormaRepasse.Recebimento) + { + if (!Base.HasValue) + { + list.AddValue("Base", Messages.Obrigatorio); + } + if (Forma.GetValueOrDefault() == FormaRepasse.Prazo && Base.GetValueOrDefault() != BaseRepasse.Vencimento) + { + list.AddValue("Base", Messages.Invalido); + } + } + if (Forma.HasValue && Forma.GetValueOrDefault() == FormaRepasse.Recebimento && Base.HasValue) + { + list.AddValue("Base", Messages.Invalido); + } + return list; + } + + public List Log() + { + return new List + { + new TupleList + { + Tuples = new ObservableCollection> + { + new Tuple("TIPO", Tipo.GetDescription(), ""), + new Tuple("VALOR NOVO", $"{ValorNovo:##.00}", ""), + new Tuple("VALOR RENOVAÇÃO", $"{ValorRenovacao:##.00}", ""), + new Tuple("INCIDÊNCIA", Incidencia.GetDescription(), ""), + new Tuple("FORMA PAGAMENTO", Forma.GetDescription(), ""), + new Tuple("BASE PAGAMENTO", Base.GetDescription(), ""), + new Tuple("ATIVO", Ativo ? "SIM" : "NÃO", "") + } + } + }; + } +} -- cgit v1.2.3