private void UpdateStartTimes(MatchResultUpdateModel[] updates, ICompetitionsManager manager)
        {
            var dateUpdates =
                updates.Where(
                    up =>
                    (up.StartTimeHours.HasValue || up.StartTimeMinutes.HasValue || up.StartTimeType.HasValue) &&
                    up.Date.NotNullOrEmpty());

            var startTimeUpdates =
                dateUpdates.Select(
                    dateUpdate =>
            {
                var startTimeUpdateInfo       = new MatchStartTimeUpdateInfo();
                startTimeUpdateInfo.MatchId   = dateUpdate.Id;
                startTimeUpdateInfo.StartTime = BuildStartTime(dateUpdate.Date, dateUpdate.StartTimeHours,
                                                               dateUpdate.StartTimeMinutes);
                if (dateUpdate.StartTimeType.HasValue)
                {
                    startTimeUpdateInfo.StartTimeType = dateUpdate.StartTimeType.Value;
                }

                return(startTimeUpdateInfo);
            });

            manager.UpdateMatchStartTime(startTimeUpdates.ToArray());
        }
Example #2
0
        public void UpdateMatchStartTime(MatchStartTimeUpdateInfo startTimeUpdateInfo)
        {
            UseDataContext(
                dataContext =>
            {
                var match = dataContext.Matches.FirstOrDefault(m => m.Id == startTimeUpdateInfo.MatchId);
                if (match.IsNotNull())
                {
                    // !!!!
                    if (match.Status < (int)MatchStatus.Planned)
                    {
                        match.Status = (int)MatchStatus.Planned;
                    }
                    match.StartTime     = startTimeUpdateInfo.StartTime.ToUniversalTime();
                    match.StartTimeType = (int)startTimeUpdateInfo.StartTimeType;

                    dataContext.SubmitChanges();
                }
            });
        }
Example #3
0
        public void UpdateMatchStartTime(MatchStartTimeUpdateInfo startTimeUpdateInfo)
        {
            var competitionMatchesRepository = ServiceProvider.Get <ICompetitionMatchesRepository>();

            competitionMatchesRepository.UpdateMatchStartTime(startTimeUpdateInfo);
        }