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; } } }