Updating the FileWorker Class

To make the additions useful, we have to update the FileWorker class to read and insert the records into our Tutorials database.

Updating <FileWorker.ProcessFiles>

We need to create an instance of our LINQSQL class and then use the file that we found while polling our process folder to populate a new user record for each line in the process file. To do this we will update the <ProcessFiles> method, which is where we query the outgoing folder, send an e-mail, and then move the file to our processed folder. Example 7-6 shows the changes required for <ProcessFiles>.

Example 7-6. FileWorker updated ProcessFiles method to support the LINQSQL class implementation.

Private Sub ProcessFiles()
  Dim LinqSql As LINQSQL = New LINQSQL() ...

Get Programming Windows® Services with Microsoft® Visual Basic® 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.