예제 #1
0
        private void InitialiseData()
        {
            InitialiseBettingExchangeService();
            _matchId        = int.Parse(matchIdTextBox.Text.Trim());
            _chosenRunnerId = chosenRunnerIdTextBox.Text.Trim();
            _chosenOdds     = decimal.Parse(chosenOddsTextBox.Text.Trim());
            _chosenAmount   = decimal.Parse(chosenAmountTextBox.Text.Trim());
            _budget         = decimal.Parse(budgetTextBox.Text.Trim());
            _startingTime   = startingDateTimePicker.Value;

            List <Runner> runners = _provider.GetRunnersForMarket(ProviderName, _matchId.ToString());

            _runnersIndexedById = new Dictionary <string, Runner>();

            // the loop does three things: 1. creates the dictionary 2. initialises alt1RunnerId and alt2RunnerId 3. composes match name
            _alt1RunnerId = _alt2RunnerId = string.Empty;
            _matchName    = string.Empty;
            string alt1Name = string.Empty, alt2Name = string.Empty;

            foreach (Runner runner in runners)
            {
                _runnersIndexedById.Add(runner.Id, runner);
                if (runner.Id != _chosenRunnerId)
                {
                    if (string.IsNullOrEmpty(_alt1RunnerId))
                    {
                        _alt1RunnerId = runner.Id;
                        alt1Name      = runner.Title;
                    }
                    else
                    {
                        _alt2RunnerId = runner.Id;
                        alt2Name      = runner.Title;
                    }
                }
                _matchName += runner.Title + "-";
            }
            _matchName = _matchName.Substring(0, _matchName.Length - 1);
            Logger.Write(Resources.ProjectName, _matchName, "Initialising.");
            Logger.Write(Resources.ProjectName, _matchName, "Alt1: " + alt1Name + "; Alt2: " + alt2Name);
            Logger.Write(Resources.ProjectName, _matchName, "Chosen Odds: " + _chosenOdds);
        }
예제 #2
0
        private void InitialiseData()
        {
            InitialiseBettingExchangeService();

            List <Runner> runners = _provider.GetRunnersForMarket(ProviderName, MarketId);

            _runnersIndexedById = new Dictionary <string, Runner>();

            // the loop does three things: 1. creates the dictionary 2. initialises alt1RunnerId and alt2RunnerId 3. composes match name
            _alt1RunnerId = _alt2RunnerId = string.Empty;
            _matchName    = string.Empty;
            string alt1Name = string.Empty, alt2Name = string.Empty;

            foreach (Runner runner in runners)
            {
                _runnersIndexedById.Add(runner.Id, runner);
                if (runner.Id != ChosenRunnerId)
                {
                    if (string.IsNullOrEmpty(_alt1RunnerId))
                    {
                        _alt1RunnerId = runner.Id;
                        alt1Name      = runner.Title;
                        if (alt1Name != "The Draw")
                        {
                            _opponentRunnerName = RunnerAliasesHelper.GetNameAliasesForAlias(alt1Name).RunnerName;
                        }
                    }
                    else
                    {
                        _alt2RunnerId = runner.Id;
                        alt2Name      = runner.Title;
                        if (alt2Name != "The Draw")
                        {
                            _opponentRunnerName = alt2Name;
                        }
                    }
                }
                else
                {
                    _chosenRunnerName = RunnerAliasesHelper.GetNameAliasesForAlias(runner.Title).RunnerName;
                }
                _matchName += runner.Title + "-";
            }
            _matchName = _matchName.Substring(0, _matchName.Length - 1);
            Logger.Write(Resources.ProjectName, _matchName, "Initialising.");
            Logger.Write(Resources.ProjectName, _matchName, "Alt1: " + alt1Name + "; Alt2: " + alt2Name);
            Logger.Write(Resources.ProjectName, _matchName, "Chosen Odds: " + ChosenOdds);
        }