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");
}
}