public async Task <List <string> > TransmitirNotasFiscalEmContingencia() //Chamar esse método quando o serviço voltar { List <string> erros = new List <string>(); var notaFiscalService = new NotaFiscalService(); var notas = notaFiscalService.GetNotasContingencia(); var config = ConfiguracaoService.GetConfiguracao(); var notasNFe = new List <string>(); var notasNFCe = new List <string>(); foreach (var nota in notas) { string xml = await nota.LoadXmlAsync(); if (nota.Modelo.Equals("55")) { notasNFe.Add(xml); } else { notasNFCe.Add(xml); } } try { if (notasNFCe.Count() != 0) { erros = await new NFeAutorizacaoContingencia().TransmitirConsultarLoteContingenciaAsync(config, notasNFCe, Modelo.Modelo65); } if (notasNFe.Count() != 0) { erros = await new NFeAutorizacaoContingencia().TransmitirConsultarLoteContingenciaAsync(config, notasNFe, Modelo.Modelo55); } } catch (Exception e) { string sDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "EmissorNFeDir"); if (!Directory.Exists(sDirectory)) { Directory.CreateDirectory(sDirectory); } using (FileStream stream = File.Create(Path.Combine(sDirectory, "logTransmitirContingencia.txt"))) { using (StreamWriter writer = new StreamWriter(stream)) { writer.WriteLine(e.ToString()); } } return(null); } return(erros); }