Esempio n. 1
0
        private void CheckAndCreatePairRunner(bool isRelay, IDataReader reader, Dictionary <int, RunnerPair> runnerPairs, int runnerID, Result res)
        {
            // is this a pair-runner?
            if (!isRelay && reader["allocationControl"] != null && reader["allocationControl"] as string == "groupedWithRef" && reader["allocationEntryId"] != DBNull.Value)
            {
                int        otherRunnerId = Convert.ToInt32(reader["allocationEntryId"].ToString());
                RunnerPair rp;

                if (runnerPairs.ContainsKey(runnerID))
                {
                    rp = runnerPairs[runnerID];
                }
                else if (runnerPairs.ContainsKey(otherRunnerId))
                {
                    rp         = runnerPairs[otherRunnerId];
                    rp.Runner2 = res;
                    runnerPairs.Add(runnerID, rp);
                }
                else
                {
                    rp = new RunnerPair {
                        Runner1 = res
                    };
                    runnerPairs.Add(runnerID, rp);
                }

                if (rp.Runner1 != null && rp.Runner1.ID == res.ID)
                {
                    rp.Runner1 = res;
                }
                else if (rp.Runner2 != null && rp.Runner2.ID == res.ID)
                {
                    rp.Runner2 = res;
                }

                var comb = rp.CombinedRunner;
                if (comb != null && comb.Status != 999)
                {
                    FireOnResult(comb);
                }
            }
            else
            {
                FireOnResult(res);
            }
        }
Esempio n. 2
0
        private void CheckAndCreatePairRunner(bool isRelay, IDataReader reader, Dictionary<int, RunnerPair> runnerPairs, int runnerID, Result res)
        {
            // is this a pair-runner?
            if (!isRelay && reader["allocationControl"] != null && reader["allocationControl"] as string == "groupedWithRef" && reader["allocationEntryId"] != DBNull.Value)
            {
                int otherRunnerId = Convert.ToInt32(reader["allocationEntryId"].ToString());
                RunnerPair rp;

                if (runnerPairs.ContainsKey(runnerID))
                {
                    rp = runnerPairs[runnerID];

                }
                else if (runnerPairs.ContainsKey(otherRunnerId))
                {
                    rp = runnerPairs[otherRunnerId];
                    rp.Runner2 = res;
                    runnerPairs.Add(runnerID, rp);
                }
                else
                {
                    rp = new RunnerPair{
                        Runner1 = res
                    };
                    runnerPairs.Add(runnerID, rp);
                }

                if (rp.Runner1 != null && rp.Runner1.ID == res.ID)
                {
                    rp.Runner1 = res;
                }
                else if (rp.Runner2 != null && rp.Runner2.ID == res.ID)
                {
                    rp.Runner2 = res;
                }

                var comb = rp.CombinedRunner;
                if (comb != null && comb.Status != 999)
                    FireOnResult(comb);

            }
            else
            {
                FireOnResult(res);
            }
        }