summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs')
-rw-r--r--Codemerx/Gestor.Model/Model.Domain.Seguros/Repasse.cs187
1 files changed, 187 insertions, 0 deletions
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<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Repasse repasse = this;
+ return new Func<List<KeyValuePair<string, string>>>(repasse.Validate);
+ }
+ }
+
+ public decimal ValorNovo
+ {
+ get;
+ set;
+ }
+
+ public decimal ValorRenovacao
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Vendedor Vendedor
+ {
+ get;
+ set;
+ }
+
+ public List<VinculoRepasse> Vinculo
+ {
+ get;
+ set;
+ }
+
+ public Repasse()
+ {
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>()
+ {
+ new TupleList()
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("TIPO", this.Tipo.GetDescription(), ""),
+ new Tuple<string, string, string>("VALOR NOVO", string.Format("{0:##.00}", this.ValorNovo), ""),
+ new Tuple<string, string, string>("VALOR RENOVAÇÃO", string.Format("{0:##.00}", this.ValorRenovacao), ""),
+ new Tuple<string, string, string>("INCIDÊNCIA", this.Incidencia.GetDescription(), ""),
+ new Tuple<string, string, string>("FORMA PAGAMENTO", this.Forma.GetDescription(), ""),
+ new Tuple<string, string, string>("BASE PAGAMENTO", this.Base.GetDescription(), ""),
+ new Tuple<string, string, string>("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "")
+ }
+ }
+ };
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (this.Vendedor == null)
+ {
+ keyValuePairs.AddValue<string, string>("Vendedor", Messages.Obrigatorio, true);
+ }
+ if (TipoRepasse.CoCorretagem != this.Tipo.GetValueOrDefault() && this.ValorNovo == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("ValorNovo", Messages.Obrigatorio, true);
+ }
+ if (TipoRepasse.CoCorretagem != this.Tipo.GetValueOrDefault() && this.ValorRenovacao == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("ValorRenovacao", Messages.Obrigatorio, true);
+ }
+ if (!this.Tipo.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Tipo", Messages.Obrigatorio, true);
+ }
+ if (!this.Incidencia.HasValue && this.Forma.HasValue && this.Forma.GetValueOrDefault() == FormaRepasse.Recebimento)
+ {
+ keyValuePairs.AddValue<string, string>("Incidencia", Messages.Obrigatorio, true);
+ }
+ if (!this.Forma.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Forma", Messages.Obrigatorio, true);
+ }
+ if (this.Forma.HasValue && this.Forma.GetValueOrDefault() != FormaRepasse.Recebimento)
+ {
+ if (!this.Base.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Base", Messages.Obrigatorio, true);
+ }
+ if (this.Forma.GetValueOrDefault() == FormaRepasse.Prazo && this.Base.GetValueOrDefault() != BaseRepasse.Vencimento)
+ {
+ keyValuePairs.AddValue<string, string>("Base", Messages.Invalido, true);
+ }
+ }
+ if (this.Forma.HasValue && this.Forma.GetValueOrDefault() == FormaRepasse.Recebimento && this.Base.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Base", Messages.Invalido, true);
+ }
+ return keyValuePairs;
+ }
+ }
+} \ No newline at end of file