public void RecordFileAction(FileAction action) { try { connection.Get().Insert(action); System.Diagnostics.Debug.WriteLine(action.ActionType + " action successfully tracked"); } catch (MySqlException e) { System.Diagnostics.Debug.WriteLine(e.Message); } }
public bool TrackFile(string fileID, string platform) { try { connection.Get().Insert(new TrackedFile(fileID, platform)); System.Diagnostics.Debug.WriteLine("File with id " + fileID + " is now being tracked"); return(true); } catch (MySqlException e) { if (e.ErrorCode == 1062) { System.Diagnostics.Debug.WriteLine("File with id " + fileID + " is already being tracked"); return(true); //Error 1062 indicates that the file is already tracked } else { System.Diagnostics.Debug.WriteLine(e.Message); return(false); } } }
public void ShouldCreateConnection() { var connection = ConnectionProvider.Get(); Assert.IsNotNull(connection); }