public ResultInfo.Result Add(long deviceID, string value, deviceIOType ioType) { DeviceIO endIO = new DeviceIO(); endIO.DeviceID = deviceID; endIO.Valu = value; endIO.IOTypeID = long.Parse(ioType.GetHashCode().ToString()); endIO.TimeStamp = DateTime.Now; db.DeviceIOs.Add(endIO); db.SaveChanges(); return ResultInfo.GenerateOKResult(); }
public ResultInfo.Result Add(long deviceID, string value, deviceIOType ioType) { DeviceIO endIO = new DeviceIO(); endIO.DeviceID = deviceID; endIO.Valu = value; endIO.IOTypeID = long.Parse(ioType.GetHashCode().ToString()); endIO.TimeStamp = DateTime.Now; db.DeviceIOs.Add(endIO); db.SaveChanges(); return(ResultInfo.GenerateOKResult()); }
internal ResultInfo.Result SubmitIO(Guid deviceKeyPass, deviceIOType ioType, string Valu) { try { List <Device> devs = db.Devices.Where(e => e.KeyPass == deviceKeyPass).ToList(); if (devs.Count == 1) { return(Add(devs[0].ID, Valu, ioType)); } else { return(ResultInfo.GetResultByID(1)); } } catch { return(ResultInfo.GetResultByID(1)); } }
public ResultInfo.Result Add(long deviceID, string value, deviceIOType ioType, DateTime executionTime) { try { DeviceIO endIO = new DeviceIO(); endIO.DeviceID = deviceID; endIO.Valu = value; endIO.IOTypeID = long.Parse(ioType.GetHashCode().ToString()); endIO.TimeStamp = DateTime.Now; endIO.ExecTimeStamp = executionTime; db.DeviceIOs.Add(endIO); db.SaveChanges(); return(ResultInfo.GenerateOKResult("Saved", endIO.ID)); } catch { return(ResultInfo.GetResultByID(1)); } }
internal ResultInfo.Result SubmitIO(Guid deviceKeyPass, deviceIOType ioType, string Valu) { try { List<Device> devs = db.Devices.Where(e => e.KeyPass == deviceKeyPass).ToList(); if (devs.Count == 1) { return Add(devs[0].ID, Valu, ioType); } else { return ResultInfo.GetResultByID(1); } } catch { return ResultInfo.GetResultByID(1); } }
public ResultInfo.Result Add(long deviceID, string value, deviceIOType ioType, DateTime executionTime) { try { DeviceIO endIO = new DeviceIO(); endIO.DeviceID = deviceID; endIO.Valu = value; endIO.IOTypeID = long.Parse(ioType.GetHashCode().ToString()); endIO.TimeStamp = DateTime.Now; endIO.ExecTimeStamp = executionTime; db.DeviceIOs.Add(endIO); db.SaveChanges(); return ResultInfo.GenerateOKResult("Saved", endIO.ID); } catch { return ResultInfo.GetResultByID(1); } }