private IngestionTabType AddTabTypeToDb(UploadViewFileTab tab) { string uniqueTabTypeName = MakeUniqueTabTypeName(tab.TabName); IngestionTabType ingestionTabType = new IngestionTabType { IngestionTabTypeName = uniqueTabTypeName, HeaderRow = tab.HeaderRow, NumberOfDataColumns = tab.ColumnList.Count }; db.IngestionTabTypes.Add(ingestionTabType); db.SaveChanges(); return ingestionTabType; }
private void AddTabInformation(int newFileType, List<UploadViewFileTab> uploadedFileTabList) { foreach (var tab in uploadedFileTabList) { IngestionTabType ingestionTabType = new IngestionTabType(); int thisTabType = WhatTabTypeIsThis(tab); if (thisTabType == 0) { // it's a new tab type so add it to the db ingestionTabType = AddTabTypeToDb(tab); thisTabType = ingestionTabType.Id; } // tab type might not be new but file type might be // so we have to check for this pair in the wtiw db var thisPairIsAlreadyInWTIWDb = (from x in db.WhichTabsInWhichFiles where ((x.FileTypeID == newFileType) && (x.TabTypeID == thisTabType)) select x).Any(); if (!thisPairIsAlreadyInWTIWDb) AddWtiwInfoToDb(thisTabType, newFileType); // for now we are not adding tab info stuff to the db //AddTabInfoToDb(thisTabType, tab); AddColumnInformation(tab, thisTabType); } }