diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-master.tar.gz gestor-master.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs')
| -rw-r--r-- | Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs new file mode 100644 index 0000000..9d71ebe --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Agenda.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +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.Ferramentas; + +public class Agenda : DomainBase, IDomain +{ + public string Nome { get; set; } + + public string Endereco { get; set; } + + public string Cep { get; set; } + + public string Numero { get; set; } + + public string Complemento { get; set; } + + public string Bairro { get; set; } + + public string Cidade { get; set; } + + public string Estado { get; set; } + + public string Observacao { get; set; } + + public ObservableCollection<AgendaTelefone> Telefones { get; set; } + + public ObservableCollection<AgendaEmail> Emails { 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(Nome)) + { + list.AddValue("Nome", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + list.Add(new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""), + new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(Cep) ? "" : Cep, ""), + new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(Endereco) ? "" : Endereco, ""), + new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(Numero) ? "" : Numero, ""), + new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(Complemento) ? "" : Complemento, ""), + new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(Bairro) ? "" : Bairro, ""), + new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(Cidade) ? "" : Cidade, ""), + new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(Estado) ? "" : Estado, ""), + new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, "") + } + }); + ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("TELEFONES$", "", "") + }; + foreach (AgendaTelefone telefone in Telefones) + { + observableCollection.Add(new Tuple<string, string, string>($" TELEFONE {Telefones.IndexOf(telefone) + 1}$", "", "")); + object item; + if (telefone.Tipo.HasValue) + { + TipoTelefone? tipo = telefone.Tipo; + item = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null); + } + else + { + item = ""; + } + observableCollection.Add(new Tuple<string, string, string>(" TIPO", (string)item, "")); + observableCollection.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo.ToUpper(), "")); + observableCollection.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero, "")); + observableCollection.Add(new Tuple<string, string, string>(" DESCRIÇÃO", string.IsNullOrWhiteSpace(telefone.Observacao) ? "" : telefone.Observacao, "")); + } + list.Add(new TupleList + { + Tuples = observableCollection + }); + ObservableCollection<Tuple<string, string, string>> observableCollection2 = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("EMAILS$", "", "") + }; + foreach (AgendaEmail email in Emails) + { + observableCollection2.Add(new Tuple<string, string, string>($" EMAIL {Emails.IndexOf(email) + 1}$", "", "")); + observableCollection2.Add(new Tuple<string, string, string>(" ENDEREÇO DE EMAIL", string.IsNullOrWhiteSpace(email.Email) ? "" : email.Email, "")); + } + list.Add(new TupleList + { + Tuples = observableCollection2 + }); + return list; + } +} |