Exemplo n.º 1
0
        public Playing(int deviceNumber, Table table)
        {
            DeviceNumber = deviceNumber;
            Device device = AppData.DeviceList[deviceNumber];

            BoardNumber = table.BoardNumber;

            // All directionNumbers are relative to the direction that is 0
            int directionNumber      = Utilities.DirectionToNumber(device.Direction);
            int northDirectionNumber = (4 - directionNumber) % 4;

            Direction = new string[4];
            Direction[northDirectionNumber]           = "North";
            Direction[(northDirectionNumber + 1) % 4] = "East";
            Direction[(northDirectionNumber + 2) % 4] = "South";
            Direction[(northDirectionNumber + 3) % 4] = "West";
            PairNumber = new int[4];
            PlayerName = new string[4];
            for (int i = 0; i < 4; i++)
            {
                PairNumber[i] = table.PairNumber[(directionNumber + i) % 4];
                PlayerName[i] = table.PlayerName[(directionNumber + i) % 4];
            }

            if (northDirectionNumber % 2 == 0)
            {
                Vuln02 = Utilities.NSVulnerability[(BoardNumber - 1) % 16];
                Vuln13 = Utilities.EWVulnerability[(BoardNumber - 1) % 16];
            }
            else
            {
                Vuln02 = Utilities.EWVulnerability[(BoardNumber - 1) % 16];
                Vuln13 = Utilities.NSVulnerability[(BoardNumber - 1) % 16];
            }

            // Set default values for no plays
            PlayCounter              = -999;
            LastCardNumber           = -1;
            LastCardString           = "";
            TrickNumber              = 1;
            TricksNS                 = 0;
            TricksEW                 = 0;
            TrickLeadSuit            = "";
            TrickCardString          = new string[4];
            TrickRank                = new int[4];
            TrickSuit                = new string[4];
            TrickDisplayRank         = new string[4];
            TrickDisplaySuit         = new string[4];
            PreviousTrickDisplayRank = new string[4];
            PreviousTrickDisplaySuit = new string[4];
            for (int i = 0; i < 4; i++)
            {
                TrickCardString[i]          = "";
                TrickRank[i]                = 0;
                TrickSuit[i]                = "";
                TrickDisplayRank[i]         = "";
                TrickDisplaySuit[i]         = "";
                PreviousTrickDisplayRank[i] = "";
                PreviousTrickDisplaySuit[i] = "";
            }
            PollInterval = Settings.PollInterval;
            if (AppData.IsIndividual)
            {
                PairOrPlayer = "Player";
            }
            else
            {
                PairOrPlayer = "Pair";
            }
            List <Play> playList = new List <Play>();

            using (OdbcConnection connection = new OdbcConnection(AppData.DBConnectionString))
            {
                connection.Open();

                // Get contract details
                string         SQLString    = $"SELECT [NS/EW], Contract FROM IntermediateData WHERE Section={device.SectionID} AND [Table]={device.TableNumber} AND Round={device.RoundNumber} AND Board={BoardNumber}";
                OdbcCommand    cmd          = new OdbcCommand(SQLString, connection);
                OdbcDataReader reader       = null;
                string         declarerNSEW = "";
                try
                {
                    ODBCRetryHelper.ODBCRetry(() =>
                    {
                        reader = cmd.ExecuteReader();
                        if (reader.Read())
                        {
                            declarerNSEW          = reader.GetString(0);
                            string contractString = reader.GetString(1);
                            string[] temp         = contractString.Split(' ');
                            ContractLevel         = Convert.ToInt32(temp[0]);
                            ContractSuit          = temp[1];
                            if (temp.Length > 2)
                            {
                                ContractX = temp[2];
                            }
                            else
                            {
                                ContractX = "";
                            }
                        }
                    });
                }
                finally
                {
                    reader.Close();
                    cmd.Dispose();
                }
                DisplayContract = Utilities.DisplayContract(ContractLevel, ContractSuit, ContractX);
                if (declarerNSEW == "N")
                {
                    Declarer = "North";
                }
                else if (declarerNSEW == "E")
                {
                    Declarer = "East";
                }
                else if (declarerNSEW == "S")
                {
                    Declarer = "South";
                }
                else if (declarerNSEW == "W")
                {
                    Declarer = "West";
                }
                PlayDirectionNumber  = (northDirectionNumber + Utilities.DirectionToNumber(Declarer) + 1) % 4;
                DummyDirectionNumber = (northDirectionNumber + Utilities.DirectionToNumber(Declarer) + 2) % 4;

                // Get hand records and set cards
                HandRecord handRecord = HandRecords.HandRecordsList.Find(x => x.SectionID == device.SectionID && x.BoardNumber == BoardNumber);
                if (handRecord == null)     // Can't find matching hand record, so use default SectionID = 1
                {
                    handRecord = HandRecords.HandRecordsList.Find(x => x.SectionID == 1 && x.BoardNumber == BoardNumber);
                }
                CardString  = handRecord.HandTable(northDirectionNumber, ContractSuit);
                DisplayRank = new string[4, 13];
                DisplaySuit = new string[4, 13];
                CardPlayed  = new bool[4, 13];
                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 13; j++)
                    {
                        DisplayRank[i, j] = Utilities.DisplayRank(CardString[i, j]);
                        DisplaySuit[i, j] = Utilities.DisplaySuit(CardString[i, j]);
                        CardPlayed[i, j]  = false;
                    }
                }
                SuitLengths = handRecord.SuitLengths(northDirectionNumber, ContractSuit);

                // Check PlayData table for any previous plays
                SQLString = $"SELECT Counter, Direction, Card FROM PlayData WHERE Section={device.SectionID} AND Table={device.TableNumber} AND Round={device.RoundNumber} AND Board={BoardNumber}";
                cmd       = new OdbcCommand(SQLString, connection);
                try
                {
                    ODBCRetryHelper.ODBCRetry(() =>
                    {
                        reader = cmd.ExecuteReader();
                        while (reader.Read())
                        {
                            string tempPlayDirection = reader.GetString(1);
                            string tempCardString    = reader.GetString(2);
                            int tempPlayCounter      = Convert.ToInt32(reader.GetValue(0));
                            if (tempPlayDirection == "N")
                            {
                                tempPlayDirection = "North";
                            }
                            else if (tempPlayDirection == "E")
                            {
                                tempPlayDirection = "East";
                            }
                            else if (tempPlayDirection == "S")
                            {
                                tempPlayDirection = "South";
                            }
                            else if (tempPlayDirection == "W")
                            {
                                tempPlayDirection = "West";
                            }
                            Play play = new Play(tempPlayDirection, 0, tempCardString, tempPlayCounter);
                            playList.Add(play);
                        }
                    });
                }
                finally
                {
                    reader.Close();
                    cmd.Dispose();
                }
            }
            playList.Sort((x, y) => x.PlayCounter.CompareTo(y.PlayCounter));

            // Run through each played card (if any) in turn and work out the implications
            foreach (Play play in playList)
            {
                PlayDirectionNumber = (northDirectionNumber + Utilities.DirectionToNumber(play.PlayDirection)) % 4;
                PlayCounter         = play.PlayCounter;
                int cardNumber;
                for (cardNumber = 0; cardNumber < 13; cardNumber++)
                {
                    if (play.CardString == CardString[PlayDirectionNumber, cardNumber])
                    {
                        break;
                    }
                }
                CardPlayed[PlayDirectionNumber, cardNumber] = true;
                LastCardNumber = cardNumber;
                LastCardString = CardString[PlayDirectionNumber, cardNumber];
                TrickCardString[PlayDirectionNumber]  = LastCardString;
                TrickRank[PlayDirectionNumber]        = Utilities.Rank(LastCardString);
                TrickSuit[PlayDirectionNumber]        = Utilities.Suit(LastCardString);
                TrickDisplayRank[PlayDirectionNumber] = Utilities.DisplayRank(LastCardString);
                TrickDisplaySuit[PlayDirectionNumber] = Utilities.DisplaySuit(LastCardString);
                if (PlayCounter % 4 == 0)  // First card in trick
                {
                    TrickLeadSuit = TrickSuit[PlayDirectionNumber];
                }
                if (PlayCounter % 4 == 3)  // Last card in trick, so find out which card won the trick...
                {
                    int    winningDirectionNumber = -1;
                    string winningSuit            = TrickLeadSuit;
                    int    winningRank            = 0;
                    for (int i = 0; i < 4; i++)
                    {
                        string suit = Utilities.Suit(TrickCardString[i]);
                        int    rank = Utilities.Rank(TrickCardString[i]);
                        if ((winningSuit == TrickLeadSuit && suit == TrickLeadSuit && rank > winningRank) || (winningSuit == ContractSuit && suit == ContractSuit && rank > winningRank))
                        {
                            winningDirectionNumber = i;
                            winningRank            = rank;
                        }
                        else if (TrickLeadSuit != ContractSuit && winningSuit == TrickLeadSuit && suit == ContractSuit)
                        {
                            winningDirectionNumber = i;
                            winningRank            = rank;
                            winningSuit            = ContractSuit;
                        }
                    }

                    // ... and update trick counts
                    if (Direction[winningDirectionNumber] == "North" || Direction[winningDirectionNumber] == "South")
                    {
                        TricksNS++;
                    }
                    else
                    {
                        TricksEW++;
                    }
                    TrickNumber++;

                    if (PlayCounter == 51)  // The unlikely event that all cards played, but no result recorded to database
                    {
                        Result result = new Result(deviceNumber, BoardNumber, "IntermediateData");
                        result.TricksTakenNumber = (Declarer == "North" || Declarer == "South") ? TricksNS : TricksEW;
                        result.UpdateDB("ReceivedData");
                        AppData.TableList.Find(x => x.SectionID == device.SectionID && x.TableNumber == device.TableNumber).PlayComplete = true;
                    }
                    else
                    {
                        PlayDirectionNumber = winningDirectionNumber;

                        // Reset current trick info
                        TrickLeadSuit = "";
                        for (int i = 0; i < 4; i++)
                        {
                            TrickCardString[i]          = "";
                            TrickRank[i]                = 0;
                            TrickSuit[i]                = "";
                            PreviousTrickDisplayRank[i] = TrickDisplayRank[i];
                            PreviousTrickDisplaySuit[i] = TrickDisplaySuit[i];
                            TrickDisplayRank[i]         = "";
                            TrickDisplaySuit[i]         = "";
                        }
                    }
                }
                else
                {
                    // Not last card in trick, so move play on to next hand.  Only used if this is the last played card; otherwise overwritten
                    PlayDirectionNumber = (PlayDirectionNumber + 1) % 4;
                }
            }

            // Update table info
            table.LastPlay = new Play(Utilities.Directions[PlayDirectionNumber], LastCardNumber, LastCardString, PlayCounter);
        }
