//赋值操作 private void ShowInfo(int _id) { Spread.BLL.Protocol bll = new Spread.BLL.Protocol(); Spread.Model.Protocol model = bll.GetModel(_id); txtTitle.Text = model.Title; txtAuthor.Text = model.Author; FCKeditor2.Value = model.Form; FCKeditor.Value = model.Content; txtClick.Text = model.Click.ToString(); }
private void RptBind(string strWhere, string orderby) { if (!int.TryParse(Request.Params["page"] as string, out this.page)) { this.page = 0; } Spread.BLL.Protocol bll = new Spread.BLL.Protocol(); //获得总条数 this.pcount = bll.GetCount(strWhere); if (this.pcount > 0) { this.lbtnDel.Enabled = true; } else { this.lbtnDel.Enabled = false; } this.rptList.DataSource = bll.GetPageList(this.pagesize, this.page, strWhere, orderby); this.rptList.DataBind(); }
//保存 protected void btnSave_Click(object sender, EventArgs e) { Spread.BLL.Protocol bll = new Spread.BLL.Protocol(); Spread.Model.Protocol model = bll.GetModel(this.Id); model.Title = txtTitle.Text.Trim(); model.Author = txtAuthor.Text.Trim(); model.Form = FCKeditor2.Value.Trim(); model.ClassId =0; model.ImgUrl = ""; model.Content = FCKeditor.Value; model.Click = int.Parse(txtClick.Text.Trim()); model.IsMsg = false; model.IsTop = false; model.IsRed = false; model.IsHot = false; model.IsSlide = false; bll.Update(model); Response.Write("<script>alert('协议编辑成功啦!!!!!')</script>"); }
//删除 protected void lbtnDel_Click(object sender, EventArgs e) { chkLoginLevel("delProtocol"); Spread.BLL.Protocol bll = new Spread.BLL.Protocol(); //批量删除 for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((Label)rptList.Items[i].FindControl("lb_id")).Text); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { bll.Delete(id); } } JscriptPrint("批量删除成功啦!", "List.aspx?" + CombUrlTxt(this.classId, this.keywords, this.property) + "page=0", "Success"); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text); Spread.BLL.Protocol bll = new Spread.BLL.Protocol(); Spread.Model.Protocol model = bll.GetModel(id); RptBind("Id>0" + this.CombSqlTxt(this.classId, this.keywords, this.property), "AddTime desc"); }