protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.dept pBll = new BLL.dept(); string placeSql = ""; string roleSql = "roleId<>1"; if (Request.Cookies["isAdmin"].Value != "1") { placeSql = " deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") "; roleSql = "roleId>2"; } ClassHelper.AddDeptList(ddrPlace); BLL.role roleBll = new BLL.role(); ddrRole.DataTextField = "roleName"; ddrRole.DataValueField = "roleId"; ddrRole.DataSource = roleBll.GetList(roleSql); ddrRole.DataBind(); ddrRole.Items.Insert(0, new ListItem("请选择", "0")); ddrRole.SelectedValue = "2"; ddrRole.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { StringBuilder strWhere = new StringBuilder(); strWhere.Append("roleId=2 "); if (Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_IsAdmin) != "1") { BLL.dept pBll = new BLL.dept(); strWhere.Append(" and deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") "); } rptList.DataSource = bll.GetList(strWhere.ToString() + " order by addTime desc"); rptList.DataBind(); } if (RequsetAjax("del")) { //删除 try { string userId = Request.Form["userId"].ToString(); bll.Delete(int.Parse(userId)); Response.Write("{\"status\":1,\"msg\":\"成功!\"}"); } catch { Response.Write("{\"status\":0,\"msg\":\"失败!\"}"); } Response.End(); } }
public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append("roleId=2 "); if (txtKeyword.Text.Trim() != "") { strWhere.AppendFormat(" and userName like '%{0}%'", txtKeyword.Text.Trim()); } if (Request.Cookies["isAdmin"].Value != "1") { BLL.dept pBll = new BLL.dept(); strWhere.Append(" and deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") "); } ds = bll.GetList(strWhere.ToString()); string[] arr = { "冻结", "正常" }; Common.CommonHelper.AddDtColumns(ds.Tables[0], "status", arr); gridView.DataSource = ds; gridView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.dept pBll = new BLL.dept(); string placeSql = ""; string roleSql = "roleId<>1"; if (Request.Cookies["isAdmin"].Value != "1") { placeSql = " deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") "; roleSql = "roleId>2"; } ClassHelper.AddDeptList(ddrPlace); BLL.role roleBll = new BLL.role(); ddrRole.DataTextField = "roleName"; ddrRole.DataValueField = "roleId"; ddrRole.DataSource = roleBll.GetList(roleSql); ddrRole.DataBind(); ddrRole.Items.Insert(0, new ListItem("请选择", "0")); } }