protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Master.PageTitle = "مقالات";
                int pid = 0;
                if (Request.QueryString["Aid"] != null)
                {
                    try
                    {
                        pid = Convert.ToInt32(Request.QueryString["Aid"].ToString());
                    }
                    catch (Exception ex)
                    {
                        pid = 0;
                    }
                }

                if (pid == 0)
                {
                    Response.Redirect("~/Default.aspx");
                }
                else
                {
                    CMS_Content page = new CMS_Content();
                    page.LoadByPrimaryKey(pid);
                    uiImageMain.ImageUrl = "Images.aspx?Inner=t&Image=" + page.MainImagePath;
                    uiLiteralContent.Text = Server.HtmlDecode(page.ArContent);
                }
            }
        }
示例#2
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;
 }
示例#3
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();
     }
 }