public void InsertHeartBreak(HeartBreak info) { using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = "sp_Device_HeartBreak"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@MachineId", info.MachineId); cmd.Parameters.AddWithValue("@MachineName", info.MachineName); cmd.Parameters.AddWithValue("@ChannelInfo", info.ChannelInfo); cmd.ExecuteNonQuery(); } }
public void HandlerTest() { DbHandler db = new DbHandler(); NetStructure.HeartBreak outInfo = new NetStructure.HeartBreak() { MachineId = 19, ChannelInfo = 6 }; Machines machine = db.SelectMachine(outInfo.MachineId); HeartBreak innerInfo = this.exchangeData(outInfo, machine); //记录原始数据 db.InsertHeartBreak(innerInfo); ////记录设备状态 //RefreshOnlineInfo(machine); }