public Match(MatchDate date, Guid homeTeamId, Guid visitorTeamId, GeneralName location) { Id = Guid.NewGuid(); if (IsValidInparameters(date, homeTeamId, visitorTeamId, location)) { Date = date; MatchTimeInMinutes = 90; Location = location; HomeAssists = new List <Event>(); HomeExchanges = new HashSet <Exchange>(); HomeGoals = new List <Event>(); HomeTeamId = homeTeamId; HomeLineup = new HashSet <Guid>(); HomeRedCards = new List <Event>(); HomeYellowCards = new List <Event>(); IsPlayed = false; VisitorAssists = new List <Event>(); VisitorExchanges = new HashSet <Exchange>(); VisitorGoals = new List <Event>(); VisitorTeamId = visitorTeamId; VisitorLineup = new HashSet <Guid>(); VisitorRedCards = new List <Event>(); VisitorYellowCards = new List <Event>(); } }
public void MapFormFieldsToEntity() { // Save match date/time to entity if (MatchDate.HasValue && MatchTimeFrom.HasValue && MatchTimeTo.HasValue) { var period = new DateTimePeriod(MatchDate?.Add(MatchTimeFrom.Value), MatchDate?.Add(MatchTimeTo.Value)); Match.SetRealStart(TimeZoneConverter.ToUtc(period.Start), period.Duration()); } else { Match.SetRealStart(null, TimeSpan.Zero); } // Add sets to entity Match.Sets.Clear(true); for (var i = 0; i < Sets.Count; i++) { // sets where home and guest ball points are NULL, will be ignored if (Sets[i].Home.HasValue || Sets[i].Guest.HasValue) { // home or guest NULL values are invalidated with -1 Match.Sets.Add(new SetEntity { MatchId = Match.Id, SequenceNo = i + 1, HomeBallPoints = Sets[i].Home ?? -1, GuestBallPoints = Sets[i].Guest ?? -1 }); } } // point calculation must run before validation because of tie-break handling Match.Sets.CalculateSetPoints(Round.SetRule, Round.MatchRule); Match.Remarks = Remarks; Match.ChangeSerial++; Match.IsComplete = true; }
private bool IsValidInparameters(MatchDate date, Guid homeTeamId, Guid visitorTeamId, GeneralName location) { if (date.Value.Date < DateTime.Now.Date) { throw new ArgumentOutOfRangeException($"{nameof(date)} is out of range can only be between now and {EndDateForMatchCreation} years from now."); } if (date.Value.Date > EndDateForMatchCreation.Date) { throw new ArgumentOutOfRangeException($"{nameof(date)} is out of range can only be between now and {EndDateForMatchCreation} years from now."); } if (homeTeamId == Guid.Empty) { throw new ArgumentException($"{nameof(homeTeamId)} cannot be an empty Guid."); } if (visitorTeamId == Guid.Empty) { throw new ArgumentException($"{nameof(visitorTeamId)} cannot be an empty Guid."); } if (location == null) { throw new ArgumentNullException($"{nameof(location)} cannot be null."); } return(true); }
public string GetMatchDate() { if (MatchDate.Contains("/")) { return(MatchDate); } var dateStr = MatchDate.Replace('T', ' '); dateStr = dateStr.Replace('Z', ' '); return(DateTime.ParseExact(dateStr, "yyyy-MM-dd HH:mm:ss ", CultureInfo.CurrentCulture).ToShortDateString()); }
private void convertListsToObjects() { matchDate = match.Date; homeTeam = ServiceLocator.Instance.TeamService.GetBy(match.HomeTeamId); visitorTeam = ServiceLocator.Instance.TeamService.GetBy(match.VisitorTeamId); homeScore = match.HomeGoals.Count(); visitorScore = match.VisitorGoals.Count(); homeGoals = new ObservableCollection <Event>(match.HomeGoals); visitorGoals = new ObservableCollection <Event>(match.VisitorGoals); homeAssists = new ObservableCollection <Event>(match.HomeAssists); visitorAssists = new ObservableCollection <Event>(match.VisitorAssists); homeRedCards = new ObservableCollection <Event>(match.HomeRedCards); visitorRedCards = new ObservableCollection <Event>(match.VisitorRedCards); homeYellowCards = new ObservableCollection <Event>(match.HomeYellowCards); visitorYellowCards = new ObservableCollection <Event>(match.VisitorYellowCards); homeLineup = new ObservableCollection <Guid>(match.HomeLineup); visitorLineup = new ObservableCollection <Guid>(match.VisitorLineup); homeExchanges = new ObservableCollection <Exchange>(match.HomeExchanges); visitorExchanges = new ObservableCollection <Exchange>(match.VisitorExchanges); }
void ReleaseDesignerOutlets() { if (BottomConstraint != null) { BottomConstraint.Dispose(); BottomConstraint = null; } if (ChatEditMessage != null) { ChatEditMessage.Dispose(); ChatEditMessage = null; } if (ChatEditMessageContainer != null) { ChatEditMessageContainer.Dispose(); ChatEditMessageContainer = null; } if (ChatMessageWindow != null) { ChatMessageWindow.Dispose(); ChatMessageWindow = null; } if (ChatOneBack != null) { ChatOneBack.Dispose(); ChatOneBack = null; } if (ChatOneLeftConstraint != null) { ChatOneLeftConstraint.Dispose(); ChatOneLeftConstraint = null; } if (ChatOneRightConstraint != null) { ChatOneRightConstraint.Dispose(); ChatOneRightConstraint = null; } if (ChatSendMessage != null) { ChatSendMessage.Dispose(); ChatSendMessage = null; } if (ChatTargetImage != null) { ChatTargetImage.Dispose(); ChatTargetImage = null; } if (ChatViewProfile != null) { ChatViewProfile.Dispose(); ChatViewProfile = null; } if (MatchDate != null) { MatchDate.Dispose(); MatchDate = null; } if (MenuBlock != null) { MenuBlock.Dispose(); MenuBlock = null; } if (MenuContainer != null) { MenuContainer.Dispose(); MenuContainer = null; } if (MenuFriend != null) { MenuFriend.Dispose(); MenuFriend = null; } if (MenuIcon != null) { MenuIcon.Dispose(); MenuIcon = null; } if (MenuLayer != null) { MenuLayer.Dispose(); MenuLayer = null; } if (MenuLocationUpdates != null) { MenuLocationUpdates.Dispose(); MenuLocationUpdates = null; } if (MenuReport != null) { MenuReport.Dispose(); MenuReport = null; } if (MenuUnmatch != null) { MenuUnmatch.Dispose(); MenuUnmatch = null; } if (NoMessages != null) { NoMessages.Dispose(); NoMessages = null; } if (RoundBottom != null) { RoundBottom.Dispose(); RoundBottom = null; } if (Snackbar != null) { Snackbar.Dispose(); Snackbar = null; } if (SnackBottomConstraint != null) { SnackBottomConstraint.Dispose(); SnackBottomConstraint = null; } if (SnackTopConstraint != null) { SnackTopConstraint.Dispose(); SnackTopConstraint = null; } if (TargetName != null) { TargetName.Dispose(); TargetName = null; } if (UnmatchDate != null) { UnmatchDate.Dispose(); UnmatchDate = null; } }
public override string ToString() { return(Opposition.Name + " (" + MatchDate.ToShortDateString() + ")"); }
public MatchNot(MatchDate condition) => this.Condition = condition;
public MatchOr(MatchDate first, MatchDate second) { this.First = first; this.Second = second; }
public DatesFilter(DateSeries series, MatchDate condition) { this.Series = series; this.Condition = condition; }