/// <summary> /// Loads dropdown list with versions. /// </summary> /// <param name="documentId">ID of current document</param> /// <param name="versionHistoryId">ID of current version history</param> private void LoadDropDown(int documentId, int versionHistoryId) { DataSet ds = VersionManager.GetDocumentHistory(documentId, "VersionHistoryID !=" + versionHistoryId, "ModifiedWhen DESC, VersionNumber DESC", -1, "VersionHistoryID, VersionNumber, ModifiedWhen"); string version = null; // Converting modified time to corect time zone if (!DataHelper.DataSourceIsEmpty(ds)) { foreach (DataRow dr in ds.Tables[0].Rows) { version = ValidationHelper.GetString(dr["VersionNumber"], null); version += " (" + GetUserDate(dr["ModifiedWhen"]) + ")"; drpCompareTo.Items.Add(new ListItem(version, ValidationHelper.GetString(dr["VersionHistoryID"], "0"))); } } // If history to be compared is available if (drpCompareTo.Items.Count > 0) { drpCompareTo.Items.Insert(0, GetString("history.select")); } // Otherwise hide dropdown list else { pnlControl.Visible = false; } // Pre-select dropdown list if (drpCompareTo.Items.FindByValue(versionCompare.ToString()) != null) { drpCompareTo.SelectedValue = versionCompare.ToString(); } }
/// <summary> /// Returns version number with date for given document. /// </summary> private string GetVersionNumber(int documentId, int version) { DataSet ds = VersionManager.GetDocumentHistory(documentId, "VersionHistoryID =" + version, null, 1, "VersionNumber, ModifiedWhen"); if (DataHelper.DataSourceIsEmpty(ds)) { return(null); } else { string versionNumber = ValidationHelper.GetString(ds.Tables[0].Rows[0]["VersionNumber"], null); versionNumber += " (" + GetUserDate(ds.Tables[0].Rows[0]["ModifiedWhen"]) + ")"; return(versionNumber); } }