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