diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-master.tar.gz gestor-master.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs')
| -rw-r--r-- | Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs new file mode 100644 index 0000000..51bb764 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text.RegularExpressions; +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; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Tarefa : DomainBase, IDomain +{ + public bool Aberto { get; set; } + + public string Cliente { get; set; } + + public long IdCliente { get; set; } + + public Trilha Trilha { get; set; } + + public Fase Fase { get; set; } + + public TipoDeTarefa TipoDeTarefa { get; set; } + + public TipoTarefa Entidade { get; set; } + + public long IdEntidade { get; set; } + + public Usuario UsuarioCadastro { get; set; } + + public Usuario Usuario { get; set; } + + public List<Usuario> UsuariosVinculados { get; set; } + + public DateTime Agendamento { get; set; } + + public DateTime? Conclusao { get; set; } + + public string Titulo { get; set; } + + public string Anotacoes { get; set; } + + public string AnotacoesInternas { get; set; } + + public string Descricao { get; set; } + + public string DescricaoInterna { get; set; } + + public string Referencia { get; set; } + + public StatusTarefa Status { get; set; } + + public Documento Documento { get; set; } + + public CategoriaTarefa Categoria { get; set; } + + public bool? Restrito { get; set; } + + public List<ResponsavelTarefa> Responsaveis { get; set; } + + public bool HabilitarPublica { get; set; } + + public bool Publica { get; set; } + + public bool AgendamentoRetroativo { 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 (Entidade != TipoTarefa.Notas) + { + if (IdEntidade == 0L && Trilha == null) + { + list.AddValue("IdEntidade", Messages.Obrigatorio); + } + if (!AgendamentoRetroativo && Status != StatusTarefa.Realizado && Agendamento < Funcoes.GetNetworkTime().AddMinutes(-15.0) && Trilha == null) + { + list.AddValue("Agendamento", Messages.Invalido); + } + } + if (Usuario == null) + { + list.AddValue("Usuario|RESPONSÁVEL", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(Titulo)) + { + list.AddValue("Titulo|TÍTULO", Messages.Obrigatorio); + } + if (DateTime.Compare(Agendamento, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Agendamento, new DateTime(9999, 12, 31)) > 0) + { + list.AddValue("Agendamento", string.Format(Messages.DataInvalida)); + } + if (Conclusao.HasValue && (DateTime.Compare(Conclusao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Conclusao.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("Conclusao|CONCLUSÃO", string.Format(Messages.DataInvalida)); + } + if (Status == StatusTarefa.Realizado && !Conclusao.HasValue) + { + list.AddValue("Conclusao|CONCLUSÃO", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + Descricao = new Regex("<title>.*<\\/title>").Replace(Descricao, "").Trim(); + Descricao = new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)").Replace(Descricao, "").Trim(); + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("TÍTULO", string.IsNullOrWhiteSpace(Titulo) ? "" : Titulo, ""), + new Tuple<string, string, string>("AGENDAMENTO", Agendamento.ToShortDateString(), ""), + new Tuple<string, string, string>("HORA", Agendamento.ToShortTimeString(), ""), + new Tuple<string, string, string>("RESPONSÁVEL", string.IsNullOrWhiteSpace(Usuario.Nome) ? "" : Usuario.Nome, ""), + new Tuple<string, string, string>("STATUS", Status.GetDescription(), ""), + new Tuple<string, string, string>("TIPO DE TAREFA", TipoDeTarefa?.Nome, ""), + new Tuple<string, string, string>("ANOTAÇÕES", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, "") + } + } + }; + } +} |