public override void WriteToDb() { using (afmdbEntities ctx = new afmdbEntities()) { tbtimerecorder timeRecorder = new tbtimerecorder(); timeRecorder.workState = (int)this.workState; timeRecorder.startTime = this.StartTime; timeRecorder.endTime = this.EndTime; timeRecorder.subType = (int)this.abNormalType; ctx.tbtimerecorder.Add(timeRecorder); } }
public void WriteToDb() { try { using (afmdbEntities ctx = new afmdbEntities()) { tbtimerecorder timeRecorder = new tbtimerecorder(); timeRecorder.workState = (int)this.workState; timeRecorder.startTime = this.StartTime; timeRecorder.endTime = this.EndTime; timeRecorder.span = this.span; timeRecorder.subType = (int)this.timeType; ctx.tbtimerecorder.Add(timeRecorder); ctx.SaveChangesAsync(); } } catch { } }