private void ucSelectCustomer_Changed(object sender, EventArgs e) { // Check permissions if (ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, true)) { // Load value form dynamic control string values = null; if (ucSelectCustomer != null) { values = ValidationHelper.GetString(ucSelectCustomer.GetValue("OnlineMarketingValue"), null); } if (!String.IsNullOrEmpty(values)) { // Store users one by one string[] customerIds = values.Split(';'); foreach (string customerId in customerIds) { // Check if user ID is valid int customerIdInt = ValidationHelper.GetInteger(customerId, 0); if (customerIdInt <= 0) { continue; } // Add new relation int parentId = (ci.ContactMergedWithContactID == 0) ? ci.ContactID : ci.ContactMergedWithContactID; MembershipInfoProvider.SetRelationship(customerIdInt, MemberTypeEnum.EcommerceCustomer, ci.ContactID, parentId, true); ci = ContactInfoProvider.GetContactInfo(contactId); } // When contact was merged then refresh complete page if ((ci != null) && (ci.ContactMergedWithContactID > 0)) { Page.Response.Redirect(URLHelper.Url.ToString(), true); } else { gridElem.ReloadData(); } } } }
private void UniSelector_OnItemsSelected(object sender, EventArgs e) { // Check permissions if (ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, true)) { string values = ValidationHelper.GetString(selectUser.UniSelector.Value, null); if (!String.IsNullOrEmpty(values)) { // Store users one by one string[] userIds = values.Split(';'); foreach (string userId in userIds) { // Check if user ID is valid int userIdInt = ValidationHelper.GetInteger(userId, 0); if (userIdInt <= 0) { continue; } // Add new relation int parentId = (ci.ContactMergedWithContactID == 0) ? ci.ContactID : ci.ContactMergedWithContactID; MembershipInfoProvider.SetRelationship(userIdInt, MemberTypeEnum.CmsUser, ci.ContactID, parentId, true); // When contact was merged update contact info ci = ContactInfoProvider.GetContactInfo(contactId); } // When contact was merged then refresh complete page if ((ci != null) && (ci.ContactMergedWithContactID > 0)) { Page.Response.Redirect(URLHelper.Url.ToString(), true); } else { gridElem.ReloadData(); } } } }