summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs')
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs210
1 files changed, 210 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs
new file mode 100644
index 0000000..613fddc
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Prospeccao.cs
@@ -0,0 +1,210 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+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;
+
+namespace Gestor.Model.Domain.Seguros;
+
+public class Prospeccao : DomainBase, IDomain
+{
+ private string _nome;
+
+ private string _item;
+
+ private string _observacao;
+
+ public long IdEmpresa { get; set; }
+
+ [Description("CLIENTE")]
+ public string Nome
+ {
+ get
+ {
+ return _nome?.ToUpper();
+ }
+ set
+ {
+ _nome = value;
+ }
+ }
+
+ [Description("DOCUMENTO")]
+ public string Documento { get; set; }
+
+ [Tipo("DATA?")]
+ [Description("NASCIMENTO")]
+ public DateTime? Nascimento { get; set; }
+
+ [Description("DDD")]
+ public string Prefixo1 { get; set; }
+
+ [Description("TELEFONE")]
+ public string Telefone1 { get; set; }
+
+ [Description("DDD")]
+ public string Prefixo2 { get; set; }
+
+ [Description("TELEFONE")]
+ public string Telefone2 { get; set; }
+
+ [Description("E-MAIL")]
+ public string Email { get; set; }
+
+ [Tipo("DATA?")]
+ [Description("VIGÊNCIA FINAL")]
+ public DateTime? VigenciaFinal { get; set; }
+
+ [Description("ITEM")]
+ public string Item
+ {
+ get
+ {
+ return _item?.ToUpper();
+ }
+ set
+ {
+ _item = value;
+ }
+ }
+
+ public Vendedor Vendedor { get; set; }
+
+ [Tipo("ENUM?")]
+ [Description("STATUS")]
+ public StatusProspeccao? Status { get; set; }
+
+ [Description("STATUS PERSONALIZADO")]
+ public StatusDeProspeccao StatusPersonalizado { get; set; }
+
+ [Description("TIPO")]
+ public string Tipo { get; set; }
+
+ [Description("VALOR")]
+ public decimal Valor { get; set; }
+
+ public string Observacao
+ {
+ get
+ {
+ return _observacao?.ToUpper();
+ }
+ set
+ {
+ _observacao = value;
+ }
+ }
+
+ public bool Excluido { get; set; }
+
+ public Tarefa Tarefa { get; set; }
+
+ public bool CriarTarefa { get; set; }
+
+ public bool AbrirTarefa { get; set; }
+
+ public bool Renovacao { get; set; }
+
+ public DateTime? DataCriacao { get; set; }
+
+ public long UsuarioCriacao { get; set; }
+
+ public Produto Produto { get; set; }
+
+ public List<ArquivoDigital> Anexos { get; set; }
+
+ public Ramo Ramo { 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 (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("Nascimento", string.Format(Messages.DataInvalida));
+ }
+ if (VigenciaFinal.HasValue && (DateTime.Compare(VigenciaFinal.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(VigenciaFinal.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ list.AddValue("VigenciaFinal|VENCIMENTO", string.Format(Messages.DataInvalida));
+ }
+ if (string.IsNullOrWhiteSpace(Nome))
+ {
+ list.AddValue("Nome", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Telefone1) && string.IsNullOrWhiteSpace(Telefone2) && string.IsNullOrWhiteSpace(Email))
+ {
+ list.AddValue("Telefone1|TELEFONE 1", Messages.Obrigatorio);
+ }
+ if (!VigenciaFinal.HasValue)
+ {
+ list.AddValue("VigenciaFinal|VENCIMENTO", Messages.Obrigatorio);
+ }
+ if (string.IsNullOrWhiteSpace(Item))
+ {
+ list.AddValue("Item", Messages.Obrigatorio);
+ }
+ return list;
+ }
+
+ public List<TupleList> Log()
+ {
+ List<TupleList> list = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""),
+ new Tuple<string, string, string>("DOCUMENTO", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""),
+ new Tuple<string, string, string>("NASCIMENTO", (!Nascimento.HasValue) ? "" : Nascimento?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("PRIMEIRO PREFIXO", string.IsNullOrWhiteSpace(Prefixo1) ? "" : Prefixo1, ""),
+ new Tuple<string, string, string>("PRIMEIRO TELEFONE", string.IsNullOrWhiteSpace(Telefone1) ? "" : Telefone1, ""),
+ new Tuple<string, string, string>("SEGUNDO PREFIXO", string.IsNullOrWhiteSpace(Prefixo2) ? "" : Prefixo2, ""),
+ new Tuple<string, string, string>("SEGUNDO TELEFONE", string.IsNullOrWhiteSpace(Telefone2) ? "" : Telefone2, ""),
+ new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, ""),
+ new Tuple<string, string, string>("ITEM", string.IsNullOrWhiteSpace(Item) ? "" : Item, ""),
+ new Tuple<string, string, string>("PRODUTO", string.IsNullOrWhiteSpace(Produto?.Nome) ? "" : Produto.Nome, ""),
+ new Tuple<string, string, string>("VENCIMENTO", (!VigenciaFinal.HasValue) ? "" : VigenciaFinal?.ToShortDateString(), ""),
+ new Tuple<string, string, string>("VENDEDOR", string.IsNullOrWhiteSpace(Vendedor?.Nome) ? "" : Vendedor.Nome, "")
+ };
+ object item;
+ if (Status.HasValue)
+ {
+ StatusProspeccao? status = Status;
+ item = (status.HasValue ? status.GetValueOrDefault().GetDescription() : null);
+ }
+ else
+ {
+ item = "";
+ }
+ obj.Add(new Tuple<string, string, string>("STATUS", (string)item, ""));
+ obj.Add(new Tuple<string, string, string>("STATUS PERSONALIZADO", (StatusPersonalizado == null) ? "" : StatusPersonalizado.Nome, ""));
+ obj.Add(new Tuple<string, string, string>("OBSERVAÇÃO", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, ""));
+ tupleList.Tuples = obj;
+ list.Add(tupleList);
+ List<TupleList> list2 = list;
+ if (Tarefa != null)
+ {
+ ObservableCollection<Tuple<string, string, string>> tuples = new ObservableCollection<Tuple<string, string, string>>
+ {
+ new Tuple<string, string, string>("TAREFA$", "", ""),
+ new Tuple<string, string, string>(" RESPONSÁVEL", string.IsNullOrWhiteSpace(Tarefa.Usuario.Nome) ? "" : Tarefa.Usuario.Nome, ""),
+ new Tuple<string, string, string>(" DATA DO AGENDAMENTO", Tarefa.Agendamento.ToShortDateString(), ""),
+ new Tuple<string, string, string>(" HORA DO AGENDAMENTO", Tarefa.Agendamento.ToShortTimeString(), "")
+ };
+ list2.Add(new TupleList
+ {
+ Tuples = tuples
+ });
+ }
+ return list2;
+ }
+}