public DataObject.DeviceEvent GetEvent(string Serial) { DataObject.DeviceEvent deviceEvent = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "[Security].[ListEvents] '{0}'"; using (SqlCommand command = new SqlCommand(string.Format(query, Serial), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { deviceEvent = new DataObject.DeviceEvent(); while (reader.Read()) { deviceEvent.Id = int.Parse(reader.GetValue(0).ToString()); deviceEvent.Serial = Serial; deviceEvent.Event = reader.GetValue(1).ToString(); } } } } return deviceEvent; }
public DataObject.DeviceEvent GetEvent(string Serial) { DataObject.DeviceEvent deviceEvent = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "[Security].[ListEvents] '{0}'"; using (SqlCommand command = new SqlCommand(string.Format(query, Serial), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { deviceEvent = new DataObject.DeviceEvent(); while (reader.Read()) { deviceEvent.Id = int.Parse(reader.GetValue(0).ToString()); deviceEvent.Serial = Serial; deviceEvent.Event = reader.GetValue(1).ToString(); } } } } return(deviceEvent); }