public void BaseStationSystemEvents_Constructor_Initialises_To_Known_State_And_Properties_Work() { var record = new BaseStationSystemEvents(); TestUtilities.TestProperty(record, "App", null, "Ab"); TestUtilities.TestProperty(record, "Msg", null, "Hn"); TestUtilities.TestProperty(record, "SystemEventsID", 0, 123); TestUtilities.TestProperty(record, "TimeStamp", DateTime.MinValue, DateTime.Now); }
/// <summary> /// Generates parameters for a system event object. /// </summary> /// <param name="systemEvent"></param> /// <param name="includeSystemEventID"></param> /// <returns></returns> public static DynamicParameters FromSystemEvent(BaseStationSystemEvents systemEvent, bool includeSystemEventID = true) { var result = new DynamicParameters(); if (includeSystemEventID) { result.Add(nameof(systemEvent.SystemEventsID), value: systemEvent.SystemEventsID); } result.Add(nameof(systemEvent.TimeStamp), value: systemEvent.TimeStamp); result.Add(nameof(systemEvent.App), value: systemEvent.App); result.Add(nameof(systemEvent.Msg), value: systemEvent.Msg); return(result); }
/// <summary> /// See interface docs. /// </summary> /// <param name="systemEvent"></param> public void DeleteSystemEvent(BaseStationSystemEvents systemEvent) { if (!WriteSupportEnabled) { throw new InvalidOperationException("You cannot delete a system event record when write support is disabled"); } lock (_ConnectionLock) { OpenConnection(); if (_Connection != null) { _SystemEventsTable.Delete(_Connection, _TransactionHelper.Transaction, _DatabaseLog, systemEvent); } } }
/// <summary> /// See interface docs. /// </summary> /// <param name="systemEvent"></param> public void UpdateSystemEvent(BaseStationSystemEvents systemEvent) { if (!WriteSupportEnabled) { throw new InvalidOperationException("You cannot update a system event record when write support is disabled"); } systemEvent.TimeStamp = SQLiteDateHelper.Truncate(systemEvent.TimeStamp); lock (_ConnectionLock) { OpenConnection(); if (_Connection != null) { _SystemEventsTable.Update(_Connection, _TransactionHelper.Transaction, _DatabaseLog, systemEvent); } } }
public void DeleteSystemEvent(BaseStationSystemEvents systemEvent) { ; }
public void UpdateSystemEvent(BaseStationSystemEvents systemEvent) { ; }
public void InsertSystemEvent(BaseStationSystemEvents systemEvent) { ; }
/// <summary> /// Inserts a new record and returns the ID. /// </summary> /// <param name="connection"></param> /// <param name="transaction"></param> /// <param name="log"></param> /// <param name="systemEvent"></param> /// <returns></returns> public int Insert(IDbConnection connection, IDbTransaction transaction, TextWriter log, BaseStationSystemEvents systemEvent) { var preparedCommand = PrepareInsert(connection, transaction, "Insert", "SystemEventsID", "TimeStamp", "App", "Msg"); return((int)Sql.ExecuteInsert(preparedCommand, log, systemEvent.TimeStamp, systemEvent.App, systemEvent.Msg)); }
/// <summary> /// Deletes the record passed across. /// </summary> /// <param name="connection"></param> /// <param name="transaction"></param> /// <param name="log"></param> /// <param name="systemEvent"></param> public void Delete(IDbConnection connection, IDbTransaction transaction, TextWriter log, BaseStationSystemEvents systemEvent) { var preparedCommand = PrepareCommand(connection, transaction, "Delete", _DeleteCommandText, 1); Sql.SetParameters(preparedCommand, systemEvent.SystemEventsID); Sql.LogCommand(log, preparedCommand.Command); preparedCommand.Command.ExecuteNonQuery(); }