protected void btnDelete_Click(object sender, EventArgs e) { try { for (int i = 0; i < gvMain.Rows.Count; i++) { CheckBox chk = (CheckBox)gvMain.Rows[i].Cells[0].Controls[0]; if (gvMain.Rows[i].Cells[1].Text == "admin" && chk.Checked) { JScript.Instance.ShowMessage(this.UpdatePanel1, "管理员帐号不能删除!"); return; } if (chk.Enabled && chk.Checked) { dsUser.Tables[0].Rows[i].Delete(); } } userDal.Delete(dsUser); totalCount = userDal.GetRowCount(filter); pager.RecordCount = totalCount; if (pageIndex > pager.PageCount) { pageIndex = pager.PageCount; } GridDataBind(); } catch (Exception exp) { JScript.Instance.ShowMessage(this.UpdatePanel1, exp.Message); } }
/// <summary> /// 删除用户信息 /// </summary> /// <param name="userno">用户编号</param> /// <returns></returns> public OperateResultModel DeleteUser(string userno) { SysUserDal dal = new SysUserDal(); return(dal.Delete(userno)); }
public void TestDeleteUser() { m_SysUserDal.Delete("13"); }