protected void datanewsquan_ItemDataBound(object sender, DataListItemEventArgs e) { Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo(); int index = int.Parse(datanewsquan.DataKeys[e.Item.ItemIndex].ToString()); //DataSet bllds = newbll.GetList("NewsTypeID="+index+""); int pageSize = 5; //每页大小 int page = 1; //当前第几页 int recordCount; //总共有多少条数据 if (Request.QueryString["page"] != null) { if (Request.QueryString["page"].ToString() != "") { page = int.Parse(Request.QueryString["page"].ToString()); } } recordCount = newbll.GetNewCount("NewsTypeID=" + index + ""); int pageCount = recordCount / pageSize + 1;//共有多少页 if (recordCount % pageSize == 0) { pageCount--; } DataSet bllds = newbll.GeNewsList(pageSize * (page - 1), pageSize, "NewsTypeID=" + index + ""); DataList dlNews = e.Item.FindControl("datanewsfen") as DataList; dlNews.DataSource = bllds; dlNews.DataBind(); Maticsoft.BLL.NewsTypeInfo typebll = new Maticsoft.BLL.NewsTypeInfo(); Maticsoft.Model.NewsTypeInfo typemodel = typebll.GetModel(int.Parse(this.datanewsquan.DataKeys[e.Item.ItemIndex].ToString())); Label lbltype = e.Item.FindControl("lbltype") as Label; lbltype.Text = typemodel.NewsTypeTitle; Label lblpage = e.Item.FindControl("lblpage") as Label; }
private void ShowInfo(int NewsTypeID) { Maticsoft.BLL.NewsTypeInfo bll = new Maticsoft.BLL.NewsTypeInfo(); Maticsoft.Model.NewsTypeInfo model = bll.GetModel(NewsTypeID); this.lblNewsTypeID.Text = model.NewsTypeID.ToString(); this.txtNewsTypeTitle.Text = model.NewsTypeTitle; }
public 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; } int NewsTypeID = int.Parse(this.lblNewsTypeID.Text); string NewsTypeTitle = this.txtNewsTypeTitle.Text; Maticsoft.Model.NewsTypeInfo model = new Maticsoft.Model.NewsTypeInfo(); model.NewsTypeID = NewsTypeID; model.NewsTypeTitle = NewsTypeTitle; Maticsoft.BLL.NewsTypeInfo bll = new Maticsoft.BLL.NewsTypeInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void bind() { Maticsoft.BLL.FuWuTypeInfo fuwubll = new Maticsoft.BLL.FuWuTypeInfo(); DataSet fuwuds = fuwubll.GetAllList(); dtlstfuwu.DataSource = fuwuds; dtlstfuwu.DataBind(); Maticsoft.BLL.NewsTypeInfo newsbll = new Maticsoft.BLL.NewsTypeInfo(); DataSet newsds = newsbll.GetAllList(); dtlistNews.DataSource = newsds; dtlistNews.DataBind(); Maticsoft.BLL.NicheTypeInfo nichebll = new Maticsoft.BLL.NicheTypeInfo(); DataSet nicheds = nichebll.GetAllList(); drpNiche.DataSource = nicheds; drpNiche.DataBind(); Maticsoft.BLL.ProductType probll = new Maticsoft.BLL.ProductType(); DataSet prods = probll.GetAllList(); drpxing.DataSource = prods; drpxing.DataTextField = "ProTypeTitle"; drpxing.DataValueField = "ProTypeID"; drpxing.DataBind(); }
private void bind() { Maticsoft.BLL.NewsTypeInfo typebll = new Maticsoft.BLL.NewsTypeInfo(); DataSet ds = typebll.GetAllList(); datanewsquan.DataSource = ds; datanewsquan.DataKeyField = "NewsTypeID"; datanewsquan.DataBind(); }
private void drpbind() { Maticsoft.BLL.NewsTypeInfo typebll = new Maticsoft.BLL.NewsTypeInfo(); DataSet typeds = typebll.GetAllList(); drpNewsType.DataSource = typeds; drpNewsType.DataTextField = "NewsTypeTitle"; drpNewsType.DataValueField = "NewsTypeID"; drpNewsType.DataBind(); }
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; }
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 = ""; }
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; }
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"); }