예제 #1
0
 public async Task UpsertOpenCompetition(Competition competition)
 {
     var entity = new OpenCompetitionEntity(competition.Id)
     {
         ServiceUrl         = competition.ServiceUrl,
         TenantId           = competition.TenantId,
         TeamId             = competition.TeamId,
         ChannelId          = competition.ChannelId,
         MainActivityId     = competition.MainActivityId,
         ResultActivityId   = competition.ResultActivityId,
         CreatedTime        = competition.CreatedTime,
         PlannedDrawTime    = competition.PlannedDrawTime,
         ActualDrawTime     = competition.ActualDrawTime,
         Locale             = competition.Locale,
         OffsetHours        = competition.OffsetHours,
         Gift               = competition.Gift,
         GiftImageUrl       = competition.GiftImageUrl,
         WinnerCount        = competition.WinnerCount,
         Status             = competition.Status,
         CreatorName        = competition.CreatorName,
         CreatorAadObjectId = competition.CreatorAadObjectId,
         WinnerAadObjectIds = competition.WinnerAadObjectIds,
         Competitors        = competition.Competitors
     };
     await OpenCompetitions.InsertOrReplace(entity);
 }
예제 #2
0
        public async Task <Competition> GetOpenCompetition(Guid competitionId)
        {
            var entity = await OpenCompetitions.Retrieve(new OpenCompetitionEntity(competitionId));

            if (entity == null)
            {
                return(null);
            }
            return(new Competition
            {
                Id = entity.Id,
                ServiceUrl = entity.ServiceUrl,
                TenantId = entity.TenantId,
                TeamId = entity.TeamId,
                ChannelId = entity.ChannelId,
                MainActivityId = entity.MainActivityId,
                ResultActivityId = entity.ResultActivityId,
                CreatedTime = entity.CreatedTime,
                PlannedDrawTime = entity.PlannedDrawTime,
                ActualDrawTime = entity.ActualDrawTime,
                Locale = entity.Locale,
                OffsetHours = entity.OffsetHours,
                Gift = entity.Gift,
                GiftImageUrl = entity.GiftImageUrl,
                WinnerCount = entity.WinnerCount,
                Status = entity.Status,
                CreatorName = entity.CreatorName,
                CreatorAadObjectId = entity.CreatorAadObjectId,
                WinnerAadObjectIds = entity.WinnerAadObjectIds,
                Competitors = entity.Competitors
            });
        }
예제 #3
0
        public async Task <List <Guid> > GetOpenCompetitionIds(DateTimeOffset maxPlannedDrawTime)
        {
            var openCompetitions = await OpenCompetitions.Query(
                $"PlannedDrawTime lt datetime'{maxPlannedDrawTime.ToString("yyyy-MM-ddTHH:mm:ss")}Z'",
                selectColumns : new List <string> {
                "Id"
            });

            return(openCompetitions.Select(oc => oc.Id).ToList());
        }
예제 #4
0
 public async Task DeleteOpenCompetition(Guid competitionId)
 {
     await OpenCompetitions.Delete(new OpenCompetitionEntity(competitionId));
 }