From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- Gestor.Application/Helpers/MailHelper.cs | 745 ------------------------------- 1 file changed, 745 deletions(-) delete mode 100644 Gestor.Application/Helpers/MailHelper.cs (limited to 'Gestor.Application/Helpers/MailHelper.cs') diff --git a/Gestor.Application/Helpers/MailHelper.cs b/Gestor.Application/Helpers/MailHelper.cs deleted file mode 100644 index e9f2cde..0000000 --- a/Gestor.Application/Helpers/MailHelper.cs +++ /dev/null @@ -1,745 +0,0 @@ -using CsQuery.ExtensionMethods.Internal; -using Gestor.Application.ViewModels; -using Gestor.Common.Helpers; -using Gestor.Common.Validation; -using Gestor.Infrastructure.Repository.Interface; -using Gestor.Infrastructure.UnitOfWork.Generic; -using Gestor.Infrastructure.UnitOfWork.Logic; -using Gestor.Model.Common; -using Gestor.Model.Domain.Common; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.MalaDireta; -using Gestor.Model.Domain.Seguros; -using Gestor.Model.Helper; -using Google.Apis.Auth.OAuth2; -using Google.Apis.Gmail.v1; -using Google.Apis.Gmail.v1.Data; -using Google.Apis.Requests; -using Google.Apis.Services; -using Microsoft.Identity.Client; -using MimeKit; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Net.Mail; -using System.Net.Mime; -using System.Net.Sockets; -using System.Runtime.CompilerServices; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; - -namespace Gestor.Application.Helpers -{ - public class MailHelper - { - public MailHelper() - { - } - - private static StringContent ConverteMailMessageParaStringContent(MailMessage message) - { - StringContent stringContent; - MimeMessage mimeMessage = (MimeMessage)message; - using (MemoryStream memoryStream = new MemoryStream()) - { - mimeMessage.WriteTo(memoryStream, new CancellationToken()); - memoryStream.Position = (long)0; - using (StreamReader streamReader = new StreamReader(memoryStream)) - { - string end = streamReader.ReadToEnd(); - stringContent = new StringContent(Convert.ToBase64String(Encoding.ASCII.GetBytes(end)), Encoding.UTF8, "text/plain"); - } - } - return stringContent; - } - - public static AlternateView CreateAlternateView(string mailBody) - { - int i; - List linkedResources = new List(); - string[] array = ( - from Match m in Regex.Matches(mailBody, "", RegexOptions.IgnoreCase) - select m.Groups[0].Value).ToArray(); - for (i = 0; i < (int)array.Length; i++) - { - string value = Regex.Match(array[i], "(?<=src=\")(.*?)(?=\")", RegexOptions.IgnoreCase).Value; - string str = Regex.Match(value, "file:(///).*\\.(.*)", RegexOptions.IgnoreCase).Groups[2].Value; - if (str == "jpg") - { - str = "jpeg"; - } - if (Uri.IsWellFormedUriString(value, UriKind.Absolute)) - { - Uri uri = new Uri(value); - if (File.Exists(uri.LocalPath)) - { - mailBody = mailBody.Replace(value, string.Concat("data:image/", str, ";base64,", Convert.ToBase64String(File.ReadAllBytes(uri.LocalPath)))); - } - } - } - array = ( - from Match m in Regex.Matches(mailBody, "", RegexOptions.IgnoreCase) - select m.Groups[0].Value).ToArray(); - for (i = 0; i < (int)array.Length; i++) - { - string str1 = array[i]; - string value1 = Regex.Match(str1, "(?<=src=\").*(?=\")", RegexOptions.IgnoreCase).Value; - string value2 = Regex.Match(value1, "(?<=data:).*(?=;)", RegexOptions.IgnoreCase).Value; - if (Gestor.Common.Validation.ValidationHelper.IsNullOrEmpty(value2) || Gestor.Common.Validation.ValidationHelper.IsNullOrEmpty(value1)) - { - mailBody = mailBody.Replace(str1, string.Empty); - } - else - { - byte[] numArray = Convert.FromBase64String(Regex.Match(value1, "(?<=base64,)[^\"]*", RegexOptions.IgnoreCase).Value); - string str2 = Guid.NewGuid().ToString(); - linkedResources.Add(new LinkedResource(new MemoryStream(numArray), value2) - { - ContentId = str2, - TransferEncoding = TransferEncoding.Base64 - }); - string str3 = string.Concat("cid:", str2); - mailBody = mailBody.Replace(value1, str3); - } - } - AlternateView alternateView = AlternateView.CreateAlternateViewFromString(mailBody, null, "text/html"); - ExtensionMethods.AddRange(alternateView.LinkedResources, linkedResources); - return alternateView; - } - - public static string Encode(string text) - { - return Convert.ToBase64String(Encoding.UTF8.GetBytes(text)).Replace('+', '-').Replace('/', '\u005F').Replace("=", ""); - } - - public List Send(Credencial credencial, List destinatarios, TipoTela tela, long id) - { - List logEnvios1 = new List(); - int num = 100; - destinatarios.ForEach(async (Destinatario i) => { - if (num == 0) - { - num = 100; - await Task.Delay(1000); - } - List logEnvios = logEnvios1; - logEnvios.Add(await this.SendAsync(credencial, i, null, null, 0, false)); - logEnvios = null; - num--; - }); - return logEnvios1; - } - - public async Task SendAsync(Credencial credencial, Destinatario destinatario, FiltroArquivoDigital filtro = null, List maladireta = null, TipoTela tela = 0, bool confirmarLeitura = false) - { - TipoTela tipoTela = new TipoTela(); - IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); - LogEnvio logEnvio2 = await Task.Run(() => { - AuthenticationResult result; - List strs; - string str; - long id; - string str1; - string str2; - string str3; - string str4; - string str5; - string str6; - Action action2 = null; - Action action3 = null; - LogEnvio logEnvio = new LogEnvio(); - logEnvio.set_Credencial(credencial); - logEnvio.set_Destinatario(destinatario); - LogEnvio logEnvio1 = logEnvio; - AlternateView alternateView = MailHelper.CreateAlternateView(destinatario.get_Corpo()); - try - { - MailMessage mailMessage = new MailMessage() - { - From = new MailAddress(credencial.get_Email(), (string.IsNullOrWhiteSpace(credencial.get_Header()) ? Recursos.Empresa.get_Nome() : credencial.get_Header())), - BodyEncoding = Encoding.UTF8, - Subject = destinatario.get_Assunto() - }; - mailMessage.AlternateViews.Add(alternateView); - mailMessage.ReplyToList.Add(new MailAddress((string.IsNullOrWhiteSpace(credencial.get_Replyto()) ? credencial.get_Email() : credencial.get_Replyto()))); - mailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; - mailMessage.IsBodyHtml = true; - MailMessage mailMessage1 = mailMessage; - if (confirmarLeitura) - { - mailMessage1.Headers.Add("Disposition-Notification-To", credencial.get_Email()); - } - destinatario.get_Email().Split(new char[] { ';' }).ToList().ForEach((string s) => { - if (!Gestor.Model.Helper.ValidationHelper.ValidacaoEmail(s)) - { - return; - } - mailMessage1.To.Add(new MailAddress(s)); - }); - List strs1 = new List(); - List encaminharOculto = destinatario.get_EncaminharOculto(); - if (encaminharOculto != null) - { - encaminharOculto.ForEach((string x) => { - if (string.IsNullOrEmpty(x)) - { - return; - } - if (!x.Contains(";")) - { - if (!Gestor.Model.Helper.ValidationHelper.ValidacaoEmail(x)) - { - return; - } - strs1.Add(x); - return; - } - List list = x.Split(new char[] { ';' }).ToList(); - Action u003cu003e9_6 = action2; - if (u003cu003e9_6 == null) - { - Action action = (string s) => { - if (!Gestor.Model.Helper.ValidationHelper.ValidacaoEmail(s)) - { - return; - } - strs1.Add(s); - }; - Action action1 = action; - action2 = action; - u003cu003e9_6 = action1; - } - list.ForEach(u003cu003e9_6); - }); - } - else - { - } - List encaminhar = destinatario.get_Encaminhar(); - if (encaminhar != null) - { - encaminhar.ForEach((string x) => { - if (string.IsNullOrEmpty(x)) - { - return; - } - if (!x.Contains(";")) - { - if (!Gestor.Model.Helper.ValidationHelper.ValidacaoEmail(x)) - { - return; - } - strs1.Add(x); - return; - } - List list = x.Split(new char[] { ';' }).ToList(); - Action u003cu003e9_7 = action3; - if (u003cu003e9_7 == null) - { - Action action = (string s) => { - if (!Gestor.Model.Helper.ValidationHelper.ValidacaoEmail(s)) - { - return; - } - strs1.Add(s); - }; - Action action1 = action; - action3 = action; - u003cu003e9_7 = action1; - } - list.ForEach(u003cu003e9_7); - }); - } - else - { - } - strs1.ForEach((string x) => mailMessage1.Bcc.Add(new MailAddress(x))); - List anexos = destinatario.get_Anexos(); - if (anexos != null) - { - anexos.ForEach((Gestor.Model.Domain.Common.ArquivoDigital x) => { - Attachment attachment = new Attachment(new MemoryStream(x.get_Arquivo()), string.Concat(x.get_Descricao(), Gestor.Common.Validation.ValidationHelper.GetDefaultExtension(x.get_Extensao()))); - mailMessage1.Attachments.Add(attachment); - }); - } - else - { - } - if (credencial.get_Email().Contains("@gmail.com")) - { - credencial.set_Tipo(1); - } - TipoEmail tipo = credencial.get_Tipo(); - if (tipo == 1) - { - ClientSecrets clientSecret = new ClientSecrets(); - clientSecret.set_ClientId("378618252089-fm92uqgnk2jivf25mk2tv9s735n4nf6u.apps.googleusercontent.com"); - clientSecret.set_ClientSecret("kUiTfSuwZLLfteqwX7x6glsu"); - UserCredential userCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(clientSecret, new string[] { GmailService.Scope.GmailSend }, credencial.get_Email(), CancellationToken.None, null, null).Result; - Google.Apis.Gmail.v1.Data.Message message = new Google.Apis.Gmail.v1.Data.Message(); - message.set_Raw(MailHelper.Encode(MimeMessage.CreateFromMailMessage(mailMessage1).ToString())); - Google.Apis.Gmail.v1.Data.Message message1 = message; - BaseClientService.Initializer initializer = new BaseClientService.Initializer(); - initializer.set_HttpClientInitializer(userCredential); - initializer.set_ApplicationName("AGGER GESTOR"); - UsersResource.MessagesResource.SendRequest sendRequest = (new GmailService(initializer)).get_Users().get_Messages().Send(message1, credencial.get_Email()); - logEnvio1.set_Enviado(false); - if (sendRequest.Execute().get_LabelIds().Contains("SENT")) - { - logEnvio1.set_Enviado(true); - } - } - else if (tipo == 2) - { - StringContent stringContent = new StringContent(""); - PublicClientApplicationBuilder publicClientApplicationBuilder = PublicClientApplicationBuilder.Create("8d1c32fe-4c17-4d5b-a21b-55b5529c3e12").WithDefaultRedirectUri(); - CacheOptions cacheOption = new CacheOptions(); - cacheOption.set_UseSharedCache(true); - IPublicClientApplication publicClientApplication = publicClientApplicationBuilder.WithCacheOptions(cacheOption).Build(); - string[] strArrays = new string[] { "user.read", "https://graph.microsoft.com/Mail.Send" }; - try - { - stringContent = MailHelper.ConverteMailMessageParaStringContent(mailMessage1); - IEnumerable accounts = publicClientApplication.GetAccountsAsync().Result; - result = (accounts == null || accounts.Count() == 0 ? publicClientApplication.AcquireTokenInteractive(strArrays).ExecuteAsync().Result : publicClientApplication.AcquireTokenSilent(strArrays, (accounts != null ? accounts.FirstOrDefault() : null)).ExecuteAsync().Result); - } - catch - { - result = publicClientApplication.AcquireTokenInteractive(strArrays).ExecuteAsync().Result; - } - using (HttpClient httpClient = new HttpClient()) - { - httpClient.get_DefaultRequestHeaders().Clear(); - httpClient.get_DefaultRequestHeaders().Add("Authorization", string.Concat("Bearer ", (result != null ? result.get_AccessToken() : null))); - logEnvio1.set_Enviado(httpClient.PostAsync("https://graph.microsoft.com/v1.0/me/sendMail", stringContent).Result.get_IsSuccessStatusCode()); - } - } - else - { - NetworkCredential networkCredential = new NetworkCredential() - { - Password = EncryptionHelper.Decrypt(credencial.get_Senha()), - UserName = credencial.get_Usuario() ?? credencial.get_Email() - }; - SmtpClient smtpClient = new SmtpClient() - { - EnableSsl = credencial.get_Seguro(), - Host = credencial.get_Dominio(), - Port = credencial.get_Porta().GetValueOrDefault(587), - UseDefaultCredentials = false, - Credentials = networkCredential - }; - smtpClient.SendCompleted += new SendCompletedEventHandler((object sender, AsyncCompletedEventArgs args) => { - logEnvio1.set_Enviado((!args.Cancelled ? true : args.Error != null)); - if (args.Error != null) - { - logEnvio1.set_Erro(args.Error.ToString()); - } - }); - smtpClient.Send(mailMessage1); - logEnvio1.set_Enviado(true); - } - } - catch (Exception exception1) - { - Exception exception = exception1; - logEnvio1.set_Enviado(false); - logEnvio1.set_Erro((exception.InnerException == null ? exception.Message : string.Concat(exception.Message, " | ", exception.InnerException.Message))); - } - if (tela == 40) - { - return logEnvio1; - } - using (UnitOfWork commited = Instancia.Commited) - { - List strs2 = new List() - { - destinatario.get_Email() - }; - if (destinatario.get_Encaminhar() != null) - { - strs2.AddRange(destinatario.get_Encaminhar()); - } - List strs3 = new List(); - if (destinatario.get_EncaminharOculto() != null) - { - strs3.AddRange(destinatario.get_EncaminharOculto()); - } - List arquivoDigitals = destinatario.get_Anexos(); - if (arquivoDigitals != null) - { - Func u003cu003e9_09 = MailHelper.u003cu003ec.u003cu003e9__0_9; - if (u003cu003e9_09 == null) - { - u003cu003e9_09 = (Gestor.Model.Domain.Common.ArquivoDigital x) => string.Concat(x.get_Descricao(), Gestor.Common.Validation.ValidationHelper.GetDefaultExtension(x.get_Extensao())); - MailHelper.u003cu003ec.u003cu003e9__0_9 = u003cu003e9_09; - } - strs = arquivoDigitals.Select(u003cu003e9_09).ToList(); - } - else - { - strs = null; - } - List strs4 = strs; - DateTime networkTime = Funcoes.GetNetworkTime(); - if (filtro != null) - { - switch (filtro.get_Tipo()) - { - case 1: - { - tipoTela = 1; - break; - } - case 2: - { - tipoTela = 2; - break; - } - case 3: - { - tipoTela = 5; - break; - } - case 4: - { - tipoTela = 3; - break; - } - case 5: - { - tipoTela = 7; - break; - } - case 6: - { - tipoTela = 15; - break; - } - case 7: - { - tipoTela = 23; - break; - } - case 8: - { - tipoTela = 13; - break; - } - case 9: - { - tipoTela = 25; - break; - } - case 10: - { - tipoTela = 24; - break; - } - case 11: - { - tipoTela = 33; - break; - } - case 12: - { - tipoTela = 16; - break; - } - case 13: - { - tipoTela = 18; - break; - } - default: - { - tipoTela = 0; - break; - } - } - if (strs4 != null && logEnvio1.get_Enviado()) - { - LogEmail logEmail = new LogEmail(); - logEmail.set_Credencial(credencial); - logEmail.set_EntityId(filtro.get_Id()); - logEmail.set_Usuario(Recursos.Usuario); - logEmail.set_Data(networkTime); - logEmail.set_Tela(tipoTela); - logEmail.set_Destinatarios(string.Join(";", strs2)); - logEmail.set_Cco(string.Join(";", strs3)); - logEmail.set_Assunto(destinatario.get_Assunto()); - logEmail.set_Corpo(destinatario.get_Corpo()); - logEmail.set_Anexos(string.Join(";", strs4)); - logEmail.set_Versao(LoginViewModel.VersaoAtual); - logEmail.set_NomeMaquina(Environment.MachineName); - logEmail.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList = hostEntry.AddressList; - Func u003cu003e9_010 = MailHelper.u003cu003ec.u003cu003e9__0_10; - if (u003cu003e9_010 == null) - { - u003cu003e9_010 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - MailHelper.u003cu003ec.u003cu003e9__0_10 = u003cu003e9_010; - } - IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault(u003cu003e9_010); - if (pAddress != null) - { - str6 = pAddress.ToString(); - } - else - { - str6 = null; - } - logEmail.set_Ip(str6); - commited.get_RegistroLogRepository().SaveOrUpdate(logEmail); - } - commited.Commit(); - } - else if (maladireta == null) - { - if (strs4 != null) - { - LogEmail logEmail1 = new LogEmail(); - logEmail1.set_Credencial(credencial); - logEmail1.set_Usuario(Recursos.Usuario); - logEmail1.set_Data(networkTime); - logEmail1.set_Tela(tela); - logEmail1.set_Destinatarios(string.Join(";", strs2)); - logEmail1.set_Cco(string.Join(";", strs3)); - logEmail1.set_Assunto(destinatario.get_Assunto()); - logEmail1.set_Corpo(destinatario.get_Corpo()); - logEmail1.set_Anexos(string.Join(";", strs4)); - logEmail1.set_Versao(LoginViewModel.VersaoAtual); - logEmail1.set_NomeMaquina(Environment.MachineName); - logEmail1.set_UsuarioMaquina(Environment.UserName); - IPAddress[] pAddressArray = hostEntry.AddressList; - Func u003cu003e9_016 = MailHelper.u003cu003ec.u003cu003e9__0_16; - if (u003cu003e9_016 == null) - { - u003cu003e9_016 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - MailHelper.u003cu003ec.u003cu003e9__0_16 = u003cu003e9_016; - } - IPAddress pAddress1 = ((IEnumerable)pAddressArray).FirstOrDefault(u003cu003e9_016); - if (pAddress1 != null) - { - str = pAddress1.ToString(); - } - else - { - str = null; - } - logEmail1.set_Ip(str); - commited.get_RegistroLogRepository().SaveOrUpdate(logEmail1); - } - commited.Commit(); - } - else - { - foreach (MalaDireta maladiretum in maladireta) - { - if (maladiretum.get_Tela() == 1) - { - LogEmail logEmail2 = new LogEmail(); - logEmail2.set_Credencial(credencial); - logEmail2.set_Usuario(Recursos.Usuario); - logEmail2.set_EntityId(maladiretum.get_Cliente().get_Id()); - logEmail2.set_Data(networkTime); - logEmail2.set_Tela(maladiretum.get_Tela()); - logEmail2.set_Destinatarios(string.Join(";", strs2)); - logEmail2.set_Cco(string.Join(";", strs3)); - logEmail2.set_Assunto(destinatario.get_Assunto()); - logEmail2.set_Corpo(destinatario.get_Corpo()); - logEmail2.set_Anexos(string.Join(";", strs4)); - logEmail2.set_Versao(LoginViewModel.VersaoAtual); - logEmail2.set_NomeMaquina(Environment.MachineName); - logEmail2.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList1 = hostEntry.AddressList; - Func u003cu003e9_011 = MailHelper.u003cu003ec.u003cu003e9__0_11; - if (u003cu003e9_011 == null) - { - u003cu003e9_011 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - MailHelper.u003cu003ec.u003cu003e9__0_11 = u003cu003e9_011; - } - IPAddress pAddress2 = ((IEnumerable)addressList1).FirstOrDefault(u003cu003e9_011); - if (pAddress2 != null) - { - str5 = pAddress2.ToString(); - } - else - { - str5 = null; - } - logEmail2.set_Ip(str5); - logEmail2.set_Relatorio(maladiretum.get_Relatorio()); - commited.get_RegistroLogRepository().SaveOrUpdate(logEmail2); - } - else if (maladiretum.get_Tela() == 2) - { - LogEmail logEmail3 = new LogEmail(); - logEmail3.set_Credencial(credencial); - logEmail3.set_Usuario(Recursos.Usuario); - logEmail3.set_EntityId(maladiretum.get_Apolice().get_Id()); - logEmail3.set_Data(networkTime); - logEmail3.set_Tela(maladiretum.get_Tela()); - logEmail3.set_Destinatarios(string.Join(";", strs2)); - logEmail3.set_Cco(string.Join(";", strs3)); - logEmail3.set_Assunto(destinatario.get_Assunto()); - logEmail3.set_Corpo(destinatario.get_Corpo()); - logEmail3.set_Anexos(string.Join(";", strs4)); - logEmail3.set_Versao(LoginViewModel.VersaoAtual); - logEmail3.set_NomeMaquina(Environment.MachineName); - logEmail3.set_UsuarioMaquina(Environment.UserName); - IPAddress[] pAddressArray1 = hostEntry.AddressList; - Func u003cu003e9_012 = MailHelper.u003cu003ec.u003cu003e9__0_12; - if (u003cu003e9_012 == null) - { - u003cu003e9_012 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - MailHelper.u003cu003ec.u003cu003e9__0_12 = u003cu003e9_012; - } - IPAddress pAddress3 = ((IEnumerable)pAddressArray1).FirstOrDefault(u003cu003e9_012); - if (pAddress3 != null) - { - str4 = pAddress3.ToString(); - } - else - { - str4 = null; - } - logEmail3.set_Ip(str4); - logEmail3.set_Relatorio(maladiretum.get_Relatorio()); - commited.get_RegistroLogRepository().SaveOrUpdate(logEmail3); - } - else if (maladiretum.get_Tela() == 5) - { - LogEmail logEmail4 = new LogEmail(); - logEmail4.set_Credencial(credencial); - logEmail4.set_Usuario(Recursos.Usuario); - logEmail4.set_EntityId(maladiretum.get_Parcela().get_Id()); - logEmail4.set_Data(networkTime); - logEmail4.set_Tela(maladiretum.get_Tela()); - logEmail4.set_Destinatarios(string.Join(";", strs2)); - logEmail4.set_Cco(string.Join(";", strs3)); - logEmail4.set_Assunto(destinatario.get_Assunto()); - logEmail4.set_Corpo(destinatario.get_Corpo()); - logEmail4.set_Anexos(string.Join(";", strs4)); - logEmail4.set_Versao(LoginViewModel.VersaoAtual); - logEmail4.set_NomeMaquina(Environment.MachineName); - logEmail4.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList2 = hostEntry.AddressList; - Func u003cu003e9_013 = MailHelper.u003cu003ec.u003cu003e9__0_13; - if (u003cu003e9_013 == null) - { - u003cu003e9_013 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - MailHelper.u003cu003ec.u003cu003e9__0_13 = u003cu003e9_013; - } - IPAddress pAddress4 = ((IEnumerable)addressList2).FirstOrDefault(u003cu003e9_013); - if (pAddress4 != null) - { - str3 = pAddress4.ToString(); - } - else - { - str3 = null; - } - logEmail4.set_Ip(str3); - logEmail4.set_Relatorio(maladiretum.get_Relatorio()); - commited.get_RegistroLogRepository().SaveOrUpdate(logEmail4); - } - else if (maladiretum.get_Tela() != 7) - { - if (maladiretum.get_Tela() != null) - { - continue; - } - LogEmail logEmail5 = new LogEmail(); - logEmail5.set_Credencial(credencial); - logEmail5.set_Usuario(Recursos.Usuario); - Documento apolice = maladiretum.get_Apolice(); - id = (apolice != null ? apolice.get_Id() : (long)0); - logEmail5.set_EntityId(id); - logEmail5.set_Data(networkTime); - logEmail5.set_Tela(2); - logEmail5.set_Destinatarios(string.Join(";", strs2)); - logEmail5.set_Cco(string.Join(";", strs3)); - logEmail5.set_Assunto(destinatario.get_Assunto()); - logEmail5.set_Corpo(destinatario.get_Corpo()); - logEmail5.set_Anexos(string.Join(";", strs4)); - logEmail5.set_Versao(LoginViewModel.VersaoAtual); - logEmail5.set_NomeMaquina(Environment.MachineName); - logEmail5.set_UsuarioMaquina(Environment.UserName); - IPAddress[] pAddressArray2 = hostEntry.AddressList; - Func u003cu003e9_015 = MailHelper.u003cu003ec.u003cu003e9__0_15; - if (u003cu003e9_015 == null) - { - u003cu003e9_015 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - MailHelper.u003cu003ec.u003cu003e9__0_15 = u003cu003e9_015; - } - IPAddress pAddress5 = ((IEnumerable)pAddressArray2).FirstOrDefault(u003cu003e9_015); - if (pAddress5 != null) - { - str1 = pAddress5.ToString(); - } - else - { - str1 = null; - } - logEmail5.set_Ip(str1); - logEmail5.set_Relatorio(maladiretum.get_Relatorio()); - commited.get_RegistroLogRepository().SaveOrUpdate(logEmail5); - } - else - { - LogEmail logEmail6 = new LogEmail(); - logEmail6.set_Credencial(credencial); - logEmail6.set_Usuario(Recursos.Usuario); - logEmail6.set_EntityId(maladiretum.get_Sinistro().get_Id()); - logEmail6.set_Data(networkTime); - logEmail6.set_Tela(maladiretum.get_Tela()); - logEmail6.set_Destinatarios(string.Join(";", strs2)); - logEmail6.set_Cco(string.Join(";", strs3)); - logEmail6.set_Assunto(destinatario.get_Assunto()); - logEmail6.set_Corpo(destinatario.get_Corpo()); - logEmail6.set_Anexos(string.Join(";", strs4)); - logEmail6.set_Versao(LoginViewModel.VersaoAtual); - logEmail6.set_NomeMaquina(Environment.MachineName); - logEmail6.set_UsuarioMaquina(Environment.UserName); - IPAddress[] addressList3 = hostEntry.AddressList; - Func u003cu003e9_014 = MailHelper.u003cu003ec.u003cu003e9__0_14; - if (u003cu003e9_014 == null) - { - u003cu003e9_014 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; - MailHelper.u003cu003ec.u003cu003e9__0_14 = u003cu003e9_014; - } - IPAddress pAddress6 = ((IEnumerable)addressList3).FirstOrDefault(u003cu003e9_014); - if (pAddress6 != null) - { - str2 = pAddress6.ToString(); - } - else - { - str2 = null; - } - logEmail6.set_Ip(str2); - logEmail6.set_Relatorio(maladiretum.get_Relatorio()); - commited.get_RegistroLogRepository().SaveOrUpdate(logEmail6); - } - } - commited.Commit(); - } - } - return logEnvio1; - }); - return logEnvio2; - } - } -} \ No newline at end of file -- cgit v1.2.3