protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { if (base.Request.QueryString["NewsID"] != null) { int NewsID = int.Parse(base.Request.QueryString["NewsID"]); Chain.BLL.News bllNews = new Chain.BLL.News(); Chain.Model.News modelNews = bllNews.GetModel(NewsID); this.txtNewsDesc.Value = modelNews.NewsDesc; this.txtNewsName.Value = modelNews.NewsName; this.txtNewsRemark.Value = modelNews.NewsRemark; this.imgNewsPhoto.Src = modelNews.NewsPhoto.ToString(); this.txtUpdateNewsName.Value = modelNews.NewsPhoto; if (modelNews.IsRecommend == 1) { this.cbkIsRecommend.Checked = true; } else { this.cbkIsRecommend.Checked = false; } this.txtNewsID.Value = NewsID.ToString(); this.ltlTitle.Text = "微官网 > 动态管理 > 动态编辑 "; } else { this.ltlTitle.Text = "微官网 > 动态管理 > 动态新增 "; } } }
public List <Chain.Model.News> DataTableToList(DataTable dt) { List <Chain.Model.News> modelList = new List <Chain.Model.News>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.News model = new Chain.Model.News(); if (dt.Rows[i]["NewsID"] != null && dt.Rows[i]["NewsID"].ToString() != "") { model.NewsID = int.Parse(dt.Rows[i]["NewsID"].ToString()); } if (dt.Rows[i]["NewsName"] != null && dt.Rows[i]["NewsName"].ToString() != "") { model.NewsName = dt.Rows[i]["NewsName"].ToString(); } if (dt.Rows[i]["NewsPhoto"] != null && dt.Rows[i]["NewsPhoto"].ToString() != "") { model.NewsPhoto = dt.Rows[i]["NewsPhoto"].ToString(); } if (dt.Rows[i]["NewsDesc"] != null && dt.Rows[i]["NewsDesc"].ToString() != "") { model.NewsDesc = dt.Rows[i]["NewsDesc"].ToString(); } if (dt.Rows[i]["NewsCreateTime"] != null && dt.Rows[i]["NewsCreateTime"].ToString() != "") { model.NewsCreateTime = DateTime.Parse(dt.Rows[i]["NewsCreateTime"].ToString()); } modelList.Add(model); } } return(modelList); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { if (base.Request.QueryString["NewsID"] != null) { int ProductID = int.Parse(base.Request.QueryString["NewsID"]); Chain.Model.News modelNews = this.bllNews.GetModel(ProductID); this.spNewsDesc.InnerHtml = modelNews.NewsDesc; this.spNewsCreateTime.InnerHtml = modelNews.NewsCreateTime.ToString("yyyy-MM-dd HH:mm:ss"); this.spNewsName.InnerText = modelNews.NewsName; } this.rptNewsBind(); } }
public bool Update(Chain.Model.News model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.News model) { return(this.dal.Add(model)); }