Exemplo n.º 1
0
 /// <summary>
 /// Handles the Click event of the btnDelete control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try {
         int pageId = 0;
         int.TryParse(lblPageId.Text, out pageId);
         if (pageId > 0)
         {
             Content.Page page = new Content.Page(pageId);
             int          pageToLoadChildren = page.ParentId;
             Content.Page.Delete(pageId);
             PageCache.RemovePageByID(pageId);//Clear the Item from the cache.
             PageMenuCache.RefreshMenuPageCollection();
             GetPageDataSet();
             LoadTreeView(ds);
             LoadChildren(pageToLoadChildren);
             LoadParentPageDropDown(ds);
             btnDelete.Visible = false;
             Reset();
             Master.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblPageDeleted"));
         }
     }
     catch (Exception ex) {
         Logger.Error(typeof(contentedit).Name + ".btnDelete_Click", ex);
         Master.MessageCenter.DisplayCriticalMessage(ex.Message);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Loads the navigation.
 /// </summary>
 private void LoadNavigation()
 {
     xmlDataSource.EnableCaching = false;
     xmlDataSource.CacheDuration = 0;
     RewriteService.AddRewriteNameSpaceForXslt(xmlDataSource);
     xmlDataSource.Data = PageMenuCache.GetPageMenu();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Handles the Click event of the btnSave control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try {
         Content.Page page;
         int          parentId = 0;
         int          pageId   = 0;
         int.TryParse(lblPageId.Text, out pageId);
         if (pageId > 0)
         {
             page = new Content.Page(pageId);
         }
         else
         {
             page          = new Content.Page();
             page.PageGuid = Guid.NewGuid();
         }
         int.TryParse(ddlParentPage.SelectedValue, out parentId);
         //if(parentId != page.PageId) {//add it to the end of the new parent category
         object sortOrder = new Query(Content.Page.Schema).WHERE(Content.Page.Columns.ParentId, Comparison.Equals, parentId).GetMax(Content.Page.Columns.SortOrder);
         page.SortOrder = string.IsNullOrEmpty(sortOrder.ToString()) ? 1 : (int)sortOrder + 1;
         //}
         page.ParentId    = parentId;
         page.Title       = txtTitle.Text;
         page.MenuTitle   = txtMenuTitle.Text;
         page.Keywords    = txtKeywords.Text;
         page.Description = txtDescription.Text;
         int templateId = 1; //default to 3 column
         int.TryParse(ddlPageTemplate.SelectedValue, out templateId);
         page.TemplateId = templateId;
         //page.Content = HttpUtility.HtmlEncode(txtContent.Value);
         page.Save(WebUtility.GetUserName());
         //Remove from cache will make it reload on the next request.
         PageCache.RemovePageByID(pageId);
         PageMenuCache.RefreshMenuPageCollection();
         Reset();
         GetPageDataSet();
         LoadTreeView(ds);
         LoadChildren(page.ParentId);
         LoadParentPageDropDown(ds);
         Master.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblPageSaved"));
     }
     catch (Exception ex) {
         Logger.Error(typeof(contentedit).Name + ".btnSave_Click", ex);
         Master.MessageCenter.DisplayCriticalMessage(ex.Message);
     }
 }