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