Beispiel #1
0
        /// <summary>
        /// Publishing a document
        ///
        /// A xmlrepresentation of the document and its data are exposed to the runtime data
        /// (an xmlrepresentation is added -or updated if the document previously are published) ,
        /// this will lead to a new version of the document being created, for continuing editing of
        /// the data.
        /// </summary>
        /// <param Name="u">The usercontext under which the action are performed</param>
        public void Publish(User u)
        {
            _published = true;
            string tempVersion = System.Version.ToString();
            Guid   newVersion  = createNewVersion();

            Log.Add(LogTypes.Publish, u, Id, "");

            Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text,
                                                                       "insert into cmsDocument (newest, nodeId, published, documentUser, versionId, Text, TemplateId) values (1," +
                                                                       Id + ", 0, " + u.Id + ", '" + newVersion + "', N'" + Umbraco.SqlHelper.SafeString(Text) +
                                                                       "', " + _template + ")");
            Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text,
                                                                       "update cmsDocument set published = 0 where nodeId = " + Id +
                                                                       " update cmsDocument set published = 1, newest = 0 where versionId = '" +
                                                                       tempVersion + "'");

            // update release and expire dates
            Document newDoc = new Document(Id, newVersion);

            if (ReleaseDate != new DateTime())
            {
                newDoc.ReleaseDate = ReleaseDate;
            }
            if (ExpireDate != new DateTime())
            {
                newDoc.ExpireDate = ExpireDate;
            }

            // Update xml in db using the new document (has correct version date)
            newDoc.XmlGenerate(new XmlDocument());
        }
Beispiel #2
0
        /// <summary>
        /// Publishing a document
        /// 
        /// A xmlrepresentation of the document and its data are exposed to the runtime data
        /// (an xmlrepresentation is added -or updated if the document previously are published) ,
        /// this will lead to a new version of the document being created, for continuing editing of
        /// the data.
        /// </summary>
        /// <param Name="u">The usercontext under which the action are performed</param>
        public void Publish(User u)
        {
            _published = true;
            string tempVersion = System.Version.ToString();
            Guid newVersion = createNewVersion();

            Log.Add(LogTypes.Publish, u, Id, "");

            Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text,
                                      "insert into cmsDocument (newest, nodeId, published, documentUser, versionId, Text, TemplateId) values (1," +
                                      Id + ", 0, " + u.Id + ", '" + newVersion + "', N'" + Umbraco.SqlHelper.SafeString(Text) +
                                      "', " + _template + ")");
            Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text,
                                      "update cmsDocument set published = 0 where nodeId = " + Id +
                                      " update cmsDocument set published = 1, newest = 0 where versionId = '" +
                                      tempVersion + "'");

            // update release and expire dates
            Document newDoc = new Document(Id, newVersion);
            if (ReleaseDate != new DateTime())
                newDoc.ReleaseDate = ReleaseDate;
            if (ExpireDate != new DateTime())
                newDoc.ExpireDate = ExpireDate;

            // Update xml in db using the new document (has correct version date)
            newDoc.XmlGenerate(new XmlDocument());
        }