public TakenParams[] GetTakenParams() { string query = "SELECT id, guid, guid_params, guid_meters FROM taken_params"; List<Object> list = GetRecordsFromReader(query, RetrieveTakenParams); TakenParams[] result = new TakenParams[list.Count]; for (int i = 0; i < list.Count; i++) { result[i] = (TakenParams)list[i]; } list.Clear(); return result; }
/// <summary> /// Получает наиболее новое (по дате) "настраиваемое" значение /// </summary> /// <param name="taken_params"></param> /// <returns></returns> public Value GetLatestVariousValue(TakenParams taken_params) { Value tempVal = new Value(); string query = "SELECT * FROM various_values WHERE id_taken_params=" + taken_params.id.ToString() + " ORDER BY date DESC,time DESC LIMIT 1"; List<Object> list = GetRecordsFromReader(query, RetrieveValueWithDateTime); if (list.Count == 1) tempVal = (Value)list[0]; return tempVal; }
public TakenParams[] GetTakenParamByMetersGUIDandParamsType(Guid guid_meters, Byte types_params) { string query = "SELECT id, guid, guid_params, guid_meters FROM taken_params " + "WHERE guid_meters = '" + guid_meters.ToString() + "' AND guid_params IN (SELECT guid FROM params WHERE guid_types_params IN (SELECT guid FROM types_params WHERE type = " + types_params.ToString() + "))"; List<Object> list = GetRecordsFromReader(query, RetrieveTakenParams); TakenParams[] result = new TakenParams[list.Count]; for (int i = 0; i < list.Count; i++) { result[i] = (TakenParams)list[i]; } list.Clear(); return result; }
public Value[] GetExistsVariousValuesDT(TakenParams taken_params, DateTime BeginDT, DateTime EndDT) { string query = "SELECT id, date, time, value, status, id_taken_params FROM various_values " + "WHERE (id_taken_params = " + taken_params.id + ") AND date BETWEEN '" + BeginDT.ToShortDateString() + "' AND '" + EndDT.ToShortDateString() + "' AND time BETWEEN '" + BeginDT.ToShortTimeString() + "' AND '" + EndDT.ToShortTimeString() + "'"; List<Object> list = GetRecordsFromReader(query, RetrieveValueWithDateTime); Value[] result = new Value[list.Count]; for (int i = 0; i < list.Count; i++) { result[i] = (Value)list[i]; } list.Clear(); return result; }