public bool AddNewslzs(NewsInfolzs n) { string sql = string.Format(@"insert into NewsInfo valuesinsert into NewsInfo values('{0}','{1}','{2}','{3}',default,'1',null)", n.n_name, n.N_type, n.n_title, n.n_content); return(new DBhelper().Excute(sql)); }
public DataTable CheckGridlzs(NewsInfolzs n) { string sql = @"select *,case when N_type='1' then '体育新闻' when N_type = '2' then '娱乐新闻' when N_type = '3' then '财经新闻' when N_type = '4' then '时事新闻' when N_type = '5' then '其他新闻' end as XWLX ,case when n_state = '1' then '未审核' when n_state = '2' then '已审核' end as SHZT from NewsInfo where 1=1 "; if (n.N_type != 0) { sql += string.Format("and N_type='{0}'", n.N_type); } if (n.n_title != "") { sql += string.Format("and n_title like '%{0}%'", n.n_title); } if (n.n_content != "") { sql += string.Format("and n_content like '%{0}%'", n.n_content); } return(new DBhelper().Get(sql)); }
protected void Button2_Click(object sender, EventArgs e) { NewsInfolzs n = new NewsInfolzs(); n.n_name = Request.QueryString["user"]; n.n_title = this.TextBox1.Text; n.n_content = this.TextBox2.Text; bool flag = new UserInfoBLLlzs().AddNewslzs(n); }
protected void Button1_Click(object sender, EventArgs e) { NewsInfolzs n = new NewsInfolzs(); n.N_type = Convert.ToInt32(DropDownList1.SelectedIndex.ToString()); n.n_title = this.TextBox1.Text; n.n_content = this.TextBox2.Text; DataTable dt = new UserInfoBLLlzs().CheckGridlzs(n); this.GridView1.DataSource = dt; this.GridView1.DataBind(); }
public bool AddNewslzs(NewsInfolzs n) { return(new UserInfoDALlzs().AddNewslzs(n)); }
public DataTable CheckGridlzs(NewsInfolzs n) { return(new UserInfoDALlzs().CheckGridlzs(n)); }