Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Master.PageTitle = "الأخبار";
         if (Request.QueryString["NID"] != null && !string.IsNullOrEmpty(Request.QueryString["NID"]))
         {
             uiPanelAllNews.Visible = false;
             uiPanelViewNews.Visible = true;
             int id = Convert.ToInt32(Request.QueryString["NID"].ToString());
             News currentnews = new News();
             currentnews.LoadByPrimaryKey(id);
             uiLabelDate.Text = string.Format("{0:yyyy-MMM-dd}", currentnews.PostedDate);
             uiLabelDate.Text += " " + string.Format("{0:hh:mm}", currentnews.PostedDate);
             uiLabelTitle.Text = currentnews.ArTitle;
             if (!string.IsNullOrEmpty(currentnews.MainImagePath))
                 uiImageNews.ImageUrl = "images.aspx?Inner=news&Image="+currentnews.MainImagePath;
             else
                 uiImageNews.ImageUrl = "images.aspx?Inner=news&Image=" + "arabic/images/logo_Big_watermark.jpg";
             uiLiteralContent.Text = Server.HtmlDecode(currentnews.ArContent);
         }
         else
         {
             uiPanelAllNews.Visible = true;
             uiPanelViewNews.Visible = false;
             BindData();
         }
     }
 }
Esempio n. 2
0
        protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditNews")
            {
                News objData = new News();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                CurrentArNews = objData;
                uiTextBoxArTitle.Text = objData.ArTitle;
                uiTextBoxBrief.Text = objData.Description;
                uiTextBoxDate.Text = objData.PostedDate.ToString("dd/MM/yyyy");
                uiDropDownListHours.SelectedValue = objData.PostedDate.Hour.ToString("00");
                uiDropDownListMins.SelectedValue = objData.PostedDate.Minute.ToString("00");
                uiRadEditorPageContent.Content = Server.HtmlDecode(objData.ArContent);
                uiPanelViewNews.Visible = false;
                uiPanelEdit.Visible = true;

            }
            else if (e.CommandName == "DeleteNews")
            {
                News objData = new News();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                objData.MarkAsDeleted();
                objData.Save();
                CurrentArNews = null;
                BindData();

            }
        }