summaryrefslogtreecommitdiff
path: root/Gestor.Model/Model.Domain.Ferramentas/LogEmail.cs
blob: a884b02d4eb89b0e5116ebd3bf4e1945def963b4 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
using Gestor.Model.Common;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Domain.Seguros;
using Gestor.Model.Validation;
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 LogEmail : DomainBase
	{
		public string Anexos
		{
			get;
			set;
		}

		public string Assunto
		{
			get;
			set;
		}

		public string Cco
		{
			get;
			set;
		}

		public string Corpo
		{
			get;
			set;
		}

		public Gestor.Model.Domain.Ferramentas.Credencial Credencial
		{
			get;
			set;
		}

		public DateTime Data
		{
			get;
			set;
		}

		public string Destinatarios
		{
			get;
			set;
		}

		public long EntityId
		{
			get;
			set;
		}

		public string Ip
		{
			get;
			set;
		}

		public string NomeMaquina
		{
			get;
			set;
		}

		public Gestor.Model.Common.Relatorio Relatorio
		{
			get;
			set;
		}

		public TipoTela Tela
		{
			get;
			set;
		}

		public Gestor.Model.Domain.Seguros.Usuario Usuario
		{
			get;
			set;
		}

		public string UsuarioMaquina
		{
			get;
			set;
		}

		public string Versao
		{
			get;
			set;
		}

		public LogEmail()
		{
		}

		public List<TupleList> CriarLogEmail()
		{
			string email;
			string str;
			this.Corpo = (new Regex("<title>.*<\\/title>")).Replace(this.Corpo, "").Trim();
			this.Corpo = (new Regex("(<[^>]*>)|(p\\s?{[^}]*})|(\\r)|(\\n)")).Replace(this.Corpo, "").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>("ASSUNTO", (string.IsNullOrWhiteSpace(this.Assunto) ? "" : this.Assunto), ""),
				new Tuple<string, string, string>("CORPO", (string.IsNullOrWhiteSpace(this.Corpo) ? "" : this.Corpo), "")
			};
			Gestor.Model.Domain.Ferramentas.Credencial credencial = this.Credencial;
			if (credencial != null)
			{
				email = credencial.Email;
			}
			else
			{
				email = null;
			}
			if (string.IsNullOrWhiteSpace(email))
			{
				str = "";
			}
			else
			{
				Gestor.Model.Domain.Ferramentas.Credencial credencial1 = this.Credencial;
				if (credencial1 != null)
				{
					str = credencial1.Email;
				}
				else
				{
					str = null;
				}
			}
			observableCollection.Add(new Tuple<string, string, string>("E-MAIL DE ENVIO", str, ""));
			observableCollection.Add(new Tuple<string, string, string>("DESTINATÁRIOS", (string.IsNullOrWhiteSpace(this.Destinatarios) ? "" : this.Destinatarios), ""));
			observableCollection.Add(new Tuple<string, string, string>("ANEXOS", (string.IsNullOrWhiteSpace(this.Anexos) ? "" : this.Anexos), ""));
			observableCollection.Add(new Tuple<string, string, string>("CCO", (string.IsNullOrWhiteSpace(this.Cco) ? "" : this.Cco), ""));
			observableCollection.Add(new Tuple<string, string, string>("RELATORIO", (string.IsNullOrWhiteSpace(this.Relatorio.GetDescription()) ? "" : this.Relatorio.GetDescription()), ""));
			tupleList.Tuples = observableCollection;
			tupleLists.Add(tupleList);
			return tupleLists;
		}
	}
}