diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs')
| -rw-r--r-- | Codemerx/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs b/Codemerx/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs new file mode 100644 index 0000000..165b244 --- /dev/null +++ b/Codemerx/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<ResponsavelTarefa> 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<Gestor.Model.Domain.Seguros.Usuario> UsuariosVinculados
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Tarefa tarefa = this;
+ return new Func<List<KeyValuePair<string, string>>>(tarefa.Validate);
+ }
+ }
+
+ public Tarefa()
+ {
+ }
+
+ public List<TupleList> Log()
+ {
+ string nome;
+ this.Descricao = (new Regex("<title>.*<\\/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 |