/// <summary> /// Audits the creation of a new message by the specified user /// </summary> /// <param name="userID">User ID.</param> /// <param name="messageID">Message ID.</param> /// <returns>true if the save was successful, false otherwise</returns> public static bool AuditNewMessage(int userID, int messageID) { AuditDataMessageRelatedEntity toLog = new AuditDataMessageRelatedEntity(); toLog.AuditActionID = (int)AuditActions.AuditNewMessage; toLog.UserID = userID; toLog.AuditedOn = DateTime.Now; toLog.MessageID = messageID; return toLog.Save(); }
/// <summary>Creates a new, empty AuditDataMessageRelatedEntity object.</summary> /// <returns>A new, empty AuditDataMessageRelatedEntity object.</returns> public override IEntity Create() { IEntity toReturn = new AuditDataMessageRelatedEntity(); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewAuditDataMessageRelated // __LLBLGENPRO_USER_CODE_REGION_END return toReturn; }
/// <summary> /// Audits the approval of an attachment. We'll log the approval of an attachment with the messageid, as attachments are stored related to a message. /// </summary> /// <param name="userID">The user ID.</param> /// <param name="attachmentID">The attachment ID.</param> public static bool AuditApproveAttachment(int userID, int attachmentID) { AuditDataMessageRelatedEntity toLog = new AuditDataMessageRelatedEntity(); AttachmentCollection collection = new AttachmentCollection(); // use a scalar query to obtain the message id so we don't have to pull it completely in memory. An attachment can be big in size so we don't want to // read the entity to just read the messageid. We could use excluding fields to avoid the actual attachment data, but this query is really simple. // this query will return 1 value directly from the DB, so it won't read all attachments first into memory. int messageID = (int)collection.GetScalar(AttachmentFieldIndex.MessageID, null, AggregateFunction.None, (AttachmentFields.AttachmentID==attachmentID)); toLog.AuditActionID = (int)AuditActions.AuditApproveAttachment; toLog.UserID = userID; toLog.MessageID = messageID; toLog.AuditedOn = DateTime.Now; return toLog.Save(); }