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()); }
public String print() { return(String.Format(KopsHelper.GetLocalInfo(), HtmlResources.ProtocolsHTMLTableResultBody, Place, Number, Names, Rank, Region, Correction, Result)); }
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()); }
public String PrintResult(double res, double sessionMax) { return(String.Format(KopsHelper.GetLocalInfo(), "{0:0.00}%", 100.0 * res / sessionMax)); }