private double writePatrolByClub(ref pdfPage page, Structs.Shooter[] shooters, ref double yPos) { Structs.Club club = myInterface.GetClub(shooters[0].ClubId); if (yPos + conversionPixelsToMM * (2 * fontSize + fontHeaderSize) > bottomMargin) { // Paging page = getNewPage(ref yPos); yPos = writePatrolByClubHeader(page, yPos); } addText(page, club.ClubId, columnPatrolsByClubClubIdPos, yPos, fontHeader, fontHeaderSize); yPos = addText(page, club.Name, columnPatrolsByClubNamePos, yPos, fontHeader, fontHeaderSize); foreach (Structs.Shooter shooter in shooters) { if (yPos + 2 * conversionPixelsToMM * fontSize > bottomMargin) { // Paging page = getNewPage(ref yPos); yPos = writePatrolByClubHeader(page, yPos); } foreach (Structs.Competitor comp in myInterface.GetCompetitors(shooter.ShooterId, "PatrolId")) { if (yPos + 2 * conversionPixelsToMM * fontSize > bottomMargin) { // Paging page = getNewPage(ref yPos); yPos = writePatrolByClubHeader(page, yPos); } if (comp.PatrolId >= 1) { Structs.Patrol patrol = myInterface.GetPatrol(comp.PatrolId); string weaponText = getWeapon(myInterface.GetWeapon(comp.WeaponId)); addText(page, shooter.Givenname + ", " + shooter.Surname, columnPatrolsByClubNamePos, yPos, font, fontSize); addText(page, patrol.PatrolId.ToString() + " (" + patrol.StartDateTimeDisplay.ToShortTimeString() + ")", columnPatrolsByClubPatrolPos, yPos, font, fontSize); addText(page, weaponText, columnPatrolsByClubWeaponPos, yPos, font, fontSize); Structs.ShootersClassShort sc = (Structs.ShootersClassShort)(int) comp.ShooterClass; string classText = sc.ToString().Replace("Klass", "").Replace("Damklass", "D"); classText += myInterface.GetWeapon(comp.WeaponId).WClass.ToString().Substring(0, 1); yPos = addText(page, classText, columnPatrolsByClubClassPos, yPos, font, fontSize); yPos += 1; } } } return(yPos + 5); }
private string getShooterClassString(Structs.Competitor comp) { string toReturn = ""; Structs.Weapon weapon = CommonCode.GetWeapon(comp.WeaponId); toReturn += CommonCode.ConvertWeaponsClassToResultClass(weapon.WClass).ToString(); Structs.ShootersClassShort shortSC = (Structs.ShootersClassShort)comp.ShooterClass; toReturn += shortSC.ToString() .Replace("Klass", ""); return(toReturn); }
private double writeResultsClassHeader(pdfPage page, double yPos, Structs.ResultWeaponsClass wclass, Structs.ShootersClass uclass) { Structs.ShootersClassShort uclassshort = (Structs.ShootersClassShort)(int) uclass; string klass = uclassshort.ToString().Replace("Klass", "") + wclass.ToString(); addText(page, "Klass:", leftMargin, yPos, fontCompetitionHeader, fontCompetitionHeaderSize); yPos = addText(page, klass, leftMargin + 30, yPos, fontCompetitionHeader, fontCompetitionHeaderSize); yPos = yPos + 4; return(yPos); }
private void printThisCompetitor(PrintPageEventArgs ev, Structs.Competitor comp, ref float yPos) { Structs.Shooter shooter = CommonCode.GetShooter(comp.ShooterId); Structs.Club club = CommonCode.GetClub(shooter.ClubId); Structs.Weapon weapon = CommonCode.GetWeapon(comp.WeaponId); // Print name string shooterName = shooter.Surname + " " + shooter.Givenname + ", " + club.Name; ev.Graphics.DrawString(shooterName, printCompetitorFont, Brushes.Black, placeNameX, yPos, new StringFormat()); // Print Club /*ev.Graphics.DrawString(club.Name, * printCompetitorFont, Brushes.Black, placeClubX, yPos, * new StringFormat());*/ // Print weaponsgroup ev.Graphics.DrawString(weapon.WClass.ToString(), printCompetitorFont, Brushes.Black, placeLeftHeaderX, yPos + 2 * printCompetitorFont.Height, new StringFormat()); // Print shooterclass Structs.ShootersClassShort sclassshort = (Structs.ShootersClassShort) (int) comp.ShooterClass; ev.Graphics.DrawString(sclassshort.ToString(), printCompetitorFont, Brushes.Black, placeLeftHeaderX, yPos + 4 * printCompetitorFont.Height, new StringFormat()); // Print weapon if (comp.WeaponId.ToLower().IndexOf("unknown") == -1) { ev.Graphics.DrawString(comp.WeaponId.Replace("Unknown", ""), printCompetitorFont, Brushes.Black, placeLeftHeaderX, yPos + 6 * printCompetitorFont.Height, new StringFormat()); } // Draw "arrived" checkbox float size = printCompetitorFont.Height; float left = placeNameX + ev.Graphics.MeasureString(shooterName, printCompetitorFont).Width + 10; float height = yPos; ev.Graphics.DrawString("Ankommit", printCompetitorFont, Brushes.Black, left + size, height, new StringFormat()); Pen pen = new Pen(Brushes.Black, 2); ev.Graphics.DrawLine(pen, left, height, left + size, height); ev.Graphics.DrawLine(pen, left, height + size, left + size, height + size); ev.Graphics.DrawLine(pen, left, height, left, height + size); ev.Graphics.DrawLine(pen, left + size, height, left + size, height + size); if (shooter.Arrived) { ev.Graphics.DrawLine(pen, left, height, left + size, height + size); ev.Graphics.DrawLine(pen, left + size, height, left, height + size); } printEmptyCompetitor(ev, ref yPos, comp.Lane); }
DSInternetExport getShootersForPatrolExportByClub() { DSInternetExport toReturn = new DSInternetExport(); Hashtable shooters = new Hashtable(); Hashtable clubs = new Hashtable(); Hashtable weapons = new Hashtable(); foreach (Structs.Competitor comp in myInterface.GetCompetitors()) { if (comp.PatrolId != -1 & comp.Lane != -1) { DSInternetExport.PatrolsByClubRow newRow = toReturn.PatrolsByClub.NewPatrolsByClubRow(); newRow.PatrolId = comp.PatrolId; newRow.Lane = comp.Lane; Structs.Shooter shooter; if (shooters.Contains(comp.ShooterId)) { shooter = (Structs.Shooter)shooters[comp.ShooterId]; } else { shooter = myInterface.GetShooter(comp.ShooterId); shooters.Add(comp.ShooterId, shooter); } newRow.ShooterName = shooter.Surname + " " + shooter.Givenname; newRow.Payed = shooter.Payed; Structs.Club club; if (clubs.Contains(shooter.ClubId)) { club = (Structs.Club)clubs[shooter.ClubId]; } else { club = myInterface.GetClub(shooter.ClubId); clubs.Add(shooter.ClubId, club); } newRow.ClubName = club.Name; newRow.ClubId = shooter.ClubId; Structs.Patrol patrol = myInterface.GetPatrol(comp.PatrolId); newRow.Start = patrol.StartDateTimeDisplay; Structs.Weapon weapon; if (weapons.Contains(comp.WeaponId)) { weapon = (Structs.Weapon)weapons[comp.WeaponId]; } else { weapon = myInterface.GetWeapon(comp.WeaponId); weapons.Add(comp.WeaponId, weapon); } newRow.Weapon = weapon.Manufacturer; newRow.WeaponCaliber = weapon.Caliber; Structs.ShootersClassShort shootershort = (Structs.ShootersClassShort) (int) comp.ShooterClass; newRow.ShooterClass = shootershort.ToString() .Replace("Klass", "") .Replace("Damklass", "D") + weapon.WClass.ToString() .Replace("1", "") .Replace("2", "") .Replace("3", ""); toReturn.PatrolsByClub.AddPatrolsByClubRow(newRow); } } return(toReturn); }
private string getShooterClassString(int classInt) { Structs.ShootersClassShort sclass = (Structs.ShootersClassShort)classInt; return(sclass.ToString().Replace("Klass", "").Replace("ÖP", "Ö")); }