protected void btnok_Click(object sender, EventArgs e) { Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo(); Maticsoft.Model.NewsInfo newmodel = newbll.GetModel(1); if (txtNewsTitle.Text.Trim() == "") { lblNewsTitle.Text = "请填写新闻标题"; return; } newmodel.NewsTitle = txtNewsTitle.Text.Trim(); lblNewsTitle.Text = ""; if (txtKeyword.Text.Trim() == "") { lblkeyword.Text = "请填写新闻关键字"; return; } newmodel.NewsKey = txtKeyword.Text.Trim(); lblkeyword.Text = ""; newmodel.NewsTypeID = int.Parse(drpNewsType.SelectedValue); if (txtwrite.Text.Trim() == "") { lblwrite.Text = "请填写新闻发布人"; return; } newmodel.Write = txtwrite.Text.Trim(); lblwrite.Text = ""; newmodel.Fatime = Convert.ToDateTime(txtfatime.Text.Trim()); newmodel.ImageURL = Image1.ImageUrl; newmodel.NewsContent = txtNewContent.Text.Trim(); newbll.Update(newmodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>"); bind(); }
protected void datamess_ItemDataBound(object sender, DataListItemEventArgs e) { int index = int.Parse(datamess.DataKeys[e.Item.ItemIndex].ToString()); Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo(); Maticsoft.Model.NewsInfo newmodel = newbll.GetModel(index); int typeid = int.Parse(newmodel.NewsTypeID.ToString()); Maticsoft.BLL.NewsTypeInfo typebll = new Maticsoft.BLL.NewsTypeInfo(); Maticsoft.Model.NewsTypeInfo typemodel = typebll.GetModel(typeid); ((Label)e.Item.FindControl("lbltype")).Text = typemodel.NewsTypeTitle; }
private void bind() { Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo(); int index = int.Parse(Request.QueryString["NewsID"].ToString()); Maticsoft.Model.NewsInfo newmodel = newbll.GetModel(index); txtfatime.Text = Convert.ToDateTime(newmodel.Fatime.ToString()).ToString("yyyy-MM-dd"); Image1.ImageUrl = newmodel.ImageURL; txtKeyword.Text = newmodel.NewsKey; txtNewContent.Text = newmodel.NewsContent; txtNewsTitle.Text = newmodel.NewsTitle; txtwrite.Text = newmodel.Write; drpNewsType.SelectedValue = newmodel.NewsTypeID.ToString(); }
private void ShowInfo(int NewsID) { Maticsoft.BLL.NewsInfo bll = new Maticsoft.BLL.NewsInfo(); Maticsoft.Model.NewsInfo model = bll.GetModel(NewsID); this.lblNewsID.Text = model.NewsID.ToString(); this.txtNewsTitle.Text = model.NewsTitle; this.txtNewsKey.Text = model.NewsKey; this.txtWrite.Text = model.Write; this.txtNewsTypeID.Text = model.NewsTypeID.ToString(); this.txtFatime.Text = model.Fatime.ToString(); this.txtImageURL.Text = model.ImageURL; this.txtHitNum.Text = model.HitNum.ToString(); this.txtNewsContent.Text = model.NewsContent; }
private void bind(int newsid) { Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo(); Maticsoft.Model.NewsInfo newmodel = newbll.GetModel(newsid); int typeid = int.Parse(newmodel.NewsTypeID.ToString()); Maticsoft.BLL.NewsTypeInfo typebll = new Maticsoft.BLL.NewsTypeInfo(); Maticsoft.Model.NewsTypeInfo typemodel = typebll.GetModel(typeid); lblFatime.Text = Convert.ToDateTime(newmodel.Fatime.ToString()).ToString("yyyy-MM-dd"); lblNewsContent.Text = newmodel.NewsContent; lblNewsTitle.Text = newmodel.NewsTitle; lblNewsTypeTitle.Text = typemodel.NewsTypeTitle; lblNewsTypeTitle1.Text = typemodel.NewsTypeTitle; lblWrite.Text = newmodel.Write; imgnews.ImageUrl = newmodel.ImageURL; }
private void bind() { Maticsoft.BLL.NewsInfo newsbll = new Maticsoft.BLL.NewsInfo(); int index = int.Parse(Request.QueryString["NewsID"].ToString()); Maticsoft.Model.NewsInfo newmodel = newsbll.GetModel(index); Maticsoft.BLL.NewsTypeInfo typebll = new Maticsoft.BLL.NewsTypeInfo(); int typeid = int.Parse(newmodel.NewsTypeID.ToString()); Maticsoft.Model.NewsTypeInfo typemodel = typebll.GetModel(typeid); lblkey.Text = newmodel.NewsKey; lblstarttime.Text = Convert.ToDateTime(newmodel.Fatime.ToString()).ToString("yyyy-MM-dd"); lbltitle.Text = newmodel.NewsTitle; lbltype.Text = typemodel.NewsTypeTitle; lblwrite.Text = newmodel.Write; Image1.ImageUrl = newmodel.ImageURL; txtcontent.Text = newmodel.NewsContent; }