/// <summary> /// 修改、删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvDepartInfo_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { try { int departId = Convert.ToInt32(e.CommandArgument.ToString()); DepartInfoService.DeleteDepart(departId); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "key", "alert('请先删除外键中的数据!')", true); } BindDepartInfo(); } if (e.CommandName == "Update") { int departId = Convert.ToInt32(e.CommandArgument.ToString()); Response.Redirect("SaveDepart.aspx?departId=" + departId); } }
/// <summary> /// 删除部门信息 /// </summary> /// <param name="departId"></param> /// <returns></returns> public static int DeleteDepart(int departId) { return(DepartInfoService.DeleteDepart(departId)); }