Beispiel #1
0
        private void printShooter(PrintPageEventArgs ev,
                                  Structs.Shooter shooter, ref float yPos)
        {
            Structs.Competitor[] competitors =
                CommonCode.GetCompetitors(shooter.ShooterId, "PatrolId");

            foreach (Structs.Competitor comp in competitors)
            {
                if (comp.PatrolId > 0)
                {
                    Structs.Patrol patrol = CommonCode.GetPatrol(comp.PatrolId);
                    ev.Graphics.DrawString(patrol.StartDateTimeDisplay.ToShortTimeString(),
                                           printCompetitorFont, Brushes.Black, LeftMargin + tab1, yPos,
                                           new StringFormat());

                    ev.Graphics.DrawString(patrol.PatrolId.ToString(),
                                           printCompetitorFont, Brushes.Black, LeftMargin + tab2, yPos,
                                           new StringFormat());
                }
                Structs.Weapon weapon = CommonCode.GetWeapon(comp.WeaponId);
                ev.Graphics.DrawString(weapon.Manufacturer + ", " +
                                       weapon.Model + "(" + comp.WeaponId + ")",
                                       printCompetitorFont, Brushes.Black, LeftMargin + tab3, yPos,
                                       new StringFormat());
                yPos += printHeaderFont.GetHeight();
            }

            currentShooter++;
        }
Beispiel #2
0
        //Override OnBeginPrint to set up the font we are going to use
        protected override void OnBeginPrint(PrintEventArgs ev)
        {
            base.OnBeginPrint(ev);

            competitors = CommonCode.GetCompetitors(Patrol);

            labelDocument = CommonCode.Settings.PrinterSettings.LabelResultDocument;
            printFont     = new Font(labelDocument.FontName, labelDocument.FontSize,
                                     System.Drawing.FontStyle.Regular);
        }
        //Override OnBeginPrint to set up the font we are going to use
        protected override void OnBeginPrint(PrintEventArgs ev)
        {
            base.OnBeginPrint(ev);

            _competitors = _commonCode.GetCompetitors();
            _nrofseries  = _commonCode.GetStationsCount();
            _competition = _commonCode.GetCompetitions()[0];

            _labelDocument = _commonCode.Settings.PrinterSettings.LabelMirrorPrintDocument;
            _printFont     = new Font(_labelDocument.FontName, _labelDocument.FontSize,
                                      FontStyle.Regular);
        }
        private void printPatrol(ref PrintPageEventArgs ev, ref float yPos, int tab)
        {
            printPatrolHeader(ref ev, ref yPos, tab);
            Structs.Competitor[] comps = CommonCode.GetCompetitors(this.patrol, "Lane");

            foreach (Structs.Competitor comp in comps)
            {
                Structs.Shooter shooter = CommonCode.GetShooter(comp.ShooterId);
                Structs.Club    club    = CommonCode.GetClub(shooter.ClubId);

                ev.Graphics.DrawString(comp.Lane.ToString(),
                                       printCompetitorFont, Brushes.Black, this.colLane, yPos, new StringFormat());


                string name = shooter.Givenname + ", " + shooter.Surname;
                while (ev.Graphics.MeasureString(name, printCompetitorFont).Width > (colClub - colName))
                {
                    name = name.Substring(0, name.Length - 1);
                }
                ev.Graphics.DrawString(name,
                                       printCompetitorFont, Brushes.Black, this.colName, yPos, new StringFormat());


                string clubString = club.Name;
                while (ev.Graphics.MeasureString(clubString, printCompetitorFont).Width > (colResult - colClub))
                {
                    clubString = clubString.Substring(0, clubString.Length - 1);
                }
                ev.Graphics.DrawString(clubString,
                                       printCompetitorFont, Brushes.Black, colClub, yPos, new StringFormat());

                switch (CompetitionType)
                {
                case Structs.CompetitionTypeEnum.Field:
                    printCompetitorField(comp, ref ev, ref yPos);
                    break;

                case Structs.CompetitionTypeEnum.MagnumField:
                    printCompetitorMagnumField(comp, ref ev, ref yPos);
                    break;

                case Structs.CompetitionTypeEnum.Precision:
                    printCompetitorPrecision(comp, ref ev, ref yPos);
                    break;

                default:
                    throw new ApplicationException("Unknown CompetitionType");
                }
            }
        }
        private void printPatrol(PrintPageEventArgs ev, Structs.Patrol patrol, ref float yPos, int maxLanes)
        {
            placeLeftHeaderX = ev.PageBounds.Left + 10;
            placeLeftHeaderX = leftMargin;

            //placeClubX = (ev.PageBounds.Right - ev.PageBounds.Left)/2 + ev.PageBounds.Left;
            placeNameX = 80 + ev.PageBounds.Left;
            placeNameX = placeLeftHeaderX + 70;

            // Print competitorheader
            //ev.Graphics.DrawString("Namn",
            //	printCompetitorHeaderFont, Brushes.Black, placeNameX, yPos,
            //	new StringFormat());

            //yPos += printHeaderFont.GetHeight();

            // Print competitors
            for (int thisLane = lastPrintedLane + 1; thisLane <= maxLanes; thisLane++)
            {
                bool laneFound = false;
                lastPrintedLane = thisLane;
                foreach (Structs.Competitor comp in CommonCode.GetCompetitors(patrol, "Lane"))
                {
                    if (comp.Lane == thisLane)
                    {
                        laneFound = true;
                        printThisCompetitor(ev, comp, ref yPos);
                        yPos += this.printCompetitorFont.GetHeight() / 2;
                    }
                }
                if (!laneFound)
                {
                    printEmptyCompetitor(ev, ref yPos, thisLane);
                    yPos += this.printCompetitorFont.GetHeight() / 2;
                }

                if (yPos + heightOfOneCompetitor > (ev.PageBounds.Height - 2 * printHeaderFont.GetHeight() - 20) &
                    thisLane < maxLanes)
                {
                    return;
                }
            }
            currentPatrol++;
            lastPrintedLane = 0;
        }
