Beispiel #1
0
            private void configureUploadANSL()
            {
                var syncList = new ObjectSyncList();

                foreach (Type t in uploadTypes())
                {
                    syncList.Load(t, _mobileDB);
                }
                syncList.initialize(LookupSynchronizationInformation.getFieldDataList(), LookupSynchronizationInformation.getReflexiveReferences(), LookupSynchronizationInformation.getReflexiveIDFields());
                var snsb = new SNSBPictureTransfer(_userNo, _projectID, _mobileDB, ApplicationPathManager.getFolderPath(ApplicationFolder.Pictures));

                _ansl = new AnalyzeSyncObjectList(syncList, _mobileDB, _repository, _sync, snsb);
            }
Beispiel #2
0
        private void uploadFieldDataWorker(IReportDetailedProgress actor)
        {
            if (ConnectionsAccess.Instance.State.CheckForFlags(Diversity_Synchronization.ConnectionsAccess.ConnectionState.DatabasesConnected))
            {
                actor.IsProgressIndeterminate = true;
                actor.ProgressDescriptionID   = 1141;

                ObjectSyncList syncList    = new ObjectSyncList();
                List <Type>    uploadTypes = new List <Type>();
                uploadTypes.Add(typeof(CollectionAgent));
                uploadTypes.Add(typeof(CollectionEvent));
                uploadTypes.Add(typeof(CollectionEventImage));
                uploadTypes.Add(typeof(CollectionEventLocalisation));
                uploadTypes.Add(typeof(CollectionEventProperty));
                uploadTypes.Add(typeof(CollectionSpecimen));
                uploadTypes.Add(typeof(CollectionSpecimenImage));
                uploadTypes.Add(typeof(Identification));
                uploadTypes.Add(typeof(IdentificationUnit));
                uploadTypes.Add(typeof(IdentificationUnitAnalysis));
                uploadTypes.Add(typeof(IdentificationUnitGeoAnalysis));
                uploadTypes.Add(typeof(CollectionEventSeries));
                uploadTypes.Add(typeof(CollectionProject));
                //Bis hier: Korrepondiert zu DBVersion 31
                foreach (Type t in uploadTypes)
                {
                    syncList.Load(t, ConnectionsAccess.MobileDB);
                }

                syncList.initialize(LookupSynchronizationInformation.getFieldDataList(), LookupSynchronizationInformation.getReflexiveReferences(), LookupSynchronizationInformation.getReflexiveIDFields());
                String userNumber = (ConnectionsAccess.Profile.AgentURI == null)?"":ConnectionsAccess.Profile.AgentURI.Replace(@"http://id.snsb.info/Agents/", "");
                if (userNumber == "")
                {
                    //TODO Empty User No
                }


                SNSBPictureTransfer snsb = new SNSBPictureTransfer(userNumber, (int)ConnectionsAccess.Profile.ProjectID, ConnectionsAccess.MobileDB, OptionsAccess.getFolderPath(ApplicationFolder.Pictures));

                AnalyzeSyncObjectList ansl = new AnalyzeSyncObjectList(syncList, ConnectionsAccess.MobileDB, ConnectionsAccess.RepositoryDB, ConnectionsAccess.Synchronization, snsb);
                ansl.analyzeAll();


                //Alles außer InsertState auf ignore setzen
                List <ListContainer> conflicted;
                List <ListContainer> conflictResolved;
                List <ListContainer> synchronized;
                List <ListContainer> insert;
                List <ListContainer> update;
                List <ListContainer> ignore;
                List <ListContainer> delete;
                List <ListContainer> premature;
                conflicted       = ansl.getObjectsOfState(SyncStates_Enum.ConflictState);
                conflictResolved = ansl.getObjectsOfState(SyncStates_Enum.ConflictResolvedState);
                synchronized     = ansl.getObjectsOfState(SyncStates_Enum.SynchronizedState);
                insert           = ansl.getObjectsOfState(SyncStates_Enum.InsertState);
                update           = ansl.getObjectsOfState(SyncStates_Enum.UpdateState);
                ignore           = ansl.getObjectsOfState(SyncStates_Enum.IgnoreState);
                delete           = ansl.getObjectsOfState(SyncStates_Enum.DeletedState);
                premature        = ansl.getObjectsOfState(SyncStates_Enum.PrematureState);
                //ProgressDescription = "Warning: Only InsertState is allowed at the moment. All other states will be set to IgnoreState";
                System.Threading.Thread.Sleep(1000);

                foreach (ListContainer lc in conflicted)
                {
                    lc.State = SyncStates_Enum.IgnoreState;
                }
                foreach (ListContainer lc in conflictResolved)
                {
                    lc.State = SyncStates_Enum.IgnoreState;
                }
                foreach (ListContainer lc in synchronized)
                {
                    lc.State = SyncStates_Enum.IgnoreState;//Exception throwen?
                }
                foreach (ListContainer lc in update)
                {
                    lc.State = SyncStates_Enum.IgnoreState;
                }
                foreach (ListContainer lc in delete)
                {
                    lc.State = SyncStates_Enum.IgnoreState;
                }
                foreach (ListContainer lc in premature)
                {
                    lc.State = SyncStates_Enum.IgnoreState;//Exception throwen?
                }
                ansl.synchronizeAll();

                SyncStatus.Instance.Sync |= SyncStatus.SyncState.FieldDataUpload;
            }
        }