protected void btnok_Click(object sender, EventArgs e) { Maticsoft.BLL.ZiXunInfo zixunbll = new Maticsoft.BLL.ZiXunInfo(); Maticsoft.Model.ZiXunInfo zixunmodel = new Maticsoft.Model.ZiXunInfo(); zixunmodel.zixuncontent = txtcontent.Text.Trim(); if (txtusename.Text.Trim() == "") { lblusename.Text = "请填写用户名称.."; return; } zixunmodel.zixunUserName = txtusename.Text.Trim(); lblusename.Text = ""; if (txttitle.Text.Trim() == "") { lnltitle.Text = "请填写提问标题.."; return; } zixunmodel.zixunTitle = txttitle.Text.Trim(); lnltitle.Text = ""; if (txtlinphoto.Text.Trim() == "") { lbllinkphoto.Text = "请填写您的联系方式.."; } lbllinkphoto.Text = ""; zixunmodel.zixunuserPhoto = txtlinphoto.Text.Trim(); zixunmodel.zixuntime = Convert.ToDateTime(DateTime.Now.ToString()); zixunbll.Add(zixunmodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('提交信息成功!!')</script>"); bind(); txtcontent.Text = string.Empty; txtlinphoto.Text = string.Empty; txttitle.Text = string.Empty; txtusename.Text = string.Empty; }
private void ShowInfo(int zixunID) { Maticsoft.BLL.ZiXunInfo bll = new Maticsoft.BLL.ZiXunInfo(); Maticsoft.Model.ZiXunInfo model = bll.GetModel(zixunID); this.lblzixunID.Text = model.zixunID.ToString(); this.lblzixunTitle.Text = model.zixunTitle; this.lblzixuntime.Text = model.zixuntime.ToString(); this.lblzixuncontent.Text = model.zixuncontent; this.lblzixunUserName.Text = model.zixunUserName; this.lblzixunuserPhoto.Text = model.zixunuserPhoto; }
private void bind() { Maticsoft.BLL.ZiXunInfo zixunbll = new Maticsoft.BLL.ZiXunInfo(); int index = int.Parse(Request.QueryString["zixunID"].ToString()); Maticsoft.Model.ZiXunInfo zixunmodel = zixunbll.GetModel(index); lblname.Text = zixunmodel.zixunUserName; lbltitle.Text = zixunmodel.zixunTitle; lblphoto.Text = zixunmodel.zixunuserPhoto; txtzixuncontent.Text = zixunmodel.zixuncontent; txtzixundaan.Text = zixunmodel.ZiXundaan; }
private void bind() { Maticsoft.BLL.ZiXunInfo zixunbll = new Maticsoft.BLL.ZiXunInfo(); int pageSize = 15; //每页大小 int page = 1; //当前第几页 int recordCount; //总共有多少条数据 if (Request.QueryString["page"] != null) { if (Request.QueryString["page"].ToString() != "") { page = int.Parse(Request.QueryString["page"].ToString()); } } recordCount = zixunbll.GetzixunCount("ZiXundaan is not null"); int pageCount = recordCount / pageSize + 1;//共有多少页 if (recordCount % pageSize == 0) { pageCount--; } DataSet ds = zixunbll.GetzixunList(pageSize * (page - 1), pageSize, "ZiXundaan is not null"); datazixun.DataSource = ds; datazixun.DataBind(); if (ds.Tables[0].Rows.Count > 0) { this.lblpage.Text += "共有<b>" + recordCount + "</b>条记录 "; this.lblpage.Text += "当前第<b>" + page + "</b>页 "; if (page == 1) { this.lblpage.Text += "首页 "; this.lblpage.Text += "上一页 "; } else { this.lblpage.Text += "<a href='xiangmu.aspx?page=" + 1 + " '>首页</a> "; this.lblpage.Text += "<a href='xiangmu.aspx?page=" + (page - 1).ToString() + " '>上一页</a> "; } if (page == pageCount) { this.lblpage.Text += "下一页 "; this.lblpage.Text += "尾页 "; } else { this.lblpage.Text += "<a href='xiangmu.aspx?page=" + (page + 1).ToString() + " '>下一页</a> "; this.lblpage.Text += "<a href='xiangmu.aspx?page=" + pageCount.ToString() + " '>尾页</a> "; } } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtzixunTitle.Text.Trim().Length == 0) { strErr += "zixunTitle不能为空!\\n"; } if (!PageValidate.IsDateTime(txtzixuntime.Text)) { strErr += "zixuntime格式错误!\\n"; } if (this.txtzixuncontent.Text.Trim().Length == 0) { strErr += "zixuncontent不能为空!\\n"; } if (this.txtzixunUserName.Text.Trim().Length == 0) { strErr += "zixunUserName不能为空!\\n"; } if (this.txtzixunuserPhoto.Text.Trim().Length == 0) { strErr += "zixunuserPhoto不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int zixunID = int.Parse(this.lblzixunID.Text); string zixunTitle = this.txtzixunTitle.Text; DateTime zixuntime = DateTime.Parse(this.txtzixuntime.Text); string zixuncontent = this.txtzixuncontent.Text; string zixunUserName = this.txtzixunUserName.Text; string zixunuserPhoto = this.txtzixunuserPhoto.Text; Maticsoft.Model.ZiXunInfo model = new Maticsoft.Model.ZiXunInfo(); model.zixunID = zixunID; model.zixunTitle = zixunTitle; model.zixuntime = zixuntime; model.zixuncontent = zixuncontent; model.zixunUserName = zixunUserName; model.zixunuserPhoto = zixunuserPhoto; Maticsoft.BLL.ZiXunInfo bll = new Maticsoft.BLL.ZiXunInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void btnok_Click(object sender, EventArgs e) { Maticsoft.BLL.ZiXunInfo zixunbll = new Maticsoft.BLL.ZiXunInfo(); Maticsoft.Model.ZiXunInfo zixunmodel = zixunbll.GetModel(1); if (txtusename.Text.Trim() == "") { lblusername.Text = "请填写提问人姓名"; return; } zixunmodel.zixunUserName = txtusename.Text.Trim(); lblusername.Text = ""; if (txtlinkphoto.Text.Trim() == "") { lbllinkphoto.Text = "请填写您的联系方式"; return; } zixunmodel.zixunuserPhoto = txtlinkphoto.Text.Trim(); lbllinkphoto.Text = ""; if (txtzixuntitle.Text.Trim() == "") { lbltitile.Text = "请填写提问标题"; return; } zixunmodel.zixunTitle = txtzixuntitle.Text.Trim(); lbltitile.Text = ""; if (txtzixuncontent.Text.Trim() == "") { lblcontent.Text = "请填写提问内容"; return; } zixunmodel.zixuncontent = txtzixuncontent.Text.Trim(); lblcontent.Text = ""; if (txtzixundaan.Text.Trim() == "") { lbldaan.Text = "请填写您的答案"; return; } zixunmodel.ZiXundaan = txtzixundaan.Text.Trim(); lbldaan.Text = ""; zixunbll.Update(zixunmodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>"); bind(); }
private void bind() { Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo(); DataSet newds = newbll.GetList(7, "", " Fatime desc "); datanews.DataSource = newds; datanews.DataBind(); Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo(); DataSet nicheds = nichebll.GetList(6, "", "Fatime desc"); dataniche.DataSource = nicheds; dataniche.DataBind(); Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product(); DataSet prods = probll.GetList(4, "", " Fatime desc"); datapro.DataSource = prods; datapro.DataBind(); Maticsoft.BLL.WeiLanInfo weilanbll = new Maticsoft.BLL.WeiLanInfo(); DataSet weilands = weilanbll.GetList(6, "", " Fatime desc "); dataweilan.DataSource = weilands; dataweilan.DataBind(); DataSet toujiands = probll.GetList(4, " Toujian=1 ", " Fatime desc"); datatoujian.DataSource = toujiands; datatoujian.DataBind(); Maticsoft.BLL.ZiXunInfo zixunbll = new Maticsoft.BLL.ZiXunInfo(); DataSet zixunds = zixunbll.GetList(6, "ZiXundaan is not null", " zixuntime desc "); dataxiangmo.DataSource = zixunds; dataxiangmo.DataBind(); Maticsoft.BLL.JiShuInfo jishubll = new Maticsoft.BLL.JiShuInfo(); DataSet jishuds = jishubll.GetList(6, "", " Fatime desc "); datajishu.DataSource = jishuds; datajishu.DataBind(); Maticsoft.BLL.FuWuInfo fuwubll = new Maticsoft.BLL.FuWuInfo(); DataSet fuwuds = fuwubll.GetList(6, "", " Fatime desc "); datafuwu.DataSource = fuwuds; datafuwu.DataBind(); }