public List <ProcessingTimeEntity> GetProcessingTimes() { List <ProcessingTimeEntity> output = new List <ProcessingTimeEntity>(); using (var connection = GetConnection()) { connection.Open(); var command = connection.CreateCommand(); command.CommandText = $"SELECT Id, Every, Replay, InitialDate FROM {TableNames.ProcessingTimes};"; using var reader = command.ExecuteReader(); while (reader.Read()) { var id = reader.GetInt32(0); var every = reader.GetInt32(1); var replay = ProcessingDateReplayHelper.IdToProcessingDateReplay(reader.GetInt32(2)); var initialDate = DateTime.Parse(reader.GetString(3)); output.Add(new ProcessingTimeEntity { Id = id, Every = every, Replay = replay, InitialDate = initialDate }); } } return(output); }
public void UpdateProcessingTime(ProcessingTimeEntity task) { int numberOfRow = RunCommand($"UPDATE {TableNames.ProcessingTimes} SET Every = {task.Every}, Replay={ProcessingDateReplayHelper.ProcessingDateReplayToId(task.Replay)}, InitialDate='{task.InitialDate}' WHERE Id = {task.Id};"); IsRowEffected(numberOfRow, "Beim Ändern des Nutzers ist ein Fehler aufgetreten."); }
public void CreateProcessingTime(ProcessingTimeEntity task) { task.Id = GetGlobalCounter(); int numberOfRow = RunCommand($"INSERT INTO {TableNames.ProcessingTimes} (Id, Every, Replay, InitialDate) VALUES ({task.Id}, {task.Every}, {ProcessingDateReplayHelper.ProcessingDateReplayToId(task.Replay)}, '{task.InitialDate}');"); IsRowEffected(numberOfRow, "Beim Erstellen des Nutzers ist ein Fehler aufgetreten."); }