Exemple #1
0
        /// <summary>
        /// Read the working version of the document and attachment.
        /// </summary>
        protected virtual void readWorkVersion()
        {
            if (haveReadWorkVersion)
            {
                return;
            }
            haveReadWorkVersion = true;

            // Existing object?
            if (sordVal.id >= 0)
            {
                // read versions
                long      editC = EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers;
                EditInfoZ editZ = new EditInfoZ(editC, new SordZ(0));

                EditInfo ed = Conn.Ix.checkoutDoc(sordVal.guid, null, editZ, LockC.NO);

                // object has versions and/or attachments
                if (ed.document != null)
                {
                    // The current working versions might have been set by
                    // a previsious call to Version.File=c:/hello.txt.
                    // Thus do not overwrite the current working versions.

                    FWDocVersion wver = docs.WorkVersion;
                    FWDocVersion watt = atts.WorkVersion;

                    if (ed.document.docs != null && ed.document.docs.Length != 0)
                    {
                        DocVersion dv = ed.document.docs[0];
                        if (wver == null)
                        {
                            // ANPASSUNG
                            if (dv.workVersion)  // <-- Diese Zeile wurde eingefügt
                            {
                                wver = docs.InternalAdd(dv);
                            }
                        }
                        else if (wver.Signature == null)
                        {
                            wver.Signature = ClassFactory.NewDocVersion(dv.sig, this, FWDocVersionType.TYPE_SIGNATURE);
                        }
                    }

                    if (watt == null)
                    {
                        if (ed.document.atts != null && ed.document.atts.Length != 0)
                        {
                            DocVersion dv = ed.document.atts[0];
                            watt = atts.InternalAdd(dv);
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Read all versions.
        /// </summary>
        /// <returns></returns>
        protected virtual void readAllVersions()
        {
            if (haveReadAll)
            {
                return;
            }
            haveReadAll = true;
            if (sordVal.id < 0)
            {
                return;
            }

            FWDocVersion wdoc = Version;
            FWDocVersion watt = Attachment;

            EditInfoZ editZ = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbAttachmentMembers, new SordZ(0));
            EditInfo  ed    = Conn.Ix.checkoutDoc(sordVal.guid, "-1", editZ, LockC.NO);

            if (ed.document.docs != null)
            {
                foreach (DocVersion dv in ed.document.docs)
                {
                    if (wdoc != null)
                    {
                        if (wdoc.Id == dv.id)
                        {
                            continue;
                        }
                        dv.workVersion = false;
                    }
                    docs.InternalAdd(dv);
                }
            }
            else

            if (ed.document.atts != null)
            {
                foreach (DocVersion dv in ed.document.atts)
                {
                    FWDocVersion xdv = ClassFactory.NewDocVersion(dv, this, FWDocVersionType.TYPE_ATTACHMENT);
                    if (watt != null)
                    {
                        if (watt.Id == dv.id)
                        {
                            continue;
                        }
                        dv.workVersion = false;
                    }
                    atts.InternalAdd(dv);
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// Set the original file name in the Sord, if the Sord has not already a working version
 /// (new document or document without file).
 /// </summary>
 /// <param name="docs">Collection of versions.</param>
 protected virtual void setOriginalFileNameFromModifiedVersions(List <FWDocVersion> docs)
 {
     if (sordVal.doc == 0)
     {
         for (int i = docs.Count - 1; i >= 0; i--)
         {
             FWDocVersion xdv = docs[i];
             if (xdv.WorkVersion)
             {
                 String             file = xdv.File;
                 System.IO.FileInfo fi   = new System.IO.FileInfo(file);
                 if (file != null)
                 {
                     OriginalFileName = fi.Name;
                 }
                 break;
             }
         }
     }
 }
Exemple #4
0
 /// <summary>
 /// Assign the DocVersion objects returned by checkinDocBegin.
 /// </summary>
 /// <param name="modifiedVersions">Collection of modified versions.</param>
 /// <param name="dvs">Array of version objects returned from checkinDocBegin</param>
 protected virtual void assignPreparedDocVersions(List <FWDocVersion> modifiedVersions, DocVersion[] dvs)
 {
     for (int i = 0; i < modifiedVersions.Count; i++)
     {
         FWDocVersion xdv = modifiedVersions[i];
         if (xdv.FileModified)
         {
             xdv.Core = dvs[i];
         }
         else if (xdv.Modified)
         {
             // checkinDocBegin sets DocVersion.id=0 because
             // upload-URLs in DocVersion.url are created for inserting new Versions.
             // Since we do not want to insert a new version here (file was not modified),
             // we restore the version ID.
             int versionId = xdv.Id;
             xdv.Core = dvs[i];
             xdv.Id   = versionId;
         }
     }
 }
Exemple #5
0
 /// <summary>
 /// Converts the values from the internal document version object.
 /// </summary>
 /// <param name="save">true, to save into the internal document object</param>
 protected virtual void updateInternalData(bool save)
 {
     if (save)
     {
     }
     else
     {
         if (dvVal != null)
         {
             if (dvVal.sig != null)
             {
                 if (this.sigVal == null)
                 {
                     this.sigVal = ClassFactory.NewDocVersion(dvVal.sig, sord, FWDocVersionType.TYPE_SIGNATURE);
                 }
                 else
                 {
                     this.sigVal.Core = dvVal.sig;
                 }
             }
             if (dvVal.preview != null)
             {
                 if (this.previewVal == null)
                 {
                     this.previewVal = ClassFactory.NewDocVersion(dvVal.preview, sord, FWDocVersionType.TYPE_PREVIEW);
                 }
                 else
                 {
                     this.previewVal.Core = dvVal.preview;
                 }
             }
         }
         else
         {
             dvVal = new DocVersion();
             dvVal.encryptionSet = sord.Core.details.encryptionSet;
             dvVal.pathId        = sord.Core.path;
         }
     }
 }