protected void LinkButton1_Command(object sender, CommandEventArgs e) { if (Session["_user_id"] == null) { Common.MessageAlert.Alert(Page, "alert('请先登陆,后收藏');location.href='Login.aspx'"); } else { Model.collect modc = new Model.collect(); modc.proid = Convert.ToInt32(uid.Text); BLL.collect blloc = new BLL.collect(); SqlDataReader dr = blloc.drsco(modc); if (dr.Read()) { Common.MessageAlert.Alert(Page, "该产品您已收藏了!"); } else { Model.collect mocll = new Model.collect(); mocll.userid = Convert.ToInt32(Session["_user_id"]); mocll.proimage = Image_1.ImageUrl; mocll.proid = Convert.ToInt32(uid.Text); mocll.proname = title_l.Text; mocll.proprice = Convert.ToDouble(local.Text); BLL.collect bcll = new BLL.collect(); int i = bcll.insertco(mocll); if (i > 0) { Common.MessageAlert.Alert(Page, "收藏成功!"); } } } }
public void data() { Model.collect mocl = new Model.collect(); mocl.userid = Convert.ToInt32(Session["_userid"]); BLL.collect bllc = new BLL.collect(); DataSet ds = bllc.drco(AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, mocl); Repeater1.DataSource = ds; Repeater1.DataBind(); }
protected void ImageButton1_Command(object sender, CommandEventArgs e) { int i = Convert.ToInt32(e.CommandArgument); Model.collect mop = new Model.collect(); mop.id = i; BLL.collect blo = new BLL.collect(); int f = blo.depo(mop); if (f > 0) { Common.MessageAlert.Alert(Page, "删除成功!"); data(); } else { Common.MessageAlert.Alert(Page, "删除失败!"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["_userid"] == null) { Common.MessageAlert.AlertLocation(Page, "alert('请先登入!');location.href='Login.aspx'"); } else { Model.collect moc = new Model.collect(); moc.userid = Convert.ToInt32(Session["_userid"]); BLL.collect blc = new BLL.collect(); int i = blc.count(moc); //Response.Write(i); AspNetPager1.RecordCount = i; AspNetPager1.PageSize = 4; data(); } }
protected void ImageButton1_Command(object sender, CommandEventArgs e) { int i = Convert.ToInt32(e.CommandArgument); //Response.Write(e.CommandArgument); Model.collect mop = new Model.collect(); mop.id = i; BLL.collect blo = new BLL.collect(); int f = blo.depo(mop); if (f > 0) { Common.MessageAlert.Alert(Page, "删除成功!"); data(); } else { Common.MessageAlert.Alert(Page, "删除失败!"); } }