//保存 protected void btnSave_Click(object sender, EventArgs e) { Spread.BLL.Links bll = new Spread.BLL.Links(); Spread.Model.Links model = bll.GetModel(this.Id); model.Title = txtTitle.Text.Trim(); model.WebUrl = txtWebUrl.Text.Trim(); model.IsImage = 0; if (cbIsImage.Checked == true) { model.IsImage = 1; } model.ImgUrl = txtImgUrl.Text.Trim(); model.UserName = txtUserName.Text.Trim(); model.UserTel = txtUserTel.Text.Trim(); model.UserMail = txtUserMail.Text.Trim(); model.SortId = int.Parse(txtSortId.Text.Trim()); model.IsRed = 0; model.IsLock = 0; if (cblItem.Items[0].Selected == true) { model.IsRed = 1; } if (cblItem.Items[1].Selected == true) { model.IsLock = 1; } bll.Update(model); JscriptPrint("链接编辑成功啦!", "List.aspx", "Success"); }
//删除 protected void lbtnDel_Click(object sender, EventArgs e) { chkLoginLevel("delLinks"); Spread.BLL.Links bll = new Spread.BLL.Links(); //批量删除 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", "Success"); }
private void RptBind(string strWhere) { if (!int.TryParse(Request.Params["page"] as string, out this.page)) { this.page = 0; } Spread.BLL.Links bll = new Spread.BLL.Links(); //获得总条数 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, "AddTime desc"); this.rptList.DataBind(); }
//赋值操作 private void ShowInfo(int _id) { Spread.BLL.Links bll = new Spread.BLL.Links(); Spread.Model.Links model = bll.GetModel(_id); txtTitle.Text = model.Title; txtWebUrl.Text = model.WebUrl; if (model.IsImage == 1) { cbIsImage.Checked = true; } txtImgUrl.Text = model.ImgUrl; txtUserName.Text = model.UserName; txtUserTel.Text = model.UserTel; txtUserMail.Text = model.UserMail; if (model.IsRed == 1) { cblItem.Items[0].Selected = true; } if (model.IsLock == 1) { cblItem.Items[1].Selected = true; } txtSortId.Text = model.SortId.ToString(); }