2
I need to adapt this method of an application Windows Forms
https://github.com/BoletoNet/boletonet for Console Application
, that is, instead of using the object saveFileDialog.ShowDialog()
I have to create the file using another class method Stream
:
Method Used in Windows Forms application:
public void GeraArquivoCNAB400(IBanco banco, Cedente cedente, Boletos boletos)
{
try
{
saveFileDialog.Filter = "Arquivos de Retorno (*.rem)|*.rem|Todos Arquivos (*.*)|*.*";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
ArquivoRemessa arquivo = new ArquivoRemessa(TipoArquivo.CNAB400);
//Valida a Remessa Correspondentes antes de Gerar a mesma...
string vMsgRetorno = string.Empty;
bool vValouOK = arquivo.ValidarArquivoRemessa(cedente.Convenio.ToString(), banco, cedente, boletos, 1, out vMsgRetorno);
if (!vValouOK)
{
MessageBox.Show(String.Concat("Foram localizados inconsistências na validação da remessa!", Environment.NewLine, vMsgRetorno),
"Teste",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
else
{
arquivo.GerarArquivoRemessa("0", banco, cedente, boletos, saveFileDialog.OpenFile(), 1);
MessageBox.Show("Arquivo gerado com sucesso!", "Teste",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I need to adapt to be used in a Console Application application.
What exactly do you need? It seems to me to just take those parts that are from Windows Forms and replace with a fixed value.
– Maniero
How would I replace it with a fixed amount ?
– hard123