summaryrefslogtreecommitdiff
path: root/Gestor.Model/Model.Domain.Seguros/Parceiro.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Model/Model.Domain.Seguros/Parceiro.cs')
-rw-r--r--Gestor.Model/Model.Domain.Seguros/Parceiro.cs528
1 files changed, 528 insertions, 0 deletions
diff --git a/Gestor.Model/Model.Domain.Seguros/Parceiro.cs b/Gestor.Model/Model.Domain.Seguros/Parceiro.cs
new file mode 100644
index 0000000..16bbdaf
--- /dev/null
+++ b/Gestor.Model/Model.Domain.Seguros/Parceiro.cs
@@ -0,0 +1,528 @@
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text.RegularExpressions;
+
+namespace Gestor.Model.Domain.Seguros
+{
+ public class Parceiro : DomainBase, IDomain
+ {
+ private string _nome;
+
+ private string _cep;
+
+ private string _endereco;
+
+ private string _numero;
+
+ private string _complemento;
+
+ private string _bairro;
+
+ private string _cidade;
+
+ private string _uf;
+
+ private string _cgccpf;
+
+ private string _contato;
+
+ private string _email;
+
+ private string _ddd1;
+
+ private string _telefone1;
+
+ private string _ddd2;
+
+ private string _telefone2;
+
+ private string _ddd3;
+
+ private string _telefone3;
+
+ private string _obs;
+
+ [Log(true)]
+ public string Bairro
+ {
+ get
+ {
+ string str = this._bairro;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._bairro = value;
+ }
+ }
+
+ [Log(true)]
+ public string Cep
+ {
+ get
+ {
+ if (this._cep == null || !Regex.IsMatch(this._cep, "[0-9]+"))
+ {
+ return "";
+ }
+ return this._cep.Trim();
+ }
+ set
+ {
+ this._cep = value;
+ }
+ }
+
+ [Description("DOCUMENTO")]
+ [Log(true)]
+ public string Cgccpf
+ {
+ get
+ {
+ string str = this._cgccpf;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._cgccpf = value;
+ }
+ }
+
+ [Log(true)]
+ public string Cidade
+ {
+ get
+ {
+ string str = this._cidade;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._cidade = value;
+ }
+ }
+
+ [Log(true)]
+ public string Complemento
+ {
+ get
+ {
+ string str = this._complemento;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._complemento = value;
+ }
+ }
+
+ [Log(true)]
+ public string Contato
+ {
+ get
+ {
+ string str = this._contato;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._contato = value;
+ }
+ }
+
+ [Description("PREFIXO 1")]
+ [Log(true)]
+ public string Ddd1
+ {
+ get
+ {
+ string str = this._ddd1;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._ddd1 = value;
+ }
+ }
+
+ [Description("PREFIXO 2")]
+ [Log(true)]
+ public string Ddd2
+ {
+ get
+ {
+ string str = this._ddd2;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._ddd2 = value;
+ }
+ }
+
+ [Description("PREFIXO 3")]
+ [Log(true)]
+ public string Ddd3
+ {
+ get
+ {
+ string str = this._ddd3;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._ddd3 = value;
+ }
+ }
+
+ [Log(true)]
+ public string Email
+ {
+ get
+ {
+ string str = this._email;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToLower().Trim();
+ }
+ set
+ {
+ this._email = value;
+ }
+ }
+
+ [Log(true)]
+ public string Endereco
+ {
+ get
+ {
+ string str = this._endereco;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._endereco = value;
+ }
+ }
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ string str = this._nome;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._nome = value;
+ }
+ }
+
+ [Description("NÚMERO")]
+ [Log(true)]
+ public string Numero
+ {
+ get
+ {
+ string str = this._numero;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._numero = value;
+ }
+ }
+
+ [Description("OBSERVAÇÃO")]
+ [Log(true)]
+ public string Obs
+ {
+ get
+ {
+ string str = this._obs;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._obs = value;
+ }
+ }
+
+ [Description("TELEFONE 1")]
+ [Log(true)]
+ public string Telefone1
+ {
+ get
+ {
+ string str = this._telefone1;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._telefone1 = value;
+ }
+ }
+
+ [Description("TELEFONE 2")]
+ [Log(true)]
+ public string Telefone2
+ {
+ get
+ {
+ string str = this._telefone2;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._telefone2 = value;
+ }
+ }
+
+ [Description("TELEFONE 3")]
+ [Log(true)]
+ public string Telefone3
+ {
+ get
+ {
+ string str = this._telefone3;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._telefone3 = value;
+ }
+ }
+
+ public Gestor.Model.Common.TipoPerda? TipoPerda
+ {
+ get;
+ set;
+ }
+
+ [Description("ESTADO")]
+ [Log(true)]
+ public string Uf
+ {
+ get
+ {
+ string str = this._uf;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._uf = value;
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Parceiro parceiro = this;
+ return new Func<List<KeyValuePair<string, string>>>(parceiro.Validate);
+ }
+ }
+
+ public Parceiro()
+ {
+ }
+
+ public List<TupleList> Log()
+ {
+ return 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>("DOCUMENTO", (string.IsNullOrWhiteSpace(this.Cgccpf) ? "" : this.Cgccpf), ""),
+ new Tuple<string, string, string>("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd1) ? "" : this.Ddd1), ""),
+ new Tuple<string, string, string>("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone1) ? "" : this.Telefone1), ""),
+ new Tuple<string, string, string>("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd2) ? "" : this.Ddd2), ""),
+ new Tuple<string, string, string>("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone2) ? "" : this.Telefone2), ""),
+ new Tuple<string, string, string>("TERCEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd3) ? "" : this.Ddd3), ""),
+ new Tuple<string, string, string>("TERCEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone3) ? "" : this.Telefone3), ""),
+ new Tuple<string, string, string>("E-MAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), ""),
+ 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.Uf) ? "" : this.Uf), "")
+ }
+ }
+ };
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ int num;
+ int? nullable;
+ bool flag;
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ string nome = this.Nome;
+ if (nome != null)
+ {
+ nullable = new int?((int)nome.Trim().Split(new char[] { ' ' }).Length);
+ }
+ else
+ {
+ nullable = null;
+ }
+ if (!nullable.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Nome", Messages.Obrigatorio, true);
+ }
+ else if (this.Nome.Length > 100)
+ {
+ keyValuePairs.AddValue<string, string>("Nome", string.Format(Messages.MaiorQueLimite, 100), true);
+ }
+ if (!string.IsNullOrEmpty(this.Cgccpf) && !this.Cgccpf.ValidacaoDocumento())
+ {
+ keyValuePairs.AddValue<string, string>("Cgccpf", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Ddd1) && !this.Ddd1.ValidacaoPrefixo())
+ {
+ keyValuePairs.AddValue<string, string>("Ddd1|PRIMEIRO DDD", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Telefone1) && !this.Telefone1.ValidacaoTelefone())
+ {
+ keyValuePairs.AddValue<string, string>("Telefone1|PRIMEIRO TELEFONE", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Ddd2) && !this.Ddd2.ValidacaoPrefixo())
+ {
+ keyValuePairs.AddValue<string, string>("Ddd2|SEGUNDO DDD", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Telefone2) && !this.Telefone2.ValidacaoTelefone())
+ {
+ keyValuePairs.AddValue<string, string>("Telefone2|SEGUNDO TELEFONE", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Ddd3) && !this.Ddd3.ValidacaoPrefixo())
+ {
+ keyValuePairs.AddValue<string, string>("Ddd3|TERCEIRO DDD", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Telefone3) && !this.Telefone3.ValidacaoTelefone())
+ {
+ keyValuePairs.AddValue<string, string>("Telefone3|TERCEIRO TELEFONE", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(this.Email) && this.Email.Length > 100)
+ {
+ keyValuePairs.AddValue<string, string>("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100), true);
+ }
+ if (!string.IsNullOrEmpty(this.Email) && !this.Email.ValidacaoEmail())
+ {
+ keyValuePairs.AddValue<string, string>("Email|E-MAIL", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(this.Cep) && !this.Cep.ValidacaoCep())
+ {
+ keyValuePairs.AddValue<string, string>("Cep|CEP", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(this.Uf) && !this.Uf.ValidacaoEstado())
+ {
+ keyValuePairs.AddValue<string, string>("Uf|ESTADO", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(this.Numero) && !int.TryParse(this.Numero, out num))
+ {
+ keyValuePairs.AddValue<string, string>("Numero|NÚMERO", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(this.Numero))
+ {
+ string numero = this.Numero;
+ if (numero != null)
+ {
+ flag = numero.Count<char>() > 5;
+ }
+ else
+ {
+ flag = false;
+ }
+ if (flag)
+ {
+ keyValuePairs.AddValue<string, string>("Numero|NÚMERO", Messages.Invalido, true);
+ }
+ }
+ return keyValuePairs;
+ }
+ }
+} \ No newline at end of file