private static void MergeMatchResult(MatchLn mtch) { try { MatchResultLn rslt = new MatchResultLn(); rslt.MatchId = mtch.MatchId; rslt.BtrMatchId = mtch.BtrMatchId; rslt.StartDate.Value = mtch.StartDate.Value; rslt.HomeCompetitorId.Value = mtch.HomeCompetitorId.Value; rslt.AwayCompetitorId.Value = mtch.AwayCompetitorId.Value; rslt.IsLiveBet.Value = mtch.IsLiveBet.Value; rslt.Score.Value = mtch.LiveMatchInfo.Score.Value; rslt.ExtendedState.Value = string.Empty; rslt.TeamWon = mtch.TeamWon.Value; var lGroups = mtch.ParentGroups.Clone(); GroupLn groupTournament = null; GroupLn groupSport = null; GroupLn groupCategory = null; foreach (var group in lGroups) { if (group.Type == GroupLn.GROUP_TYPE_GROUP_T) { groupTournament = group; } else if (group.Type == GroupLn.GROUP_TYPE_SPORT) { groupSport = group; } else if (group.Type == GroupLn.GROUP_TYPE_GROUP_C) { groupCategory = group; } } ExcpHelper.ThrowIf <RelatedLineObjectNotFoundException>(groupTournament == null, "Cannot find Tournament Group for {0} and {1}", mtch, rslt); ExcpHelper.ThrowIf <RelatedLineObjectNotFoundException>(groupSport == null, "Cannot find Sport Group for {0} and {1}", mtch, rslt); ExcpHelper.ThrowIf <RelatedLineObjectNotFoundException>(groupCategory == null, "Cannot find Category Group for {0} and {1}", mtch, rslt); rslt.TournamentGroupId.Value = groupTournament.GroupId; rslt.SportGroupId.Value = groupSport.GroupId; rslt.CategoryGroupId.Value = groupCategory.GroupId; LineSr.Instance.AllObjects.MatchResults.MergeLineObject(rslt); } catch (Exception excp) { m_logger.Excp(excp, "MergeMatchResult ERROR for {0}", mtch); } }
public static bool IsMatchValid(MatchLn match, MatchesFilter filter) { if (match == null) { return(false); } if (filter == null) { return(true); } // filter by date if (filter.DateRange != null && filter.DateRange.IsInRange(match.MatchView.StartDate) == false) { return(false); } // filter by tournament ids if (filter.TournamentIds != null && filter.TournamentIds.Length > 0) { if (match.MatchView.TournamentView == null || match.MatchView.TournamentView.LineObject == null || filter.TournamentIds.Contains(match.MatchView.TournamentView.LineObject.Id) == false) { return(false); } } // filter by base odds if (filter.BaseBetOddsRange != null) { var baseBetDomain = match.GetBaseBetDomain(); if (baseBetDomain == null || baseBetDomain.Odds == null) { return(false); } // take only valid odds >= 1.0 var validOdds = baseBetDomain.Odds.Where(x => x.Value.Value >= 1M); // The smallest valid odd must be in range of the filter in order to pass if (validOdds.Count() <= 1 || filter.BaseBetOddsRange.IsInRange(validOdds.OrderBy(x => x.Value.Value).First().Value.Value) == false) { return(false); } } return(true); }
private static bool MatchFilter2(MatchLn match) { if (match.EndDate.Value == null) { return(false); } if (match.EndDate.Value.LocalDateTime < MatchExpireDate) { return(true); } if (((match.SourceType == eServerSourceType.BtrVfl || match.SourceType == eServerSourceType.BtrVhc) && match.StartDate.Value.LocalDateTime < VirtualExpireDate)) { return(true); } return(false); }