Ejemplo n.º 1
0
        private UserProfiles()
        {
            IRestriction restrict = RestrictionFactory.TypeRestriction(typeof(UserProfile));

            _userList            = con.LoadList <UserProfile>(restrict);
            this._currentProfile = SERIALIZER.CreateISerializableObject <UserProfile>();
        }
        public void Load(Type t, Serializer serializer)
        {
            IRestriction r = RestrictionFactory.TypeRestriction(t);
            IList <ISerializableObject> list = serializer.Connector.LoadList(t, r);

            addList(list);
        }
Ejemplo n.º 3
0
        //Beim Iterieren über die EventSeries muss beachtet werden, dass
        //die EmptyEventSeries manuell zur Auswahl zugefügt werden muss.(noch nicht erledigt)
        private EventSeriess()
        {
            IRestriction restrict = RestrictionFactory.TypeRestriction(typeof(CollectionEventSeries));

            _ceIterator             = new DirectAccesIteratorImpl <CollectionEventSeries>();
            _ceIterator.Serializer  = SERIALIZER;
            _ceIterator.Restriction = restrict;
            this.Current            = _ceIterator.First();
        }
Ejemplo n.º 4
0
        private void buttonLoad_Click(object sender, RoutedEventArgs e)
        {
            IRestriction r = RestrictionFactory.TypeRestriction(typeof(CollectionEventLocalisation));
            IList <CollectionEventLocalisation> spec = mobSer.Connector.LoadList <CollectionEventLocalisation>(r);
            CollectionEventLocalisation         ce   = spec.First();
            Guid g = ce.Rowguid;

            r    = RestrictionFactory.Eq(typeof(CollectionEventLocalisation), "_guid", g);
            obj2 = repSer.Connector.Load <CollectionEventLocalisation>(r);
        }
Ejemplo n.º 5
0
        public void Load(Type t)
        {
            IRestriction r = RestrictionFactory.TypeRestriction(t);

            IList <ISerializableObject> list = this._serializer.Connector.LoadList(t, r);

            foreach (ISerializableObject iso in list)
            {
                this._pool.AddISerializableObject(iso);
            }
        }
Ejemplo n.º 6
0
        private void buttonIdentifications_Click(object sender, EventArgs e)
        {
            IRestriction r = RestrictionFactory.TypeRestriction(typeof(IdentificationUnit));
            IList <IdentificationUnit> units = mobileDBSerializer.Connector.LoadList <IdentificationUnit>(r);

            foreach (IdentificationUnit iu in units)
            {
                Identification id = iu.Identifications.First();
                id.TaxonomicName = iu.LastIdentificationCache;
                mobileDBSerializer.Connector.Save(id);
            }
            MessageBox.Show("Success");
        }
Ejemplo n.º 7
0
        //Problem: Wenn ncht alle Fremdschlüssel in registered Types liegen, werden hier Null-Werte eingatreagen.
        //Dies tritt auf, wenn nicht alle DataItems die beim Serialiszer registriert sind, synchronisiert werden sollen.
        public SyncPool CreateSyncPool()
        {
            SyncPool pool = new SyncPool(_serializer, _syncSerializer);

            foreach (Type t in _registeredTypes)
            {
                IRestriction r = RestrictionFactory.TypeRestriction(t);
                IList <ISerializableObject> list = _serializer.Connector.LoadList(t, r);
                foreach (ISerializableObject iso in list)
                {
                    pool.AddISerializableObject(iso);
                }
            }
            pool.Intialize();
            return(pool);
        }
Ejemplo n.º 8
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            IRestriction               rIds       = RestrictionFactory.TypeRestriction(typeof(Identification));
            IRestriction               rUnits     = RestrictionFactory.TypeRestriction(typeof(IdentificationUnit));
            IList <Identification>     idents_mob = mobileDBSerializer.Connector.LoadList <Identification>(rIds);
            IList <Identification>     idents_rep = new List <Identification>();
            IList <IdentificationUnit> units_mob  = mobileDBSerializer.Connector.LoadList <IdentificationUnit>(rUnits);
            IList <IdentificationUnit> units_rep  = new List <IdentificationUnit>();

            foreach (Identification mobi in idents_mob)
            {
                IRestriction   r       = RestrictionFactory.Eq(typeof(Identification), "_guid", mobi.Rowguid);
                Identification partner = repositorySerializer.Connector.Load <Identification>(r);
                if (partner == null)
                {
                    MessageBox.Show(mobi.Rowguid.ToString());
                }
                else
                {
                    if (mobi.IdentificationDate != partner.IdentificationDate)
                    {
                        idents_rep.Add(partner);
                    }
                }
            }
            //foreach (IdentificationUnit mobi in units_mob)
            //{

            //    IRestriction r = RestrictionFactory.Eq(typeof(IdentificationUnit), "_guid", mobi.Rowguid);
            //    IdentificationUnit partner = repositorySerializer.Connector.Load<IdentificationUnit>(r);
            //    if (partner == null)
            //        MessageBox.Show(mobi.Rowguid.ToString());
            //    else
            //    {
            //        units_rep.Add(partner);
            //    }
            //}
            MessageBox.Show("Success");
        }
Ejemplo n.º 9
0
        private void buttonSynchronize_Click(object sender, EventArgs e)
        {
            if (download == false)
            {
                buttonSynchronize.Text = "Synchronizing";
                //Alles außer InsertState auf ignore setzen
                MessageBox.Show("Warning: Only InsertState is allowed at the moment. All other states will be set to IgnoreState");
                foreach (SyncContainer sc in conflicted)
                {
                    sc.Ignore();
                }
                foreach (SyncContainer sc in conflictResolved)
                {
                    sc.Ignore();
                }
                foreach (SyncContainer sc in synchronized)
                {
                    sc.Ignore();
                }
                foreach (SyncContainer sc in update)
                {
                    sc.Ignore();
                }
                foreach (SyncContainer sc in truncate)
                {
                    sc.Ignore();
                }
                foreach (SyncContainer sc in delete)
                {
                    sc.Ignore();
                }
                foreach (SyncContainer sc in premature)
                {
                    sc.Ignore();
                }
            }
            if (download == true)
            {
                buttonSynchronize.Text = "Synchronizing";
                //Veränderungen an den definierenden KLassen werden überschrieben
                MessageBox.Show("Your changes in defining data items will be overwritten");
                foreach (SyncContainer sc in conflicted)
                {
                    sc.Resolve(sc.SourceObject);
                }
            }
            if (listBoxConflicts.Items.Count != 0)
            {
                MessageBox.Show("Resolve Conflicts first!");
                return;
            }
            //Je nach gewählter Richtung synchronisieren
            if (download == true)
            {
                mobileDBSyncTool.Synchronize(SyncPool);

                //DisplayOrder für taxonomische Gruppen zurücksetzen
                IRestriction r1 = RestrictionFactory.TypeRestriction(typeof(CollTaxonomicGroup_Enum));
                IList <CollTaxonomicGroup_Enum> groups = mobileDBSerializer.Connector.LoadList <CollTaxonomicGroup_Enum>(r1);
                foreach (CollTaxonomicGroup_Enum tg in groups)
                {
                    tg.DisplayOrder = 0;
                    mobileDBSerializer.Connector.Save(tg);
                }
                this.mobileDBSyncTool.Analyze(SyncPool);
            }
            else
            {
                repositorySyncTool.Synchronize(SyncPool);
                this.repositorySyncTool.Analyze(SyncPool);
            }
            buttonSynchronize.Text = "Synchronized";



            // 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.Text = "Completed";
        }