protected void btnYes_Click(object sender, EventArgs e) { DatingAppWebService.User deleteUser = new DatingAppWebService.User(); int userID = int.Parse(Session["UserID"].ToString()); DatingAppWebService.DatingApp proxy = new DatingAppWebService.DatingApp(); proxy.DeleteUser(userID); lblConfirm.Visible = false; btnYes.Visible = false; btnNo.Visible = false; Response.Redirect("Default.aspx"); }
protected void btnSaveEdit_Click(object sender, EventArgs e) { DatingAppWebService.User updateUser = new DatingAppWebService.User(); int userID = int.Parse(Session["UserID"].ToString()); User user = GetUser(userID); updateUser.UserID = userID; updateUser.UserName = txtUserName.Text; updateUser.Location = ddlState.SelectedItem.ToString(); updateUser.Gender = ddlGender.SelectedItem.ToString(); updateUser.Bio = txtBio.Text; DatingAppWebService.DatingApp proxy = new DatingAppWebService.DatingApp(); proxy.UpdateUser(updateUser); updatePhotoToDB(userID); //showProfile(true); //showEdit(false); Response.Redirect("Profile.aspx"); }
protected void btnSubmit_Click(object sender, EventArgs e) { String plainTextPassword = txtPassword.Text; String encryptedPassword; UTF8Encoding encoder = new UTF8Encoding(); Byte[] textBytes; textBytes = encoder.GetBytes(plainTextPassword); RijndaelManaged rmEncryption = new RijndaelManaged(); MemoryStream myMemoryStream = new MemoryStream(); CryptoStream myEncryptionStream = new CryptoStream(myMemoryStream, rmEncryption.CreateEncryptor(key, vector), CryptoStreamMode.Write); myEncryptionStream.Write(textBytes, 0, textBytes.Length); myEncryptionStream.FlushFinalBlock(); myMemoryStream.Position = 0; Byte[] encryptedBytes = new Byte[myMemoryStream.Length]; myMemoryStream.Read(encryptedBytes, 0, encryptedBytes.Length); myEncryptionStream.Close(); myMemoryStream.Close(); encryptedPassword = Convert.ToBase64String(encryptedBytes); DatingAppWebService.User newUser = new DatingAppWebService.User(); int userId = 0; Boolean formComplete = isComplete(); Boolean validPhoneNumber = validPhone(); //checks if passwords match, then creates a new user object if (formComplete == false) { Response.Write("<script>alert('Please Fill out the Form Completely')</script>"); } else if (validPhoneNumber == false) { Response.Write("<script>alert('Please Enter a Valid Phone Number')</script>"); } else { newUser.UserName = txtName.Text; newUser.Birthdate = DateTime.Parse(inputDate.Text); newUser.EmailAddress = txtEmail.Text; newUser.PhoneNumber = txtPhone.Text; newUser.Gender = ddlGender.SelectedItem.ToString(); newUser.Bio = txtBio.Text; newUser.Location = ddlState.SelectedItem.ToString(); newUser.Password = encryptedPassword; newUser.SecAnswer1 = txtSecQuestion1.Text; newUser.SecAnswer2 = txtSecQuestion2.Text; newUser.SecAnswer3 = txtSecQuestion3.Text; DatingAppWebService.DatingApp proxy = new DatingAppWebService.DatingApp(); userId = proxy.AddNewUser(newUser); if (userId != -1) { Boolean email = generateVerification(txtName.Text, txtEmail.Text); } } Session["UserName"] = txtName.Text; Session["EmailAddress"] = txtEmail.Text; uploadPhotoToDB(userId); Response.Redirect("Verification.aspx"); //if(userId == 0) //{ // Response.Write("<h3>Worked?</h3>"); //} //else //{ // Response.Write("<h3>Nope</h3>"); //} }