Beispiel #1
0
        public String PrintPlayerHistory(int n)
        {
            StringBuilder res = new StringBuilder();

            res.Append(
                PrintTitle(
                    String.Format(KopsHelper.GetLocalInfo(), HtmlResources.ProtocolsHTMLTableHistoryHeader,
                                  n,
                                  Pairs.GetPairNames(Pairs.GetInternalPairNumber(n)),
                                  Pairs.GetPairRank(Pairs.GetInternalPairNumber(n)),
                                  Pairs.GetPairRegion(Pairs.GetInternalPairNumber(n))
                                  )
                    )
                );

            res.Append(HtmlResources.histHead);

            res.Append(PrintPlayerHistoryRows(n));

            if (sessionMax > 0)
            {
                res.AppendFormat(KopsHelper.GetLocalInfo(), HtmlResources.ProtocolsHTMLTableHistoryFooter,
                                 scoringMethod.PrintResult(sessionResults[n].Value),
                                 scoringMethod.PrintResult(sessionResults[n].Key));
            }

            res.Append("</table>");

            return(res.ToString());
        }
Beispiel #2
0
 public Player(String name)
 {
     this.name = name.Substring(0, 17).Trim();
     if (!name.Substring(17, 4).Trim().Equals(String.Empty))
     {
         this.wk = KopsHelper.GetDoubleFromString(name.Substring(17, 4).Trim());
     }
     else
     {
         this.wk = 0;
     }
     this.location = name.Substring(21, 5).Trim();
 }
Beispiel #3
0
 public String print()
 {
     return(String.Format(KopsHelper.GetLocalInfo(), HtmlResources.ProtocolsHTMLTableResultBody,
                          Place, Number, Names, Rank, Region, Correction, Result));
 }
Beispiel #4
0
        public String PrintPlayerHistoryRows(int n)
        {
            StringBuilder res = new StringBuilder();

            for (int i = 0; i < boards.Count; i++)
            {
                int    round = i / dealsPerRound;
                int    op    = 0;
                String line  = "";

                KopsDeal          deal   = null;
                Nullable <double> result = null;

                for (int j = 0; j < movement.Deals(round); j++)
                {
                    bool wrongLine = boards[i].GetDeal(j).line;

                    if ((wrongLine && Pairs.GetPairNumber(movement.GetNS(round, j)) == n) ||
                        (!wrongLine && Pairs.GetPairNumber(movement.GetEW(round, j)) == n))
                    {
                        line   = "NS";
                        op     = wrongLine ? movement.GetEW(round, j) : movement.GetNS(round, j);
                        deal   = boards[i].GetDeal(j);
                        result = boards[i].GetDeal(j).GetNSResult();
                    }
                    else if ((wrongLine && Pairs.GetPairNumber(movement.GetEW(round, j)) == n) ||
                             (!wrongLine && Pairs.GetPairNumber(movement.GetNS(round, j)) == n))
                    {
                        line   = "EW";
                        op     = wrongLine ? movement.GetNS(round, j) : movement.GetEW(round, j);
                        deal   = boards[i].GetDeal(j);
                        result = boards[i].GetDeal(j).GetEWResult();
                    }
                }
                if (op != 0)
                {
                    if (i % dealsPerRound == 0)
                    {
                        int pairInternalNumber = Pairs.GetInternalPairNumber(Pairs.GetPairNumber(op));
                        res.AppendFormat(KopsHelper.GetLocalInfo(), @"<tr><td class=""right nbr1"" rowspan=""{0}"">{1}</td>
                         <td class=""nbr"" rowspan=""{0}"">{2}</td>
                            <td class=""right nbr"" rowspan=""{0}"">{3}</td>
                             <td class=""nbr"" rowspan=""{0}"">{4}</td>",
                                         dealsPerRound,
                                         Pairs.GetPairNumber(op),
                                         Pairs.GetPairNames(pairInternalNumber),
                                         Pairs.GetPairRank(pairInternalNumber) > 0 ?
                                         String.Format(KopsHelper.GetLocalInfo(), "{0:0.0}",
                                                       Pairs.GetPairRank(pairInternalNumber)) : "",
                                         Pairs.GetPairRegion(pairInternalNumber));
                    }
                    else
                    {
                        res.Append("<tr>");
                    }

                    res.AppendFormat(KopsHelper.GetLocalInfo(), @"<td class=""right"">{0}</td><td>{1}</td>{2}<td class=""right"">{3}</td></tr>",
                                     boards[i].GetBoardNumber(),
                                     line, deal.GetHtml(line.Equals("NS") ? 1 : -1).print(),
                                     result.HasValue ? scoringMethod.PrintResult(result.Value, 2.0 * maxNumberOfRecords - 2.0) :
                                     "");
                }
            }

            return(res.ToString());
        }
Beispiel #5
0
 public String PrintResult(double res, double sessionMax)
 {
     return(String.Format(KopsHelper.GetLocalInfo(), "{0:0.00}%", 100.0 * res / sessionMax));
 }