/**
  * Reading the document from the database reader
  *
  * @dataReader : SQLite Reader that read from the database
  *
  * return the read document from the database
  **/
 public override Document find(SQLiteDataReader dataReader)
 {
     if (dataReader.Read())
     {
         Document document = new Document();
         document.setId(dataReader[idColumn].ToString());
         document.setOwner(dataReader[DatabaseConstants.COLUMN_OWENER].ToString());
         document.setDocument((byte[])dataReader[DatabaseConstants.COLUMN_DOCUMENT]);
         return(document);
     }
     throw new DatabaseException(DatabaseConstants.NOT_FOUND("404"));
 }
Пример #2
0
        /**
         * Getting the share from the SQLiteDataReader
         *
         * @reader : the SQLiteDataReader
         *
         * return a share from the reader
         **/
        public override Share find(SQLiteDataReader reader)
        {
            if (reader.Read())
            {
                Share share = new Share();
                share.userId       = reader[idColumn].ToString();
                share.documentsIds = CSVParser.CSV2List(reader[documentsIds].ToString()).ToHashSet();
                return(share);
            }

            throw new DatabaseException(DatabaseConstants.NOT_FOUND("404"));
        }
Пример #3
0
 /**
  * Updating the share in the database
  *
  * @share : the share to update
  * @columns : the columns to update
  *
  * return true if and only if the update was successfull and false otherwise
  **/
 public override bool update(Share share, params String [] columns)
 {
     //Logging
     Logging.paramenterLogging(nameof(update), false, new Pair(nameof(columns), columns.ToString()), new Pair(nameof(share), share.ToString()));
     //Updating the notebook
     try {
         return(driver.executeQuery(parser.getUpdate(tableName, idColumn, share.userId, share, columns)) != -1);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(update), true, new Pair(nameof(columns), columns.ToString()), new Pair(nameof(share), share.ToString()));
     //Notebook was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(share.ToString()));
 }
 /**
  * Deleting the authentication for the user
  *
  * @username : the username of the user to delete the authentication
  *
  * return ture if and only if the delete was done successfully
  **/
 public bool delete(String username)
 {
     //Logging
     Logging.paramenterLogging(nameof(delete), false, new Pair(nameof(username), username));
     //deleting from the database
     try {
         return(driver.executeQuery(parser.getDelete(DatabaseConstants.TABLE_AUTHENTICATE, DatabaseConstants.COLUMN_USERNAME, username)) != -11);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(register), true, new Pair(nameof(username), username));
     //Username not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(username));
 }
Пример #5
0
 /**
  * Getting the Note from the dataReader
  *
  * @reader : the sql reader
  *
  * return a note from the reader if it was found and throw an exception otherwise
  **/
 public override Note find(SQLiteDataReader reader)
 {
     if (reader.Read())
     {
         Note note = new Note();
         note.setAuthor(reader[DatabaseConstants.COLUMN_AUTHOR].ToString());
         note.setDocumentId(reader[DatabaseConstants.COLUMN_DOCUMENTID].ToString());
         note.setId(reader[idColumn].ToString());
         note.setLastModified(DateTime.Parse(reader[DatabaseConstants.COLUMN_LASTMODIFIED].ToString()));
         note.setDateCreated(DateTime.Parse(reader[DatabaseConstants.COLUMN_DATECREATED].ToString()));
         note.setTitle(reader[DatabaseConstants.COLUMN_TITLE].ToString());
         return(note);
     }
     //Note was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND("404"));
 }
        /**
         * Getting the notebook from the SQLiteDataReader
         *
         * @reader : the SQLiteDataReader
         *
         * return a notebook from the reader
         **/
        public override Notebook find(SQLiteDataReader reader)
        {
            if (reader.Read())
            {
                Notebook notebook = new Notebook();
                notebook.setAuthor(reader[DatabaseConstants.COLUMN_AUTHOR].ToString());
                notebook.setId(reader[idColumn].ToString());
                notebook.setDateCreated(DateTime.Parse(reader[DatabaseConstants.COLUMN_DATECREATED].ToString()));
                notebook.setLastModified(DateTime.Parse(reader[DatabaseConstants.COLUMN_LASTMODIFIED].ToString()));
                notebook.setNotes(CSVParser.CSV2List(reader[DatabaseConstants.COLUMN_NOTESID].ToString()).ToHashSet());
                notebook.setTitle(reader[DatabaseConstants.COLUMN_TITLE].ToString());
                return(notebook);
            }

            throw new DatabaseException(DatabaseConstants.NOT_FOUND("404"));
        }
 /**
  * Deleting the notebook base on the id
  *
  * @id : the id of the notebook
  *
  * return true if and only if the delete operation was successfull
  **/
 public override bool delete(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(delete), false, new Pair(nameof(id), id));
     //Deleting the Notebook from database
     try {
         driver.executeQuery(parser.getDelete(tableName, idColumn, id));
         return(true);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(delete), true, new Pair(nameof(id), id));
     //Notebook was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
