/// <summary> /// Checks whether the name is unique. /// </summary> /// <param name="name">New attachment name</param> /// <param name="extension">New attachment extension. If null current is used.</param> private bool IsNameUnique(string name, string extension) { if (ai != null) { // Ensure extension is set extension = extension ?? ai.AttachmentExtension; // Use correct identifier if attachment is under workflow int identifier = VersionHistoryID > 0 ? AttachmentHistoryID : ai.AttachmentID; // Check that the name is unique in the document or version context Guid attachmentFormGuid = QueryHelper.GetGuid("formguid", Guid.Empty); bool nameIsUnique; if ((ai.AttachmentFormGUID == Guid.Empty) || (attachmentFormGuid == Guid.Empty)) { // Get the node TreeNode node = DocumentHelper.GetDocument(ai.AttachmentDocumentID, baseImageEditor.Tree); nameIsUnique = DocumentHelper.IsUniqueAttachmentName(node, name, extension, identifier, baseImageEditor.Tree); } else { nameIsUnique = AttachmentInfoProvider.IsUniqueTemporaryAttachmentName(attachmentFormGuid, name, extension, identifier); } return(nameIsUnique); } return(false); }
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); }
/// <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); }
/// <summary> /// Checks whether the name is unique. /// </summary> private bool IsAttachmentNameUnique(AttachmentInfo ai, string name) { if (ai != null) { // Check that the name is unique in the document or version context Guid attachmentFormGuid = QueryHelper.GetGuid("formguid", Guid.Empty); bool nameIsUnique = false; if (attachmentFormGuid == Guid.Empty) { // Get the node nameIsUnique = DocumentHelper.IsUniqueAttachmentName(Node, name, ai.AttachmentExtension, ai.AttachmentID, TreeProvider); } else { nameIsUnique = AttachmentInfoProvider.IsUniqueTemporaryAttachmentName(attachmentFormGuid, name, ai.AttachmentExtension, ai.AttachmentID); } return(nameIsUnique); } return(false); }