Exemplo n.º 2
0
        public Bidding(int deviceNumber, Table table)
        {
            DeviceNumber = deviceNumber;
            Device device = AppData.DeviceList[deviceNumber];

            BoardNumber = table.BoardNumber;
            Direction   = device.Direction;
            int directionNumber = Utilities.DirectionToNumber(Direction);

            PairNumber   = table.PairNumber[directionNumber];
            PlayerName   = table.PlayerName[directionNumber];
            NSVulnerable = Utilities.NSVulnerability[(BoardNumber - 1) % 16];
            EWVulnerable = Utilities.EWVulnerability[(BoardNumber - 1) % 16];
            BidTable     = new string[10, 4];
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    BidTable[i, j] = "";
                }
            }
            LastCallDirection = "";
            LastBidLevel      = 0;
            LastBidSuit       = "";
            LastBidX          = "";
            LastBidDirection  = "";
            PassCount         = 0;
            BidCounter        = -1;
            ToBidDirection    = "";
            PollInterval      = Settings.PollInterval;
            if (AppData.IsIndividual)
            {
                PairOrPlayer = "Player";
            }
            else
            {
                PairOrPlayer = "Pair";
            }
            List <DatabaseBid> databaseBidList = new List <DatabaseBid>();

            using (OdbcConnection connection = new OdbcConnection(AppData.DBConnectionString))
            {
                connection.Open();
                Utilities.CheckTabPlayPairNos(connection);
                string         SQLString = $"SELECT Counter, Bid, Direction FROM BiddingData WHERE Section={device.SectionID} AND Table={device.TableNumber} AND Round={device.RoundNumber} AND Board={BoardNumber}";
                OdbcCommand    cmd       = new OdbcCommand(SQLString, connection);
                OdbcDataReader reader    = null;
                try
                {
                    ODBCRetryHelper.ODBCRetry(() =>
                    {
                        reader = cmd.ExecuteReader();
                        while (reader.Read())
                        {
                            int tempCounter         = reader.GetInt32(0);
                            string tempBid          = reader.GetString(1);
                            string tempDirection    = reader.GetString(2);
                            DatabaseBid databaseBid = new DatabaseBid
                            {
                                Counter   = tempCounter,
                                Bid       = tempBid,
                                Direction = tempDirection
                            };
                            databaseBidList.Add(databaseBid);
                        }
                    });
                }
                finally
                {
                    reader.Close();
                    cmd.Dispose();
                }
            }

            databaseBidList.Sort((x, y) => x.Counter.CompareTo(y.Counter));
            foreach (DatabaseBid databaseBid in databaseBidList)
            {
                BidCounter = databaseBid.Counter;
                if (databaseBid.Direction == "N")
                {
                    LastCallDirection = "North";
                    ToBidDirection    = "East";
                }
                else if (databaseBid.Direction == "E")
                {
                    LastCallDirection = "East";
                    ToBidDirection    = "South";
                }
                else if (databaseBid.Direction == "S")
                {
                    LastCallDirection = "South";
                    ToBidDirection    = "West";
                }
                else if (databaseBid.Direction == "W")
                {
                    LastCallDirection = "West";
                    ToBidDirection    = "North";
                }
                if (databaseBid.Bid == "PASS")
                {
                    PassCount++;
                    BidTable[BidCounter / 4, BidCounter % 4] = "<span style='color:darkgreen'>Pass</span>";
                }
                else if (databaseBid.Bid == "x")
                {
                    PassCount = 0;
                    BidTable[BidCounter / 4, BidCounter % 4] = "<span style='color:darkred'>X</span>";
                    LastBidX         = "x";
                    LastBidDirection = LastCallDirection;
                }
                else if (databaseBid.Bid == "xx")
                {
                    PassCount = 0;
                    BidTable[BidCounter / 4, BidCounter % 4] = "<span style='color:darkblue'>XX</span>";
                    LastBidX         = "xx";
                    LastBidDirection = LastCallDirection;
                }
                else
                {
                    LastBidLevel     = Convert.ToInt32(databaseBid.Bid.Substring(0, 1));
                    LastBidX         = "";
                    LastBidDirection = LastCallDirection;
                    LastBidSuit      = databaseBid.Bid.Substring(1);
                    if (LastBidSuit == "S")
                    {
                        BidTable[BidCounter / 4, BidCounter % 4] = LastBidLevel.ToString() + "<span style='color:black'>&spades;</span>";
                    }
                    else if (LastBidSuit == "H")
                    {
                        BidTable[BidCounter / 4, BidCounter % 4] = LastBidLevel.ToString() + "<span style='color:red'>&hearts;</span>";
                    }
                    else if (LastBidSuit == "D")
                    {
                        BidTable[BidCounter / 4, BidCounter % 4] = LastBidLevel.ToString() + "<span style='color:orangered'>&diams;</span>";
                    }
                    else if (LastBidSuit == "C")
                    {
                        BidTable[BidCounter / 4, BidCounter % 4] = LastBidLevel.ToString() + "<span style='color:darkblue'>&clubs;</span>";
                    }
                    else
                    {
                        BidTable[BidCounter / 4, BidCounter % 4] = LastBidLevel.ToString() + "NT";
                    }
                }
            }

            HandRecord handRecord = HandRecords.HandRecordsList.Find(x => x.SectionID == device.SectionID && x.BoardNumber == BoardNumber);

            if (handRecord == null)     // Can't find matching hand record, so use default SectionID = 1
            {
                handRecord = HandRecords.HandRecordsList.Find(x => x.SectionID == 1 && x.BoardNumber == BoardNumber);
            }
            CardString  = handRecord.HandRow(device.Direction);
            DisplayRank = new string[13];
            DisplaySuit = new string[13];
            for (int i = 0; i < 13; i++)
            {
                DisplayRank[i] = Utilities.DisplayRank(CardString[i]);
                DisplaySuit[i] = Utilities.DisplaySuit(CardString[i]);
            }
            Dealer = handRecord.Dealer;

            BidDirections = new string[4];
            int northDirectionNumber = (4 - Utilities.DirectionToNumber(Dealer)) % 4;

            BidDirections[northDirectionNumber]           = "North";
            BidDirections[(northDirectionNumber + 1) % 4] = "East";
            BidDirections[(northDirectionNumber + 2) % 4] = "South";
            BidDirections[(northDirectionNumber + 3) % 4] = "West";

            if (ToBidDirection == "")
            {
                ToBidDirection = Dealer;
            }

            // Set table info
            table.LastBid = new Bid(LastCallDirection, LastBidLevel, LastBidSuit, LastBidX, false, LastBidDirection, PassCount, BidCounter);
        }
