public static void AppendAuction(StringBuilder html, Auction auction)
        {
            if (auction == null)
            {
                return;
            }
            html.Append("<div>");
            html.Append("<table cellspacing=\"0\" cellpadding=\"4\" border=\"1px\">");
            html.Append("<colgroup><col span=\"4\" align=\"center\"/></colgroup>");
            html.Append("<tr>");
            html.Append("<th><b>"
                        + HTMLDirectionMapper.GetstringFromDirection(Direction.West)
                        + "</b></th>");
            html.Append("<th><b>"
                        + HTMLDirectionMapper.GetstringFromDirection(Direction.North)
                        + "</b></th>");
            html.Append("<th><b>"
                        + HTMLDirectionMapper.GetstringFromDirection(Direction.East)
                        + "</b></th>");
            html.Append("<th><b>"
                        + HTMLDirectionMapper.GetstringFromDirection(Direction.South)
                        + "</b></th></tr>");

            // Make "balanced" array of bids:
            var bids = new List <Bid>();

            if (auction.Dealer == Direction.South)
            {
                bids.Add(null);
                bids.Add(null);
                bids.Add(null);
            }
            if (auction.Dealer == Direction.East)
            {
                bids.Add(null);
                bids.Add(null);
            }
            if (auction.Dealer == Direction.West)
            {
                bids.Add(null);
            }
            bids.AddRange(auction.Bids);

            for (int i = 0; i < (bids.Count / 4) + 1; i++)
            {
                int ix = i * 4;
                html.Append("<tr>");
                AddBid(html, bids, ix);
                AddBid(html, bids, ix + 1);
                AddBid(html, bids, ix + 2);
                AddBid(html, bids, ix + 3);
                html.Append("</tr>");
            }

            html.Append("</table></div>");
        }
示例#2
0
        public static void AppendDeal(StringBuilder html, Deal deal,
                                      Direction dealer, Vulnerability vulnerability)
        {
            if (deal == null)
            {
                return;
            }
            html.Append("<div class=\"diagram\">");
            html.Append("<div class=\"header\">");
            html.Append("<div>Dealer: "
                        + HTMLDirectionMapper.GetstringFromDirection(dealer) + "</div>");
            html.Append("<div>Vuln: "
                        + HTMLVulnerabilityMapper.GetstringFromVulnerability(vulnerability)
                        + "</div>");
            html.Append("</div>");

            AppendHand(html, deal.North, "north", "North");
            AppendHand(html, deal.West, "west", "West");
            AppendHand(html, deal.East, "east", "East");
            AppendHand(html, deal.South, "south", "South");

            html.Append("</div>");
        }