protected void lbtAble_Click(object sender, EventArgs e) { var bll = new BLL.CCOM.View_Admin(); var lbtn = sender as LinkButton; if (lbtn != null) { var id = Int64.Parse(DESEncrypt.Decrypt(lbtn.ToolTip.ToString())); bool isOn = false; bool result = true; try { var m = bll.GetModel("User_id=" + id); isOn = m.User_status == true; m.User_status = isOn ^ true; if (bll.Update(m) == false) { result = false; } } catch { result = false; } string keywords = MyRequest.GetQueryString("keywords"); int page = MyRequest.GetQueryInt("page", 1); if (result == true) { JscriptMsg(isOn ? "禁用成功!" : "启用成功!", Utils.CombUrlTxt("ConfManager.aspx", "fun_id={0}&keywords={1}&page={2}", DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Success"); } else { JscriptMsg(isOn ? "禁用失败!" : "启用失败!", Utils.CombUrlTxt("ConfManager.aspx", "fun_id={0}&keywords={1}&page={2}", DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString()), "Error"); } RptBind(CombSqlTxt(this.keywords), " User_id desc "); } }
//tab1 #region 数据绑定================================= private void RptBind(string _strWhere, string _order) { int pageSize = GetPageSize(15); //每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; var bll = new BLL.CCOM.View_Admin(); //计算数量 int totalCount = bll.GetRecordCount(_strWhere); //绑定当页 this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("ConfFinish.aspx", "fun_id={0}&keywords={1}&page={2}", DESEncrypt.Encrypt(this.fun_id), this.keywords, "__id__"); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); }