summaryrefslogtreecommitdiff
path: root/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs')
-rw-r--r--Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs264
1 files changed, 0 insertions, 264 deletions
diff --git a/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs b/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs
deleted file mode 100644
index 165b244..0000000
--- a/Gestor.Model/Model.Domain.Ferramentas/Tarefa.cs
+++ /dev/null
@@ -1,264 +0,0 @@
-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