Example #1
0
        private void ProcessEdiFile(IFileData fileData, FileParsingResult result)
        {
            var parser      = new EdiTextFileParser(fileData);
            var exceptions  = new List <Exception>();
            var ediClaimXml = parser.Parse(exceptions);

            lock (this)
            {
                result.Errors.AddRange(exceptions);
                result.EdiClaimXml = ediClaimXml;
            }
        }
Example #2
0
 public CompositeTextFileParser(FileProfile fileToProcess, IFileData fileData, IDslScriptRunner scriptRunner, ICustomLogicContainer customLogicContainer, bool isEdiFileFormat = false, int startAtLineNumber = -1)
 {
     _result                = new FileParsingResult();
     _fileToProcess         = fileToProcess;
     _scriptRunner          = scriptRunner;
     _fileToStreamConverter = new FileToStreamConverter();
     _writers               = new Dictionary <object, StreamWriter>();
     _customLogicContainer  = customLogicContainer;
     _fileData              = fileData;
     _isEdiFileFormat       = isEdiFileFormat;
     _startAtLineNumber     = startAtLineNumber;
     SplitSchemas();
 }
Example #3
0
        private void ProcessSingleFile(object schema, IFileData fileData, FileParsingResult result, int startAtLineNumber)
        {
            var fileProfile = this._fileToProcess.GetDeepClone();

            fileProfile.FileProfileId = -1;
            fileProfile.FileName      = fileData.OriginalFileName;
            fileProfile.IsMultiSchema = false;
            fileProfile.HeaderLines   = 0;
            if (!_fileToProcess.IsMultiSchema)
            {
                fileProfile.HeaderLines = _fileToProcess.HeaderLines;
            }
            fileProfile.FooterLines = 0;
            var correctFileTypes = from x in _fileToProcess.FileTypes
                                   where x.SchemaIdentifier == schema.ToString()
                                   select x;

            fileProfile.FileTypes = correctFileTypes.ToList();
            if (fileProfile.FileTypes != null && fileProfile.FileTypes.Count == 1)
            {
                if (_fileToProcess.IsFixedWidth)
                {
                    int scn = 0;
                    foreach (var rd in fileProfile.FileTypes[0].RowDefinitions)
                    {
                        scn++;
                        rd.SourceColumnNumber = scn;
                    }
                }
                var parser     = new TextFileParser(fileProfile, fileData, _scriptRunner, _headerFields, startAtLineNumber);
                var exceptions = new List <Exception>();
                var table      = parser.Parse(exceptions);
                lock (this)
                {
                    result.Errors.AddRange(exceptions);
                    result.Tables[schema] = table;
                }
            }
        }