示例#1
0
        public static Market[] ConvertMarketTypeWithPricesCollection(MarketTypeWithPrices[] remoteMarkets)
        {
            Market[] localMarkets = new Market[remoteMarkets.Length];

            for (int j = 0 ; j < remoteMarkets.Length ; j++)
            {
                MarketTypeWithPrices remoteMarket = remoteMarkets[j];

                localMarkets[j] = new Market();
                localMarkets[j].MarketId = remoteMarket.Id;
                localMarkets[j].Name = remoteMarket.Name;
                localMarkets[j].MarketType = remoteMarket.Type;
                localMarkets[j].MarketStatus = remoteMarket.Status;
                localMarkets[j].NoOfWinningSelections = remoteMarket.NumberOfWinningSelections;
                localMarkets[j].StartTime = remoteMarket.StartTime;
                localMarkets[j].WithdrawalSeqNo = remoteMarket.WithdrawalSequenceNumber;
                localMarkets[j].DisplayOrder = remoteMarket.DisplayOrder;
                localMarkets[j].IsEnabledForMultiples = remoteMarket.IsEnabledForMultiples;

                if (remoteMarket.Selections != null)
                    localMarkets[j].Selections = SelectionConverter.ConvertSelectionTypeWithPricesCollection(remoteMarket.Selections);
            }

            return localMarkets;
        }
示例#2
0
        public static Market[] ConvertMarketTypeCollection(MarketType[] remoteMarkets)
        {
            Market[] localMarkets = new Market[remoteMarkets.Length];

            for (int j = 0 ; j < remoteMarkets.Length ; j++)
            {
                MarketType remoteMarket = remoteMarkets[j];

                localMarkets[j] = new Market();
                localMarkets[j].MarketId = remoteMarket.Id;
                localMarkets[j].Name = remoteMarket.Name;
                localMarkets[j].MarketType = remoteMarket.Type;
                localMarkets[j].MarketStatus = remoteMarket.Status;
                localMarkets[j].NoOfWinningSelections = remoteMarket.NumberOfWinningSelections;
                localMarkets[j].StartTime = remoteMarket.StartTime;
                localMarkets[j].WithdrawalSeqNo = remoteMarket.WithdrawalSequenceNumber;
                localMarkets[j].DisplayOrder = remoteMarket.DisplayOrder;
                localMarkets[j].IsEnabledForMultiples = remoteMarket.IsEnabledForMultiples;
                localMarkets[j].IsInRunningAllowed = remoteMarket.IsInRunningAllowed;
                localMarkets[j].ManagedWhenInRunning = remoteMarket.IsManagedWhenInRunning;
                localMarkets[j].InRunningDelaySeconds = remoteMarket.InRunningDelaySeconds;

                // This field is not currently implemented properly.
                localMarkets[j].IsCurrentlyInRunning = remoteMarket.IsCurrentlyInRunning;

                if (remoteMarket.Selections != null)
                    localMarkets[j].Selections = SelectionConverter.ConvertSelectionTypeCollection(remoteMarket.Selections);
            }

            return localMarkets;
        }
示例#3
0
        private void getPricesButton1_Click(object sender, System.EventArgs e)
        {
            const string API_NAME = "GetPrices";
                _logWriter.BeginCall(API_NAME);

                try
                {
                    _currentMarket = _readonlyAgent.GetPrices(selectedMarketId);
                    if (_currentMarket.Selections != null)
                        selectionsGrid.DataSource = DataTableCreator.CreateAndPopulateSelectionsTable(_currentMarket.Selections);

                    _logWriter.EndCall(API_NAME+" marketStatus: "+_currentMarket.MarketStatus);
                }
                catch (Exception ex)
                {
                    _logWriter.FailCall(API_NAME, ex.Message);
                }
        }
示例#4
0
        /// <summary>
        /// Handles when user makes selection from tree, either an event or market.
        /// </summary>
        private void eventsTreeView_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
        {
            ClearIdsOrNames();

            // If not market node selected then just display event name (id) and exit.
            if (e.Node.Text.Length < 6 || e.Node.Text.IndexOf("Market", 0, 6) < 0)
            {
                this.getPricesButton1.Enabled = false;
                if (e.Node.Tag != null)
                    DisplayIdsOrNames(e.Node.Tag.ToString(), e.Node.Text, null, null, null, null);
                return;
            }
            else // Else is market, so display market name (id) and continue on to get selections and prices.
            {
                if (e.Node.Tag != null)
                {
                    DisplayIdsOrNames(e.Node.Parent.Tag.ToString(), e.Node.Parent.Text
                        , e.Node.Tag.ToString(), e.Node.Text.Substring(8)
                        , null, null);
                    this.getPricesButton1.Enabled = true;
                }
            }

            const string API_NAME = "GetPrices";
            _logWriter.BeginCall(API_NAME);

            try
            {
                selectedMarketId = (long)e.Node.Tag;
                _currentMarket = _readonlyAgent.GetPrices((long) e.Node.Tag);
                if (_currentMarket.Selections != null)
                    selectionsGrid.DataSource = DataTableCreator.CreateAndPopulateSelectionsTable(_currentMarket.Selections);

                _logWriter.EndCall(API_NAME+" marketStatus: "+_currentMarket.MarketStatus);
            }
            catch (Exception ex)
            {
                _logWriter.FailCall(API_NAME, ex.Message);
            }
        }