private void printCompetitorField(Structs.Competitor comp,
                                          ref PrintPageEventArgs ev, ref float yPos)
        {
            float xPosHitsPerStn = this.colResult;
            int   nrOfLines      = 1;
            int   hits           = 0;
            int   figureHits     = 0;
            int   points         = 0;

            Structs.CompetitorResult[] compresults =
                CommonCode.GetCompetitorResults(comp.CompetitorId);

            foreach (Structs.CompetitorResult compres in compresults)
            {
                hits       += compres.Hits;
                figureHits += compres.FigureHits;
                points     += compres.Points;

                string strn = compres.Hits.ToString() +
                              "/" + compres.FigureHits.ToString();
                if (xPosHitsPerStn +
                    ev.Graphics.MeasureString(strn, printCompetitorFont).Width >
                    colResultMaxWidth)
                {
                    nrOfLines++;
                    xPosHitsPerStn = this.colResult;
                }
                if (this.NorwegianCount &
                    strn != "")
                {
                    string[] parts    = strn.Split('/');
                    int      thisHits = int.Parse(parts[0]);
                    int      figures  = int.Parse(parts[1]);
                    strn = (thisHits + figures).ToString();
                }
                ev.Graphics.DrawString(strn,
                                       printCompetitorFont, Brushes.Black, xPosHitsPerStn,
                                       yPos + (nrOfLines - 1) *
                                       printCompetitorHeaderFont.GetHeight(),
                                       new StringFormat());
                xPosHitsPerStn += ev.Graphics.MeasureString(strn + "  ",
                                                            printCompetitorFont).Width;
            }

            if (!this.NorwegianCount)
            {
                ev.Graphics.DrawString(hits.ToString() + "/" + figureHits.ToString(),
                                       printCompetitorFont, Brushes.Black, this.colResultTot, yPos, new StringFormat());
            }
            else
            {
                ev.Graphics.DrawString((hits + figureHits).ToString(),
                                       printCompetitorFont, Brushes.Black, this.colResultTot, yPos, new StringFormat());
            }

            ev.Graphics.DrawString(points.ToString(),
                                   printCompetitorFont, Brushes.Black, this.colPoints, yPos, new StringFormat());

            yPos += nrOfLines * this.printCompetitorFont.GetHeight();
        }
Пример #2
0
        private void printTeamMemberResults(PrintPageEventArgs ev, ref float yPos, Structs.Competitor competitor)
        {
            try
            {
                Structs.Shooter shooter = CommonCode.GetShooter(competitor.ShooterId);
                printString(ev, shooter.Surname + " " + shooter.Givenname,
                            printCompetitorFont, this.colTeamResult, yPos, this.colTeamResultTot - this.colTeamResult);

                int hits       = 0;
                int figurehits = 0;
                foreach (Structs.CompetitorResult res in CommonCode.GetCompetitorResults(competitor.CompetitorId))
                {
                    hits       += res.Hits;
                    figurehits += res.FigureHits;
                }

                switch (CompetitionType)
                {
                case Structs.CompetitionTypeEnum.Field:
                {
                    if (competition.NorwegianCount)
                    {
                        printString(ev, (hits + figurehits).ToString(),
                                    printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot);
                    }
                    else
                    {
                        printString(ev, hits.ToString() + "/" + figurehits.ToString(),
                                    printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot);
                    }
                    break;
                }

                case Structs.CompetitionTypeEnum.MagnumField:
                {
                    printString(ev, hits.ToString() + "/" + figurehits.ToString(),
                                printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot);
                    break;
                }

                case Structs.CompetitionTypeEnum.Precision:
                {
                    printString(ev, hits.ToString(),
                                printCompetitorFont, this.colTeamResultTot, yPos, this.colTeamPoints - this.colTeamResultTot);
                    break;
                }

                default:
                    throw new ApplicationException("Unknown CompetitionType");
                }
            }
            catch (Exception exc)
            {
                Trace.WriteLine("CPrintResultlist.printTeamMemberResults Exception: " + exc.ToString());
            }
        }