Ejemplo n.º 1
0
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button2_Click(object sender, EventArgs e)
        {
            string ids = selInfo();
            int    num = 0;

            if (ids.Length == 0)
            {
                Jscript.Alert("请选择要删除的记录!", this.Page);
                return;
            }
            string[] arr = ids.TrimEnd(',').Split(',');
            for (int i = 0; i < arr.Length; i++)
            {
                if (AdminUserService.Delete(Convert.ToInt32(arr[i])) > 0)
                {
                    num++;
                }
            }

            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('成功删除" + num + "条记录!');", true);
            DataSet ds = AdminUserService.GetList("");

            if (ds.Tables[0].Rows.Count > 0)
            {
                this.repInfo.DataSource = ds;
                repInfo.DataBind();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete管理员
        /// </summary>
        private void DelAdmin()
        {
            int id  = CRequest.GetInt("id", 0);
            int num = AdminUserService.Delete(id);

            Response.Redirect("/admin/manager.aspx?delAdmin=" + num);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///删除用户
        /// </summary>
        /// <param name="context"></param>
        public void DeleteAdminUserRequest(HttpContext context)
        {
            var response = new ResponseMessage();

            try
            {
                var id  = context.Request["id"];
                var del = _userInfoService.Delete(id);

                response.code = del == true ? 0 : 500;
                response.msg  = "删除成功";
                context.Response.Write(SerializeHelp.ToJson(response));
            }
            catch (Exception e)
            {
                response.code = 500;
                response.msg  = "操作失败,请重试";
                context.Response.Write(SerializeHelp.ToJson(response));
            }
        }