private void butRestore_Click(object sender, EventArgs e) { if (gridMain.GetSelectedIndex() == -1) { return; //should never happen. } wikiPageTitleSelected = listWikiPageTitles[gridMain.SelectedIndices[0]]; if (WikiPages.GetByTitle(wikiPageTitleSelected) != null) { MsgBox.Show(this, "Selected page has already been restored."); //should never happen. return; } WikiPage wikiPageRestored = WikiPageHists.RevertFrom(WikiPageHists.GetDeletedByTitle(listWikiPageTitles[gridMain.SelectedIndices[0]])); wikiPageRestored.UserNum = Security.CurUser.UserNum; WikiPages.InsertAndArchive(wikiPageRestored); DialogResult = DialogResult.OK; }
private void butRevert_Click(object sender, EventArgs e) { if (gridMain.GetSelectedIndex() == -1) { return; } if (gridMain.GetSelectedIndex() == gridMain.Rows.Count - 1) //current revision of page //DialogResult=DialogResult.OK; { return; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Revert page to currently selected revision?")) { return; } WikiPage wikiPageNew = WikiPageHists.RevertFrom(gridMain.Rows[gridMain.GetSelectedIndex()].Tag as WikiPageHist); wikiPageNew.UserNum = Security.CurUser.UserNum; WikiPages.InsertAndArchive(wikiPageNew); FillGrid(); }
private void butRevert_Click(object sender, EventArgs e) { if (gridMain.GetSelectedIndex() == -1) { return; } if (gridMain.GetSelectedIndex() == gridMain.Rows.Count - 1) //current revision of page //DialogResult=DialogResult.OK; { return; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Revert page to currently selected revision?")) { return; } WikiPage wikiPageNew = WikiPageHists.RevertFrom(ListWikiPageHists[gridMain.GetSelectedIndex()]); wikiPageNew.UserNum = Security.CurUser.UserNum; WikiPages.InsertAndArchive(wikiPageNew); FillGrid(); gridMain.SetSelected(false); gridMain.SetSelected(gridMain.Rows.Count - 1, true); //select the new revision. gridMain.ScrollToEnd(); //in case there are LOTS of revisions. Should this go in the fill grid code? }