コード例 #1
0
        public async Task <ScheduleCheckResult> Get()
        {
            foreach (Models.ScheduleSyncSpec s in _dbContext.ScheduleSyncSpecs.ToArray())
            {
                if (s.Expires < DateTime.Today)
                {
                    _dbContext.Remove(s);

                    continue;
                }

                TeamSnapApi api = new TeamSnapApi(s.TeamSnapToken);

                HashSet <DateTime> exclusions = new HashSet <DateTime>(_dbContext.ScheduleSyncSpecExclusions.Where(x => x.ScheduleSyncSpecID == s.ID).Select(x => x.ExcludedDate));

                IEnumerable <ScheduleComparer.CompareResult> res = await new ScheduleComparer(api, _parser, s.TeamSnapTeamId, s.TwinRinkTeamName, exclusions).RunCompareAsync();

                if (res.Any())
                {
                    await BuildAndSendEmail(s, res);
                }

                s.LastChecked = DateTime.UtcNow;
            }

            await _dbContext.SaveChangesAsync();

            return(new ScheduleCheckResult());
        }
コード例 #2
0
    public ScheduleComparer(TeamSnapApi tsApi, TwinRinksScheduleParserService trApi, long teamSnapTeamId, string twinRinksTeam, HashSet <DateTime> exclusions = null, CompareOptions options = null)
    {
        if (string.IsNullOrWhiteSpace(twinRinksTeam))
        {
            throw new System.ArgumentException("message", nameof(twinRinksTeam));
        }

        this.tsApi = tsApi ?? throw new System.ArgumentNullException(nameof(tsApi));
        this.trApi = trApi ?? throw new System.ArgumentNullException(nameof(trApi));

        this.teamSnapTeamId = teamSnapTeamId;
        this.twinRinksTeam  = twinRinksTeam;
        this.exclusions     = exclusions;

        Options = options ?? new CompareOptions();
    }
コード例 #3
0
 public CreateModel(TeamSnapApi tsApi, TwinRinksScheduleParserService parser, Models.TwinRinksHelperContext dbContext)
 {
     this.tsApi  = tsApi ?? throw new System.ArgumentNullException(nameof(tsApi));
     this.parser = parser ?? throw new System.ArgumentNullException(nameof(parser));
     _dbContext  = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
コード例 #4
0
 public CompareScheduleModel(TeamSnapApi tsApi, TwinRinksScheduleParserService parser)
 {
     this.tsApi  = tsApi ?? throw new System.ArgumentNullException(nameof(tsApi));
     this.parser = parser ?? throw new System.ArgumentNullException(nameof(parser));
 }
コード例 #5
0
 public PrintTeamStickers(TeamSnapApi tsApi, TeamStickerPrintingService ts)
 {
     _teamStickerService = ts ?? throw new System.ArgumentNullException(nameof(ts));
     this.tsApi          = tsApi ?? throw new System.ArgumentNullException(nameof(tsApi));
 }
コード例 #6
0
 public CreateEventsModel(TeamSnapApi tsApi, TwinRinksScheduleParserService trApi)
 {
     this.tsApi = tsApi ?? throw new System.ArgumentNullException(nameof(tsApi));
     this.trApi = trApi ?? throw new System.ArgumentNullException(nameof(trApi));
 }