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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.