/// <summary> /// 删除用户 /// </summary> private string DeleteUser(HttpContext context) { string userid = context.Request.Params["uid"]; var jr = new JsonResultModel <int>() { IsSucceed = false, Data = 0, Msg = "删除用户失败", RedirectUrl = string.Empty }; if (!string.IsNullOrEmpty(userid)) { int uid = 0; int.TryParse(userid, out uid); if (user_bll.DeleteUser(uid) > 0) { jr.IsSucceed = true; jr.Msg = "删除用户成功"; jr.Data = uid; } } return(JsonConvert.SerializeObject(jr)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int id = Convert.ToInt32(context.Request["id"]); UserInfoBLL bll = new UserInfoBLL(); if (bll.DeleteUser(id)) { context.Response.Write("yes"); } else { context.Response.Write("no"); } }
/// <summary> /// 删除用户 /// </summary> /// <param name="userId"></param> /// <returns></returns> public JsonResult DeleteUser(int userId) { if (userId == 0) { return(Json(new { result = "error", mesage = "用户编号为空" })); } string errMsg = string.Empty; appUserBll.DeleteUser(userId, ref errMsg); var result = new { result = "ok", message = "操作成功" }; if (!string.IsNullOrEmpty(errMsg)) { result = new { result = "error", message = errMsg }; } //Common.LogHelper.InsertLog(String.Format("删除用户,ID-{0}", userId.ToString()), 43, "后台用户"); return(Json(result, JsonRequestBehavior.AllowGet)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int id; if (int.TryParse(context.Request.QueryString["id"], out id)) { UserInfoBLL bll = new UserInfoBLL(); if (bll.DeleteUser(id)) { context.Response.Redirect("Index.aspx"); } else { context.Response.Write("error"); } } else { context.Response.Write("Parameters error"); } }