From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Model.Domain.Seguros/Prospeccao.cs | 400 +++++++++++++++++++++ 1 file changed, 400 insertions(+) create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs') diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs new file mode 100644 index 0000000..059b612 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Prospeccao.cs @@ -0,0 +1,400 @@ +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +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.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Gestor.Model.Domain.Seguros +{ + public class Prospeccao : DomainBase, IDomain + { + private string _nome; + + private string _item; + + private string _observacao; + + public bool AbrirTarefa + { + get; + set; + } + + public List Anexos + { + get; + set; + } + + public bool CriarTarefa + { + get; + set; + } + + public DateTime? DataCriacao + { + get; + set; + } + + [Description("DOCUMENTO")] + public string Documento + { + get; + set; + } + + [Description("E-MAIL")] + public string Email + { + get; + set; + } + + public bool Excluido + { + get; + set; + } + + public long IdEmpresa + { + get; + set; + } + + [Description("ITEM")] + public string Item + { + get + { + string str = this._item; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._item = value; + } + } + + [Description("NASCIMENTO")] + [Tipo("DATA?")] + public DateTime? Nascimento + { + get; + set; + } + + [Description("CLIENTE")] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + public string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + [Description("DDD")] + public string Prefixo1 + { + get; + set; + } + + [Description("DDD")] + public string Prefixo2 + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Produto Produto + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Ramo Ramo + { + get; + set; + } + + public bool Renovacao + { + get; + set; + } + + [Description("STATUS")] + [Tipo("ENUM?")] + public StatusProspeccao? Status + { + get; + set; + } + + [Description("STATUS PERSONALIZADO")] + public StatusDeProspeccao StatusPersonalizado + { + get; + set; + } + + public Gestor.Model.Domain.Ferramentas.Tarefa Tarefa + { + get; + set; + } + + [Description("TELEFONE")] + public string Telefone1 + { + get; + set; + } + + [Description("TELEFONE")] + public string Telefone2 + { + get; + set; + } + + [Description("TIPO")] + public string Tipo + { + get; + set; + } + + public long UsuarioCriacao + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Prospeccao prospeccao = this; + return new Func>>(prospeccao.Validate); + } + } + + [Description("VALOR")] + public decimal Valor + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Vendedor Vendedor + { + get; + set; + } + + [Description("VIGÊNCIA FINAL")] + [Tipo("DATA?")] + public DateTime? VigenciaFinal + { + get; + set; + } + + public Prospeccao() + { + } + + public List Log() + { + string shortDateString; + string nome; + string str; + string nome1; + string description; + List tupleLists = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> observableCollection = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("DOCUMENTO", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), "") + }; + DateTime? nascimento = this.Nascimento; + if (!nascimento.HasValue) + { + shortDateString = ""; + } + else + { + nascimento = this.Nascimento; + if (nascimento.HasValue) + { + shortDateString = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + shortDateString = null; + } + } + observableCollection.Add(new Tuple("NASCIMENTO", shortDateString, "")); + observableCollection.Add(new Tuple("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Prefixo1) ? "" : this.Prefixo1), "")); + observableCollection.Add(new Tuple("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone1) ? "" : this.Telefone1), "")); + observableCollection.Add(new Tuple("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.Prefixo2) ? "" : this.Prefixo2), "")); + observableCollection.Add(new Tuple("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone2) ? "" : this.Telefone2), "")); + observableCollection.Add(new Tuple("E-MAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), "")); + observableCollection.Add(new Tuple("ITEM", (string.IsNullOrWhiteSpace(this.Item) ? "" : this.Item), "")); + Gestor.Model.Domain.Seguros.Produto produto = this.Produto; + if (produto != null) + { + nome = produto.Nome; + } + else + { + nome = null; + } + observableCollection.Add(new Tuple("PRODUTO", (string.IsNullOrWhiteSpace(nome) ? "" : this.Produto.Nome), "")); + nascimento = this.VigenciaFinal; + if (!nascimento.HasValue) + { + str = ""; + } + else + { + nascimento = this.VigenciaFinal; + if (nascimento.HasValue) + { + str = nascimento.GetValueOrDefault().ToShortDateString(); + } + else + { + str = null; + } + } + observableCollection.Add(new Tuple("VENCIMENTO", str, "")); + Gestor.Model.Domain.Seguros.Vendedor vendedor = this.Vendedor; + if (vendedor != null) + { + nome1 = vendedor.Nome; + } + else + { + nome1 = null; + } + observableCollection.Add(new Tuple("VENDEDOR", (string.IsNullOrWhiteSpace(nome1) ? "" : this.Vendedor.Nome), "")); + StatusProspeccao? status = this.Status; + if (!status.HasValue) + { + description = ""; + } + else + { + status = this.Status; + if (status.HasValue) + { + description = status.GetValueOrDefault().GetDescription(); + } + else + { + description = null; + } + } + observableCollection.Add(new Tuple("STATUS", description, "")); + observableCollection.Add(new Tuple("STATUS PERSONALIZADO", (this.StatusPersonalizado == null ? "" : this.StatusPersonalizado.Nome), "")); + observableCollection.Add(new Tuple("OBSERVAÇÃO", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + List tupleLists1 = tupleLists; + if (this.Tarefa != null) + { + ObservableCollection> observableCollection1 = new ObservableCollection>() + { + new Tuple("TAREFA$", "", ""), + new Tuple(" RESPONSÁVEL", (string.IsNullOrWhiteSpace(this.Tarefa.Usuario.Nome) ? "" : this.Tarefa.Usuario.Nome), "") + }; + DateTime agendamento = this.Tarefa.Agendamento; + observableCollection1.Add(new Tuple(" DATA DO AGENDAMENTO", agendamento.ToShortDateString(), "")); + agendamento = this.Tarefa.Agendamento; + observableCollection1.Add(new Tuple(" HORA DO AGENDAMENTO", agendamento.ToShortTimeString(), "")); + tupleLists1.Add(new TupleList() + { + Tuples = observableCollection1 + }); + } + return tupleLists1; + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Nascimento.HasValue && (DateTime.Compare(this.Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Nascimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Nascimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.VigenciaFinal.HasValue && (DateTime.Compare(this.VigenciaFinal.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.VigenciaFinal.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("VigenciaFinal|VENCIMENTO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Telefone1) && string.IsNullOrWhiteSpace(this.Telefone2) && string.IsNullOrWhiteSpace(this.Email)) + { + keyValuePairs.AddValue("Telefone1|TELEFONE 1", Messages.Obrigatorio, true); + } + if (!this.VigenciaFinal.HasValue) + { + keyValuePairs.AddValue("VigenciaFinal|VENCIMENTO", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Item)) + { + keyValuePairs.AddValue("Item", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3