summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs')
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs114
1 files changed, 114 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs
new file mode 100644
index 0000000..adefad5
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Gestor.Model.Validation;
+using Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Financeiro;
+
+public class Planos : DomainBase, IDomain
+{
+ private string _descricao;
+
+ private Sinal _sinal;
+
+ private string _nome;
+
+ public bool Selecionado { get; set; }
+
+ [Log(true)]
+ [Name(true)]
+ [Description("DESCRIÇÃO")]
+ public string Descricao
+ {
+ get
+ {
+ return _descricao?.ToUpper();
+ }
+ set
+ {
+ _descricao = value;
+ string text = ((Sinal == Sinal.Credito) ? "(+)" : "(-)");
+ Nome = value.ToUpper() + " " + text;
+ }
+ }
+
+ [Log(true)]
+ public string Nome
+ {
+ get
+ {
+ return _nome.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Log(true)]
+ [Description("TIPO CONTA")]
+ public TipoConta TipoConta { get; set; }
+
+ [Log(true)]
+ public bool Ativo { get; set; }
+
+ [Log(true)]
+ public Sinal Sinal
+ {
+ get
+ {
+ return _sinal;
+ }
+ set
+ {
+ _sinal = value;
+ string text = ((value == Sinal.Credito) ? "(+)" : "(-)");
+ Nome = Descricao + " " + text;
+ }
+ }
+
+ [Log(true)]
+ public Plano Plano { get; set; }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(Descricao))
+ {
+ list.AddValue("Descricao", Messages.Obrigatorio);
+ }
+ if (Plano == null)
+ {
+ list.AddValue("Plano", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("PLANO", (Plano == null) ? "" : Plano?.Descricao, ""),
+ new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "")
+ };
+ _ = Sinal;
+ obj.Add(new Tuple<string, string, string>("SINAL", Sinal.GetDescription(), ""));
+ tupleList.Tuples = obj;
+ list.Add(tupleList);
+ return list;
+ }
+}