/// <summary> /// Gera o arquivo de retorno de identificação quando a partir de um arquivo que já foi gerado /// </summary> /// <param name="idArquivo"></param> /// <returns></returns> public void GeraArquivoFisicoRetornoIdentificacao(int idArquivo) { try { var cab = ACSOPRGCR_RCabecalhoBD.ConsultaPorIdArquivo(idArquivo); string path = ConfigurationManager.AppSettings["ACSOIDTSC_R.CRI.DiretotioDestino"]; string pathCompleto = Path.Combine(path, cab.NomeArquivo); using (StreamWriter sw = new StreamWriter(pathCompleto, false, Encoding.UTF8)) { //Gero Cabeçalho sw.WriteLine(cab.ToString()); //Gero Lote sw.WriteLine(ACSOPRGCR_RLoteBD.ConsultaPorIdArquivo(idArquivo).ToString()); //Gero detalhe foreach (var det in ACSOPRGCR_RDetalheBD.ConsultaPorIdArquivo(idArquivo)) { sw.WriteLine(det.ToString()); } //Gero Rodapé sw.WriteLine(ACSOPRGCR_RRodapeBD.ConsultaPorIdArquivo(idArquivo).ToString()); } } catch (Exception) { throw; } }
/// <summary> /// Gera o arquivo de retorno de carga quando a partir de um arquivo que já foi gerado /// </summary> /// <param name="idArquivo"></param> /// <returns></returns> public StringWriter GeraArquivoRetornoCarga(int idArquivo) { try { using (StringWriter sw = new StringWriter(new System.Globalization.CultureInfo("pt-BR"))) { //Gero Cabeçalho sw.WriteLine(ACSOPRGCR_RCabecalhoBD.ConsultaPorIdArquivo(idArquivo).ToString()); //Gero Lote sw.WriteLine(ACSOPRGCR_RLoteBD.ConsultaPorIdArquivo(idArquivo).ToString()); //Gero detalhe foreach (var det in ACSOPRGCR_RDetalheBD.ConsultaPorIdArquivo(idArquivo)) { sw.WriteLine(det.ToString()); } //Gero Rodapé sw.WriteLine(ACSOPRGCR_RRodapeBD.ConsultaPorIdArquivo(idArquivo)); return(sw); } } catch (Exception) { throw; } }