コード例 #1
0
    private bool IsAttachmentNameUnique()
    {
        if (attachment != null)
        {
            // Use correct identifier if attachment is under workflow
            int identifier = VersionHistoryID > 0 ? GetAttachmentHistoryId() : attachment.AttachmentID;

            // Check that the name is unique in the document or version context
            Guid attachmentFormGuid = QueryHelper.GetGuid("formguid", Guid.Empty);
            bool nameIsUnique;
            if ((attachment.AttachmentFormGUID == Guid.Empty) || (attachmentFormGuid == Guid.Empty))
            {
                // Get the node
                nameIsUnique = DocumentHelper.AttachmentHasUniqueName(node, attachment);
            }
            else
            {
                nameIsUnique = AttachmentInfoProvider.IsUniqueTemporaryAttachmentName(attachmentFormGuid, attachment.AttachmentName, attachment.AttachmentExtension, identifier);
            }

            return(nameIsUnique);
        }

        return(false);
    }
コード例 #2
0
    /// <summary>
    /// Checks whether the name is unique.
    /// </summary>
    private bool IsAttachmentNameUnique(DocumentAttachment attachment)
    {
        // Check that the name is unique in the document or version context
        Guid attachmentFormGuid = QueryHelper.GetGuid("formguid", Guid.Empty);
        bool nameIsUnique;

        if (attachmentFormGuid == Guid.Empty)
        {
            // Get the node
            nameIsUnique = DocumentHelper.AttachmentHasUniqueName(Node, attachment);
        }
        else
        {
            nameIsUnique = AttachmentInfoProvider.IsUniqueTemporaryAttachmentName(attachmentFormGuid, attachment.AttachmentName, attachment.AttachmentExtension, attachment.AttachmentID);
        }

        return(nameIsUnique);
    }