private void button5_Click(object sender, EventArgs e) { String filename; Boolean fileExists; for (int day = 1; day <= 31; day++) { filename = PrintLogFile.MountName(@"C:\Work\PrintLogs", day, 12, 2010); fileExists = File.Exists(filename); if (fileExists) { MessageBox.Show("Importando arquivo: " + filename); PrintLogPersistence persistence = new PrintLogPersistence(4, dataAccess.GetConnection(), this, false); persistence.ImportFile(filename); } } }
private void button3_Click(object sender, EventArgs e) { String filename = PrintLogFile.MountName(@"C:\PaperCut Print Logger\logs\csv\daily", 10, 04, 2013); CSVReader csvReader = new CSVReader(filename, null); dataGridView1.DataSource = csvReader.Read(); /* * dataGridView1.Columns.Add("hora", "Hora"); * dataGridView1.Columns.Add("usuario", "Usuário"); * dataGridView1.Columns.Add("impressora", "Impressora"); * dataGridView1.Columns.Add("quantidade_paginas", "Quant. Páginas"); * * CopiedDocumentDAO copiedDocumentDAO = new CopiedDocumentDAO(dataAccess.GetConnection()); * List<Object> copiedDocuments = copiedDocumentDAO.GetCopiedDocuments(10, new DateTime(2010, 11, 17), new DateTime(2010, 11, 20), null, null); * foreach (CopiedDocument copy in copiedDocuments) * { * Object[] values = new Object[] { copy.jobTime, copy.userName, copy.printerName, copy.pageCount }; * dataGridView1.Rows.Add(values); * } */ }