1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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;
}
}
|