/// <summary> /// /// </summary> /// <param name="deviceID"></param> /// <param name="data"></param> public void InsertHDData(int deviceID, HDDeviceData data) { string s = "insert into tblHDData(deviceID, DT, Value) values(@deviceID, @dt, @value)"; ListDictionary list = new ListDictionary(); list.Add("deviceID", deviceID); list.Add("dt", data.DT); list.Add("value", data.Value ? 1 : 0); ExecuteScalar(s, list); }
public override void OnProcess(ITask task, IParseResult pr) { if (pr.IsSuccess) { if (StringHelper.Equal(task.Opera.Name, "Read")) { byte byteValue = (byte)task.LastParseResult.Results["value"]; bool value = byteValue != 0; HDDeviceData data = new HDDeviceData(); data.Value = value; task.Device.DeviceDataManager.Last = data; int id = GuidHelper.ConvertToInt32(task.Device.Guid); DBI.Instance.InsertHDData(id, data); } } }