protected void uiLinkButtonCancelNews_Click(object sender, EventArgs e) { uiPanelCurrentNews.Visible = true; uiPanelCurrent.Visible = false; uiPanelEditSettings.Visible = false; CurrentNews = null; BindData(); }
protected void uiLinkButtonAdd_Click(object sender, EventArgs e) { uiPanelCurrentNews.Visible = false; uiPanelCurrent.Visible = true; uiPanelEditSettings.Visible = false; CurrentNews = null; uiTextBoxContent.Text = ""; }
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; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Ermia_BLL.NewsTicker NT = new Ermia_BLL.NewsTicker(); NT.Query.AddOrderBy(Ermia_BLL.News.ColumnNames.PostedDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC); GeneralSettings GS = new GeneralSettings(); GS.LoadByPrimaryKey(1); int top = 0; try { if (int.TryParse(GS.Value, out top)) NT.Query.Top = top; } catch (Exception ee) { NT.Query.Top = 2; } NT.Query.Load(); uiRepeaterTicker.DataSource = NT.DefaultView; uiRepeaterTicker.DataBind(); } }
private void BindData() { NewsTicker NT = new NewsTicker(); NT.LoadAll(); uiGridViewNews.DataSource = NT.DefaultView; uiGridViewNews.DataBind(); }
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(); }