Example #1
0
        /// <summary>
        /// Gets curret version for the corresponding file.
        /// </summary>
        /// <returns>Instance of <see cref="IVersionAsync"/>.</returns>
        public IVersion GetCurrentVersion()
        {
            string command =
                @"SELECT VersionId, ItemId, VersionNumber, Name, Created, SerialNumber
                  FROM DMS_DocumentVersions
                  WHERE ItemId = @ItemId AND VersionNumber = 
                       (SELECT MAX(VersionNumber) FROM DMS_DocumentVersions WHERE ItemId = @ItemId)";

            return(context.ExecuteVersion(
                       path.Remove(path.IndexOf('?')),
                       command,
                       "@ItemId", itemId).FirstOrDefault());
        }
Example #2
0
        /// <summary>
        /// Gets next version after this.
        /// </summary>
        /// <returns>Next version or <c>null</c>.</returns>
        public IVersion GetSuccessor()
        {
            string command =
                @"SELECT VersionId, ItemId, VersionNumber, Name, CreatedOn, SerialNumber
                  FROM DMS_DocumentVersions
                  WHERE (ItemId = @ItemId) AND (VersionNumber =
                        (SELECT MIN(VersionNumber)
                         FROM DMS_DocumentVersions
                         WHERE (ItemId = @ItemId) AND (VersionNumber > @VersionNumber)))";

            return(context.ExecuteVersion(
                       path.Remove(path.IndexOf('?')),
                       command,
                       "@ItemId", itemId,
                       "@VersionNumber", versionNumber).FirstOrDefault());
        }