Пример #8
0
 /**
  * updatting the task in the SQL Database
  *
  * @task : the task that will get updated
  * @columns : the column in the database that will be updated
  *
  * return true if and only if the updating operation was successfull
  **/
 public override bool update(TaskNote task, params String[] columns)
 {
     //Logging
     Logging.paramenterLogging(nameof(update), false, new Pair(nameof(task), task.ToString()));
     //Updating
     try {
         return(driver.executeQuery(parser.getUpdate(tableName,
                                                     DatabaseConstants.COLUMN_ID, task.id, task, columns)) != -1);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(update), true, new Pair(nameof(task), task.ToString()));
     //TaskNote was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(task.ToString()));
 }
 /**
  * Updatting the document in the SQL Database
  *
  * @document : the document that will get updated
  * @columns : the column in the database that will be updated
  *
  * return true if and only if the updating operation was successfull
  **/
 public override bool update(Document document, params String[] columns)
 {
     //Logging
     Logging.paramenterLogging(nameof(update), false, new Pair(nameof(document), document.ToString()));
     //Updating
     try {
         bool flag = delete(document.getId()); //This is done because of the blob
         return(flag && save(document));
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(update), true, new Pair(nameof(document), document.ToString()));
     //Documnet was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(document.ToString()));
 }
 /**
  * Finding he notebook based on it's id
  *
  * @id : the notebook id
  *
  * return notebook if it was found and throw an Exception otherwise
  **/
 public override Notebook findById(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findById), false, new Pair(nameof(id), id));
     //Finding the notebook
     try {
         SQLiteDataReader reader   = driver.getReader(parser.getSelect(tableName, idColumn, DatabaseConstants.ALL, id));
         Notebook         notebook = find(reader);
         reader.Close();
         return(notebook);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findById), true, new Pair(nameof(id), id));
     //Notebook was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
Пример #11
0
 /**
  * Getting all Documents Id
  *
  * @userId : the user to get the documents from
  *
  * return a list of ids
  **/
 public List <String> findAllDocumentsIds(String userId)
 {
     //Logging
     Logging.paramenterLogging(nameof(findAllDocumentsIds), false, new Pair(nameof(userId), userId));
     //Getting all ids
     try {
         SQLiteDataReader reader       = driver.getReader(parser.getSelect(tableName, idColumn, documentsIds, userId));
         List <String>    documnetsIds = CSVParser.CSV2List(reader[documentsIds].ToString());
         reader.Close();
         return(documnetsIds);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findAllDocumentsIds), true, new Pair(nameof(userId), userId));
     //Not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(userId));
 }
Пример #12
0
 /**
  * Finding the share based on it's id
  *
  * @userId : the user Id to search for
  *
  * return share if it was found and throw an Exception otherwise
  **/
 public override Share findById(String userId)
 {
     //Logging
     Logging.paramenterLogging(nameof(findById), false, new Pair(nameof(userId), userId));
     //Getting all ids
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName, idColumn, documentsIds, userId));
         Share            share  = find(reader);
         reader.Close();
         return(share);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findById), true, new Pair(nameof(userId), userId));
     //Not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(userId));
 }
