public static async Task AddPeriodsAsync(IEnumerable <Period> periods) { using (var context = new PeriodContext()) { context.Periods.AddRange(periods); await context.SaveChangesAsync(); } }
public async Task <IEnumerable <Period> > QueryAllPeriodsAsync() { using (var context = new PeriodContext()) { var result = await context.Periods.ToListAsync(); return(result); } }
public static async Task CreateTheDatabaseAsync() { PeriodContext.Filename = Path.Combine(ApplicationData.Current.LocalFolder.Path, DbName); if (await IsFilePresent() == false) { var context = new PeriodContext(); await context.Database.EnsureCreatedAsync(); } }
public static async Task AddPeriodAsync(bool isInPomodoro, bool hasFinished, DateTime startTime, DateTime endTime) { using (var context = new PeriodContext()) { context.Periods.Add(new Period { From = startTime, HasFinished = hasFinished, To = endTime, IsFocus = isInPomodoro }); await context.SaveChangesAsync(); } }
public static async Task RemoveFuturePeriodsAsync() { using (var context = new PeriodContext()) { var time = DateTime.Now; var periods = await context.Periods.Where(p => p.From > time).ToListAsync(); context.Periods.RemoveRange(periods); int records = await context.SaveChangesAsync(); } }
private async void Save() { if (!PeriodContext.Validate()) { return; } if (IsEdit) { if (await PeriodService.Update(Period.Id, Model)) { Dialog.Close(DialogResult.Ok(true)); } } else { if (await PeriodService.Create(Model)) { Dialog.Close(DialogResult.Ok(true)); } } }
public GLDataWriter(PeriodContext context) { _context = context; }
public PeriodContext period() { PeriodContext _localctx = new PeriodContext(Context, State); EnterRule(_localctx, 294, RULE_period); try { State = 2394; switch ( Interpreter.AdaptivePredict(TokenStream,159,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { State = 2392; period_explicit(); } break; case 2: EnterOuterAlt(_localctx, 2); { State = 2393; period_start(); } break; } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return _localctx; }