Exemple #1
0
 /// <summary>
 /// Het wijzigen van een opmerking
 /// Geeft false terug als de bewerking niet uitgevoerd kon worden
 /// </summary>
 /// <param name="commentaar">Een opmerking van het type Comment</param>
 /// <returns>Een boolean</returns>
 public async Task<bool> UpdateComment(Comment commentaar)
 {
     try
     {
         COMMENT updateCommentaar = new COMMENT
         {
             Id = commentaar.Id,
             ObjectCodeId = commentaar.ObjectCodeId,
             ObjectCode = commentaar.ObjectCode,
             DefectCodeId = commentaar.DefectCodeId,
             DefectCode = commentaar.DefectCode,
             Omschrijving = commentaar.Omschrijving,
             Vehicle_Id = commentaar.Vehicle_Id,
             Chauffeur = commentaar.Chauffeur,
             Datum = commentaar.Datum
         };
         await db.UpdateAsync(updateCommentaar);
         return true;
     }
     catch (Exception e)
     {
         paLogging.log.Error(String.Format("Fout bij het aanpassen van het rijbericht {0}\nFoutmelding: {1}", commentaar.Id, e.Message));
         return false;
     }
 }
Exemple #2
0
        /// <summary>
        /// Het toevoegen van een opmerking
        /// </summary>
        /// <param name="commentaar">Een opmerking van het type Comment</param>
        /// <returns>Een Comment instantie</returns>
        public async Task<Comment> AddComment(Comment commentaar)
        {
            try
            {
                COMMENT nieuwCommentaar = new COMMENT
                {
                    Id = aantalCommentaren,
                    ObjectCodeId = commentaar.ObjectCodeId,
                    ObjectCode = commentaar.ObjectCode,
                    DefectCodeId = commentaar.DefectCodeId,
                    DefectCode = commentaar.DefectCode,
                    Omschrijving = commentaar.Omschrijving,
                    Vehicle_Id = completeAuto.Id,
                    Chauffeur = commentaar.Chauffeur,
                    Datum = commentaar.Datum
                };
                await db.InsertAsync(nieuwCommentaar);
                Comment opmerking = new Comment(nieuwCommentaar.Id, nieuwCommentaar.Omschrijving, nieuwCommentaar.ObjectCodeId, nieuwCommentaar.DefectCodeId, nieuwCommentaar.Vehicle_Id, nieuwCommentaar.Chauffeur, nieuwCommentaar.Datum);
                aantalCommentaren++;
                return opmerking;
            }
            catch (SQLiteException sqlEx)
            {
                paLogging.log.Error(String.Format("SQLite fout bij het wegschrijven van rijberichten {0} ({1} - {2}: {3}", commentaar.Id, commentaar.ObjectCodeId, commentaar.DefectCodeId, sqlEx.Message));
                return null;
            }
            catch (Exception e)
            {
                paLogging.log.Error(String.Format("Onbekende fout bij het wegschrijven van rijberichten {0} ({1} - {2}: {3}", commentaar.Id, commentaar.ObjectCodeId, commentaar.DefectCodeId, e.Message));
                return null;
            }

        }