private float calculateTeamHeight(ResultsReturnTeam result) { float teamHeight = printCompetitorHeaderFont.GetHeight(); Structs.Team team = CommonCode.GetTeam(result.TeamId); int nrCompetitors = team.CompetitorIds.Count; return(teamHeight * (2 + nrCompetitors)); }
private void printTeamMembersResults(PrintPageEventArgs ev, ref float yPos, ResultsReturnTeam result) { Structs.Team team = CommonCode.GetTeam(result.TeamId); foreach (int compid in (int[])team.CompetitorIds.ToArray(typeof(int))) { Structs.Competitor comp = CommonCode.GetCompetitor(compid); printTeamMemberResults(ev, ref yPos, comp); yPos += printCompetitorFont.GetHeight(); } }
double calculateTeamHeight(ResultsReturnTeam result) { Structs.Team team = myInterface.GetTeam(result.TeamId); if (team.CompetitorIds == null) { return(conversionPixelsToMM * fontSize); } else { return(conversionPixelsToMM * fontSize * (1 + team.CompetitorIds.Count)); } }
private bool printTeamResults(PrintPageEventArgs ev, ref float yPos, int tab) { printHeader(ev, ref yPos, tab); this.printHeaderTeam(ev, ref yPos); if (teamresults == null) { teamresults = CommonCode.ResultsGetTeams( this.wclass, this.competition); } //int place=0; //foreach(ResultsReturnTeam result in teamresults) for (int i = currentTeamCheck; i < teamresults.Length; i++) { ResultsReturnTeam result = teamresults[i]; bool printThisTeam = true; if (this.clubId != null) { if (this.clubId != result.ClubId) { printThisTeam = false; } else { printThisTeam = true; } } if (printThisTeam) { if (yPos + calculateTeamHeight(result) > ev.MarginBounds.Bottom) { currentTeamCheck = i; return(true); } currentTeamPlace++; printTeamResult(ev, ref yPos, currentTeamPlace, result); printTeamMembersResults(ev, ref yPos, result); // Ok, done printing. Draw line beneath the shooter. yPos += 1; ev.Graphics.DrawLine(new Pen(Brushes.Black, 1), new PointF(this.LeftMargin, yPos - 1), new PointF(this.RightMargin, yPos - 1)); } } return(false); }
private ResultsReturnTeam[] convertIntoArray(DSResults results) { ResultsReturnTeam[] returnArray = new ResultsReturnTeam[results.TeamResults.Count]; int i = 0; foreach (DSResults.TeamResultsRow row in results.TeamResults) { returnArray[i] = new ResultsReturnTeam(); returnArray[i].ClubId = row.ClubId; returnArray[i].TeamId = row.TeamId; returnArray[i].Hits = row.Hits; returnArray[i].Points = row.Points; returnArray[i].TeamName = row.TeamName; returnArray[i].FigureHits = row.FigureHits; returnArray[i].HitsPerStn = row.HitsPerStn; i++; } return(returnArray); }
private double writeResultsTeam(pdfPage page, double yPos, ResultsReturnTeam result, int place) { double newYPos = yPos; Structs.Club club = myInterface.GetClub(result.ClubId); if (competition.CompetitionId == 0) { competition = myInterface.GetCompetitions()[0]; } addText(page, place.ToString(), this.leftMargin, yPos, font, fontResultSize); addText(page, result.TeamName, this.colResultNamePos, yPos, colResultClubPos - colResultNamePos, font, fontResultSize); addText(page, club.Name, this.colResultClubPos, yPos, colResultResultPos - colResultClubPos, font, fontResultSize); switch (competition.Type) { case Structs.CompetitionTypeEnum.Field: { if (competition.NorwegianCount) { addText(page, (result.Hits + result.FigureHits).ToString(), colResultTotPos, yPos, font, fontResultSize); } else { addText(page, result.Hits.ToString() + "/" + result.FigureHits.ToString(), colResultTotPos, yPos, font, fontResultSize); } addText(page, result.Points.ToString(), this.colResultPointsPos, yPos, font, fontResultSize); break; } case Structs.CompetitionTypeEnum.Precision: { addText(page, result.Hits.ToString(), this.colResultPointsPos, yPos, font, fontResultSize); break; } default: throw new ApplicationException("Not implemented yet"); } /*if (competition.UsePriceMoney && * result.PriceMoney != 0) * { * newYPos = addText(page, result.PriceMoney.ToString() + ":-", * this.colResultPricePos, yPos, font, fontResultSize); * }*/ string[] HitsPerStn = result.HitsPerStn.Split(';'); double xPos = colResultResultPos; double xMaxPos = colResultTotPos; foreach (string thisStn in HitsPerStn) { int maxXSizeInPoints = (int)((xMaxPos - xPos) / conversionPixelsToMM); if (font.getWordWidth(thisStn, fontSize) > maxXSizeInPoints) { xPos = colResultResultPos; yPos = newYPos; } newYPos = addText(page, thisStn, xPos, yPos, font, fontResultSize); xPos += conversionPixelsToMM * font.getWordWidth(thisStn, fontSize); } Structs.Team team = myInterface.GetTeam(result.TeamId); foreach (int compid in (int[])team.CompetitorIds.ToArray(typeof(int))) { newYPos = writeResultsTeam(page, newYPos, colResultResultPos, colResultTotPos, compid); } return(newYPos); }
private void printTeamResult(PrintPageEventArgs ev, ref float yPos, int place, ResultsReturnTeam result) { int nrOfLinesThisResult = 1; printString(ev, place.ToString(), printCompetitorFont, this.colTeamPlace, yPos, this.colTeamClub - this.colTeamPlace); printString(ev, CommonCode.GetClub(result.ClubId).Name, printCompetitorFont, this.colTeamClub, yPos, this.colTeamName - this.colTeamClub); printString(ev, result.TeamName, printCompetitorFont, this.colTeamName, yPos, this.colTeamResult - this.colTeamName); float xPosHitsPerStn = this.colTeamResult; foreach (string strnTemp in result.HitsPerStn.Split(';')) { string strn = strnTemp; if (xPosHitsPerStn + ev.Graphics.MeasureString(strn, printCompetitorFont).Width > colTeamResultMaxWidth) { nrOfLinesThisResult++; xPosHitsPerStn = this.colTeamResult; } if (strn != "") { switch (CompetitionType) { case Structs.CompetitionTypeEnum.Field: if (!competition.NorwegianCount) { string[] parts = strn.Split('/'); int hits = int.Parse(parts[0]); int figures = int.Parse(parts[1]); strn = hits.ToString(); } else { } break; case Structs.CompetitionTypeEnum.MagnumField: if (!competition.NorwegianCount) { string[] parts = strn.Split('/'); int hits = int.Parse(parts[0]); int figures = int.Parse(parts[1]); strn = hits.ToString(); } else { } break; case Structs.CompetitionTypeEnum.Precision: break; } } ev.Graphics.DrawString(strn, printCompetitorFont, Brushes.Black, xPosHitsPerStn, yPos + (nrOfLinesThisResult - 1) * printCompetitorHeaderFont.GetHeight(), new StringFormat()); xPosHitsPerStn += ev.Graphics.MeasureString(strn + " ", printCompetitorFont).Width; } switch (CompetitionType) { case Structs.CompetitionTypeEnum.Field: { if (competition.NorwegianCount) { printString(ev, (result.Hits + result.FigureHits).ToString(), printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot); } else { printString(ev, result.Hits.ToString() + "/" + result.FigureHits.ToString(), printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot); } printString(ev, result.Points.ToString(), printCompetitorFont, this.colTeamPoints, yPos, this.RightMargin - this.colTeamPoints); break; } case Structs.CompetitionTypeEnum.MagnumField: { printString(ev, result.Hits.ToString() + "/" + result.FigureHits.ToString(), printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot); printString(ev, result.Points.ToString(), printCompetitorFont, this.colTeamPoints, yPos, this.RightMargin - this.colTeamPoints); break; } case Structs.CompetitionTypeEnum.Precision: { printString(ev, result.Hits.ToString(), printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot); break; } default: throw new ApplicationException("Unknown CompetitionType"); } yPos += nrOfLinesThisResult * printCompetitorHeaderFont.GetHeight(); }