Ejemplo n.º 1
0
        private static void MergeCollections <T>(SyncList <T> lSource, DictionaryOfLineObjectCollection dlocTarget) where T : ILineObject <T>
        {
            Debug.Assert(lSource != null);
            ILineObjectCollection <T> locTarget = dlocTarget.GetLineObjectCollection <T>();

            foreach (T objSource in lSource)
            {
                ILineObjectWithId <T>  objById  = objSource as ILineObjectWithId <T>;
                ILineObjectWithKey <T> objByKey = objSource as ILineObjectWithKey <T>;

                try
                {
                    if (objById != null)
                    {
                        if (objById.Id != 0)
                        {
                            locTarget.MergeLineObject(objSource);
                        }
                    }
                    else if (objByKey != null)
                    {
                        locTarget.MergeLineObject(objSource);
                    }
                    else
                    {
                        Debug.Assert(false);
                    }
                }
                catch (Exception excp)
                {
                    m_logger.Excp(excp, "Could not merge object {0}", objSource);
                }
            }
        }
Ejemplo n.º 2
0
        public static void EnsureFromCache()
        {
            DictionaryOfLineObjectCollection dlocSource = DatabaseCache.Instance.AllObjects;
            DictionaryOfLineObjectCollection dlocTarget = LineSr.Instance.AllObjects;

            MergeCollections <TimeTypeLn>(dlocSource, dlocTarget);
            MergeCollections <ScoreTypeLn>(dlocSource, dlocTarget);
            MergeCollections <BetTypeLn>(dlocSource, dlocTarget);
            MergeCollections <BetDomainTypeLn>(dlocSource, dlocTarget);

            MergeCollections <TaggedStringLn>(dlocSource, dlocTarget);

            ILineObjectCollection <GroupLn> locGroups = dlocSource.GetLineObjectCollection <GroupLn>();
            SyncList <GroupLn> lGroups = locGroups.ToSyncList();

            lGroups.Sort(delegate(GroupLn g1, GroupLn g2)
            {
                long lParentGroupId1 = g1.ParentGroupId.Value ?? 0;
                long lParentGroupId2 = g2.ParentGroupId.Value ?? 0;

                if (lParentGroupId1 == lParentGroupId2)
                {
                    return(g1.GroupId.CompareTo(g2.GroupId));
                }

                return(lParentGroupId1.CompareTo(lParentGroupId2));
            });

            MergeCollections <GroupLn>(lGroups, dlocTarget);
            MergeCollections <CompetitorLn>(dlocSource, dlocTarget);
            MergeCollections <CompetitorToOutrightLn>(dlocSource, dlocTarget);
            MergeCollections <MatchLn>(dlocSource, dlocTarget);
            MergeCollections <LiveMatchInfoLn>(dlocSource, dlocTarget);
            MergeCollections <MatchToGroupLn>(dlocSource, dlocTarget);
            MergeCollections <BetDomainLn>(dlocSource, dlocTarget);
            MergeCollections <OddLn>(dlocSource, dlocTarget);
            MergeCollections <MatchResultLn>(dlocSource, dlocTarget);
            MergeCollections <ResourceRepositoryLn>(dlocSource, dlocTarget);
            MergeCollections <ResourceAssignmentLn>(dlocSource, dlocTarget);
            MergeCollections <CompetitorInfosLn>(dlocSource, dlocTarget);
            MergeCollections <MatchInfosLn>(dlocSource, dlocTarget);
            MergeCollections <TournamentInfosLn>(dlocSource, dlocTarget);
            MergeCollections <LiabilityLn>(dlocSource, dlocTarget);
            MergeCollections <LanguageLn>(dlocSource, dlocTarget);
            MergeCollections <TournamentMatchLocksLn>(dlocSource, dlocTarget);

            LineSr.Instance.NewOrChangedObjects.UnsetPropertiesChanged();
            LineSr.Instance.NewOrChangedObjects.Clear();
            LineSr.Instance.ObjectsToRemove.Clear();
        }
Ejemplo n.º 3
0
        public static LineContainer ToMetaDataLineContainer(DictionaryOfLineObjectCollection diAll)
        {
            dynamic lc = new LineContainer();

            LineObjectCollectionToSerializableObjectList <TaggedStringLn>(lc, diAll);

            LineObjectCollectionToSerializableObjectList <TimeTypeLn>(lc, diAll);
            LineObjectCollectionToSerializableObjectList <ScoreTypeLn>(lc, diAll);
            LineObjectCollectionToSerializableObjectList <BetTypeLn>(lc, diAll);
            LineObjectCollectionToSerializableObjectList <BetDomainTypeLn>(lc, diAll);

            //LineObjectCollectionToSerializableObjectList<GroupLn>(lc, diAll);
            LineObjectCollectionToSerializableObjectList <CompetitorLn>(lc, diAll);
            //LineObjectCollectionToSerializableObjectList<MatchLn>(lc, diAll);
            //LineObjectCollectionToSerializableObjectList<LiveMatchInfoLn>(lc, diAll);
            //LineObjectCollectionToSerializableObjectList<MatchResultLn>(lc, diAll);
            //LineObjectCollectionToSerializableObjectList<MatchToGroupLn>(lc, diAll);
            //LineObjectCollectionToSerializableObjectList<BetDomainLn>(lc, diAll);
            //LineObjectCollectionToSerializableObjectList<OddLn>(lc, diAll);

            return(lc);
        }
Ejemplo n.º 4
0
 private DatabaseCache()
 {
     m_diAll = new DictionaryOfLineObjectCollection();
     m_diAll.Initialize();
 }
Ejemplo n.º 5
0
 private static void LineObjectCollectionToSerializableObjectList <T>(LineContainer lc, DictionaryOfLineObjectCollection diAll) where T : ILineObject <T>
 {
     LineObjectCollectionToSerializableObjectList <T>(lc, diAll.GetLineObjectCollection <T>());
 }
Ejemplo n.º 6
0
        private static void MergeCollections <T>(DictionaryOfLineObjectCollection dlocSource, DictionaryOfLineObjectCollection dlocTarget) where T : ILineObject <T>
        {
            ILineObjectCollection <T> loc = dlocSource.GetLineObjectCollection <T>();

            MergeCollections <T>(loc.ToSyncList(), dlocTarget);
        }