コード例 #1
0
        static public TimelineIndex GetTimelineIndex(int userId)
        {
            Database      db = new Database();
            TimelineIndex ti = new TimelineIndex();

            ti.Timelines = db.Timelines.Where(x => x.UserID == userId).ToList();

            return(ti);
        }
コード例 #2
0
        // GET: Timeline
        public ActionResult Index()
        {
            TimelineIndex tli = DatabaseService.GetTimelineIndex(1);

            return(View("TimelineIndex", tli));
        }
コード例 #3
0
ファイル: TestTimeline.cs プロジェクト: Neo4Net/Neo4Net
        private void MakeSureUncommittedChangesAreSortedCorrectly(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, 300000, 100000, 500000, 900000, 800000);

            using (Transaction tx = _db.beginTx())
            {
                timestamps.addAll(CreateTimestamps(creator, timeline, 40000, 70000, 20000));
                assertEquals(SortedEntities(timestamps, false), asCollection(timeline.GetBetween(null, null).GetEnumerator()));
                tx.Success();
            }

            using (Transaction ignore = _db.beginTx())
            {
                assertEquals(SortedEntities(timestamps, false), asCollection(timeline.GetBetween(null, null).GetEnumerator()));
            }
        }
コード例 #4
0
ファイル: TestTimeline.cs プロジェクト: Neo4Net/Neo4Net
        private void MakeSureWeCanQueryLowerDefaultThan1970(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, -10000, 0, 10000);

            using (Transaction tx = _db.beginTx())
            {
                assertEquals(SortedEntities(timestamps, true), asCollection(timeline.GetBetween(null, 10000L, true).GetEnumerator()));
                tx.Success();
            }
        }
コード例 #5
0
ファイル: TestTimeline.cs プロジェクト: Neo4Net/Neo4Net
        private void MakeSureRangesAreReturnedInCorrectReversedOrder(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, 300000, 200000, 199999, 400000, 100000, 500000, 600000, 900000, 800000);

            using (Transaction tx = _db.beginTx())
            {
                assertEquals(SortedEntities(timestamps, true), asCollection(timeline.GetBetween(null, null, true).GetEnumerator()));
                tx.Success();
            }
        }
コード例 #6
0
ファイル: TestTimeline.cs プロジェクト: Neo4Net/Neo4Net
        // ======== Tests, although private so that we can create two versions of each,
        // ======== one for nodes and one for relationships

        private void MakeSureFirstAndLastAreReturnedCorrectly(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, 223456, 12345, 432234);

            using (Transaction tx = _db.beginTx())
            {
                assertEquals(timestamps.get(1).first(), timeline.First);
                assertEquals(timestamps.Last.Value.first(), timeline.Last);
                tx.Success();
            }
        }
コード例 #7
0
ファイル: TestTimeline.cs プロジェクト: Neo4Net/Neo4Net
        private Pair <PropertyContainer, long> CreateTimestampedEntity(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline, long timestamp)
        {
            PropertyContainer entity = creator.Create();

            timeline.Add(entity, timestamp);
            return(Pair.of(entity, timestamp));
        }
コード例 #8
0
ファイル: TestTimeline.cs プロジェクト: Neo4Net/Neo4Net
 private LinkedList <Pair <PropertyContainer, long> > CreateTimestamps(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline, params long[] timestamps)
 {
     using (Transaction tx = _db.beginTx())
     {
         LinkedList <Pair <PropertyContainer, long> > result = new LinkedList <Pair <PropertyContainer, long> >();
         foreach (long timestamp in timestamps)
         {
             result.AddLast(CreateTimestampedEntity(creator, timeline, timestamp));
         }
         tx.Success();
         return(result);
     }
 }