public static NewsEntity getById(int newsId) { DataRow dr = DbHelper.ExecuteDataRow("p_News_getById", newsId); NewsEntity _news = new NewsEntity(); if (dr != null) { _news.Newsid = newsId; _news.Type = dr["type"].ToString(); _news.Title = dr["title"].ToString(); _news.Subtitle = dr["subtitle"].ToString(); _news.TitleCss = dr["titleCss"].ToString(); _news.Source = dr["source"].ToString(); _news.Context = dr["context"].ToString(); _news.Click = Convert.ToInt32(dr["click"]); _news.IsTop = Convert.ToBoolean(dr["isTop"]); _news.IsShow = Convert.ToBoolean(dr["isShow"]); _news.InputDt = Convert.ToDateTime(dr["inputDt"]); _news.AdminId = Convert.ToInt32(dr["adminId"]); } return _news; }
protected void btn_Save_Click(object sender, EventArgs e) { NewsEntity _news = new NewsEntity(); _news.Newsid = newsid; _news.Type = "1"; _news.Title = txt_title.Text; _news.Subtitle = txt_subtitle.Text; _news.TitleCss = drp_css.SelectedValue.ToString(); _news.Source = txt_source.Text; _news.Context = txt_context.Text; _news.IsTop = cbx_isTop.Checked; _news.IsShow = cbx_isShow.Checked; _news.AdminId = logic.sysAdmin.AdminID; if (newsid != 0) { logic.news.update(_news); } else { logic.news.insert(_news); } Library.Script.ClientMsgUrl("保存成功!", "noticeList.aspx"); }
public static void update(NewsEntity _news) { News.update(_news); }
public static void insert(NewsEntity _news) { News.insert(_news); }
public static void update(NewsEntity _news) { DbHelper.ExecuteNonQuery("p_News_update", _news.Newsid, _news.Type, _news.Title, _news.Subtitle, _news.TitleCss, _news.Source, _news.Context, _news.IsTop, _news.IsShow); }
public static int insert(NewsEntity _news) { return Convert.ToInt32(DbHelper.ExecuteScalar("p_News_insert", _news.Type, _news.Title, _news.Subtitle, _news.TitleCss, _news.Source, _news.Context, _news.IsTop, _news.IsShow, _news.AdminId)); }