private void SetupCustomUserPart(ActivatedContentContext context, CustomUserPart customUserPart) { customUserPart.UserLazyField.Loader(() => customUserPart.Record.UserPartRecord == null ? null : this.contentManager.Get<UserPart>(customUserPart.Record.UserPartRecord.Id)); customUserPart.UserLazyField.Setter(userPart => { if ( userPart != null ) { var exists = this.contentManager.Query<CustomUserPart, CustomUserRecord>() .Where(x => x.UserPartRecord != null && x.UserPartRecord.Id == userPart.Record.Id) .List() .Any(); if ( exists ) { throw new ArgumentException("This user record is already assigned to a custom user"); } customUserPart.Record.UserPartRecord = userPart.Record; } else { customUserPart.Record.UserPartRecord = null; } return userPart; }); }
public void CustomUserRequestedInviteWasGranted(CustomUserPart customUserPart) { this.workflowManager.TriggerEvent( "CustomUserRequestedInviteWasGranted", customUserPart.ContentItem, () => new Dictionary<string, object> { { "CustomUser", customUserPart.ContentItem }, { "User", customUserPart.User } }); }
public CustomUserEdit(CustomUserPart customUser) { this.Id = customUser.Id; this.CanUserDataBeChanged = false; if ( customUser.User != null ) { this.OrchardUserId = customUser.User.Id; this.UserName = customUser.User.UserName; this.Email = customUser.User.Email; if ( customUser.User.RegistrationStatus == UserStatus.Pending ) { this.CanUserDataBeChanged = true; } } this.FirstName = customUser.FirstName; this.LastName = customUser.LastName; this.ActivationCode = customUser.ActivationCode; this.WelcomeText = customUser.WelcomeText; }