コード例 #1
0
 public static SummaryProcessStat ProcessCompetitionPack(LoggerWrapper logger, BrokerData brokerData, GatherBehaviorMode algoMode, BrokerCompetitionSettings brokerSettings, Action<SummaryProcessStat, BrokerType, SportType, CompetitionItemRawTransport, MatchParsed> actionForMatchedItem)
 {
     var stat = new SummaryProcessStat();
     var competitorProvider = ProjectProvider.Instance.CompetitorProvider;
     var competitionProvider = ProjectProvider.Instance.CompetitionProvider;
     foreach (var competitionParsed in brokerData.Competitions) {
         var competition = competitionProvider.GetCompetitionSpecify(stat[ProcessStatType.CompetitionFromRaw], stat[ProcessStatType.CompetitionSpecifyFromRaw], brokerData.Broker, brokerData.Language, competitionParsed.Type, competitionParsed.Name, competitionParsed, algoMode);
         foreach (var matchParsed in competitionParsed.Matches) {
             var competitorStat = stat[ProcessStatType.CompetitorFromRaw];
             var competitors = new[] {
                 competitorProvider
                 .GetCompetitor(competitorStat, brokerData.Broker, brokerData.Language, competitionParsed.Type, competition.Object.GenderType, matchParsed.CompetitorName1, algoMode),
                 competitorProvider
                 .GetCompetitor(competitorStat, brokerData.Broker, brokerData.Language, competitionParsed.Type, competition.Object.GenderType, matchParsed.CompetitorName2, algoMode)
             };
             if (competitors.Any(c => c.RawObject.ID == default(int))) {
                 continue;
             }
             if (competitors.Any(c => c.Object.ID == default(int)) && competitors.Any(c => c.Object.ID != default(int))) {
                 var linker = new SystemStateProvder();
                 linker.ApplyLinker(competitors.First(c => c.Object.ID != default(int)).RawObject.ID, BrokerEntityType.Competitor);
                 var unlikedCompetitor = competitors.First(c => c.Object.ID == default(int));
                 unlikedCompetitor.Object.ID = RawCompetitor.DataSource.GetByKey(unlikedCompetitor.RawObject.ID).CompetitoruniqueID;
             }
             var creationCiMode = (matchParsed.Odds.SafeAny() || matchParsed.Result != null) ? algoMode : algoMode.FlagDrop(GatherBehaviorMode.CreateOriginalIfMatchedAll);
             var competitionItemRawTransport = competitionProvider.GetCompetitionItem(stat[ProcessStatType.CompetitionItemFromRaw], brokerData.Broker, competitors, competition, matchParsed.DateUtc, creationCiMode, brokerSettings);
             if (competitionItemRawTransport != null && competitionItemRawTransport.CompetitionItemID != default(int)) {
                 if (competitionItemRawTransport.CompetitionItemID < default(int)) {
                     competitionItemRawTransport.CompetitionItemID = -competitionItemRawTransport.CompetitionItemID;
                     logger.Info("Inverse data for ID = {0} {1} {2}", competitionItemRawTransport.CompetitionItemID, brokerData.Broker, brokerData.Language);
                     ReverseAllDataInMatch(matchParsed);
                 }
                 actionForMatchedItem(stat, brokerData.Broker, competitionParsed.Type, competitionItemRawTransport, matchParsed);
             }
         }
     }
     logger.Info("SaveResults: {0} {1} {2} {3}: Competitions: {4}/{5} CompetitionItems: {6}/{7} Competitors {8}/{9} {10}", brokerData.Competitions.FirstOrDefault(c => c.Matches.Any())?.Matches.FirstOrDefault()?.DateUtc.Date.ToString("yyyy MMMM dd"),
         brokerData.Broker, brokerData.Language, algoMode,
         stat[ProcessStatType.CompetitionSpecifyFromRaw].FinallySuccessCount, stat[ProcessStatType.CompetitionSpecifyFromRaw].TotalCount,
         stat[ProcessStatType.CompetitionItemFromRaw].FinallySuccessCount, stat[ProcessStatType.CompetitionItemFromRaw].TotalCount,
         stat[ProcessStatType.CompetitorFromRaw].FinallySuccessCount, stat[ProcessStatType.CompetitorFromRaw].TotalCount,
         brokerData.Competitions.GroupBy(c => c.Type).Select(g => string.Format("{0}={1}", g.Key, g.Count())).StrJoin(", "));
     return stat;
 }
コード例 #2
0
ファイル: UserActionLogger.cs プロジェクト: dnmsk/rProject
        private static void LogInternal(LoggerWrapper logger, long guestId, Enum feature, int? objectId, Dictionary<string, string> additionalParams)
        {
            try {
                if (guestId <= 0) {
                    return;
                }
                logger.Info("{0};{1};{2}", guestId, Convert.ToInt32(feature), objectId.HasValue ? objectId.Value.ToString() : "NULL");

                LogsActionProcessor.Instance.ProcessActionID(guestId, feature, objectId, null, additionalParams);
            } catch (Exception e) {
                _logger.Error(e);
            }
        }