示例#1
0
    public void Register(ParticipationType participationType, string subscription, Action <object> response, object payload)
    {
        string subscriptionType = null;

        if (participationType == ParticipationType.SUBSCRIBER)
        {
            subscriptionType = string.Format("{0}_{1}", SUBSCRIBE, subscription);
        }
        else if (participationType == ParticipationType.PUBLISHER)
        {
            subscriptionType = string.Format("{0}_{1}", PUBLISH, subscription);
        }
        var observer = new Observer()
        {
            Subscription = subscriptionType, Respond = response
        };

        _observers.Add(observer);
        foreach (var observerItem in _observers)
        {
            var publication = string.Format("{0}_{1}", PUBLISH, subscription);
            if (observerItem.Subscription == publication)
            {
                observerItem.Respond(payload);
            }
        }
    }
示例#2
0
 public static bool PMManagement(ParticipationType participationType)
 {
     if (participationType == ParticipationType.Creator ||
         participationType == ParticipationType.ProjectManager)
     {
         return(true);
     }
     else
     {
         throw exception;
     }
 }
示例#3
0
 public static bool TaskCRUD(ParticipationType participationType)
 {
     if (participationType == ParticipationType.Creator ||
         participationType == ParticipationType.ProjectManager ||
         participationType == ParticipationType.Expert ||
         participationType == ParticipationType.TeamLeader)
     {
         return(true);
     }
     else
     {
         throw exception;
     }
 }
示例#4
0
文件: ChatBL.cs 项目: PichitK/RESTPrj
        public static string GetChatRoomId(int[] participatedMemberId, ParticipationType type)
        {
            if (!Enum.IsDefined(typeof(ParticipationType), type))
            {
                throw new OrgException("Invalid participation type");
            }

            int[]  sortedId   = participatedMemberId.OrderBy(r => r).ToArray();
            string chatroomId = ((int)type).ToString();

            foreach (int i in sortedId)
            {
                string memberId = i.ToString();

                chatroomId += memberId.Length.ToString() + memberId;
            }

            return(chatroomId);
        }
        public async Task <IActionResult> AddMember(Guid projectId, Guid memberId, ParticipationType participationType)
        {
            var id = User.Claims.Where(c => c.Type == "Id").Select(c => c.Value).SingleOrDefault();

            if (String.IsNullOrEmpty(id))
            {
                return(Unauthorized());
            }
            Guid actorId = new(id);

            try
            {
                await _projectsService.AddMember(projectId, memberId, participationType, actorId);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
示例#6
0
 public GetProjectParticipationByParticipationSpec(Guid projectId, ParticipationType participationType)
 {
     Predicate = p => p.ProjectId == projectId && p.ParticipationType == participationType;
 }
        private void FillPacticipants(Contest contest, ICollection<string> participantsIds, ParticipationType participationType)
        {
            if (participantsIds == null || participationType == ParticipationType.Open)
            {
                contest.Participants.Clear();
            }
            else
            {
                var participants = contest.Participants.ToList();

                foreach (var participantId in participantsIds)
                {
                    if (contest.Participants.All(p => p.Id != participantId))
                    {
                        var participant = this.ContestsData.Users.Find(participantId);
                        contest.Participants.Add(participant);
                    }
                }

                foreach (var participant in participants)
                {
                    if (!participantsIds.Contains(participant.Id))
                    {
                        contest.Participants.Remove(participant);
                    }
                }
            }
        }
 public override int GetHashCode()
 {
     unchecked { return(((ParticipationType != null ? ParticipationType.GetHashCode() : 0) * 397) ^ (int)ParticipationState); }
 }
示例#9
0
    public void Register(ParticipationType participationType, string subscription, Action <object> response)
    {
        object payload = null;

        Register(participationType, subscription, response, payload);
    }
示例#10
0
 public static bool TaskMooving(ParticipationType participationType)
 {
     return(true);
 }
 public async System.Threading.Tasks.Task AddMember(Guid projectId, Guid memberId, ParticipationType participationType, Guid actorId)
 {
     if (await _policyService.IsAllowedToUserManagement(new GetProjectParticipationByKeySpec(projectId, actorId)))
     {
         await _projectParticipationRepository.Create(new ProjectParticipation()
         {
             ProjectId         = projectId,
             UserId            = memberId,
             TeamId            = null,
             ParticipationType = participationType
         });
     }
 }
示例#12
0
 public UserParticipationNotification(User user, ParticipationType participationType)
 {
     User = user;
     When = DateTime.Now;
     ParticipationType = participationType;
 }