public PeanutParticipationType Create(PeanutParticipationTypeDto participationTypeDto, UserGroup userGroup, User createdBy) { PeanutParticipationType peanutParticipationType = new PeanutParticipationType(participationTypeDto, userGroup, new EntityCreatedDto(createdBy, DateTime.Now)); PeanutParticipationTypeDao.Save(peanutParticipationType); return(peanutParticipationType); }
public void CreateParticipationType() { PeanutParticipationType participationType = PeanutParticipationTypeCreator.Create(persist: false); PeanutParticipationTypeDao.Save(participationType); var peanutParticipationType = PeanutParticipationTypeDao.Get(participationType.Id); peanutParticipationType.UserGroup.Should().Be(participationType.UserGroup); peanutParticipationType.Name.Should().Be(participationType.Name); peanutParticipationType.IsProducer.Should().Be(participationType.IsProducer); peanutParticipationType.IsCreditor.Should().Be(participationType.IsCreditor); peanutParticipationType.MaxParticipatorsOfType.Should().Be(participationType.MaxParticipatorsOfType); }
public PeanutParticipationType Create(UserGroup userGroup = null, string name = "Test Typ", bool isCreditor = true, bool isProducer = false, int maxParticipators = 1, bool persist = true) { if (userGroup == null) { userGroup = UserGroupCreator.Create(); } User user = UserGroupMembershipCreator.Create(userGroup, persist: persist).User; var peanutParticipationTypeDto = new PeanutParticipationTypeDto { IsCreditor = isCreditor, Name = name, IsProducer = isProducer, MaxParticipatorsOfType = maxParticipators }; PeanutParticipationType peanutParticipationType = new PeanutParticipationType(peanutParticipationTypeDto, userGroup, new EntityCreatedDto(user, DateTime.Now)); return(peanutParticipationType); }
public void InviteAllGroupMembers(Peanut peanut, UserGroup userGroup, PeanutParticipationType peanutParticipationType, PeanutInvitationNotificationOptions peanutInvitationNotificationOptions, User user) { IList <UserGroupMembership> members = UserGroupService.FindMembershipsByGroups(PageRequest.All, new List <UserGroup> { userGroup }, new List <UserGroupMembershipType> { UserGroupMembershipType.Administrator, UserGroupMembershipType.Member }).ToList(); PeanutParticipationType participationType = peanutParticipationType; if (participationType != null) { PeanutParticipationDto peanutParticipationDto = new PeanutParticipationDto(participationType, PeanutParticipationState.Pending); /*Alle Nutzer einladen, die noch nicht als Teilnehmer am Peanut hinterlegt sind.*/ IList <UserGroupMembership> inviteableMembers = members.Except(peanut.Participations.Select(part => part.UserGroupMembership)).ToList(); foreach (UserGroupMembership inviteableMember in inviteableMembers) { InviteUser(peanut, inviteableMember, peanutParticipationDto, peanutInvitationNotificationOptions, user); } } }
public PeanutParticipationTypeSelectionModel(PeanutParticipationType selectedParticipationType, IList <PeanutParticipationType> selectableParticipationTypes) { SelectableParticipationTypes = selectableParticipationTypes; SelectedParticipationType = selectedParticipationType; }