summaryrefslogtreecommitdiff
path: root/Gestor.Model/Model.Domain.Ferramentas/Agenda.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Model/Model.Domain.Ferramentas/Agenda.cs')
-rw-r--r--Gestor.Model/Model.Domain.Ferramentas/Agenda.cs178
1 files changed, 178 insertions, 0 deletions
diff --git a/Gestor.Model/Model.Domain.Ferramentas/Agenda.cs b/Gestor.Model/Model.Domain.Ferramentas/Agenda.cs
new file mode 100644
index 0000000..263f0bc
--- /dev/null
+++ b/Gestor.Model/Model.Domain.Ferramentas/Agenda.cs
@@ -0,0 +1,178 @@
+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;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.CompilerServices;
+
+namespace Gestor.Model.Domain.Ferramentas
+{
+ public class Agenda : DomainBase, IDomain
+ {
+ public string Bairro
+ {
+ get;
+ set;
+ }
+
+ public string Cep
+ {
+ get;
+ set;
+ }
+
+ public string Cidade
+ {
+ get;
+ set;
+ }
+
+ public string Complemento
+ {
+ get;
+ set;
+ }
+
+ public ObservableCollection<AgendaEmail> Emails
+ {
+ get;
+ set;
+ }
+
+ public string Endereco
+ {
+ get;
+ set;
+ }
+
+ public string Estado
+ {
+ get;
+ set;
+ }
+
+ public string Nome
+ {
+ get;
+ set;
+ }
+
+ public string Numero
+ {
+ get;
+ set;
+ }
+
+ public string Observacao
+ {
+ get;
+ set;
+ }
+
+ public ObservableCollection<AgendaTelefone> Telefones
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Agenda agenda = this;
+ return new Func<List<KeyValuePair<string, string>>>(agenda.Validate);
+ }
+ }
+
+ public Agenda()
+ {
+ }
+
+ public List<TupleList> Log()
+ {
+ string description;
+ List<TupleList> tupleLists = new List<TupleList>()
+ {
+ new TupleList()
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""),
+ new Tuple<string, string, string>("CEP", (string.IsNullOrWhiteSpace(this.Cep) ? "" : this.Cep), ""),
+ new Tuple<string, string, string>("ENDEREÇO", (string.IsNullOrWhiteSpace(this.Endereco) ? "" : this.Endereco), ""),
+ new Tuple<string, string, string>("NÚMERO", (string.IsNullOrWhiteSpace(this.Numero) ? "" : this.Numero), ""),
+ new Tuple<string, string, string>("COMPLEMENTO", (string.IsNullOrWhiteSpace(this.Complemento) ? "" : this.Complemento), ""),
+ new Tuple<string, string, string>("BAIRRO", (string.IsNullOrWhiteSpace(this.Bairro) ? "" : this.Bairro), ""),
+ new Tuple<string, string, string>("CIDADE", (string.IsNullOrWhiteSpace(this.Cidade) ? "" : this.Cidade), ""),
+ new Tuple<string, string, string>("ESTADO", (string.IsNullOrWhiteSpace(this.Estado) ? "" : this.Estado), ""),
+ new Tuple<string, string, string>("OBSERVAÇÕES", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao), "")
+ }
+ }
+ };
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("TELEFONES$", "", "")
+ };
+ foreach (AgendaTelefone telefone in this.Telefones)
+ {
+ observableCollection.Add(new Tuple<string, string, string>(string.Format(" TELEFONE {0}$", this.Telefones.IndexOf(telefone) + 1), "", ""));
+ ObservableCollection<Tuple<string, string, string>> observableCollection1 = observableCollection;
+ TipoTelefone? tipo = telefone.Tipo;
+ if (!tipo.HasValue)
+ {
+ description = "";
+ }
+ else
+ {
+ tipo = telefone.Tipo;
+ if (tipo.HasValue)
+ {
+ description = tipo.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ description = null;
+ }
+ }
+ observableCollection1.Add(new Tuple<string, string, string>(" TIPO", description, ""));
+ 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), ""));
+ }
+ tupleLists.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 this.Emails)
+ {
+ observableCollection2.Add(new Tuple<string, string, string>(string.Format(" EMAIL {0}$", this.Emails.IndexOf(email) + 1), "", ""));
+ observableCollection2.Add(new Tuple<string, string, string>(" ENDEREÇO DE EMAIL", (string.IsNullOrWhiteSpace(email.Email) ? "" : email.Email), ""));
+ }
+ tupleLists.Add(new TupleList()
+ {
+ Tuples = observableCollection2
+ });
+ return tupleLists;
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(this.Nome))
+ {
+ keyValuePairs.AddValue<string, string>("Nome", Messages.Obrigatorio, true);
+ }
+ return keyValuePairs;
+ }
+ }
+} \ No newline at end of file