protected void Add_Click(object sender, EventArgs e) { if (txtContent.Text.Trim().Length == 0) { Response.Write("<script>alert('内容不能为空!');</script>"); return; } AllianceArticle da = new AllianceArticle(); AllianceArticleBLL alliancearticlebll = new AllianceArticleBLL(); string title = Server.HtmlEncode(TxtTitle.Text.Trim()); string writer = Server.HtmlEncode(TxtWriter.Text.Trim()); da.AddDate = Convert.ToDateTime(TxtDate.Text); da.Writer = writer; da.Title = title; da.Content = txtContent.Text; if (alliancearticlebll.Add(da)) { Response.Write("<script>alert('添加成功');window.location.href='AllianceMgr.aspx';</script>"); } else { Response.Write("<script>alert('添加失败');history.back();</script>"); } }
protected void Page_Load(object sender, EventArgs e) { alliancearticlebll = new AllianceArticleBLL(); if (!IsPostBack) { DateBind(); } }
protected void Page_Load(object sender, EventArgs e) { alliancearticlebll = new AllianceArticleBLL(); if (!IsPostBack) { labPage1 = "1"; bindNews(null); } }
protected void Page_Load(object sender, EventArgs e) { alliancearticlebll = new AllianceArticleBLL(); if (!IsPostBack) { string id = Request["id"].ToString(); listview1(int.Parse(id)); } }
protected void DataList1_DeleteCommand(object sender, DataListCommandEventArgs e) { AllianceArticleBLL alliancearticlebll = new AllianceArticleBLL(); string id = e.CommandArgument.ToString(); if (alliancearticlebll.Delete(id)) { Response.Write("<script>alert('删除成功');</script>"); } this.Response.Redirect(this.Request.Url.ToString()); }
public void DateBind(object id)//绑定要修改的信息 { AllianceArticleBLL alliancearticlebll = new AllianceArticleBLL(); AllianceArticle da = new AllianceArticle(); da = alliancearticlebll.GetNewsArticle(id); TxtTitle.Text = da.Title; TxtWriter.Text = da.Writer; TxtDate.Text = da.AddDate.ToString("d"); txtContent.Text = da.Content.ToString(); }
protected void Delete_Click(object sender, EventArgs e) { for (int i = 0; i < DataList1.Items.Count; i++) { if (((CheckBox)DataList1.Items[i].FindControl("selected")).Checked == true) { object s = ((System.Web.UI.WebControls.HyperLink)DataList1.Items[i].FindControl("Hyperlink3")).Text; AllianceArticleBLL alliancearticlebll = new AllianceArticleBLL(); if (alliancearticlebll.Delete(s)) { Response.Write("<script>alert('删除成功');history.back();</script>"); } } } this.Response.Redirect(this.Request.Url.ToString()); }
public void alliance() //工作联盟 { alliancearticlebll = new AllianceArticleBLL(); this.DatalistAlliance.DataSource = alliancearticlebll.Getlist(5); this.DatalistAlliance.DataBind(); }