Exemplo n.º 1
0
 protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditNews")
     {
         NewsTicker objdata = new NewsTicker();
         objdata.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         CurrentNews = objdata;
         uiTextBoxContent.Text = objdata.ArContent;
         uiPanelCurrentNews.Visible = false;
         uiPanelCurrent.Visible = true;
         uiPanelEditSettings.Visible = false;
     }
     else if (e.CommandName == "DeleteNews")
     {
         NewsTicker objdata = new NewsTicker();
         objdata.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objdata.MarkAsDeleted();
         objdata.Save();
         BindData();
         uiPanelCurrentNews.Visible = true;
         uiPanelCurrent.Visible = false;
         uiPanelEditSettings.Visible = false;
     }
 }
Exemplo n.º 2
0
 protected void uiLinkButtonUpdateNews_Click(object sender, EventArgs e)
 {
     if (CurrentNews != null)
     {
         CurrentNews.ArContent = uiTextBoxContent.Text;
         CurrentNews.PostedDate = DateTime.Now;
         CurrentNews.Save();
     }
     else
     {
         NewsTicker objdata = new NewsTicker();
         objdata.AddNew();
         objdata.ArContent = uiTextBoxContent.Text;
         objdata.PostedDate = DateTime.Now;
         objdata.Save();
     }
     uiTextBoxContent.Text = "";
     CurrentNews = null;
     uiPanelCurrentNews.Visible = true;
     uiPanelCurrent.Visible = false;
     uiPanelEditSettings.Visible = false;
     BindData();
 }