private void UpdateDataSources(Dictionary<string, object> dataAccessClasses) { // Get the Data Source to set string dataSourceID = commonFunctions.GetCurrentDataSourceID(); // Bail if there isn't one if (dataSourceID == null) { return; } // Get DataAccess Classes to perform updates MapUnitPolysAccess mapUnitPolysAccess = new MapUnitPolysAccess(m_theWorkspace); OverlayPolysAccess OverlayPolysAccess = new OverlayPolysAccess(m_theWorkspace); ContactsAndFaultsAccess ContactsAndFaultsAccess = new ContactsAndFaultsAccess(m_theWorkspace); OtherLinesAccess OtherLinesAccess = new OtherLinesAccess(m_theWorkspace); StationPointsAccess StationPointsAccess = new StationPointsAccess(m_theWorkspace); SamplePointsAccess SamplePointsAccess = new SamplePointsAccess(m_theWorkspace); OrientationDataPointsAccess OrientationDataPointsAccess = new OrientationDataPointsAccess(m_theWorkspace); GlossaryAccess GlossaryAccess = new GlossaryAccess(m_theWorkspace); NotesAccess NotesAccess = new NotesAccess(m_theWorkspace); RelatedDocumentsAccess RelatedDocumentsAccess = new RelatedDocumentsAccess(m_theWorkspace); DescriptionOfMapUnitsAccess DescriptionOfMapUnitsAccess = new DescriptionOfMapUnitsAccess(m_theWorkspace); // Loop through the dictionary foreach (KeyValuePair<string, object> anEntry in dataAccessClasses) { // What table does this come from? switch (anEntry.Key) { case "MapUnitPolys": // Loop through the records in the data access object that comes in MapUnitPolysAccess thisMapUnitPolysAccess = (MapUnitPolysAccess)anEntry.Value; foreach (KeyValuePair<string, MapUnitPolysAccess.MapUnitPoly> MapUnitPolysToUpdate in thisMapUnitPolysAccess.MapUnitPolysDictionary) { MapUnitPolysAccess.MapUnitPoly thisMapUnitPoly = (MapUnitPolysAccess.MapUnitPoly)MapUnitPolysToUpdate.Value; thisMapUnitPoly.DataSourceID = dataSourceID; mapUnitPolysAccess.UpdateMapUnitPoly(thisMapUnitPoly); } mapUnitPolysAccess.SaveMapUnitPolys(); break; case "OverlayPolys": OverlayPolysAccess thisOverlayPolysAccess = (OverlayPolysAccess)anEntry.Value; foreach (KeyValuePair<string, OverlayPolysAccess.OverlayPoly> OverlayPolysToUpdate in thisOverlayPolysAccess.OverlayPolysDictionary) { OverlayPolysAccess.OverlayPoly thisOverlayPoly = (OverlayPolysAccess.OverlayPoly)OverlayPolysToUpdate.Value; thisOverlayPoly.DataSourceID = dataSourceID; OverlayPolysAccess.UpdateOverlayPoly(thisOverlayPoly); } OverlayPolysAccess.SaveOverlayPolys(); break; case "ContactsAndFaults": ContactsAndFaultsAccess thisContactsAndFaultsAccess = (ContactsAndFaultsAccess)anEntry.Value; foreach (KeyValuePair<string, ContactsAndFaultsAccess.ContactsAndFault> ContactsAndFaultsToUpdate in thisContactsAndFaultsAccess.ContactsAndFaultsDictionary) { ContactsAndFaultsAccess.ContactsAndFault thisContactsAndFault = (ContactsAndFaultsAccess.ContactsAndFault)ContactsAndFaultsToUpdate.Value; thisContactsAndFault.DataSourceID = dataSourceID; ContactsAndFaultsAccess.UpdateContactsAndFault(thisContactsAndFault); } ContactsAndFaultsAccess.SaveContactsAndFaults(); break; case "OtherLines": OtherLinesAccess thisOtherLinesAccess = (OtherLinesAccess)anEntry.Value; foreach (KeyValuePair<string, OtherLinesAccess.OtherLine> OtherLinesToUpdate in thisOtherLinesAccess.OtherLinesDictionary) { OtherLinesAccess.OtherLine thisOtherLine = (OtherLinesAccess.OtherLine)OtherLinesToUpdate.Value; thisOtherLine.DataSourceID = dataSourceID; OtherLinesAccess.UpdateOtherLine(thisOtherLine); } OtherLinesAccess.SaveOtherLines(); break; case "StationPoints": StationPointsAccess thisStationPointsAccess = (StationPointsAccess)anEntry.Value; foreach (KeyValuePair<string, StationPointsAccess.StationPoint> StationPointsToUpdate in thisStationPointsAccess.StationPointsDictionary) { StationPointsAccess.StationPoint thisStationPoint = (StationPointsAccess.StationPoint)StationPointsToUpdate.Value; thisStationPoint.DataSourceID = dataSourceID; StationPointsAccess.UpdateStationPoint(thisStationPoint); } StationPointsAccess.SaveStationPoints(); break; case "SamplePoints": SamplePointsAccess thisSamplePointsAccess = (SamplePointsAccess)anEntry.Value; foreach (KeyValuePair<string, SamplePointsAccess.SamplePoint> SamplePointsToUpdate in thisSamplePointsAccess.SamplePointsDictionary) { SamplePointsAccess.SamplePoint thisSamplePoint = (SamplePointsAccess.SamplePoint)SamplePointsToUpdate.Value; thisSamplePoint.DataSourceID = dataSourceID; SamplePointsAccess.UpdateSamplePoint(thisSamplePoint); } SamplePointsAccess.SaveSamplePoints(); break; case "OrientationDataPoints": OrientationDataPointsAccess thisOrientationDataPointsAccess = (OrientationDataPointsAccess)anEntry.Value; foreach (KeyValuePair<string, OrientationDataPointsAccess.OrientationDataPoint> OrientationDataPointsToUpdate in thisOrientationDataPointsAccess.OrientationDataPointsDictionary) { OrientationDataPointsAccess.OrientationDataPoint thisOrientationDataPoint = (OrientationDataPointsAccess.OrientationDataPoint)OrientationDataPointsToUpdate.Value; thisOrientationDataPoint.DataSourceID = dataSourceID; OrientationDataPointsAccess.UpdateOrientationDataPoint(thisOrientationDataPoint); } OrientationDataPointsAccess.SaveOrientationDataPoints(); break; case "Glossary": GlossaryAccess thisGlossaryAccess = (GlossaryAccess)anEntry.Value; foreach (KeyValuePair<string, GlossaryAccess.Glossary> GlossaryToUpdate in thisGlossaryAccess.GlossaryDictionary) { GlossaryAccess.Glossary thisGlossary = (GlossaryAccess.Glossary)GlossaryToUpdate.Value; thisGlossary.DefinitionSourceID = dataSourceID; GlossaryAccess.UpdateGlossary(thisGlossary); } GlossaryAccess.SaveGlossary(); break; case "Notes": NotesAccess thisNotesAccess = (NotesAccess)anEntry.Value; foreach (KeyValuePair<string, NotesAccess.Note> NotesToUpdate in thisNotesAccess.NotesDictionary) { NotesAccess.Note thisNote = (NotesAccess.Note)NotesToUpdate.Value; thisNote.DataSourceID = dataSourceID; NotesAccess.UpdateNote(thisNote); } NotesAccess.SaveNotes(); break; case "RelatedDocuments": RelatedDocumentsAccess thisRelatedDocumentsAccess = (RelatedDocumentsAccess)anEntry.Value; foreach (KeyValuePair<string, RelatedDocumentsAccess.RelatedDocument> RelatedDocumentsToUpdate in thisRelatedDocumentsAccess.RelatedDocumentsDictionary) { RelatedDocumentsAccess.RelatedDocument thisRelatedDocument = (RelatedDocumentsAccess.RelatedDocument)RelatedDocumentsToUpdate.Value; thisRelatedDocument.DataSourceID = dataSourceID; RelatedDocumentsAccess.UpdateRelatedDocument(thisRelatedDocument); } RelatedDocumentsAccess.SaveRelatedDocuments(); break; case "DescriptionOfMapUnits": DescriptionOfMapUnitsAccess thisDescriptionOfMapUnitsAccess = (DescriptionOfMapUnitsAccess)anEntry.Value; foreach (KeyValuePair<string, DescriptionOfMapUnitsAccess.DescriptionOfMapUnit> DescriptionOfMapUnitsToUpdate in thisDescriptionOfMapUnitsAccess.DescriptionOfMapUnitsDictionary) { DescriptionOfMapUnitsAccess.DescriptionOfMapUnit thisDescriptionOfMapUnit = (DescriptionOfMapUnitsAccess.DescriptionOfMapUnit)DescriptionOfMapUnitsToUpdate.Value; thisDescriptionOfMapUnit.DescriptionSourceID = dataSourceID; DescriptionOfMapUnitsAccess.UpdateDescriptionOfMapUnit(thisDescriptionOfMapUnit); } DescriptionOfMapUnitsAccess.SaveDescriptionOfMapUnits(); break; } } }
private Dictionary<string, object> BuildDataAccessFromSelection() { // Will be building SQL Where Clauses for each possible selected thing string MapUnitPolysSearch = "MapUnitPolys_ID = '"; string OverlayPolysSearch = "OverlayPolys_ID = '"; string ContactsAndFaultsSearch = "ContactsAndFaults_ID = '"; string OtherLinesSearch = "OtherLines_ID = '"; string StationPointsSearch = "StationPoints_ID = '"; string SamplePointsSearch = "SamplePoints_ID = '"; string OrientationDataPointsSearch = "OrientationDataPoints_ID = '"; string GlossarySearch = "Glossary_ID = '"; string NotesSearch = "Notes_ID = '"; string RelatedDocumentsSearch = "RelatedDocuments_ID = '"; string DataSourcesSearch = "DataSources_ID = '"; string DescriptionOfMapUnitsSearch = "DescriptionOfMapUnits_ID = '"; // This object will be populated and returned Dictionary<string, object> dataAccessClasses = new Dictionary<string, object>(); #region Selected FEATURES // Get an enumeration of the selected features IEnumFeature selectionEnum = ArcMap.Document.FocusMap.FeatureSelection as IEnumFeature; // Loop through the features to build queries to find the features IRow thisFeature = selectionEnum.Next() as IRow; while (thisFeature != null) { // Get the Table Name string tableName = (thisFeature.Table as IDataset).Name; // Parse the table name in order to strip out unneccessary bits of SDE tables ISQLSyntax nameParser = (ISQLSyntax)m_theWorkspace; string parsedDbName, parsedOwnerName, parsedTableName; nameParser.ParseTableName(tableName, out parsedDbName, out parsedOwnerName, out parsedTableName); // Build the SQL Where Clause depending on the table... switch (parsedTableName) { case "MapUnitPolys": MapUnitPolysSearch += thisFeature.get_Value(thisFeature.Table.FindField("MapUnitPolys_ID")) + "' OR MapUnitPolys_ID = '"; break; case "OverlayPolys": OverlayPolysSearch += thisFeature.get_Value(thisFeature.Table.FindField("OverlayPolys_ID")) + "' OR OverlayPolys_ID = '"; break; case "ContactsAndFaults": ContactsAndFaultsSearch += thisFeature.get_Value(thisFeature.Table.FindField("ContactsAndFaults_ID")) + "' OR ContactsAndFaults_ID = '"; break; case "OtherLines": OtherLinesSearch += thisFeature.get_Value(thisFeature.Table.FindField("OtherLines_ID")) + "' OR OtherLines_ID = '"; break; case "StationPoints": StationPointsSearch += thisFeature.get_Value(thisFeature.Table.FindField("StationPoints_ID")) + "' OR StationPoints_ID = '"; break; case "SamplePoints": SamplePointsSearch += thisFeature.get_Value(thisFeature.Table.FindField("SamplePoints_ID")) + "' OR SamplePoints_ID = '"; break; case "OrientationDataPoints": OrientationDataPointsSearch += thisFeature.get_Value(thisFeature.Table.FindField("OrientationDataPoints_ID")) + "' OR OrientationDataPoints_ID = '"; break; } // Iterate the enumeration thisFeature = selectionEnum.Next(); } #region "Build Dictionary" // Clean up the Where Clauses, create the data access classes, and then add it to the dictionary // MapUnitPolys if (MapUnitPolysSearch != "MapUnitPolys_ID = '") { MapUnitPolysSearch = MapUnitPolysSearch.Remove(MapUnitPolysSearch.Length - 23); MapUnitPolysAccess MapUnitPolysRecords = new MapUnitPolysAccess(m_theWorkspace); MapUnitPolysRecords.AddMapUnitPolys(MapUnitPolysSearch); dataAccessClasses.Add("MapUnitPolys", MapUnitPolysRecords); } // OverlayPolys if (OverlayPolysSearch != "OverlayPolys_ID = '") { OverlayPolysSearch = OverlayPolysSearch.Remove(OverlayPolysSearch.Length - 23); OverlayPolysAccess OverlayPolysRecords = new OverlayPolysAccess(m_theWorkspace); OverlayPolysRecords.AddOverlayPolys(OverlayPolysSearch); dataAccessClasses.Add("OverlayPolys", OverlayPolysRecords); } // ContactsAndFaults if (ContactsAndFaultsSearch != "ContactsAndFaults_ID = '") { ContactsAndFaultsSearch = ContactsAndFaultsSearch.Remove(ContactsAndFaultsSearch.Length - 28); ContactsAndFaultsAccess ContactsAndFaultsRecords = new ContactsAndFaultsAccess(m_theWorkspace); ContactsAndFaultsRecords.AddContactsAndFaults(ContactsAndFaultsSearch); dataAccessClasses.Add("ContactsAndFaults", ContactsAndFaultsRecords); } // OtherLines if (OtherLinesSearch != "OtherLines_ID = '") { OtherLinesSearch = OtherLinesSearch.Remove(OtherLinesSearch.Length - 21); OtherLinesAccess OtherLinesRecords = new OtherLinesAccess(m_theWorkspace); OtherLinesRecords.AddOtherLines(OtherLinesSearch); dataAccessClasses.Add("OtherLines", OtherLinesRecords); } // StationPoints if (StationPointsSearch != "StationPoints_ID = '") { StationPointsSearch = StationPointsSearch.Remove(StationPointsSearch.Length - 24); StationPointsAccess StationPointsRecords = new StationPointsAccess(m_theWorkspace); StationPointsRecords.AddStationPoints(StationPointsSearch); dataAccessClasses.Add("StationPoints", StationPointsRecords); } // SamplePoints if (SamplePointsSearch != "SamplePoints_ID = '") { SamplePointsSearch = SamplePointsSearch.Remove(SamplePointsSearch.Length - 23); SamplePointsAccess SamplePointsRecords = new SamplePointsAccess(m_theWorkspace); SamplePointsRecords.AddSamplePoints(SamplePointsSearch); dataAccessClasses.Add("SamplePoints", SamplePointsRecords); } // OrientationDataPoints if (OrientationDataPointsSearch != "OrientationDataPoints_ID = '") { OrientationDataPointsSearch = OrientationDataPointsSearch.Remove(OrientationDataPointsSearch.Length - 32); OrientationDataPointsAccess OrientationDataPointsRecords = new OrientationDataPointsAccess(m_theWorkspace); OrientationDataPointsRecords.AddOrientationDataPoints(OrientationDataPointsSearch); dataAccessClasses.Add("OrientationDataPoints", OrientationDataPointsRecords); } #endregion #endregion #region Selected TABLE ROWS // Loop through the tables in the map IStandaloneTableCollection tableCollection = ArcMap.Document.FocusMap as IStandaloneTableCollection; for (int i = 0; i <= tableCollection.StandaloneTableCount - 1; i++) { // Get one of the tables IStandaloneTable thisTable = tableCollection.StandaloneTable[i]; string tableName = (thisTable.Table as IDataset).Name; // Parse the table name in order to strip out unneccessary bits of SDE tables ISQLSyntax nameParser = (ISQLSyntax)m_theWorkspace; string parsedDbName, parsedOwnerName, parsedTableName; nameParser.ParseTableName(tableName, out parsedDbName, out parsedOwnerName, out parsedTableName); // Find the selection ITableSelection selectedRows = thisTable as ITableSelection; ISelectionSet theSelection = selectedRows.SelectionSet; // Iterate if there are no selected rows if (theSelection.Count == 0) { continue; } // Loop through selected rows, build the where clauses up. ICursor theCursor; theSelection.Search(null, false, out theCursor); IRow theRow = theCursor.NextRow(); while (theRow != null) { switch (parsedTableName) { case "Glossary": GlossarySearch += theRow.get_Value(thisTable.Table.FindField("Glossary_ID")) + "' OR Glossary_ID = '"; break; case "Notes": NotesSearch += theRow.get_Value(thisTable.Table.FindField("Notes_ID")) + "' OR Notes_ID = '"; break; case "RelatedDocuments": RelatedDocumentsSearch += theRow.get_Value(thisTable.Table.FindField("RelatedDocuments_ID")) + "' OR RelatedDocuments_ID = '"; break; case "DataSources": DataSourcesSearch += theRow.get_Value(thisTable.Table.FindField("DataSources_ID")) + "' OR DataSources_ID = '"; break; case "DescriptionOfMapUnits": DescriptionOfMapUnitsSearch += theRow.get_Value(thisTable.Table.FindField("DescriptionOfMapUnits_ID")) + "' OR DescriptionOfMapUnits_ID = '"; break; } // Iterate theRow = theCursor.NextRow(); } } #region Build Dictionary // Clean up the Where Clauses, create the data access classes, and then add it to the dictionary // Glossary if (GlossarySearch != "Glossary_ID = '") { GlossarySearch = GlossarySearch.Remove(GlossarySearch.Length - 19); GlossaryAccess GlossaryRecords = new GlossaryAccess(m_theWorkspace); GlossaryRecords.AddGlossary(GlossarySearch); dataAccessClasses.Add("Glossary", GlossaryRecords); } // Notes if (NotesSearch != "Notes_ID = '") { NotesSearch = NotesSearch.Remove(NotesSearch.Length - 16); NotesAccess NotesRecords = new NotesAccess(m_theWorkspace); NotesRecords.AddNotes(NotesSearch); dataAccessClasses.Add("Notes", NotesRecords); } // RelatedDocuments if (RelatedDocumentsSearch != "RelatedDocuments_ID = '") { RelatedDocumentsSearch = RelatedDocumentsSearch.Remove(RelatedDocumentsSearch.Length - 27); RelatedDocumentsAccess RelatedDocumentsRecords = new RelatedDocumentsAccess(m_theWorkspace); RelatedDocumentsRecords.AddRelatedDocuments(RelatedDocumentsSearch); dataAccessClasses.Add("RelatedDocuments", RelatedDocumentsRecords); } // DataSources if (DataSourcesSearch != "DataSources_ID = '") { DataSourcesSearch = DataSourcesSearch.Remove(DataSourcesSearch.Length - 22); DataSourcesAccess DataSourcesRecords = new DataSourcesAccess(m_theWorkspace); DataSourcesRecords.AddDataSources(DataSourcesSearch); dataAccessClasses.Add("DataSources", DataSourcesRecords); } // DescriptionOfMapUnits if (DescriptionOfMapUnitsSearch != "DescriptionOfMapUnits_ID = '") { DescriptionOfMapUnitsSearch = DescriptionOfMapUnitsSearch.Remove(DescriptionOfMapUnitsSearch.Length - 32); DescriptionOfMapUnitsAccess DescriptionOfMapUnitsRecords = new DescriptionOfMapUnitsAccess(m_theWorkspace); DescriptionOfMapUnitsRecords.AddDescriptionOfMapUnits(DescriptionOfMapUnitsSearch); dataAccessClasses.Add("DescriptionOfMapUnits", DescriptionOfMapUnitsRecords); } #endregion #endregion // Okay! Return the dictionary that has been built return dataAccessClasses; }
private void UpdateDataSources(Dictionary<string, object> dataAccessClasses) { // Get the Data Source to set string dataSourceID = commonFunctions.GetCurrentDataSourceID(); // Bail if there isn't one if (dataSourceID == null) { return; } // Get DataAccess Classes to perform updates MapUnitPolysAccess mapUnitPolysAccess = new MapUnitPolysAccess(m_theWorkspace); DataSourcePolysAccess dataSourcePolysAccess = new DataSourcePolysAccess(m_theWorkspace); OtherPolysAccess OtherPolysAccess = new OtherPolysAccess(m_theWorkspace); ContactsAndFaultsAccess ContactsAndFaultsAccess = new ContactsAndFaultsAccess(m_theWorkspace); GeologicLinesAccess GeologicLinesAccess = new GeologicLinesAccess(m_theWorkspace); StationsAccess StationsAccess = new StationsAccess(m_theWorkspace); GenericSamplesAccess GenericSamplesAccess = new GenericSamplesAccess(m_theWorkspace); OrientationPointsAccess OrientationPointsAccess = new OrientationPointsAccess(m_theWorkspace); GlossaryAccess GlossaryAccess = new GlossaryAccess(m_theWorkspace); DescriptionOfMapUnitsAccess DescriptionOfMapUnitsAccess = new DescriptionOfMapUnitsAccess(m_theWorkspace); // Loop through the dictionary foreach (KeyValuePair<string, object> anEntry in dataAccessClasses) { // What table does this come from? switch (anEntry.Key) { case "MapUnitPolys": // Loop through the records in the data access object that comes in MapUnitPolysAccess thisMapUnitPolysAccess = (MapUnitPolysAccess)anEntry.Value; foreach (KeyValuePair<string, MapUnitPolysAccess.MapUnitPoly> MapUnitPolysToUpdate in thisMapUnitPolysAccess.MapUnitPolysDictionary) { MapUnitPolysAccess.MapUnitPoly thisMapUnitPoly = (MapUnitPolysAccess.MapUnitPoly)MapUnitPolysToUpdate.Value; thisMapUnitPoly.DataSourceID = dataSourceID; mapUnitPolysAccess.UpdateMapUnitPoly(thisMapUnitPoly); } mapUnitPolysAccess.SaveMapUnitPolys(); break; case "DataSourcePolys": // Loop through the records in the data access object that comes in DataSourcePolysAccess thisDataSourcePolysAccess = (DataSourcePolysAccess)anEntry.Value; foreach (KeyValuePair<string, DataSourcePolysAccess.DataSourcePoly> DataSourcePolysToUpdate in thisDataSourcePolysAccess.DataSourcePolysDictionary) { DataSourcePolysAccess.DataSourcePoly thisDataSourcePoly = (DataSourcePolysAccess.DataSourcePoly)DataSourcePolysToUpdate.Value; thisDataSourcePoly.DataSourceID = dataSourceID; dataSourcePolysAccess.UpdateDataSourcePoly(thisDataSourcePoly); } dataSourcePolysAccess.SaveDataSourcePolys(); break; case "OtherPolys": OtherPolysAccess thisOtherPolysAccess = (OtherPolysAccess)anEntry.Value; foreach (KeyValuePair<string, OtherPolysAccess.OtherPoly> OtherPolysToUpdate in thisOtherPolysAccess.OtherPolysDictionary) { OtherPolysAccess.OtherPoly thisOtherPoly = (OtherPolysAccess.OtherPoly)OtherPolysToUpdate.Value; thisOtherPoly.DataSourceID = dataSourceID; OtherPolysAccess.UpdateOtherPoly(thisOtherPoly); } OtherPolysAccess.SaveOtherPolys(); break; case "ContactsAndFaults": ContactsAndFaultsAccess thisContactsAndFaultsAccess = (ContactsAndFaultsAccess)anEntry.Value; foreach (KeyValuePair<string, ContactsAndFaultsAccess.ContactsAndFault> ContactsAndFaultsToUpdate in thisContactsAndFaultsAccess.ContactsAndFaultsDictionary) { ContactsAndFaultsAccess.ContactsAndFault thisContactsAndFault = (ContactsAndFaultsAccess.ContactsAndFault)ContactsAndFaultsToUpdate.Value; thisContactsAndFault.DataSourceID = dataSourceID; ContactsAndFaultsAccess.UpdateContactsAndFault(thisContactsAndFault); } ContactsAndFaultsAccess.SaveContactsAndFaults(); break; case "GeologicLines": GeologicLinesAccess thisGeologicLinesAccess = (GeologicLinesAccess)anEntry.Value; foreach (KeyValuePair<string, GeologicLinesAccess.GeologicLine> GeologicLinesToUpdate in thisGeologicLinesAccess.GeologicLinesDictionary) { GeologicLinesAccess.GeologicLine thisGeologicLine = (GeologicLinesAccess.GeologicLine)GeologicLinesToUpdate.Value; thisGeologicLine.DataSourceID = dataSourceID; GeologicLinesAccess.UpdateGeologicLine(thisGeologicLine); } GeologicLinesAccess.SaveGeologicLines(); break; case "Stations": StationsAccess thisStationsAccess = (StationsAccess)anEntry.Value; foreach (KeyValuePair<string, StationsAccess.Station> StationsToUpdate in thisStationsAccess.StationsDictionary) { StationsAccess.Station thisStation = (StationsAccess.Station)StationsToUpdate.Value; thisStation.DataSourceID = dataSourceID; StationsAccess.UpdateStation(thisStation); } StationsAccess.SaveStations(); break; case "GenericSamples": GenericSamplesAccess thisGenericSamplesAccess = (GenericSamplesAccess)anEntry.Value; foreach (KeyValuePair<string, GenericSamplesAccess.GenericSample> GenericSamplesToUpdate in thisGenericSamplesAccess.GenericSamplesDictionary) { GenericSamplesAccess.GenericSample thisGenericSample = (GenericSamplesAccess.GenericSample)GenericSamplesToUpdate.Value; thisGenericSample.DataSourceID = dataSourceID; GenericSamplesAccess.UpdateGenericSample(thisGenericSample); } GenericSamplesAccess.SaveGenericSamples(); break; case "OrientationPoints": OrientationPointsAccess thisOrientationPointsAccess = (OrientationPointsAccess)anEntry.Value; foreach (KeyValuePair<string, OrientationPointsAccess.OrientationPoint> OrientationPointsToUpdate in thisOrientationPointsAccess.OrientationPointsDictionary) { OrientationPointsAccess.OrientationPoint thisOrientationPoint = (OrientationPointsAccess.OrientationPoint)OrientationPointsToUpdate.Value; thisOrientationPoint.DataSourceID = dataSourceID; OrientationPointsAccess.UpdateOrientationPoint(thisOrientationPoint); } OrientationPointsAccess.SaveOrientationPoints(); break; case "Glossary": GlossaryAccess thisGlossaryAccess = (GlossaryAccess)anEntry.Value; foreach (KeyValuePair<string, GlossaryAccess.Glossary> GlossaryToUpdate in thisGlossaryAccess.GlossaryDictionary) { GlossaryAccess.Glossary thisGlossary = (GlossaryAccess.Glossary)GlossaryToUpdate.Value; thisGlossary.DefinitionSourceID = dataSourceID; GlossaryAccess.UpdateGlossary(thisGlossary); } GlossaryAccess.SaveGlossary(); break; case "DescriptionOfMapUnits": DescriptionOfMapUnitsAccess thisDescriptionOfMapUnitsAccess = (DescriptionOfMapUnitsAccess)anEntry.Value; foreach (KeyValuePair<string, DescriptionOfMapUnitsAccess.DescriptionOfMapUnit> DescriptionOfMapUnitsToUpdate in thisDescriptionOfMapUnitsAccess.DescriptionOfMapUnitsDictionary) { DescriptionOfMapUnitsAccess.DescriptionOfMapUnit thisDescriptionOfMapUnit = (DescriptionOfMapUnitsAccess.DescriptionOfMapUnit)DescriptionOfMapUnitsToUpdate.Value; thisDescriptionOfMapUnit.DescriptionSourceID = dataSourceID; DescriptionOfMapUnitsAccess.UpdateDescriptionOfMapUnit(thisDescriptionOfMapUnit); } DescriptionOfMapUnitsAccess.SaveDescriptionOfMapUnits(); break; } } }