private void AddColumnInformation(UploadViewFileTab tab, int thisTabType) { foreach (var column in tab.ColumnList) { IngestionColumnType ingestionColumnType = new IngestionColumnType(); int thisColumnType = WhatColumnTypeIsThis(column); if (thisColumnType == 0) { ingestionColumnType = AddColumnTypeToDb(column); thisColumnType = ingestionColumnType.Id; } var thisPairIsAlreadyInWCIWDb = (from x in db.WhichColumnsInWhichTabs where ((x.ColumnID == thisColumnType) && (x.TabID == thisTabType)) select x).Any(); if (!thisPairIsAlreadyInWCIWDb) AddWciwInfoToDb(thisColumnType, thisTabType); // for now we are not adding column info to the db //AddColumnInfoToDb(thisColumnType, column); } }
private IngestionColumnType AddColumnTypeToDb(UploadViewFileColumn column) { string uniqueColumnTypeName = MakeUniqueColumnTypeName(column.ColumnName); string columnName = column.ColumnName; string dataType = column.DataType; IngestionColumnType ingestionColumnType = new IngestionColumnType { HeaderName = columnName, IngestionColumnDataType = dataType, IngestionColumnTypeName = uniqueColumnTypeName }; db.IngestionColumnTypes.Add(ingestionColumnType); db.SaveChanges(); return ingestionColumnType; }