summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Ferramentas/LogEmail.cs
blob: b7134169c3527459d37d0ff8268dab2f72a4500c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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.Validation;

namespace Gestor.Model.Domain.Ferramentas;

public class LogEmail : DomainBase
{
	public Credencial Credencial { get; set; }

	public TipoTela Tela { get; set; }

	public Relatorio Relatorio { get; set; }

	public long EntityId { get; set; }

	public string Assunto { get; set; }

	public string Corpo { get; set; }

	public string Destinatarios { get; set; }

	public string Cco { get; set; }

	public string Anexos { get; set; }

	public Usuario Usuario { get; set; }

	public DateTime Data { get; set; }

	public string Versao { get; set; }

	public string NomeMaquina { get; set; }

	public string UsuarioMaquina { get; set; }

	public string Ip { get; set; }

	public List<TupleList> CriarLogEmail()
	{
		Corpo = new Regex("<title>.*<\\/title>").Replace(Corpo, "").Trim();
		Corpo = new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)").Replace(Corpo, "").Trim();
		return new List<TupleList>
		{
			new TupleList
			{
				Tuples = new ObservableCollection<Tuple<string, string, string>>
				{
					new Tuple<string, string, string>("ASSUNTO", string.IsNullOrWhiteSpace(Assunto) ? "" : Assunto, ""),
					new Tuple<string, string, string>("CORPO", string.IsNullOrWhiteSpace(Corpo) ? "" : Corpo, ""),
					new Tuple<string, string, string>("E-MAIL DE ENVIO", string.IsNullOrWhiteSpace(Credencial?.Email) ? "" : Credencial?.Email, ""),
					new Tuple<string, string, string>("DESTINATÁRIOS", string.IsNullOrWhiteSpace(Destinatarios) ? "" : Destinatarios, ""),
					new Tuple<string, string, string>("ANEXOS", string.IsNullOrWhiteSpace(Anexos) ? "" : Anexos, ""),
					new Tuple<string, string, string>("CCO", string.IsNullOrWhiteSpace(Cco) ? "" : Cco, ""),
					new Tuple<string, string, string>("RELATORIO", string.IsNullOrWhiteSpace(Relatorio.GetDescription()) ? "" : Relatorio.GetDescription(), "")
				}
			}
		};
	}
}