コード例 #1
0
        private async Task ChangeGameEventParticipationStatusAsync(
            GameEventParticipation participation,
            ParticipationStatus participationStatus)
        {
            participation.ParticipationStatus = participationStatus;

            await _repository.SaveChangesAsync();
        }
コード例 #2
0
        public void CanDeleteEvent(ParticipationStatus status, string expectedStatus)
        {
            Http.Stub(
                HttpPost
                .Url("https://api.cronofy.com/v1/calendars/" + calendarId + "/events/" + eventId + "/participation_status")
                .RequestHeader("Authorization", "Bearer " + AccessToken)
                .RequestHeader("Content-Type", "application/json; charset=utf-8")
                .RequestBodyFormat(@"{{""status"":""{0}""}}", expectedStatus)
                .ResponseCode(202)
                );

            Client.ChangeParticipationStatus(calendarId, eventId, status);
        }
コード例 #3
0
        public void CanDeleteEvent(ParticipationStatus status, string expectedStatus)
        {
            Http.Stub(
                HttpPost
                    .Url("https://api.cronofy.com/v1/calendars/" + calendarId + "/events/" + eventId + "/participation_status")
                    .RequestHeader("Authorization", "Bearer " + AccessToken)
                    .RequestHeader("Content-Type", "application/json; charset=utf-8")
                    .RequestBodyFormat(@"{{""status"":""{0}""}}", expectedStatus)
                    .ResponseCode(202)
            );

            Client.ChangeParticipationStatus(calendarId, eventId, status);
        }
コード例 #4
0
ファイル: Attendee.cs プロジェクト: rekoder/ical.net
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = SentBy?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (CommonName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (DirectoryEntry?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Type?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Members);
         hashCode = (hashCode * 397) ^ (Role?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ParticipationStatus?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Rsvp.GetHashCode();
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(DelegatedTo);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(DelegatedFrom);
         hashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
コード例 #5
0
        private Task <List <GameEventListItemDto> > GetGameEventsWithParticipationStatus(
            [NotNull] string userName,
            ParticipationStatus participationStatus)
        {
            var gameEvents = _repository.ApplicationUsers
                             .Where(ApplicationUser.UserNameEquals(userName))
                             .Include(u => u.Participations)
                             .SelectMany(u => u.Participations)
                             .Where(p => p.ParticipationStatus == participationStatus)
                             .Include(p => p.TakesPartIn)
                             .Select(p => p.TakesPartIn);

            return(gameEvents
                   .Include(ge => ge.Participations)
                   .ThenInclude(p => p.Participant)
                   .Select(ge => ge.ToGameEventListItemDto())
                   .ToListAsync());
        }
コード例 #6
0
        /// <inheritdoc/>
        public void ChangeParticipationStatus(string calendarId, string eventUid, ParticipationStatus status)
        {
            Preconditions.NotEmpty("calendarId", calendarId);
            Preconditions.NotEmpty("eventUid", eventUid);

            var request = new HttpRequest();

            request.Method = "POST";
            request.Url    = string.Format(this.UrlProvider.ParticipationStatusUrlFormat, calendarId, eventUid);
            request.AddOAuthAuthorization(this.AccessToken);

            var requestBody = new { status = status.ToString().ToLower() };

            request.SetJsonBody(requestBody);

            var response = this.HttpClient.GetResponse(request);

            if (response.Code != 202)
            {
                throw new CronofyException("Request failed");
            }
        }
コード例 #7
0
        private string serializeParticipationStatus(ParticipationStatus status, string customStatus = null)
        {
            switch (status)
            {
            case ParticipationStatus.NeedsAction: return("NEEDS-ACTION");

            case ParticipationStatus.Accepted:    return("ACCEPTED");

            case ParticipationStatus.Declined:    return("DECLINED");

            case ParticipationStatus.Tentative:   return("TENTATIVE");

            case ParticipationStatus.Delegated:   return("DELEGATED");

            case ParticipationStatus.Completed:   return("COMPLETED");

            case ParticipationStatus.InProcess:   return("IN-PROCESS");

            case ParticipationStatus.Custom:      return(customStatus);

            default: throw new NotImplementedException("Unknown participation status detected!");
            }
        }
コード例 #8
0
 /// <summary>
 /// https://developers.podio.com/doc/items/set-participation-7156154
 /// </summary>
 public PodioRestHelper.PodioResponse SetParticipation(int itemId, ParticipationStatus status)
 {
     Dictionary<string, string> args = new Dictionary<string,string>(){{"status",status.ToString() }};
     return PodioRestHelper.Request(String.Format("{0}/item/{1}/participation", Constants.PODIOAPI_BASEURL, itemId), _client.AuthInfo.AccessToken, args, PodioRestHelper.RequestMethod.PUT);
 }
コード例 #9
0
 private static IEnumerable <UserDto> GetUsersWithParticipationStatus(
     this GameEvent gameEvent,
     ParticipationStatus participationStatus) =>
 gameEvent.Participations
 .Where(p => p.ParticipationStatus == participationStatus)
 .Select(p => p.Participant.ToDto());