protected void Button1_Click(object sender, EventArgs e) { using (var derp = new ServiceReference1.ServiceClient()) { ServiceReference1.User myUser = derp.GetUserByEmail(TextBox1.Text); string type = myUser.Type.ToString(); string pw = myUser.Password; string email = myUser.Email; GetUserTextBox.Text = "Type: " + type + "\nPassword: "******"\nEmail: " + email; } }
protected void GetUserByEmail_Click(object sender, EventArgs e) { string email = null; // Set this via field #Crelde ServiceReference1.User user = null; try { user = Controller.GetUserByEmail(email); } catch (NotLoggedInException) { // Shouldn't ever happen, but if it does, do a popup and send back to login screen. #Crelde } catch (InsufficientRightsException) { // Shouldn't ever happen as the button shouldn't be visible to a user without rights. } catch (ObjectNotFoundException) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorAlert", "alert('A user does not exist with that e-mail.');", true); // A user does not exist with that email, communicate to user. } }
// THIS IS NOT YET DONE FRONT END protected void createUserSubmit_Click(object sender, EventArgs e) { ServiceReference1.User user = new ServiceReference1.User(); // Set this via fields #Crelde try { Controller.CreateUser(user); } catch (NotLoggedInException) { // Shouldn't ever happen, but if it does, do a popup and send back to login screen. #Crelde } catch (InsufficientRightsException) { // Shouldn't ever happen as the button shouldn't be visible to a user without rights. } catch (InadequateObjectException) { // User has not given enough information, explain to the user that both email and password are required. #Crelde } catch (KeyOccupiedException) { // The email that was given is already in use on the server, explain this to the user #Crelde } }