Beispiel #6
0
        private void populateCompetitors()
        {
            Trace.WriteLine("FCompetitors: DdClubs_SelectedIndexChanged() " +
                            "started on thread \"" +
                            Thread.CurrentThread.Name +
                            "\" ( " +
                            Thread.CurrentThread.ManagedThreadId.ToString() +
                            " )");

            Structs.Club club =
                CommonCode.GetClub(
                    (string)this.DdClubs.SelectedValue);
            Structs.ResultWeaponsClass wclass =
                (Structs.ResultWeaponsClass)
                    (int) this.ddWeaponClass.SelectedValue;

            // Get all shooters that belong to the current club and
            // have a competitor with the current class
            //Structs.Shooter[] shooters = CommonCode.GetShooters(club, wclass);
            Structs.Competitor[] comps = CommonCode.GetCompetitors(club, wclass, "Surname, Givenname");

            DatasetTeams ds1 = new DatasetTeams();
            DatasetTeams ds2 = new DatasetTeams();
            DatasetTeams ds3 = new DatasetTeams();
            DatasetTeams ds4 = new DatasetTeams();
            DatasetTeams ds5 = new DatasetTeams();

            shooters = new Hashtable();
            addShootersToDS(ds1, comps);
            addShootersToDS(ds2, comps);
            addShootersToDS(ds3, comps);
            addShootersToDS(ds4, comps);
            addShootersToDS(ds5, comps);

            // Bind the dropdowns to the datatable
            this.ddCompetitor1.DataSource = ds1.Competitors;
            this.ddCompetitor2.DataSource = ds2.Competitors;
            this.ddCompetitor3.DataSource = ds3.Competitors;
            this.ddCompetitor4.DataSource = ds4.Competitors;
            this.ddCompetitor5.DataSource = ds5.Competitors;

            Trace.WriteLine("FCompetitors: DdClubs_SelectedIndexChanged() ended.");
        }
Beispiel #7
0
        private void populatePatrol(Structs.Patrol thisPatrol)
        {
            Trace.WriteLine("FPatrol: populatePatrol started on thread \"" +
                            Thread.CurrentThread.Name + "\" ( " +
                            Thread.CurrentThread.ManagedThreadId.ToString() + " )");

            this.datasetPatrol.shooters.Clear();

            // Populate list with competitors from this patrol
            Structs.Competitor[] competitors =
                CommonCode.GetCompetitors(thisPatrol, "Lane");

            foreach (Structs.Competitor competitor in competitors)
            {
                DatasetPatrol.shootersRow patrolRow =
                    this.datasetPatrol.shooters.NewshootersRow();

                // Fetch data for row
                Structs.Shooter shooter =
                    CommonCode.GetShooter(competitor.ShooterId);
                Structs.Club club =
                    CommonCode.GetClub(shooter.ClubId);
                Structs.Weapon weapon =
                    CommonCode.GetWeapon(competitor.WeaponId);

                // Populate row
                patrolRow.Move         = false;
                patrolRow.competitorId = competitor.CompetitorId;
                patrolRow.Name         = shooter.Givenname + " " + shooter.Surname;
                patrolRow.Club         = club.Name;
                patrolRow.Weapon       = weapon.Manufacturer + "," +
                                         weapon.Model + "," +
                                         weapon.Caliber;
                patrolRow.Lane        = competitor.Lane;
                patrolRow.WeaponClass = weapon.WClass.ToString().Substring(0, 1);

                this.datasetPatrol.shooters.AddshootersRow(patrolRow);
            }
            Trace.WriteLine("FPatrol: populatePatrol ended.");
        }