示例#1
0
 public void DeleteAllMeetingTimesData()
 {
     using (var ctx = new LocalDatabaseContext(_localDbFilePath))
     {
         ctx.Db.DropCollection(CollectionNameMtgTimes);
     }
 }
示例#2
0
 public void Save(MeetingTimes mtgTimes)
 {
     using (var ctx = new LocalDatabaseContext(_localDbFilePath))
     {
         var timings = ctx.Db.GetCollection <MeetingTimes>(CollectionNameMtgTimes);
         timings.Insert(mtgTimes);
     }
 }
示例#3
0
        public MeetingTimes GetMeetingTimes(Guid session)
        {
            using var ctx = new LocalDatabaseContext(_localDbFilePath);
            var timings = ctx.Db.GetCollection <MeetingTimes>(CollectionNameMtgTimes);

            timings.EnsureIndex(x => x.Session);
            return(timings.FindOne(x => x.Session.Equals(session)));
        }
示例#4
0
        public void Save(MeetingTimes?mtgTimes)
        {
            if (mtgTimes == null)
            {
                return;
            }

            using var ctx = new LocalDatabaseContext(_localDbFilePath);
            var timings = ctx.Db.GetCollection <MeetingTimes>(CollectionNameMtgTimes);

            timings.Insert(mtgTimes);
        }
示例#5
0
        public IReadOnlyCollection <MeetingTimes> GetMeetingTimes(DateTime theDate)
        {
            using (var ctx = new LocalDatabaseContext(_localDbFilePath))
            {
                var timings = ctx.Db.GetCollection <MeetingTimes>(CollectionNameMtgTimes);
                timings.EnsureIndex(x => x.MeetingDate);

                var minDate = theDate.Date;
                var maxDate = theDate.Date.AddDays(1);
                return(timings.Find(
                           x => x.MeetingDate >= minDate && x.MeetingDate < maxDate)
                       .OrderBy(x => x.MeetingTimesId).ToArray());
            }
        }