1
I use the code below to generate a txt file in Windows Forms:
StreamWriter file = new StreamWriter("D:\teste.txt");
List<Producao> bpa = ProducaoDados.BuscarBPAC(txtCompetencia.Text);
foreach (Producao linha in bpa)
{
file.WriteLine(
"02" +
linha.Unidade +
linha.Competencia.Substring(3, 4) + linha.Competencia.Substring(0, 2) + //competencia
linha.Cbo +
string.Format("{0:000}", linhaTexto) + string.Format("{0:00}", linhaItem) +
linha.Procedimento +
"000" +
string.Format("{0:000000}", linha.Quant) +
"EXT"
);
linhaItem++;
if (linhaItem > 20)
{
linhaItem = 1;
linhaTexto++;
}
}
I want to know how to include this code in a project MVC
, the system create that file and in the end, appear the option pro user download the same on your machine.