protected void btnInsertRootOnly_Click(object sender, EventArgs e) { InstallationManager im = Installer; try { cvRootAndStart.IsValid = true; cvRoot.IsValid = ddlRootAndStart.SelectedIndex > 0; if (!cvRoot.IsValid) { return; } ContentItem root = im.InsertRootNode(Type.GetType(ddlRootAndStart.SelectedValue), "start", "Start Page"); if (root.ID == Status.RootItemID && root.ID == Status.StartPageID) { ltRootNode.Text = "<span class='ok'>Root node inserted.</span>"; phSame.Visible = false; phDiffer.Visible = false; RootId = root.ID; Installer.UpdateStatus(SystemStatusLevel.UpAndRunning); ShowTab("Finish"); } else { ltRootNode.Text = string.Format( "<span class='warning'>Root node inserted but you must update web.config with root item id: <b>{0}</b></span> ", root.ID); phSame.Visible = true; phDiffer.Visible = false; RootId = root.ID; StartId = root.ID; } phSame.DataBind(); } catch (Exception ex) { ltRootNode.Text = string.Format("<span class='warning'>{0}</span><!--\n{1}\n-->", ex.Message, ex); } }
protected void btnInsert_Click(object sender, EventArgs e) { InstallationManager im = Installer; try { cvRootAndStart.IsValid = ddlRoot.SelectedIndex > 0 && ddlStartPage.SelectedIndex > 0; cvRoot.IsValid = true; if (!cvRootAndStart.IsValid) { return; } ContentItem root = im.InsertRootNode(Type.GetType(ddlRoot.SelectedValue), "root", "Root Node"); ContentItem startPage = im.InsertStartPage(Type.GetType(ddlStartPage.SelectedValue), root, "start", "Start Page"); if (startPage.ID == Status.StartPageID && root.ID == Status.RootItemID) { ltRootNode.Text = "<span class='ok'>Root and start pages inserted.</span>"; } else { ltRootNode.Text = string.Format( "<span class='warning'>Start page inserted but you must update web.config with root item id: <b>{0}</b> and start page id: <b>{1}</b></span>", root.ID, startPage.ID); phSame.Visible = false; phDiffer.Visible = true; RootId = root.ID; StartId = startPage.ID; } phDiffer.DataBind(); } catch (Exception ex) { ltRootNode.Text = string.Format("<span class='warning'>{0}</span><!--\n{1}\n-->", ex.Message, ex); } }