/// <summary> /// Event is raised when the "Update" Button is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, EventArgs e) { AccountService accountService = new AccountService(); Account _account = UserAccount; ZNodeUserAccount _userAccount = new ZNodeUserAccount(); if (_account.AccountID == 0) { _userAccount.PortalID = ZNodeConfigManager.SiteConfig.PortalID; _userAccount.BillingAddress = BillingAddress; _userAccount.ShippingAddress = ShippingAddress; _userAccount.AddUserAccount(); int accountID = _userAccount.AccountID; _account = accountService.GetByAccountID(accountID); UserAccount = _account; // ZNode.Libraries.Admin.ProfileAdmin profileAdmin = new ZNode.Libraries.Admin.ProfileAdmin(); HttpContext.Current.Session["ProfileCache"] = profileAdmin.GetByProfileID(_account.ProfileID.Value); } else { //Billing Address _account.BillingFirstName = BillingAddress.FirstName; _account.BillingLastName = BillingAddress.LastName; _account.BillingCompanyName = BillingAddress.CompanyName; _account.BillingStreet = BillingAddress.Street1; _account.BillingStreet1 = BillingAddress.Street2; _account.BillingCity = BillingAddress.City; _account.BillingPostalCode = BillingAddress.PostalCode; _account.BillingStateCode = BillingAddress.StateCode; _account.BillingCountryCode = BillingAddress.CountryCode; _account.BillingEmailID = BillingAddress.EmailId; _account.BillingPhoneNumber = BillingAddress.PhoneNumber; //Shipping Address _account.ShipFirstName = ShippingAddress.FirstName; _account.ShipLastName = ShippingAddress.LastName; _account.ShipCompanyName = ShippingAddress.CompanyName; _account.ShipStreet = ShippingAddress.Street1; _account.ShipStreet1 = ShippingAddress.Street2; _account.ShipCity = ShippingAddress.City; _account.ShipPostalCode = ShippingAddress.PostalCode; _account.ShipStateCode = ShippingAddress.StateCode; _account.ShipCountryCode = ShippingAddress.CountryCode; _account.ShipEmailID = ShippingAddress.EmailId; _account.ShipPhoneNumber = ShippingAddress.PhoneNumber; //Update account accountService.Update(_account); //Set account object to cache object UserAccount = _account; if (_account.UserID.HasValue) { MembershipUser user = Membership.GetUser(_account.UserID.Value); if (user != null) { user.Email = _account.BillingEmailID; Membership.UpdateUser(user); } } } //Triggers parent control event if (ButtonClick != null) { this.ButtonClick(sender, e); } }
/// <summary> /// Occurs when one of the pager buttons is clicked, /// but before the "FoundUsers" GridView control handles the paging operation. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ui_FoundUsers_SelectedIndexChanged(object sender, EventArgs e) { //Retrieve Account Id Label userLogin = ui_FoundUsers.Rows[ui_FoundUsers.SelectedIndex].FindControl("ui_CustomerIdSelect") as Label; AccountService accountService = new AccountService(); Account _account = accountService.GetByAccountID(int.Parse(userLogin.Text)); if (_account != null) { UserAccount = _account;//Set Page session object // ZNode.Libraries.Admin.ProfileAdmin profileAdmin = new ZNode.Libraries.Admin.ProfileAdmin(); HttpContext.Current.Session["ProfileCache"] = profileAdmin.GetByProfileID(_account.ProfileID.Value); } if (SelectedIndexChanged != null) { //Triggers parent control event this.SelectedIndexChanged(sender, e); } }