Пример #13
0
 /**
  * Getting the Note id from the task id
  *
  * @taskId : the task id to search for
  *
  * return a note id if it was found and throw an exception otherwise
  **/
 public String findNote(String taskId)
 {
     //Logging
     Logging.paramenterLogging(nameof(findNote), false, new Pair(nameof(taskId), taskId));
     //Finding note id
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName, idColumn, DatabaseConstants.COLUMN_NOTEID, taskId));
         if (reader.Read())
         {
             return(reader[DatabaseConstants.COLUMN_NOTEID].ToString());
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findNote), false, new Pair(nameof(taskId), taskId));
     //Task id was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(taskId));
 }
 /**
  * Get the last id for the inseted value
  *
  * @tableName : the tableName for the id that was inserted in
  *
  * return an id
  **/
 public static String getLastId(String tableName)
 {
     //Logging
     Logging.paramenterLogging(nameof(getLastId), false, new Pair(nameof(tableName), tableName));
     try {
         SQLiteDataReader reader = DatabaseDriverImplementation.getInstance()
                                   .getReader(DatabaseParserImplementation <T> .getLastAddedRecored(tableName));
         if (reader.Read())
         {
             String id = reader[DatabaseConstants.COLUMN_ID].ToString();
             reader.Close();
             return(id);
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     Logging.paramenterLogging(nameof(getLastId), true, new Pair(nameof(tableName), tableName));
     throw new DatabaseException(DatabaseConstants.NOT_FOUND("EMPTY"));
 }
 /**
  * Login for the user
  *
  * @auth : the usernamae and password for the user (the authentication object)
  *
  * return true if and only if the login was done successfully
  **/
 public bool login(Authentication auth)
 {
     //Logging
     Logging.paramenterLogging(nameof(login), false, new Pair(nameof(auth), auth.ToString()));
     //Login
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(DatabaseConstants.TABLE_AUTHENTICATE,
                                                                     DatabaseConstants.COLUMN_USERNAME, DatabaseConstants.COLUMN_PASSWORD, auth.getUsername()));
         if (reader.Read())
         {
             return(decrypt(reader[DatabaseConstants.COLUMN_PASSWORD].ToString()).Equals(auth.getPassword()));
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(login), true, new Pair(nameof(auth), auth.ToString()));
     //Something went wrong
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(auth.ToString()));
 }
Пример #16
0
 /**
  * Getting user based on the username
  *
  * @username : the username of the user to find
  *
  * return a user if it was found and throw and exception otherwise
  **/
 public User findByUsername(String username)
 {
     //Logging
     Logging.paramenterLogging(nameof(findByUsername), false, new Pair(nameof(username), username));
     //Finding user
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName
                                                                     , DatabaseConstants.COLUMN_USERNAME, DatabaseConstants.ALL, username));
         User user = find(reader);
         Logging.logInfo(false, user.ToString());
         reader.Close();
         return(user);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findByUsername), true, new Pair(nameof(username), username));
     //User was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(username));
 }
 /**
  * Getting the document from the database based on the id
  *
  * @id : the document id to search for
  *
  * return document if found and throw an Exception otherwise
  **/
 public override Document findById(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findById), false, new Pair(nameof(id), id));
     try {
         //Finding the document
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName,
                                                                     DatabaseConstants.COLUMN_ID, DatabaseConstants.ALL, id));
         //Reading the the Record from the database
         Document document = find(reader);
         reader.Close();
         return(document);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findById), true, new Pair(nameof(id), id));
     //Document not found in the database
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
Пример #18
0
 /**
  * Getting the task from the database based on the id
  *
  * @id : the task id to search for
  *
  * return task if found and throw an Exception otherwise
  **/
 public override TaskNote findById(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findById), false, new Pair(nameof(id), id));
     //Finding the task
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName, idColumn, "*", id));
         //Reading the the Record from the database
         TaskNote task = find(reader);
         Logging.logInfo(false, nameof(findById), DatabaseConstants.FOUND(id), task.ToString());
         reader.Close();
         return(task);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findById), true, new Pair(nameof(id), id));
     //TaskNote not found in the database
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
Пример #19
0
 /**
  * Getting all the task by it's status
  *
  * @status : the status to search for in the database
  *
  * return a list of tasknotes ids with a status if it was found and throw an exception otherwise
  **/
 public List <String> findAllByStatus(Status status)
 {
     //Logging
     Logging.paramenterLogging(nameof(findAllByPriority), false, new Pair(nameof(status), status.ToString()));
     //Finding
     try {
         SQLiteDataReader reader   = driver.getReader(parser.getSelect(tableName, DatabaseConstants.COLUMN_STATUS, idColumn, status.ToString()));
         List <String>    notesids = new List <String>();
         while (reader.Read())
         {
             notesids.Add(reader[idColumn].ToString());
         }
         return(notesids);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findAllByPriority), true, new Pair(nameof(status), status.ToString()));
     //Status was not found or something went wrong
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(status.ToString()));
 }
