Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["FCKeditor:UserFilesPath"] = ConfigurationManager.AppSettings["UserFilePath"];

                if (CurrentNews != 0)
                {
                    //BindData();
                    DBLayer db = new DBLayer();
                    DataSet ds = new DataSet();
                    ds = db.GetNews(CurrentNews);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        uiTextBoxEnNewsTitle.Text = ds.Tables[0].Rows[0]["EnTitle"].ToString();
                        uiTextBoxArNewsTitle.Text = ds.Tables[0].Rows[0]["ArTitle"].ToString();
                        uiFCKeditorEnContent.Value = Server.HtmlDecode(ds.Tables[0].Rows[0]["EnBody"].ToString());
                        uiFCKeditorArContent.Value = Server.HtmlDecode(ds.Tables[0].Rows[0]["ArBody"].ToString());
                    }
                    uiPanelCurrentNews.Visible = false;
                    uiPanelCurrent.Visible = true;
                }
                else
                {
                    uiPanelCurrentNews.Visible = true;
                    uiPanelCurrent.Visible = false;
                    BindData();
                }
            }
        }
Example #2
0
        private void BindData()
        {
            DBLayer db = new DBLayer();
            DataSet ds = new DataSet();

            int id = 0;
            bool done = int.TryParse(Request.QueryString["NID"].ToString(), out id);
            if (done)
            {
                ds = db.GetNews(Convert.ToInt32(Request.QueryString["NID"].ToString()));
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        uiLabelTitle.Text = ds.Tables[0].Rows[0]["ArTitle"].ToString();
                        uiLiteralContent.Text = Server.HtmlDecode(ds.Tables[0].Rows[0]["ArBody"].ToString());
                    }
                    else
                    {
                        Response.Redirect("~/News.aspx");
                    }

                }
                else
                {
                    Response.Redirect("~/News.aspx");
                }
            }
            else
            {
                Response.Redirect("~/News.aspx");
            }
        }
Example #3
0
 protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditNews")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentNews = id;
         DBLayer db = new DBLayer();
         DataSet ds = new DataSet();
         ds = db.GetNews(id);
         if (ds.Tables[0].Rows.Count > 0)
         {
             uiTextBoxEnNewsTitle.Text = ds.Tables[0].Rows[0]["EnTitle"].ToString();
             uiTextBoxArNewsTitle.Text = ds.Tables[0].Rows[0]["ArTitle"].ToString();
             uiFCKeditorEnContent.Value = Server.HtmlDecode(ds.Tables[0].Rows[0]["EnBody"].ToString());
             uiFCKeditorArContent.Value = Server.HtmlDecode(ds.Tables[0].Rows[0]["ArBody"].ToString());
         }
         uiPanelCurrentNews.Visible = false;
         uiPanelCurrent.Visible = true;
     }
     else if (e.CommandName == "DeleteNews")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentNews = id;
         DBLayer db = new DBLayer();
         db.DeleteNews(id);
         uiPanelCurrentNews.Visible = true;
         uiPanelCurrent.Visible = false;
         BindData();
     }
 }