예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            //获取要删除的用户编号
            string userId = context.Request.QueryString["UserId"];
            //删除用户
            //1、对参数:用户编号做数据类型合法性的验证
            int id = 0;

            if (string.IsNullOrEmpty(userId) || !int.TryParse(userId, out id))
            {
                context.Response.Write("<script>alert('参数错误!');window.location.href='UsersList.aspx'</script>");
                return;
            }
            else
            {
                //2、调用业务逻辑层的方法实现删除用户功能
                int result = bll.Delete(id);
                if (result > 0)
                {
                    context.Response.Write("<script>alert('删除用户成功!');window.location.href='UsersList.aspx'</script>");
                }
                else
                {
                    context.Response.Write("<script>alert('删除用户失败!');window.location.href='UsersList.aspx'</script>");
                }
            }
        }
예제 #2
0
        protected void grvUsers_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int UsersId = Convert.ToInt32(grvUsers.DataKeys[e.RowIndex].Value.ToString());

            usersManager.Delete(UsersId);
            BindUsersGrid();
        }
예제 #3
0
        public JsonResult DeleteUser(int Id)
        {
            UsersManager usersManager = new UsersManager();

            usersManager.Delete(Id);
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
 public void DeleteTest()
 {
     UsersManager target = new UsersManager(); // TODO: Initialize to an appropriate value
     User entity = null; // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     actual = target.Delete(entity);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
예제 #5
0
        public ActionResult <dynamic> Delete(Users user)
        {
            string message = null;

            if (usersManager.Delete(user.user_token, ref message))
            {
                return(new
                {
                    success = true,
                    message = "Account was successfully deleted."
                });
            }
            return(Return500Error(message));
        }
예제 #6
0
        private void RemovUserButton_Click(object sender, EventArgs e)
        {
            UserVO current = bindingSource1.Current as UserVO;

            if (current != null)
            {
                if (Question("هل أنت متأكد من الحذف؟") == System.Windows.Forms.DialogResult.Yes)
                {
                    if (manager.Delete(current))
                    {
                        bindingSource1.Remove(current);
                        UsersDataGridView.Refresh();
                        Message("تم الحذف بنجاح");
                        Log(OperationsManager.EDIT_USERS);
                    }
                    else
                    {
                        Error();
                    }
                }
            }
        }
예제 #7
0
        public ActionResult Delete(int id)
        {
            var result = _usermanager.Delete(id);

            return(RedirectToAction("Index"));
        }
예제 #8
0
 public int Delete(Users u)
 {
     return(dal.Delete(u));
 }