summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Common/Empresa.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Common/Empresa.cs')
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Common/Empresa.cs413
1 files changed, 413 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Common/Empresa.cs b/Gestor.Model/Gestor.Model.Domain.Common/Empresa.cs
new file mode 100644
index 0000000..2f228e1
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Common/Empresa.cs
@@ -0,0 +1,413 @@
+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 Newtonsoft.Json;
+
+namespace Gestor.Model.Domain.Common;
+
+public class Empresa : EnderecoBase, IDomain
+{
+ private string _nome;
+
+ private string _documento;
+
+ private string _serial;
+
+ private string _site;
+
+ private string _email;
+
+ private string _primeiroPrefixo;
+
+ private string _primeiroTelefone;
+
+ private string _segundoPrefixo;
+
+ private string _segundoTelefone;
+
+ private string _quantidadeFiliais;
+
+ private string _responsavel;
+
+ private string _emailResponsavel;
+
+ private TipoTelefone? _tipo1;
+
+ private TipoTelefone? _tipo2;
+
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ public string NomeSocial { get; set; }
+
+ public string Documento
+ {
+ get
+ {
+ return _documento?.ToUpper().Trim();
+ }
+ set
+ {
+ _documento = value;
+ }
+ }
+
+ public string Serial
+ {
+ get
+ {
+ return _serial?.ToUpper().Trim();
+ }
+ set
+ {
+ _serial = value;
+ }
+ }
+
+ public TipoTelefone TipoTelefone1
+ {
+ get
+ {
+ if (!_tipo1.HasValue || _tipo1 == (TipoTelefone)0)
+ {
+ return TipoTelefone.Comercial;
+ }
+ return _tipo1.Value;
+ }
+ set
+ {
+ _tipo1 = value;
+ }
+ }
+
+ public TipoTelefone TipoTelefone2
+ {
+ get
+ {
+ if (!_tipo2.HasValue || _tipo2 == (TipoTelefone)0)
+ {
+ return TipoTelefone.Comercial;
+ }
+ return _tipo2.Value;
+ }
+ set
+ {
+ _tipo2 = value;
+ }
+ }
+
+ public string Site
+ {
+ get
+ {
+ return _site?.Trim();
+ }
+ set
+ {
+ _site = value;
+ }
+ }
+
+ public string Email
+ {
+ get
+ {
+ return _email?.ToLower().Trim();
+ }
+ set
+ {
+ _email = value;
+ }
+ }
+
+ public string PrimeiroPrefixo
+ {
+ get
+ {
+ return _primeiroPrefixo?.ToUpper().Trim();
+ }
+ set
+ {
+ _primeiroPrefixo = value;
+ }
+ }
+
+ public string PrimeiroTelefone
+ {
+ get
+ {
+ return _primeiroTelefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _primeiroTelefone = value;
+ }
+ }
+
+ public string SegundoPrefixo
+ {
+ get
+ {
+ return _segundoPrefixo?.ToUpper().Trim();
+ }
+ set
+ {
+ _segundoPrefixo = value;
+ }
+ }
+
+ public string SegundoTelefone
+ {
+ get
+ {
+ return _segundoTelefone?.ToUpper().Trim();
+ }
+ set
+ {
+ _segundoTelefone = value;
+ }
+ }
+
+ public long QuantidadeFuncionarios { get; set; }
+
+ public string QuantidadeFiliais
+ {
+ get
+ {
+ return _quantidadeFiliais?.ToUpper().Trim();
+ }
+ set
+ {
+ _quantidadeFiliais = value;
+ }
+ }
+
+ public string Responsavel
+ {
+ get
+ {
+ return _responsavel?.ToUpper();
+ }
+ set
+ {
+ _responsavel = value;
+ }
+ }
+
+ public string EmailResponsavel
+ {
+ get
+ {
+ return _emailResponsavel?.ToLower().Trim();
+ }
+ set
+ {
+ _emailResponsavel = value;
+ }
+ }
+
+ public string SenhaAdmin { get; set; }
+
+ public string Facebook { get; set; }
+
+ public string Instagram { get; set; }
+
+ public string Linkdin { get; set; }
+
+ public string Whatsapp { get; set; }
+
+ public string WhatsappSinistro { get; set; }
+
+ public string Twitter { get; set; }
+
+ public string Localizacao { get; set; }
+
+ public byte[] Logo { get; set; }
+
+ public string LogoId { get; set; }
+
+ public int MaxFileSize { 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(Documento))
+ {
+ list.AddValue("Documento", Messages.Obrigatorio);
+ }
+ else if (!Documento.ValidacaoDocumento())
+ {
+ list.AddValue("Documento", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(Serial))
+ {
+ list.AddValue("Serial", Messages.Obrigatorio);
+ }
+ else if (Serial.Length > 18)
+ {
+ list.AddValue("Serial", string.Format(Messages.MaiorQueLimite, 18));
+ }
+ if (!string.IsNullOrWhiteSpace(Site) && Site.Length > 80)
+ {
+ list.AddValue("Site", string.Format(Messages.MaiorQueLimite, 80));
+ }
+ if (!string.IsNullOrWhiteSpace(SenhaAdmin) && SenhaAdmin.Length > 90)
+ {
+ list.AddValue("SenhaAdmin", string.Format(Messages.MaiorQueLimite, 90));
+ }
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ else if (Nome.Length > 60)
+ {
+ list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (string.IsNullOrWhiteSpace(base.Cep))
+ {
+ list.AddValue("Cep", Messages.Obrigatorio);
+ }
+ else if (!base.Cep.ValidacaoCep())
+ {
+ list.AddValue("Cep", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(base.Endereco))
+ {
+ list.AddValue("Endereco", Messages.Obrigatorio);
+ }
+ else if (base.Endereco.Length > 60)
+ {
+ list.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 60));
+ }
+ if (string.IsNullOrWhiteSpace(base.Numero))
+ {
+ list.AddValue("Numero", Messages.Obrigatorio);
+ }
+ else if (base.Numero.Length > 10)
+ {
+ list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 10));
+ }
+ if (!string.IsNullOrWhiteSpace(base.Complemento) && base.Complemento.Length > 100)
+ {
+ list.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 100));
+ }
+ if (string.IsNullOrWhiteSpace(base.Bairro))
+ {
+ list.AddValue("Bairro", Messages.Obrigatorio);
+ }
+ else if (base.Bairro.Length > 150)
+ {
+ list.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 150));
+ }
+ if (string.IsNullOrWhiteSpace(base.Cidade))
+ {
+ list.AddValue("Cidade", Messages.Obrigatorio);
+ }
+ else if (base.Cidade.Length > 30)
+ {
+ list.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30));
+ }
+ if (string.IsNullOrWhiteSpace(base.Estado))
+ {
+ list.AddValue("Estado", Messages.Obrigatorio);
+ }
+ else if (!base.Estado.ValidacaoEstado())
+ {
+ list.AddValue("Estado", Messages.Invalido);
+ }
+ if (string.IsNullOrWhiteSpace(Email))
+ {
+ list.AddValue("Email", Messages.Obrigatorio);
+ }
+ else if (!Email.ValidacaoEmail())
+ {
+ list.AddValue("Email", Messages.Invalido);
+ }
+ else if (Email.Length > 50)
+ {
+ list.AddValue("Email", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (string.IsNullOrWhiteSpace(EmailResponsavel))
+ {
+ list.AddValue("EmailResponsavel", Messages.Obrigatorio);
+ }
+ else if (!EmailResponsavel.ValidacaoEmail())
+ {
+ list.AddValue("EmailResponsavel", Messages.Invalido);
+ }
+ else if (EmailResponsavel.Length > 50)
+ {
+ list.AddValue("EmailResponsavel", string.Format(Messages.MaiorQueLimite, 50));
+ }
+ if (!string.IsNullOrEmpty(Facebook) && !Facebook.Contains("http"))
+ {
+ Facebook = "https://" + Facebook.Trim();
+ }
+ if (!string.IsNullOrEmpty(Instagram) && !Instagram.Contains("http"))
+ {
+ Instagram = "https://" + Instagram.Trim();
+ }
+ if (!string.IsNullOrEmpty(Linkdin) && !Linkdin.Contains("http"))
+ {
+ Linkdin = "https://" + Linkdin.Trim();
+ }
+ if (!string.IsNullOrEmpty(Twitter) && !Twitter.Contains("http"))
+ {
+ Twitter = "https://" + Twitter.Trim();
+ }
+ if (!string.IsNullOrEmpty(Site) && !Site.Contains("http"))
+ {
+ Site = "http://" + Site.Trim();
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ return new List<TupleList>
+ {
+ new TupleList
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("DOCUMENTO (CPF/CNPJ)", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""),
+ new Tuple<string, string, string>("NÚMERO DE SÉRIE", string.IsNullOrWhiteSpace(Serial) ? "" : Serial, ""),
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(base.Cep) ? "" : base.Cep, ""),
+ new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(base.Endereco) ? "" : base.Endereco, ""),
+ new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(base.Numero) ? "" : base.Numero, ""),
+ new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(base.Bairro) ? "" : base.Bairro, ""),
+ new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(base.Cidade) ? "" : base.Cidade, ""),
+ new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(base.Estado) ? "" : base.Estado, ""),
+ new Tuple<string, string, string>("SITE", string.IsNullOrWhiteSpace(Site) ? "" : Site, ""),
+ new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""),
+ new Tuple<string, string, string>("PRIMEIRO PREFIXO", string.IsNullOrWhiteSpace(PrimeiroPrefixo) ? "" : PrimeiroPrefixo, ""),
+ new Tuple<string, string, string>("PRIMEIRO TELEFONE", string.IsNullOrWhiteSpace(PrimeiroTelefone) ? "" : PrimeiroTelefone, ""),
+ new Tuple<string, string, string>("SEGUNDO PREFIXO", string.IsNullOrWhiteSpace(SegundoPrefixo) ? "" : SegundoPrefixo, ""),
+ new Tuple<string, string, string>("SEGUNDO TELEFONE", string.IsNullOrWhiteSpace(SegundoTelefone) ? "" : SegundoTelefone, ""),
+ new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""),
+ new Tuple<string, string, string>("NÚMERO DE FUNCIONÁRIOS", QuantidadeFuncionarios.ToString(), ""),
+ new Tuple<string, string, string>("RESPONSÁVEL FINANCEIRO", string.IsNullOrWhiteSpace(Responsavel) ? "" : Responsavel, ""),
+ new Tuple<string, string, string>("E-MAIL DO RESPONSÁVEL", string.IsNullOrWhiteSpace(EmailResponsavel) ? "" : EmailResponsavel, "")
+ }
+ }
+ };
+ }
+}