protected void btnDeleteAcc_Click(object sender, EventArgs e) { UserService.UserCRUDClient service = new UserService.UserCRUDClient(); service.Open(); int result = service.deleteUser(((UserData)Session["User"]).getUsername()); service.Close(); if (result == 1)//if the result is one then the user is deleted and redirected to the index page { Session["User"] = null; //Response.Write("<script>alert('User Account Deleted!');</script>"); Response.Redirect("Index.aspx"); } }
protected void btnDeleteUser_ServerClick(object sender, EventArgs e) { UserService.UserCRUDClient service = new UserService.UserCRUDClient(); service.Open(); int result = service.deleteUser(this.userID); service.Close(); if (result == 1)//if the result is one then the user is deleted { userCard.InnerHtml = "<div class='col s12 m6 push-m3'>"; userCard.InnerHtml += "<div class='card white'>"; userCard.InnerHtml += "<div class='card-content Black-text'>"; userCard.InnerHtml += "<span class='card-title bold'>User Deleted Successfully</span>"; userCard.InnerHtml += "<p>You have successfully deleted the user with ID = " + this.userID + ".</p>"; userCard.InnerHtml += "</div>"; userCard.InnerHtml += "<div class='card-action'>"; userCard.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a>"; userCard.InnerHtml += "<a href='Index.aspx' runat='server' class='btn waves-effect waves-light'>Done</a>"; userCard.InnerHtml += "</div>"; userCard.InnerHtml += "</div>"; userCard.InnerHtml += "</div>"; } else { userCard.InnerHtml = "<div class='col s12 m6 push-m3'>"; userCard.InnerHtml += "<div class='card white'>"; userCard.InnerHtml += "<div class='card-content Black-text'>"; userCard.InnerHtml += "<span class='card-title bold'>User Deleted Unsuccessfully</span>"; userCard.InnerHtml += "<p>We where unable to delete the user with ID = " + this.userID + ". Please try again and if the problem persists please contact us <a href='ContactUs.aspx'>here</a>.</p>"; userCard.InnerHtml += "</div>"; userCard.InnerHtml += "<div class='card-action'>"; userCard.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light orange lighten-2'>Manage Users</a> "; userCard.InnerHtml += "<a href='Index.aspx' runat='server' class='btn waves-effect waves-light'>Done</a>"; userCard.InnerHtml += "</div>"; userCard.InnerHtml += "</div>"; userCard.InnerHtml += "</div>"; } }
protected void btnVerifyDelete_ServerClick(object sender, EventArgs e) { UserService.UserCRUDClient service = new UserService.UserCRUDClient(); service.Open(); UserData user = (UserData)Session["User"]; Object[] ds = service.Authenticate(user.getUsername(), Security.HashPassword(txtPassword.Value)); if (!(ds == null)) { int deleteResult = service.deleteUser(this.userID); if (deleteResult == 1) { //deleteUserView.InnerHtml += "<div class='col s12 m6 l4 push-l4 push-m3'>"; //deleteUserView.InnerHtml += "<div class='card white'>"; //deleteUserView.InnerHtml += "<div class='card-content black-text'>"; deleteUserView.InnerHtml = "<span class='card-title bold'>User Deleted Successfully</span>"; deleteUserView.InnerHtml += "<p>You have successfully deleted the user \"" + this.userName + "\" with ID " + userID + ".</p><br/>"; deleteUserView.InnerHtml += "<div class='card-action'>"; deleteUserView.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light'>Manage Users</a>"; deleteUserView.InnerHtml += "</div>"; } else { deleteUserView.InnerHtml = "<span class='card-title bold'>User Deleted Unsuccessfully</span>"; deleteUserView.InnerHtml += "<p>An error occured trying to delete user \"" + this.userName + "\" with ID " + userID + "</p><br/>"; deleteUserView.InnerHtml += "<div class='card-action'>"; deleteUserView.InnerHtml += "<a href='UserManagement.aspx' runat='server' class='btn waves-effect waves-light'>Manage Useres</a>"; deleteUserView.InnerHtml += "</div>"; } service.Close(); } else { invalidVerify.InnerHtml = "<p>Invalid password. Please try again.</p>"; } }