protected void btntype_Click(object sender, EventArgs e) { if (txtaddtype.Text.Trim() == "") { lbladdtype.Text = "请填写新闻类型"; return; } Maticsoft.BLL.NewsTypeInfo typebll = new Maticsoft.BLL.NewsTypeInfo(); Maticsoft.Model.NewsTypeInfo typemodel = new Maticsoft.Model.NewsTypeInfo(); typemodel.NewsTypeTitle = txtaddtype.Text.Trim(); typebll.Add(typemodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<SCRIPT>alert('信息提交成功)</SCRIPT>"); }
protected void btnNews_Click(object sender, EventArgs e) { Maticsoft.BLL.NewsTypeInfo newsbll = new Maticsoft.BLL.NewsTypeInfo(); Maticsoft.Model.NewsTypeInfo newmodel = new Maticsoft.Model.NewsTypeInfo(); if (txtNewsInfo.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请将填写完整!')</script>"); return; } newmodel.NewsTypeTitle = txtNewsInfo.Text.Trim(); newsbll.Add(newmodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>"); txtNewsInfo.Text = ""; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtNewsTypeTitle.Text.Trim().Length == 0) { strErr += "NewsTypeTitle不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string NewsTypeTitle = this.txtNewsTypeTitle.Text; Maticsoft.Model.NewsTypeInfo model = new Maticsoft.Model.NewsTypeInfo(); model.NewsTypeTitle = NewsTypeTitle; Maticsoft.BLL.NewsTypeInfo bll = new Maticsoft.BLL.NewsTypeInfo(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }