//全选CHECKBOX按钮 protected void ALLCheck_CheckedChanged(object sender, EventArgs e) { CheckBox ck = (CheckBox)sender; if (ck.Checked == true) { ((GridView)ShareForUser1.FindControl("GridView_grouplist")).Enabled = false; } else { ((GridView)ShareForUser1.FindControl("GridView_grouplist")).Enabled = true; } }
//将数据添加到控件中 public void showlist() { try { //获取到人员ID userModel = (Model.USER_Users)Session["USER_Users"]; DataTable DTMplan = new DataTable(); DTMplan = pagedosql.doSql("select APPLYUSERID from Personal_Plan_Limits where USERID='" + userModel.ID + "'").Tables[0]; //通过方法 用逗号把部门ID分开 string strapllyId = commonId.makeSqlIn(DTMplan.Rows[0]["APPLYUSERID"].ToString(), ','); //查询出部门中status =1 并且delflag=0 的用户 string sql = "SELECT * FROM USER_Users WHERE (DELFLAG = '0') and id in" + strapllyId + " ORDER BY DepartMentID"; DataTable dt1 = pagedosql.doSql(sql).Tables[0]; //通过部门ID 查看部门里有多少人员 string strsql = "select * from USER_Users where (DELFLAG = '0')"; DataTable dt = pagedosql.doSql(strsql).Tables[0]; //查询出传进来的部门ID DataTable dt2 = new DataTable(); dt2 = bug.GetList(" TAGS='部门' and DELFLAG='0'order by ISMOREN").Tables[0]; ShareForUser1.showDepartment(dt1, dt, dt2); if (dt.Rows.Count > 0) { ShareForUser1.Visible = true; } else { ShareForUser1.Visible = false; } //查看是否为全部可见 DataTable DTUserMplan = new DataTable(); DTUserMplan = pagedosql.doSql("select ISALL from Personal_Plan_Limits where USERID='" + userModel.ID + "'").Tables[0]; if (DTUserMplan.Rows[0]["ISALL"].ToString() == "1") { ((GridView)ShareForUser1.FindControl("GridView_grouplist")).Enabled = false; ALLCheck.Checked = true; } else { ((GridView)ShareForUser1.FindControl("GridView_grouplist")).Enabled = true; ALLCheck.Checked = false; } } catch { } }