protected void Page_Load(object sender, EventArgs e) { currentUser = MembershipContext.AuthenticatedUser; currentObject = (ContactRoleInfo)EditedObject; // Check read permission currentObjectSiteId = currentObject.ContactRoleID != 0 ? currentObject.ContactRoleSiteID : siteID; CheckReadPermission(currentObjectSiteId); // Preserve site info passed in query PageBreadcrumbs.Items[0].RedirectUrl = AddSiteQuery(PageBreadcrumbs.Items[0].RedirectUrl, siteID); EditForm.RedirectUrlAfterSave = AddSiteQuery(EditForm.RedirectUrlAfterSave, siteID); ContactRoleInfo contactRole = EditForm.EditedObject as ContactRoleInfo; // Set new site ID for new object if ((contactRole == null) || (contactRole.ContactRoleID < 1)) { if ((siteID == UniSelector.US_GLOBAL_RECORD) && ModifyGlobalConfiguration) { EditForm.Data["ContactRoleSiteID"] = null; } else if (IsSiteManager && currentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { EditForm.Data["ContactRoleSiteID"] = siteID; } else { EditForm.Data["ContactRoleSiteID"] = SiteContext.CurrentSiteID; } } }
protected void Page_Load(object sender, EventArgs e) { currentUser = CMSContext.CurrentUser; currentObject = (ContactRoleInfo)EditedObject; // Check read permission currentObjectSiteId = currentObject != null ? currentObject.ContactRoleSiteID : siteID; this.CheckReadPermission(currentObjectSiteId); // Preserve site info passed in query CurrentMaster.Title.Breadcrumbs[0, 1] = AddSiteQuery(CurrentMaster.Title.Breadcrumbs[0, 1], siteID); EditForm.RedirectUrlAfterSave = AddSiteQuery(EditForm.RedirectUrlAfterSave, siteID); // Set new site ID for new object if (EditedObject == null) { if ((siteID == UniSelector.US_GLOBAL_RECORD) && ModifyGlobalConfiguration) { EditForm.Data["ContactRoleSiteID"] = DBNull.Value; } else if (this.IsSiteManager && currentUser.UserSiteManagerAdmin) { EditForm.Data["ContactRoleSiteID"] = siteID; } else { EditForm.Data["ContactRoleSiteID"] = CMSContext.CurrentSiteID; } } }
private void AssignContactToAccount( int accountAccountId, ContactInfo monicaKing, ContactRoleInfo contactRoleInfo) { AccountContactInfoProvider.SetAccountContactInfo(new AccountContactInfo { ContactID = monicaKing.ContactID, AccountID = accountAccountId, ContactRoleID = contactRoleInfo.ContactRoleID }); }
/// <summary> /// UniGrid action handler. /// </summary> void Grid_OnAction(string actionName, object actionArgument) { if (actionName == "delete") { ContactRoleInfo cri = ContactRoleInfoProvider.GetContactRoleInfo(ValidationHelper.GetInteger(actionArgument, 0)); if (cri != null) { if (ConfigurationHelper.AuthorizedModifyConfiguration(cri.ContactRoleSiteID, true)) { ContactRoleInfoProvider.DeleteContactRoleInfo(cri); } } } }
private ContactRoleInfo CreateContactRole(string contactRoleCodeName) { var contactRoleInfo = ContactRoleInfoProvider.GetContactRoleInfo(contactRoleCodeName); if (contactRoleInfo != null) { ContactRoleInfoProvider.DeleteContactRoleInfo(contactRoleInfo); } var roleObj = new ContactRoleInfo(); roleObj.ContactRoleDescription = contactRoleCodeName; roleObj.ContactRoleDisplayName = contactRoleCodeName; roleObj.ContactRoleName = contactRoleCodeName; ContactRoleInfoProvider.SetContactRoleInfo(roleObj); return(roleObj); }
/// <summary> /// Creates contact role. Called when the "Create role" button is pressed. /// </summary> private bool CreateContactRole() { // Create new contact role object ContactRoleInfo newRole = new ContactRoleInfo() { ContactRoleDisplayName = "My new role", ContactRoleName = "MyNewRole", ContactRoleSiteID = CMSContext.CurrentSiteID }; // Save the contact role ContactRoleInfoProvider.SetContactRoleInfo(newRole); return true; }