Пример #1
0
        /// <summary>
        /// Used for rolling back documents to a previous version
        /// </summary>
        /// <returns> Previous published versions of the document</returns>
        public DocumentVersionList[] GetVersions()
        {
            ArrayList versions = new ArrayList();

            using (SqlDataReader dr =
                       Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(GlobalSettings.DbDSN, CommandType.Text,
                                                                                "select documentUser, versionId, updateDate, text from cmsDocument where nodeId = @nodeId order by updateDate",
                                                                                new SqlParameter("@nodeId", Id)))
            {
                while (dr.Read())
                {
                    DocumentVersionList dv =
                        new DocumentVersionList(new Guid(dr["versionId"].ToString()),
                                                DateTime.Parse(dr["updateDate"].ToString()),
                                                dr["text"].ToString(),
                                                Umbraco.BusinessLogic.User.GetUser(int.Parse(dr["documentUser"].ToString())));
                    versions.Add(dv);
                }
            }

            DocumentVersionList[] retVal = new DocumentVersionList[versions.Count];
            int i = 0;

            foreach (DocumentVersionList dv in versions)
            {
                retVal[i] = dv;
                i++;
            }
            return(retVal);
        }
Пример #2
0
        /// <summary>
        /// Used for rolling back documents to a previous version
        /// </summary>
        /// <returns> Previous published versions of the document</returns>
        public DocumentVersionList[] GetVersions()
        {
            ArrayList versions = new ArrayList();
            using (SqlDataReader dr =
                Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(GlobalSettings.DbDSN, CommandType.Text,
                                        "select documentUser, versionId, updateDate, text from cmsDocument where nodeId = @nodeId order by updateDate",
                                        new SqlParameter("@nodeId", Id)))
            {
                while (dr.Read())
                {
                    DocumentVersionList dv =
                        new DocumentVersionList(new Guid(dr["versionId"].ToString()),
                                                DateTime.Parse(dr["updateDate"].ToString()),
                                                dr["text"].ToString(),
                                                Umbraco.BusinessLogic.User.GetUser(int.Parse(dr["documentUser"].ToString())));
                    versions.Add(dv);
                }
            }

            DocumentVersionList[] retVal = new DocumentVersionList[versions.Count];
            int i = 0;
            foreach (DocumentVersionList dv in versions)
            {
                retVal[i] = dv;
                i++;
            }
            return retVal;
        }