public async Task <IActionResult> Edit(long id, [Bind("id,device,timestamps,timestampms,sendsorvalue")] App_GroundTruthData App_GroundTruthData) { if (id != App_GroundTruthData.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(App_GroundTruthData); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!App_GroundTruthDataExists(App_GroundTruthData.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(App_GroundTruthData)); }
public async Task <IActionResult> Create([Bind("id,device,timestamps,timestampms,sendsorvalue")] App_GroundTruthData App_GroundTruthData) { if (ModelState.IsValid) { _context.Add(App_GroundTruthData); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(App_GroundTruthData)); }
public void Insert(string ip, byte nodeindex, int timestamp, int timestampms, byte lr) { DeviceCache dv = GetDevice(ip); DateTime dt = DateTime.Now; App_GroundTruthData data = new App_GroundTruthData(); data.createtime = dt; data.device = ip; data.timestamp = timestamp; data.timestampms = timestampms; data.leftright = lr; data.nodeindex = nodeindex; dv.AddMiniteCache(data); }
public void AddMiniteCache(App_GroundTruthData data) { if (_MiniteCache.Count == 0) { MiniteCache newminite = new MiniteCache(); DateTime mtime = new DateTime( data.createtime.Year, data.createtime.Month, data.createtime.Day, data.createtime.Hour, data.createtime.Minute, 0, 0); newminite._Minite = mtime; _MiniteCache.Enqueue(newminite); newminite._DataList.Add(data); return; } else { } MiniteCache last = _MiniteCache.Last <MiniteCache>(); DateTime firstdt = last._Minite; DateTime startdt = new DateTime( firstdt.Year, firstdt.Month, firstdt.Day, firstdt.Hour, firstdt.Minute, 0, 0); DateTime enddt = startdt.AddMinutes(1); if (data.createtime > enddt) { DateTime newdt = new DateTime( data.createtime.Year, data.createtime.Month, data.createtime.Day, data.createtime.Hour, data.createtime.Minute, 0, 0); MiniteCache newminite = new MiniteCache(); newminite._Minite = newdt; _MiniteCache.Enqueue(newminite); newminite._DataList.Add(data); } else { last._DataList.Add(data); } }