Exemplo n.º 3
0
        public static void Set()
        {
            if (HandRecordsList.Count > 0)
            {
                return;                              // Hand records already set
            }
            using (OdbcConnection connection = new OdbcConnection(AppData.DBConnectionString))
            {
                string         SQLString = $"SELECT Section, Board, NorthSpades, NorthHearts, NorthDiamonds, NorthClubs, EastSpades, EastHearts, EastDiamonds, EastClubs, SouthSpades, SouthHearts, SouthDiamonds, SouthClubs, WestSpades, WestHearts, WestDiamonds, WestClubs FROM HandRecord";
                OdbcCommand    cmd       = new OdbcCommand(SQLString, connection);
                OdbcDataReader reader    = null;
                connection.Open();
                try
                {
                    ODBCRetryHelper.ODBCRetry(() =>
                    {
                        reader = cmd.ExecuteReader();
                        while (reader.Read())
                        {
                            HandRecord handRecord = new HandRecord
                            {
                                SectionID     = reader.GetInt16(0),
                                BoardNumber   = reader.GetInt16(1),
                                NorthSpades   = reader.GetString(2),
                                NorthHearts   = reader.GetString(3),
                                NorthDiamonds = reader.GetString(4),
                                NorthClubs    = reader.GetString(5),
                                EastSpades    = reader.GetString(6),
                                EastHearts    = reader.GetString(7),
                                EastDiamonds  = reader.GetString(8),
                                EastClubs     = reader.GetString(9),
                                SouthSpades   = reader.GetString(10),
                                SouthHearts   = reader.GetString(11),
                                SouthDiamonds = reader.GetString(12),
                                SouthClubs    = reader.GetString(13),
                                WestSpades    = reader.GetString(14),
                                WestHearts    = reader.GetString(15),
                                WestDiamonds  = reader.GetString(16),
                                WestClubs     = reader.GetString(17)
                            };
                            handRecord.Dealer = Utilities.GetDealerForBoard(handRecord.BoardNumber);
                            HandRecordsList.Add(handRecord);
                        }
                    });
                }
                finally
                {
                    reader.Close();
                    cmd.Dispose();
                }

                SQLString = $"SELECT Section, Board, NorthSpades, NorthHearts, NorthDiamonds, NorthClubs, NorthNotrump, EastSpades, EastHearts, EastDiamonds, EastClubs, EastNotrump, SouthSpades, SouthHearts, SouthDiamonds, SouthClubs, SouthNotrump, WestSpades, WestHearts, WestDiamonds, WestClubs, WestNoTrump, NorthHcp, EastHcp, SouthHcp, WestHcp FROM HandEvaluation";
                cmd       = new OdbcCommand(SQLString, connection);
                try
                {
                    ODBCRetryHelper.ODBCRetry(() =>
                    {
                        reader = cmd.ExecuteReader();
                        while (reader.Read())
                        {
                            HandRecord handRecord = HandRecordsList.Find(x => x.SectionID == reader.GetInt16(0) && x.BoardNumber == reader.GetInt16(1));
                            if (handRecord != null)
                            {
                                if (reader.GetInt16(2) > 6)
                                {
                                    handRecord.EvalNorthSpades = (reader.GetInt16(2) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalNorthSpades = "";
                                }
                                if (reader.GetInt16(3) > 6)
                                {
                                    handRecord.EvalNorthHearts = (reader.GetInt16(3) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalNorthHearts = "";
                                }
                                if (reader.GetInt16(4) > 6)
                                {
                                    handRecord.EvalNorthDiamonds = (reader.GetInt16(4) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalNorthDiamonds = "";
                                }
                                if (reader.GetInt16(5) > 6)
                                {
                                    handRecord.EvalNorthClubs = (reader.GetInt16(5) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalNorthClubs = "";
                                }
                                if (reader.GetInt16(6) > 6)
                                {
                                    handRecord.EvalNorthNT = (reader.GetInt16(6) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalNorthNT = "";
                                }
                                if (reader.GetInt16(7) > 6)
                                {
                                    handRecord.EvalEastSpades = (reader.GetInt16(7) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalEastSpades = "";
                                }
                                if (reader.GetInt16(8) > 6)
                                {
                                    handRecord.EvalEastHearts = (reader.GetInt16(8) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalEastHearts = "";
                                }
                                if (reader.GetInt16(9) > 6)
                                {
                                    handRecord.EvalEastDiamonds = (reader.GetInt16(9) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalEastDiamonds = "";
                                }
                                if (reader.GetInt16(10) > 6)
                                {
                                    handRecord.EvalEastClubs = (reader.GetInt16(10) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalEastClubs = "";
                                }
                                if (reader.GetInt16(11) > 6)
                                {
                                    handRecord.EvalEastNT = (reader.GetInt16(11) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalEastNT = "";
                                }
                                if (reader.GetInt16(12) > 6)
                                {
                                    handRecord.EvalSouthSpades = (reader.GetInt16(12) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalSouthSpades = "";
                                }
                                if (reader.GetInt16(13) > 6)
                                {
                                    handRecord.EvalSouthHearts = (reader.GetInt16(13) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalSouthHearts = "";
                                }
                                if (reader.GetInt16(14) > 6)
                                {
                                    handRecord.EvalSouthDiamonds = (reader.GetInt16(14) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalSouthDiamonds = "";
                                }
                                if (reader.GetInt16(15) > 6)
                                {
                                    handRecord.EvalSouthClubs = (reader.GetInt16(15) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalSouthClubs = "";
                                }
                                if (reader.GetInt16(16) > 6)
                                {
                                    handRecord.EvalSouthNT = (reader.GetInt16(16) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalSouthNT = "";
                                }
                                if (reader.GetInt16(17) > 6)
                                {
                                    handRecord.EvalWestSpades = (reader.GetInt16(17) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalWestSpades = "";
                                }
                                if (reader.GetInt16(18) > 6)
                                {
                                    handRecord.EvalWestHearts = (reader.GetInt16(18) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalWestHearts = "";
                                }
                                if (reader.GetInt16(19) > 6)
                                {
                                    handRecord.EvalWestDiamonds = (reader.GetInt16(19) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalWestDiamonds = "";
                                }
                                if (reader.GetInt16(20) > 6)
                                {
                                    handRecord.EvalWestClubs = (reader.GetInt16(20) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalWestClubs = "";
                                }
                                if (reader.GetInt16(21) > 6)
                                {
                                    handRecord.EvalWestNT = (reader.GetInt16(21) - 6).ToString();
                                }
                                else
                                {
                                    handRecord.EvalWestNT = "";
                                }

                                handRecord.HCPNorth = reader.GetInt16(22).ToString();
                                handRecord.HCPEast  = reader.GetInt16(23).ToString();
                                handRecord.HCPSouth = reader.GetInt16(24).ToString();
                                handRecord.HCPWest  = reader.GetInt16(25).ToString();
                            }
                        }
                    });
                }
                catch (OdbcException e)
                {
                    if (e.Errors.Count > 1 || e.Errors[0].SQLState != "42S02")  // Error other than HandEvaluation table does not exist
                    {
                        throw (e);
                    }
                }
                finally
                {
                    reader.Close();
                    cmd.Dispose();
                }
            }
            return;
        }