protected void Page_PreInit(object sender, EventArgs e) { if (!IsPostBack) { string itemId = Request.QueryString["addItem"]; if (!string.IsNullOrEmpty(itemId)) { Profile profile = ProfileManager.Instance.GetCurrentUser(Page.User.Identity.Name); AddCartItem(ref profile, itemId, 1); var profileService = new ProfileService(); profileService.DeepSave(profile); // Redirect to prevent duplictations in the wish list if user hits "Refresh" Response.Redirect("~/WishList.aspx", true); } } }
/// <summary> /// Update profile /// </summary> protected void btnSubmit_Click(object sender, EventArgs e) { Profile profile = ProfileManager.Instance.GetCurrentUser(Page.User.Identity.Name); if (AddressForm.IsValid) { if (profile.AccountCollection.Count > 0) { Account account = profile.AccountCollection[0]; UpdateAccount(ref account, AddressForm.Address); } else { Account account = profile.AccountCollection.AddNew(); account.UniqueId = profile.UniqueId; UpdateAccount(ref account, AddressForm.Address); } var profileService = new ProfileService(); profileService.DeepSave(profile); } lblMessage.Text = "Your profile information has been successfully updated.<br> "; }