예제 #1
0
 protected void uiLinkButtonUpdateCMS_Click(object sender, EventArgs e)
 {
     if (CurrentRelatedArticle != null)
     {
         CurrentRelatedArticle.ArTitle = uiTextBoxCMSTitle.Text;
         CMS_Content cms = new CMS_Content();
         cms.LoadByPrimaryKey(CurrentRelatedArticle.CMSID);
         cms.ArTitle = uiTextBoxCMSTitle.Text;
         cms.ArContent = Server.HtmlEncode(uiRadEditorCMSContent.Content);
         if (!string.IsNullOrEmpty(CMSMainImagePath))
         {
             cms.MainImagePath = CMSMainImagePath;
         }
         CMSMainImagePath = null;
         cms.Save();
         CurrentRelatedArticle.TypeID = 1;
         CurrentRelatedArticle.PageID = CurrentPage.PageID;
         CurrentRelatedArticle.Save();
     }
     else
     {
         RelatedContent rcv = new RelatedContent();
         rcv.AddNew();
         CMS_Content cms = new CMS_Content();
         cms.AddNew();
         cms.ArTitle = uiTextBoxCMSTitle.Text;
         if (!string.IsNullOrEmpty(CMSMainImagePath))
         {
             cms.MainImagePath = CMSMainImagePath;
         }
         CMSMainImagePath = null;
         rcv.ArTitle = uiTextBoxCMSTitle.Text;
         cms.ArContent = Server.HtmlEncode(uiRadEditorCMSContent.Content);
         cms.Save();
         rcv.TypeID = 1;
         rcv.PageID = CurrentPage.PageID;
         rcv.SubCategoryID = Convert.ToInt32(uiDropDownListCMSSubCats.SelectedValue);
         rcv.CMSID = cms.CMSID;
         rcv.Save();
     }
     ClearCMSFields();
     CurrentRelatedArticle = null;
     LoadArticles();
     uiPanelAllCMS.Visible = true;
     uiPanelEditCMS.Visible = false;
 }
예제 #2
0
 protected void uiGridViewCMS_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditCMS")
     {
         RelatedContent objData = new RelatedContent();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         CMS_Content cms = new CMS_Content();
         cms.LoadByPrimaryKey(objData.CMSID);
         uiTextBoxCMSTitle.Text = cms.ArTitle;
         uiRadEditorCMSContent.Content = Server.HtmlDecode(cms.ArContent);
         uiPanelAllCMS.Visible = false;
         uiPanelEditCMS.Visible = true;
         CurrentRelatedArticle = objData;
     }
     else if (e.CommandName == "DeleteCMS")
     {
         RelatedContent objData = new RelatedContent();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         CMS_Content cms = new CMS_Content();
         cms.LoadByPrimaryKey(objData.CMSID);
         objData.MarkAsDeleted();
         objData.Save();
         cms.MarkAsDeleted();
         cms.Save();
         LoadArticles();
     }
 }