Пример #20
0
 /**
  * Getting user username from it's id
  *
  * @id : the id of the user to search in the database
  *
  * return user useranme if it was found and throw an exception otherwise
  **/
 public String findUsername(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findUsername), false, new Pair(nameof(id), id));
     //Finding username of the user
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName, idColumn, DatabaseConstants.COLUMN_USERNAME, id));
         if (reader.Read())
         {
             String username = reader[DatabaseConstants.COLUMN_USERNAME].ToString();
             reader.Close();
             return(username);
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findUsername), true, new Pair(nameof(id), id));
     //User was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
Пример #21
0
 /**
  * Checking if the user is Authenticated or not
  *
  * @id : the id of the user to check
  *
  * return true if the user is Authenticated and false if not
  **/
 public bool isUserAuthenticated(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(isUserAuthenticated), false, new Pair(nameof(id), id));
     //Finding if the user is Authenticated
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName, idColumn, DatabaseConstants.COLUMN_AUTH, id));
         if (reader.Read())
         {
             int isAuth = int.Parse(reader[DatabaseConstants.COLUMN_AUTH].ToString());
             reader.Close();
             return(isAuth == 1);
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(isUserAuthenticated), true, new Pair(nameof(id), id));
     //User was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
Пример #22
0
 /**
  * Getting a note by it title
  *
  * @title : the note title
  *
  * return a note if it was found and throw an exception otherwise
  **/
 public Note findByTitle(String title)
 {
     //Logging
     Logging.paramenterLogging(nameof(findByTitle), false, new Pair(nameof(title), title));
     //Finding the note
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName
                                                                     , DatabaseConstants.COLUMN_TITLE, DatabaseConstants.ALL, title));
         Note note = find(reader);
         Logging.logInfo(false, note.ToString());
         reader.Close();
         return(note);
     } catch (Exception e) {
         Console.WriteLine(e.Message);
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findByTitle), true, new Pair(nameof(title), title));
     //Note was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(title));
 }
 /**
  * Finding Notes Id for the notebook
  *
  * @id : the id for the notebook
  *
  * return a list of notes id
  **/
 public List <String> findNotes(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findNotes), false, new Pair(nameof(id), id));
     //Finding
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName
                                                                     , idColumn, DatabaseConstants.COLUMN_NOTESID, id));
         if (reader.Read())
         {
             List <String> notesIds = CSVParser.CSV2List(reader[DatabaseConstants.COLUMN_NOTESID].ToString());
             reader.Close();
             return(notesIds);
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findNotes), true, new Pair(nameof(id), id));
     //Notebook was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
