private void analyzeButton_Click(object sender, EventArgs e) { if (analyzeButton.BackColor == System.Drawing.SystemColors.Info) { analyzeButton.BackColor = System.Drawing.SystemColors.Control; } analyzeButton.Text = "Analyzing"; if (download == true) { //Nur die Basistabellen sollen synchronisiert werden FreeSyncPoolBuilder poolBuilder = new FreeSyncPoolBuilder(repositorySerializer, syncDBSerializer); //***Analysis ist ein Speizialfall, da nur projektspezifische Daten übertrageb werden sollen //Ermittle alle Projekte aus Userprofilen, die auf dem Handy gespeichert sind DbConnection mobConn = mobileDBSerializer.CreateConnection(); mobConn.Open(); DbCommand com = mobConn.CreateCommand(); com.CommandText = "Select ProjectID From UserProfile"; DbDataReader reader = com.ExecuteReader(); List <int> projects = new List <int>(); while (reader.Read()) { projects.Add(reader.GetInt32(0)); } foreach (int project in projects) { String s = @"SELECT * FROM [DiversityCollection].[dbo].[AnalysisProjectList] (" + project + ")"; IList <ISerializableObject> list = repositorySerializer.Connector.LoadList(typeof(Analysis), s); poolBuilder.Add(list); } //******* poolBuilder.Load(typeof(AnalysisTaxonomicGroup)); //poolBuilder.Load(typeof(Collection)); poolBuilder.Load(typeof(Property)); poolBuilder.Load(typeof(CollEventImageType_Enum)); poolBuilder.Load(typeof(CollSpecimenImageType_Enum)); poolBuilder.Load(typeof(CollTaxonomicGroup_Enum)); poolBuilder.Load(typeof(LocalisationSystem)); poolBuilder.Load(typeof(CollCircumstances_Enum)); poolBuilder.Load(typeof(CollUnitRelationType_Enum)); //poolBuilder.Load(typeof(CollEventSeriesImageType_Enum)); poolBuilder.Load(typeof(CollIdentificationCategory_Enum)); //poolBuilder.Load(typeof(CollTypeStatus_Enum)); //poolBuilder.Load(typeof(CollIdentificationQualifier_Enum)); //poolBuilder.Load(typeof(CollLabelTranscriptionState_Enum)); //poolBuilder.Load(typeof(CollLabelType_Enum)); //poolBuilder.Load(typeof(CollMaterialCategory_Enum)); //****** usedTypes.Add(typeof(Analysis)); usedTypes.Add(typeof(AnalysisTaxonomicGroup)); //usedTypes.Add(typeof(Collection)); usedTypes.Add(typeof(Property)); usedTypes.Add(typeof(CollEventImageType_Enum)); usedTypes.Add(typeof(CollSpecimenImageType_Enum)); usedTypes.Add(typeof(CollTaxonomicGroup_Enum)); usedTypes.Add(typeof(LocalisationSystem)); usedTypes.Add(typeof(CollCircumstances_Enum)); usedTypes.Add(typeof(CollUnitRelationType_Enum)); //usedTypes.Add(typeof(CollEventSeriesImageType_Enum)); usedTypes.Add(typeof(CollIdentificationCategory_Enum)); //usedTypes.Add(typeof(CollTypeStatus_Enum)); //usedTypes.Add(typeof(CollIdentificationQualifier_Enum)); //usedTypes.Add(typeof(CollLabelTranscriptionState_Enum)); //usedTypes.Add(typeof(CollLabelType_Enum)); //usedTypes.Add(typeof(CollMaterialCategory_Enum)); this.repositorySyncTool = new UBT.AI4.Bio.DivMobi.SyncTool.SyncTool.SyncTool(repositorySerializer, syncDBSerializer, usedTypes); this.mobileDBSyncTool = new UBT.AI4.Bio.DivMobi.SyncTool.SyncTool.SyncTool(mobileDBSerializer, syncDBSerializer, usedTypes); //this.SyncPool = poolBuilder.buildPool(); this.SyncPool = repositorySyncTool.CreateSyncPool(); this.mobileDBSyncTool.Analyze(SyncPool); } else { usedTypes.Clear(); //usedTypes.Add(typeof(CollectionSpecimen)); //usedTypes.Add(typeof(CollectionEvent)); //usedTypes.Add(typeof(CollectionEventSeries)); //usedTypes.Add(typeof(CollectionEventProperty)); //usedTypes.Add(typeof(CollectionEventLocalisation)); //usedTypes.Add(typeof(LocalisationSystem)); //usedTypes.Add(typeof(CollectionAgent)); //usedTypes.Add(typeof(CollectionSpecimenPart)); //usedTypes.Add(typeof(CollectionProject)); usedTypes.Add(typeof(IdentificationUnit)); IRestriction r = RestrictionFactory.SqlRestriction(typeof(IdentificationUnit), "0=0"); IRestriction r1 = RestrictionFactory.Gt(typeof(IdentificationUnit), "_IdentificationUnitID", 0); //usedTypes.Add(typeof(Identification)); //usedTypes.Add(typeof(IdentificationUnitAnalysis)); //usedTypes.Add(typeof(Analysis)); //usedTypes.Add(typeof(Property)); //usedTypes.Add(typeof(CollectionEventProperty)); //usedTypes.Add(typeof(CollTaxonomicGroup_Enum)); IList <ISerializableObject> list = mobileDBSerializer.Connector.LoadList(typeof(CollectionSpecimen), r1); this.repositorySyncTool = new UBT.AI4.Bio.DivMobi.SyncTool.SyncTool.SyncTool(repositorySerializer, syncDBSerializer, divMobiTypes); this.mobileDBSyncTool = new UBT.AI4.Bio.DivMobi.SyncTool.SyncTool.SyncTool(mobileDBSerializer, syncDBSerializer, divMobiTypes); this.SyncPool = this.mobileDBSyncTool.CreateSyncPool(r1); this.repositorySyncTool.Analyze(SyncPool); } analyzeButton.Text = "Complete"; analyzeButton.BackColor = System.Drawing.SystemColors.Info; tabControlAnalysis.Enabled = true; // Listboxen mit den Analysen befüllen conflicted = (List <SyncContainer>)SyncPool.GetSyncContainer <ConflictState>(); listBoxConflicts.Items.Clear(); foreach (SyncContainer sc in conflicted) { listBoxConflicts.Items.Add(sc); } conflictResolved = (List <SyncContainer>)SyncPool.GetSyncContainer <ConflictResolvedState>(); listBoxConflictResolved.Items.Clear(); foreach (SyncContainer sc in conflictResolved) { listBoxConflictResolved.Items.Add(sc); } synchronized = (List <SyncContainer>)SyncPool.GetSyncContainer <SynchronizedState>(); listBoxSynchronized.Items.Clear(); foreach (SyncContainer sc in synchronized) { listBoxSynchronized.Items.Add(sc); } insert = (List <SyncContainer>)SyncPool.GetSyncContainer <InsertState>(); listBoxInsert.Items.Clear(); foreach (SyncContainer sc in insert) { listBoxInsert.Items.Add(sc); } update = (List <SyncContainer>)SyncPool.GetSyncContainer <UpdateState>(); listBoxUpdate.Items.Clear(); foreach (SyncContainer sc in update) { listBoxUpdate.Items.Add(sc); } ignore = (List <SyncContainer>)SyncPool.GetSyncContainer <IgnoreState>(); listBoxIgnore.Items.Clear(); foreach (SyncContainer sc in ignore) { listBoxIgnore.Items.Add(sc); } truncate = (List <SyncContainer>)SyncPool.GetSyncContainer <TruncateState>(); listBoxTruncate.Items.Clear(); foreach (SyncContainer sc in truncate) { listBoxTruncate.Items.Add(sc); } delete = (List <SyncContainer>)SyncPool.GetSyncContainer <DeletedState>(); listBoxDelete.Items.Clear(); foreach (SyncContainer sc in delete) { listBoxDelete.Items.Add(sc); } premature = (List <SyncContainer>)SyncPool.GetSyncContainer <PrematureState>(); listBoxPremature.Items.Clear(); foreach (SyncContainer sc in premature) { listBoxPremature.Items.Add(sc); } buttonSynchronize.Enabled = true; buttonSynchronize.BackColor = System.Drawing.SystemColors.Control; }