Example #1
0
        public static FileTemplate GetFileTemplate(string FileIdentifier)
        {
            FileTemplate f = FileTemplates.Where(f1 => f1.FileIdentifier == FileIdentifier).First();
            Table        t = Tables.Where(t1 => t1.TableName == f.TableName).First();

            //loop thru each of the column in table.
            //if the column is not in the template add to the template
            //if the column exists append with the datatype.
            foreach (TableColumn tc in t.TableColumns)
            {
                if (!f.FileColumns.Exists(fc => fc.Field == tc.ColumnName))
                {
                    FileColumn fc = new FileColumn(tc.ColumnName, 0, -1, -1, tc.DataType);
                    f.FileColumns.Add(fc);
                }
                else
                {
                    FileColumn ftc = f.FileColumns.Where(fc => fc.Field == tc.ColumnName).First();
                    ftc.DataType = tc.DataType;
                }
            }
            return(f);
        }
Example #2
0
 public FixedPositionExtractor(string fileidentifier)
 {
     this.fileidentifier = fileidentifier;
     fileTemplate        = FileTemplateLoad.GetFileTemplate(fileidentifier);
 }