Exemplo n.º 1
0
        /// <summary>Creates a new, empty AttachmentEntity object.</summary>
        /// <returns>A new, empty AttachmentEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new AttachmentEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewAttachment
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new attachment to the message with messageID specified. 
        /// </summary>
        /// <param name="messageID">The message ID.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="fileContents">The file contents.</param>
        /// <param name="approveValue">the value for the approved flag</param>
        public static void AddAttachment(int messageID, string fileName, byte[] fileContents, bool approveValue)
        {
            AttachmentEntity newAttachment = new AttachmentEntity();
            newAttachment.MessageID = messageID;
            newAttachment.Filename = fileName;
            newAttachment.Filecontents = fileContents;
            newAttachment.Filesize = fileContents.Length;
            newAttachment.Approved = approveValue;
            newAttachment.AddedOn = DateTime.Now;

            // save.
            newAttachment.Save();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Approves / revokes the approval of the attachment with ID passed in.
 /// </summary>
 /// <param name="attachmentID">The attachment ID.</param>
 /// <param name="approved">the new flag value for Approved</param>
 public static void ModifyAttachmentApproval(int attachmentID, bool approved)
 {
     // we'll update the approved flag directly in the db, so we don't load the whole attachment into memory.
     AttachmentEntity updater = new AttachmentEntity();
     AttachmentCollection attachments = new AttachmentCollection();
     updater.Approved = approved;
     attachments.UpdateMulti(updater, (AttachmentFields.AttachmentID == attachmentID));
 }