Пример #24
0
 /**
  * Getting Doucment Id
  *
  * @id : the note id the get the docuemnt from
  *
  * return id of the document if it was found and throw an exception otherwise
  **/
 public String findNoteDocument(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findByTitle), false, new Pair(nameof(id), id));
     //Finding the note
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName, idColumn, DatabaseConstants.COLUMN_DOCUMENTID, id));
         if (reader.Read())
         {
             String documentId = reader[DatabaseConstants.COLUMN_DOCUMENTID].ToString();
             Logging.logInfo(false, documentId);
             reader.Close();
             return(documentId);
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findByTitle), true, new Pair(nameof(id), id));
     //Note was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }
 /**
  * Getting all Documents from based on the owner's id
  *
  * @ownerId : the ownerId to search for
  *
  * return a list of document ids
  **/
 public List <String> findByOwnerId(String ownerId)
 {
     //Logging
     Logging.paramenterLogging(nameof(findByOwnerId), false, new Pair(nameof(ownerId), ownerId));
     //Finding Docuemnts
     try {
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName,
                                                                     DatabaseConstants.COLUMN_OWENER, idColumn, ownerId));
         List <String> documentsIds = new List <String>();
         while (reader.Read())
         {
             documentsIds.Add(reader[idColumn].ToString());
         }
         reader.Close();
         return(documentsIds);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findByOwnerId), true, new Pair(nameof(ownerId), ownerId));
     //Documnet was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(ownerId));
 }
 /**
  * Finding all the notebooks for an author
  *
  * @author : the author of the notebook name
  *
  * return a list of ids for the notebooks
  **/
 public List <String> findByAuthorName(String author)
 {
     //Logging
     Logging.paramenterLogging(nameof(findByAuthorName), false, new Pair(nameof(author), author));
     //Finding the notebook
     try {
         List <String>    notebooksIds = new List <String>();
         SQLiteDataReader reader       = driver.getReader(parser.getSelect(tableName
                                                                           , DatabaseConstants.COLUMN_AUTHOR, idColumn, author));
         while (reader.Read())
         {
             notebooksIds.Add(reader[idColumn].ToString());
         }
         reader.Close();
         return(notebooksIds);
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findByAuthorName), true, new Pair(nameof(author), author));
     //Notebook was not found
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(author));
 }
Пример #27
0
        /**
         * Getting the Task from the reader
         *
         * @reader : the data base reader
         *
         * return a task if it was found and throw an exception otherwise
         **/
        public override TaskNote find(SQLiteDataReader reader)
        {
            if (reader.Read())
            {
                TaskNote task = new TaskNote();
                task.dueDate = DateTime.Parse(reader[DatabaseConstants.COLUMN_DUEDATE].ToString());
                task.id      = reader[idColumn].ToString();
                String temp = reader[DatabaseConstants.COLUMN_PRIORITY].ToString();
                if (Enum.TryParse(temp, true, out Priority priority))
                {
                    task.priority = priority;
                }
                temp = reader[DatabaseConstants.COLUMN_STATUS].ToString();
                if (Enum.TryParse(temp, true, out Status status))
                {
                    task.status = status;
                }
                task.noteId = reader[DatabaseConstants.COLUMN_NOTEID].ToString();
                return(task);
            }

            throw new DatabaseException(DatabaseConstants.NOT_FOUND("404"));
        }
 public byte[] findDocumentBytes(String id)
 {
     //Logging
     Logging.paramenterLogging(nameof(findDocumentBytes), false, new Pair(nameof(id), id));
     try {
         //Finding the document
         SQLiteDataReader reader = driver.getReader(parser.getSelect(tableName,
                                                                     DatabaseConstants.COLUMN_ID, DatabaseConstants.COLUMN_DOCUMENT, id));
         //Reading the the Record from the database
         if (reader.Read())
         {
             Byte[] docuement = Encoding.Default.GetBytes(reader[DatabaseConstants.COLUMN_DOCUMENT].ToString());
             reader.Close();
             return(docuement);
         }
     } catch (Exception e) {
         Logging.logInfo(true, e.Message);
     }
     //Logging
     Logging.paramenterLogging(nameof(findDocumentBytes), true, new Pair(nameof(id), id));
     //Document not found in the database
     throw new DatabaseException(DatabaseConstants.NOT_FOUND(id));
 }