From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Gestor.Model/Model.Domain.Seguros/Repasse.cs | 187 +++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs') diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs new file mode 100644 index 0000000..691586a --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs @@ -0,0 +1,187 @@ +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.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Repasse : DomainBase, IDomain + { + private string _incidenciaVendedor = ""; + + private string _pgtoVendedor = ""; + + public bool Ativo + { + get; + set; + } + + public BaseRepasse? Base + { + get; + set; + } + + public FormaRepasse? Forma + { + get; + set; + } + + public TipoIncidencia? Incidencia + { + get; + set; + } + + public string IncidenciaVendedor + { + get + { + string description = this.Incidencia.GetDescription(); + string str = description; + this._incidenciaVendedor = description; + return str; + } + } + + public string PagtoVendedor + { + get + { + string description = this.Forma.GetDescription(); + string str = description; + this._pgtoVendedor = description; + return str; + } + } + + public Gestor.Model.Domain.Seguros.Ramo Ramo + { + get; + set; + } + + public long? Seguradora + { + get; + set; + } + + public TipoRepasse? Tipo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Repasse repasse = this; + return new Func>>(repasse.Validate); + } + } + + public decimal ValorNovo + { + get; + set; + } + + public decimal ValorRenovacao + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + public List Vinculo + { + get; + set; + } + + public Repasse() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("TIPO", this.Tipo.GetDescription(), ""), + new Tuple("VALOR NOVO", string.Format("{0:##.00}", this.ValorNovo), ""), + new Tuple("VALOR RENOVAÇÃO", string.Format("{0:##.00}", this.ValorRenovacao), ""), + new Tuple("INCIDÊNCIA", this.Incidencia.GetDescription(), ""), + new Tuple("FORMA PAGAMENTO", this.Forma.GetDescription(), ""), + new Tuple("BASE PAGAMENTO", this.Base.GetDescription(), ""), + new Tuple("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "") + } + } + }; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Vendedor == null) + { + keyValuePairs.AddValue("Vendedor", Messages.Obrigatorio, true); + } + if (TipoRepasse.CoCorretagem != this.Tipo.GetValueOrDefault() && this.ValorNovo == decimal.Zero) + { + keyValuePairs.AddValue("ValorNovo", Messages.Obrigatorio, true); + } + if (TipoRepasse.CoCorretagem != this.Tipo.GetValueOrDefault() && this.ValorRenovacao == decimal.Zero) + { + keyValuePairs.AddValue("ValorRenovacao", Messages.Obrigatorio, true); + } + if (!this.Tipo.HasValue) + { + keyValuePairs.AddValue("Tipo", Messages.Obrigatorio, true); + } + if (!this.Incidencia.HasValue && this.Forma.HasValue && this.Forma.GetValueOrDefault() == FormaRepasse.Recebimento) + { + keyValuePairs.AddValue("Incidencia", Messages.Obrigatorio, true); + } + if (!this.Forma.HasValue) + { + keyValuePairs.AddValue("Forma", Messages.Obrigatorio, true); + } + if (this.Forma.HasValue && this.Forma.GetValueOrDefault() != FormaRepasse.Recebimento) + { + if (!this.Base.HasValue) + { + keyValuePairs.AddValue("Base", Messages.Obrigatorio, true); + } + if (this.Forma.GetValueOrDefault() == FormaRepasse.Prazo && this.Base.GetValueOrDefault() != BaseRepasse.Vencimento) + { + keyValuePairs.AddValue("Base", Messages.Invalido, true); + } + } + if (this.Forma.HasValue && this.Forma.GetValueOrDefault() == FormaRepasse.Recebimento && this.Base.HasValue) + { + keyValuePairs.AddValue("Base", Messages.Invalido, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3