Exemple #1
0
        /// <summary>
        /// <see cref="IModel"/>
        /// </summary>
        public void UpdateDocument(string contentId, string contentSummary, string contentXml, bool isMasterDocument, string[] tags)
        {
            Content content = new Content(_Server);

            content.ContentId.Value      = contentId;
            content.ContentSummary.Value = contentSummary;
            content.ContentXml.Value     = contentXml;

            //Si c'est un nouveau document et que c'est un document maître alors on crée le dossier
            //et on rattache le document à ce dossier
            if (!content.Exists() && isMasterDocument)
            {
                Folder folder = new Folder(_Server);
                folder.FldId.Value      = Guid.NewGuid().ToString("N");
                folder.FldCaption.Value = content.ContentSummary.Value;
                content.FldId.Value     = folder.FldId.Value;
                folder.Update();
            }

            //Mise à jour des tags auto du document
            foreach (string s in tags)
            {
                TaggedContent taggedContent = new TaggedContent(_Server);
                taggedContent.ContentId.Value = content.ContentId.Value;
                taggedContent.TagId.Value     = s.GetHashCode();

                if (!taggedContent.Exists())
                {
                    Tag tag = new Tag(_Server);
                    tag.TagId.Value      = taggedContent.TagId.Value;
                    tag.TagCaption.Value = s;
                    tag.Update();
                }

                taggedContent.Update();
            }

            content.Update();
        }
Exemple #2
0
        /// <summary>
        /// <see cref="IModel"/>
        /// </summary>
        public void UpdateDocument(string contentId, string contentSummary, string contentXml, bool isMasterDocument, string[] tags)
        {
            Content content = new Content(_Server);
            content.ContentId.Value = contentId;
            content.ContentSummary.Value = contentSummary;
            content.ContentXml.Value = contentXml;

            //Si c'est un nouveau document et que c'est un document maître alors on crée le dossier
            //et on rattache le document à ce dossier
            if (!content.Exists() && isMasterDocument)
            {
                Folder folder = new Folder(_Server);
                folder.FldId.Value = Guid.NewGuid().ToString("N");
                folder.FldCaption.Value = content.ContentSummary.Value;
                content.FldId.Value = folder.FldId.Value;
                folder.Update();
            }

            //Mise à jour des tags auto du document
            foreach (string s in tags)
            {
                TaggedContent taggedContent = new TaggedContent(_Server);
                taggedContent.ContentId.Value = content.ContentId.Value;
                taggedContent.TagId.Value = s.GetHashCode();

                if (!taggedContent.Exists())
                {
                    Tag tag = new Tag(_Server);
                    tag.TagId.Value = taggedContent.TagId.Value;
                    tag.TagCaption.Value = s;
                    tag.Update();
                }

                taggedContent.Update();

            }

            content.Update();
        }