protected void btnDelete_Click(object sender, EventArgs e) { try { IList <string> empIdList = new List <string>(); RemoteInterfaceDal remoteDal = new RemoteInterfaceDal(); 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) { if (dsUser.Tables[0].Rows[i]["EmployeeCode"] != null && dsUser.Tables[0].Rows[i]["EmployeeCode"].ToString() != "") { empIdList.Add(dsUser.Tables[0].Rows[i]["EmployeeCode"].ToString()); } dsUser.Tables[0].Rows[i].Delete(); } } objUser.Delete(dsUser); for (int i = 0; i < empIdList.Count; i++) { remoteDal.SaveDWV_IORG_PERSON(empIdList[i]); } totalCount = objUser.GetRowCount(filter); pager.RecordCount = totalCount; if (pageIndex > pager.PageCount) { pageIndex = pager.PageCount; } GridDataBind(); } catch (Exception exp) { JScript.Instance.ShowMessage(this.UpdatePanel1, exp.Message); } }
public JsonResult Delete(string id) { SysUser.Delete("where id in (@0)", id.ToIntList()); return(Json(ArtDialogResponseResult.SuccessResult)); }