Exemplo n.º 1
0
        private void ProcessFile()
        {
            DataRow   fileContentRow   = null;
            DataTable fileContentShell = null;

            // Load the file into the readers file object.
            Logger.WriteLine("BaseFileReader.OnProcess", "             OPENING: " + FileName, System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
            Open(this, new EventArgs());

            // Load the file into the readers CompleteFileContents data table.
            Load(this, new EventArgs());

            fileContentShell           = CompleteFileContents.Clone();
            fileContentShell.TableName = Name;

            // Add the cloned table to the shared data as the modul's output table.
            SharedData.Add(fileContentShell);

            if (EndRow == 0 || EndRow > CompleteFileContents.Rows.Count)
            {
                EndRow = CompleteFileContents.Rows.Count;
            }

            if (StartRow <= CompleteFileContents.Rows.Count)
            {
                // Loop through the CompleteFileContents.Rows until we reach EndRow.
                for (int i = (StartRow - 1); i <= EndRow - 1; i++)
                {
                    // Copy the file's row contents to the reader's output table.
                    fileContentRow           = GlobalOutputTable.NewRow();
                    fileContentRow.ItemArray = CompleteFileContents.Rows[i].ItemArray;

                    GlobalOutputTable.Rows.Add(fileContentRow);
                }

                Logger.WriteLine("BaseFileReader.OnProcess", " ", System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
                Logger.WriteLine("BaseFileReader.OnProcess", "              STATUS: SUCCESSFULL", System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
                Logger.WriteLine("BaseFileReader.OnProcess", "            ROWCOUNT: " + GlobalOutputTable.Rows.Count, System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
            }
            else
            {
                Logger.WriteLine("BaseFileReader.OnProcess", " ", System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
                Logger.WriteLine("BaseFileReader.OnProcess", "              STATUS: NO DATA", System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
            }

            Close(this, new EventArgs());
        }