protected void Page_Load(object sender, EventArgs e) { if (Membership.GetUser() != null && !Page.IsPostBack) { // create customer object to search for Customer customerSearchObject = new Customer(null, null, Membership.GetUser().UserName, null, null, null, null, null, null, null, null); // get current user customer account information from the database CustomerDA customerDA = new CustomerDA(); Collection<Customer> customerInfo = customerDA.GetLike(customerSearchObject); // put the user information into the form lblUserFName.Text = customerInfo[0].FirstName; lblUserLName.Text = customerInfo[0].LastName; lblUserAddress.Text = customerInfo[0].Address; if (customerInfo[0].Address2 != null) lblUserAddress2.Text = customerInfo[0].Address2; lblUserCity.Text = customerInfo[0].City; lblUserState.Text = customerInfo[0].State; lblUserZip.Text = customerInfo[0].Zip; lblUserCountry.Text = customerInfo[0].Country; lblUserEmail.Text = Membership.GetUser().Email; } else { // user not logged in, redirect user to login page if (!Page.IsPostBack) Response.Redirect("Login.aspx"); } }
protected void Page_LoadComplete(object sender, EventArgs e) { if (Membership.GetUser() != null && !Page.IsPostBack) { // create customer object to search for Customer customerSearchObject = new Customer(null, null, Membership.GetUser().UserName, null, null, null, null, null, null, null, null); // get current user customer account information from the database CustomerDA customerDA = new CustomerDA(); Collection<Customer> customerInfo = customerDA.GetLike(customerSearchObject); // place customer ID into a variable for updating the customer customerID = (int)customerInfo[0].Id; // put the user information into the form txtFirstName.Text = customerInfo[0].FirstName; txtLastName.Text = customerInfo[0].LastName; txtAddress.Text = customerInfo[0].Address; if (customerInfo[0].Address2 != null) txtAddress2.Text = customerInfo[0].Address2; txtCity.Text = customerInfo[0].City; cboState.Text = customerInfo[0].State; txtZip.Text = customerInfo[0].Zip; cboCountry.Text = customerInfo[0].Country; txtEmail.Text = Membership.GetUser().Email; } else { // user not logged in, redirect user to login page if (!Page.IsPostBack) Response.Redirect("Login.aspx"); } }