From 0440c722a221b8068bbf388c1c0c51f0faff0451 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 14:17:46 -0300 Subject: some dlls --- .../Gestor.Model.Domain.Ferramentas/Tarefa.cs | 132 +++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs (limited to 'Gestor.Model/Gestor.Model.Domain.Ferramentas/Tarefa.cs') 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 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 Responsaveis { get; set; } + + public bool HabilitarPublica { get; set; } + + public bool Publica { get; set; } + + public bool AgendamentoRetroativo { get; set; } + + [JsonIgnore] + public Func>> ValidationEvent => Validate; + + public List> Validate() + { + List> 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 Log() + { + Descricao = new Regex(".*<\\/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, "") + } + } + }; + } +} -- cgit v1.2.3