예제 #1
0
        public void MapEntityToFormFields()
        {
            if (Match.RealStart.HasValue && Match.RealEnd.HasValue)
            {
                var startDate = TimeZoneConverter.ToZonedTime(Match.RealStart);
                var endDate   = TimeZoneConverter.ToZonedTime(Match.RealEnd);
                MatchDate     = startDate.DateTimeOffset.Date;
                MatchTimeFrom = startDate.DateTimeOffset.TimeOfDay;
                MatchTimeTo   = endDate.DateTimeOffset.TimeOfDay;
                Remarks       = Match.Remarks;
            }
            else
            {
                MatchDate = TimeZoneConverter.ToZonedTime(Match.PlannedStart)?.DateTimeOffset.Date;
            }

            Match.Sets.Sort((int)SetFieldIndex.SequenceNo, ListSortDirection.Ascending);
            foreach (var set in Match.Sets)
            {
                Sets.Add(new PointResultNullable(set.HomeBallPoints, set.GuestBallPoints));
            }

            while (Sets.Count < _maxNumberOfSets)
            {
                Sets.Add(new PointResultNullable(null, null));
            }

            Id = Match.Id;

            Remarks = Match.Remarks;
        }