コード例 #1
0
        public EditFixtureViewModel(PlannedMatchRow plannedMatch, Axuno.Tools.DateAndTime.TimeZoneConverter timeZoneConverter)
        {
            PlannedMatch      = plannedMatch;
            TimeZoneConverter = timeZoneConverter;

            // Set form fields
            if (plannedMatch != null)
            {
                Id      = PlannedMatch.Id;
                VenueId = PlannedMatch.VenueId;
                // set date and time for the current time zone
                var currentDate =
                    TimeZoneConverter.ToZonedTime(PlannedMatch.PlannedStart);
                MatchDate = currentDate?.DateTimeOffset.Date;
                MatchTime = currentDate?.DateTimeOffset.TimeOfDay;

                // mark a list item as selected
                VenueNotSpecifiedKey = null;  // "not specified" will not show in the list
                VenueId = PlannedMatch.VenueId ?? VenueNotSpecifiedKey ?? 0;
            }
        }
コード例 #2
0
        /// <summary>
        /// Fills a new <see cref="MatchEntity"/> with data retrieved from the database.
        /// </summary>
        /// <param name="currentData"></param>
        /// <returns>Returns a <see cref="MatchEntity"/> ready to be processed further.</returns>
        private MatchEntity FillMatchEntity(PlannedMatchRow currentData)
        {
            // set current values
            var match = new MatchEntity
            {
                IsNew            = false,
                Id               = currentData.Id,
                HomeTeamId       = currentData.HomeTeamId,
                GuestTeamId      = currentData.GuestTeamId,
                PlannedStart     = currentData.PlannedStart,
                PlannedEnd       = currentData.PlannedEnd,
                OrigPlannedStart = currentData.OrigPlannedStart,
                OrigPlannedEnd   = currentData.OrigPlannedEnd,
                VenueId          = currentData.VenueId,
                OrigVenueId      = currentData.OrigVenueId,
                RoundId          = currentData.RoundId,
                LegSequenceNo    = currentData.RoundLegSequenceNo,
                ChangeSerial     = currentData.ChangeSerial,
                IsDirty          = false // flag as unchanged
            };

            return(match);
        }