protected void adminEditUserController(object sender, EventArgs e) { registrationErrorHandler editHandler = new registrationErrorHandler(); if (editUserID.Text == "") { editHandler.emptyUserName(); } if (editPassword.Text == "") { editHandler.emptyPassword(); } if (editRealName.Text == "") { editHandler.emptyRealName(); } if (editEmail.Text == "") { editHandler.emptyEmail(); } else if (!editEmail.Text.Contains("@")) { editHandler.invalidEmail(); } if (editPhone.Text == "") { editHandler.emptyPhoneNumber(); } if (!editPhone.Text.All(char.IsDigit)) { editHandler.invalidPhoneNumber(); } if (editDesc.Text == "") { editHandler.emptyDescription(); } // Fetch the user object from database user targetUser = fetchUserObject(editUserID.Text); if (targetUser == null) { editHandler.userNameNotExists(); } if (editHandler.error == "") { // Edit the user object based on the provided fields targetUser.setPassword(editPassword.Text); targetUser.setName(editRealName.Text); targetUser.setEmail(editEmail.Text); targetUser.setPhoneNumber(int.Parse(editPhone.Text)); targetUser.setPersonalDescription(editDesc.Text); targetUser.setStatus(int.Parse(ddEditStat.SelectedValue)); currAdmin.editUser(targetUser); adminDialog.Visible = false; Session["success"] = "adminEditUser"; Response.Redirect("main.aspx"); } else { adminDialog.InnerHtml = editHandler.error; adminDialog.Visible = true; } }