Ejemplo n.º 1
0
        public static Bet[] ConvertOrderCollection(Order[] remoteOrders)
        {
            if (remoteOrders == null
                || remoteOrders.Length == 0)
                return null;

            Bet[] localOrders = new Bet[remoteOrders.Length];

            for (int j = 0 ; j < remoteOrders.Length ; j++)
            {
                Order remotePrice = remoteOrders[j];

                localOrders[j] = new Bet();
                localOrders[j].OrderId = remotePrice.Id;
                localOrders[j].MarketId = remotePrice.MarketId;
                localOrders[j].SelectionId = remotePrice.SelectionId;
                localOrders[j].SequenceNo = remotePrice.SequenceNumber;
                localOrders[j].IssuedAt = remotePrice.IssuedAt;
                localOrders[j].Polarity = remotePrice.Polarity;
                localOrders[j].UnmatchedStake = remotePrice.UnmatchedStake;
                localOrders[j].RequestedPrice = remotePrice.RequestedPrice;
                localOrders[j].MatchedPrice = remotePrice.MatchedPrice;
                localOrders[j].MatchedStake = remotePrice.MatchedStake;
                localOrders[j].MatchedAgainstStake = remotePrice.MatchedAgainstStake;
                localOrders[j].Status = (OrderStatus) remotePrice.Status;
                localOrders[j].RestrictOrderToBroker = remotePrice.RestrictOrderToBroker;
            }

            return localOrders;
        }
Ejemplo n.º 2
0
        public static long GetMaxSequenceNoFromListOfBets(Bet[] bets)
        {
            if (bets == null)
                return 0;

            return bets[bets.Length - 1].SequenceNo;
        }
Ejemplo n.º 3
0
        public static DataTable CreateAndPopulateBetsTable(Bet[] bets)
        {
            if (bets == null)
                return null;

            DataTable betsTable = CreateBetsTable();
            PopulateBetsTable(bets, betsTable);

            return betsTable;
        }
Ejemplo n.º 4
0
        public static Bet[] CombineTwoBetArrays(Bet[] firstArray, Bet[] secondArray)
        {
            // If they are both null, then will return null;
            if (secondArray == null)
                return firstArray;
            if (firstArray == null)
                return secondArray;

            Bet[] newBets = new Bet[firstArray.Length + secondArray.Length];

            Array.Copy(firstArray, 0, newBets, 0, firstArray.Length);
            Array.Copy(secondArray, 0, newBets, firstArray.Length, secondArray.Length);

            return newBets;
        }
Ejemplo n.º 5
0
        public static void PopulateBetsTable(Bet[] bets, DataTable betsTable)
        {
            foreach (Bet thisBet in bets)
            {
                DataRow newRow = betsTable.NewRow();

                newRow[0] = thisBet.OrderId;
                newRow[1] = thisBet.IssuedAt.ToShortDateString();
                newRow[2] = thisBet.Status.ToString();
                newRow[3] = String.Format("{0:#,##0.00;(#,##0.00);}", thisBet.RequestedPrice);
                newRow[4] = String.Format("{0:#,##0.00;(#,##0.00);}", thisBet.MatchedPrice);
                newRow[5] = String.Format("{0:$#,##0.00;($#,##0.00);}", thisBet.UnmatchedStake);
                newRow[6] = String.Format("{0:$#,##0.00;($#,##0.00);}", thisBet.MatchedStake);
                Polarity polarity = (Polarity) thisBet.Polarity;
                newRow[7] = polarity.ToString();

                betsTable.Rows.Add(newRow);
            }
        }