//保存 protected void Submit1_ServerClick(object sender, EventArgs e) { ArticleDal ar = new ArticleDal(); ar.classId = classId.Text; ar.title = ArticleTitle.Value.ToString(); ar.content = content.Value.ToString(); //保存图片 string imgPath; Img img = new Img(); img.savePathName = "article"; imgPath = img.saveImage(filePath.Value); string err; if (img.error != "") { showMessage(img.error); return; } ar.imgPath = imgPath; if (app == "edit") { ar.edit(id); err = "修改成功"; showMessage(err); } else { ar.add(); err = "添加成功"; showMessage(err, "gl_manage.aspx?classid=" + classid); } }
public bool bind_del(int id) { ArticleDal sd = new ArticleDal(); return sd.del(id); ; }
private void setBind(object sender, EventArgs e) { int pagesize = 10; int page = 1; PageCurrent pc = new PageCurrent(); page = pc.get("page"); int classid = 0; gnum(ref classid, "classid"); ArticleDal dal = new ArticleDal(); detail.DataSource = dal.get_list(classid, page, pagesize); detail.DataBind(); int recordcount = dal.getcount; Pageer.value = pc.page_list("?classid=" + classid + "&page=", pagesize, recordcount); }
public Viewinfo() { flg_nav = "listinfo"; int id = 0; gnum(ref id, "id"); DataSet ds = find("article", "id=" + id); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { view = ds.Tables[0].Rows[0]; pagetitle = view["articletitle"].ToString(); } else { HttpContext.Current.Response.Write("没有任何信息"); HttpContext.Current.Response.End(); } ArticleDal dal = new ArticleDal(); dal.set_hits(id); typetitle = dal.get_typename(id).ClassName; }
//编辑绑定 private void editArticle(int id) { ArticleDal red = new ArticleDal(); red.read(id); ArticleTitle.Value = red.title; content.Value = red.content; articleImg.Src = red.imgPath; listImgA.HRef = red.imgPath; filePath.Value = red.imgPath; //source.Value = red. string classid = red.classId; foreach (ListItem list in classId.Items) { if (list.Value.ToString() == classid) { list.Selected = true; break; } } }