From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs | 264 ++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs (limited to 'Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs') diff --git a/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs b/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs new file mode 100644 index 0000000..165b244 --- /dev/null +++ b/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs @@ -0,0 +1,264 @@ +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; + +namespace Gestor.Model.Domain.Ferramentas +{ + public class Tarefa : DomainBase, IDomain + { + public bool Aberto + { + get; + set; + } + + public DateTime Agendamento + { + get; + set; + } + + public bool AgendamentoRetroativo + { + get; + set; + } + + public string Anotacoes + { + get; + set; + } + + public string AnotacoesInternas + { + get; + set; + } + + public CategoriaTarefa Categoria + { + get; + set; + } + + public string Cliente + { + get; + set; + } + + public DateTime? Conclusao + { + get; + set; + } + + public string Descricao + { + get; + set; + } + + public string DescricaoInterna + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Documento Documento + { + get; + set; + } + + public TipoTarefa Entidade + { + get; + set; + } + + public Gestor.Model.Domain.Ferramentas.Fase Fase + { + get; + set; + } + + public bool HabilitarPublica + { + get; + set; + } + + public long IdCliente + { + get; + set; + } + + public long IdEntidade + { + get; + set; + } + + public bool Publica + { + get; + set; + } + + public string Referencia + { + get; + set; + } + + public List Responsaveis + { + get; + set; + } + + public bool? Restrito + { + get; + set; + } + + public StatusTarefa Status + { + get; + set; + } + + public Gestor.Model.Domain.Ferramentas.TipoDeTarefa TipoDeTarefa + { + get; + set; + } + + public string Titulo + { + get; + set; + } + + public Gestor.Model.Domain.Ferramentas.Trilha Trilha + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Usuario Usuario + { + get; + set; + } + + public Gestor.Model.Domain.Seguros.Usuario UsuarioCadastro + { + get; + set; + } + + public List UsuariosVinculados + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Tarefa tarefa = this; + return new Func>>(tarefa.Validate); + } + } + + public Tarefa() + { + } + + public List Log() + { + string nome; + this.Descricao = (new Regex(".*<\\/title>")).Replace(this.Descricao, "").Trim(); + this.Descricao = (new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)")).Replace(this.Descricao, "").Trim(); + List<TupleList> tupleLists = new List<TupleList>(); + TupleList tupleList = new TupleList(); + ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>() + { + new Tuple<string, string, string>("TÍTULO", (string.IsNullOrWhiteSpace(this.Titulo) ? "" : this.Titulo), "") + }; + DateTime agendamento = this.Agendamento; + observableCollection.Add(new Tuple<string, string, string>("AGENDAMENTO", agendamento.ToShortDateString(), "")); + agendamento = this.Agendamento; + observableCollection.Add(new Tuple<string, string, string>("HORA", agendamento.ToShortTimeString(), "")); + observableCollection.Add(new Tuple<string, string, string>("RESPONSÁVEL", (string.IsNullOrWhiteSpace(this.Usuario.Nome) ? "" : this.Usuario.Nome), "")); + observableCollection.Add(new Tuple<string, string, string>("STATUS", this.Status.GetDescription(), "")); + Gestor.Model.Domain.Ferramentas.TipoDeTarefa tipoDeTarefa = this.TipoDeTarefa; + if (tipoDeTarefa != null) + { + nome = tipoDeTarefa.Nome; + } + else + { + nome = null; + } + observableCollection.Add(new Tuple<string, string, string>("TIPO DE TAREFA", nome, "")); + observableCollection.Add(new Tuple<string, string, string>("ANOTAÇÕES", (string.IsNullOrWhiteSpace(this.Descricao) ? "" : this.Descricao), "")); + tupleList.Tuples = observableCollection; + tupleLists.Add(tupleList); + return tupleLists; + } + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue(); + if (this.Entidade != TipoTarefa.Notas) + { + if (this.IdEntidade == 0 && this.Trilha == null) + { + keyValuePairs.AddValue<string, string>("IdEntidade", Messages.Obrigatorio, true); + } + if (!this.AgendamentoRetroativo && this.Status != StatusTarefa.Realizado && this.Agendamento < Funcoes.GetNetworkTime().AddMinutes(-15) && this.Trilha == null) + { + keyValuePairs.AddValue<string, string>("Agendamento", Messages.Invalido, true); + } + } + if (this.Usuario == null) + { + keyValuePairs.AddValue<string, string>("Usuario|RESPONSÁVEL", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.Titulo)) + { + keyValuePairs.AddValue<string, string>("Titulo|TÍTULO", Messages.Obrigatorio, true); + } + if (DateTime.Compare(this.Agendamento, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Agendamento, new DateTime(9999, 12, 31)) > 0) + { + keyValuePairs.AddValue<string, string>("Agendamento", string.Format(Messages.DataInvalida, Array.Empty<object>()), true); + } + if (this.Conclusao.HasValue && (DateTime.Compare(this.Conclusao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Conclusao.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue<string, string>("Conclusao|CONCLUSÃO", string.Format(Messages.DataInvalida, Array.Empty<object>()), true); + } + if (this.Status == StatusTarefa.Realizado && !this.Conclusao.HasValue) + { + keyValuePairs.AddValue<string, string>("Conclusao|CONCLUSÃO", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3