private void RptBind(string strWhere, string orderby) { if (!int.TryParse(Request.Params["page"] as string, out this.page)) { this.page = 0; } Spread.BLL.User bll = new Spread.BLL.User(); //获得总条数 this.pcount = bll.GetRecordCount(strWhere); if (this.pcount > 0) { this.lbtnDel.Enabled = true; } else { this.lbtnDel.Enabled = false; } if (this.UserType > 0) { this.ddlClassId.SelectedValue = this.UserType.ToString(); this.ddlClassId.Enabled = false; } this.txtKeywords.Text = this.keywords; this.ddlProperty.SelectedValue = this.property; this.rptList.DataSource = bll.GetPageList(this.pagesize, this.page, strWhere, orderby); this.rptList.DataBind(); }
private void TreeBind() { Spread.BLL.User cbll = new Spread.BLL.User(); DataTable dt = cbll.GetList("").Tables[0]; this.ddlClassId.Items.Clear(); this.ddlClassId.Items.Add(new ListItem("所有账户", "")); foreach (DataRow dr in dt.Rows) { string Id = dr["Id"].ToString().Trim(); string Name = dr["Name"].ToString().Trim(); this.ddlClassId.Items.Add(new ListItem(Name, Id)); } }
//删除 protected void lbtnDel_Click(object sender, EventArgs e) { chkLoginLevel("delUser"); Spread.BLL.User bll = new Spread.BLL.User(); //批量删除 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("批量删除成功啦!", "UserList.aspx?" + CombUrlTxt(this.userid, 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.User bll = new Spread.BLL.User(); Spread.Model.User model = bll.GetModel(id); switch (e.CommandName.ToLower()) { case "ibtnmsg": if (model.IsLock == true) bll.UpdateField(id, "IsLock=0"); else bll.UpdateField(id, "IsLock=1"); break; } RptBind("Id>0" + this.CombSqlTxt(this.userid, this.keywords, date1, date2,this.property), "AddTime desc"); }