/// <summary> /// Register a referee. /// </summary> private void registerReferee() { int id = 0; string firstName = ""; string lastName = ""; string club = ""; string nationality = ""; string category = ""; while (reader.MoveToNextAttribute()) { if (reader.Name == ID) { id = int.Parse(reader.Value); } else if (reader.Name == PRENOM) { firstName = reader.Value; } else if (reader.Name == NOM) { lastName = reader.Value; } else if (reader.Name == CLUB) { club = reader.Value; } else if (reader.Name == NATION) { nationality = reader.Value; } else if (reader.Name == CATEGORIE) { category = reader.Value; } } FRCReferee refe = new FRCReferee(id, firstName, lastName, club, nationality, category); referee.Add(refe); }
/// <summary> /// Prints the poule with given number. /// </summary> /// <param name="graphics"></param> /// <param name="poule">The poule to be printed.</param> /// <param name="pouleNumber">The poule number.</param> private void printPoule(XGraphics graphics, FRCPoule poule, int pouleNumber) { XFont font = new XFont(FONT_TYPE, 10); double fontHeight = font.GetHeight(); double x = DEFAULT_START_X; string s1 = FRCPrinterConstants.POULE + " " + FRCPrinterConstants.NUMBER + " " + pouleNumber + " " + poule.StartTime + " " + FRCPrinterConstants.PISTE + " " + FRCPrinterConstants.NUMBER + " " + poule.PisteNumber; string s2 = FRCPrinterConstants.REFEREE + ": "; for (int i = 0; i < poule.amountOfReferees(); i++) { FRCReferee referee = poule.getNextReferee(); s2 += referee.LastName.ToUpper() + " " + referee.FirstName + " " + referee.Club; if (poule.hasNextReferee()) { s2 += ", "; } } graphics.DrawString(s1, font, XBrushes.Black, x, currentYCoordinate); currentYCoordinate += fontHeight * 1.3; graphics.DrawString(s2, font, XBrushes.Black, x, currentYCoordinate); currentYCoordinate += fontHeight * 1.3; graphics.DrawString(FRCPrinterConstants.V_M, font, XBrushes.Black, x + 400, currentYCoordinate); graphics.DrawString(FRCPrinterConstants.HS_HR, font, XBrushes.Black, x + 435, currentYCoordinate); graphics.DrawString(FRCPrinterConstants.HS, font, XBrushes.Black, x + 470, currentYCoordinate); graphics.DrawString(FRCPrinterConstants.RANK, font, XBrushes.Black, x + 495, currentYCoordinate); currentYCoordinate += fontHeight * 1.3; drawPouleGraph(graphics, x + 250, currentYCoordinate, poule.amountOfFencers()); double savedY = currentYCoordinate; currentYCoordinate += fontHeight; poule.sortFencersFencerNumberInPoule(); for (int i = 0; i < poule.amountOfFencers(); i++) { FRCFencer fencer = poule.getNextFencer(); fencer = registerFencerStatusInPouleFromMatch(poule, fencer); copyFencerInfo(fencer); registerPouleResult(fencer); string name = fencer.LastName.ToUpper() + " " + fencer.FirstName; string club = fencer.Club; double vm = fencer.VM; string vm_s = vm.ToString().Replace(',', '.'); string ind = fencer.Index.ToString(); string hs = fencer.HitsGivenInPoule.ToString(); string rank = fencer.PouleRanking.ToString(); if (vm_s.Length == 1) { vm_s += "."; } vm_s += "000"; if (vm_s.Length > 5) { vm_s = vm_s.Remove(5); } //Saving the value for fencer list in this class. getFencerMatchingID(fencer.ID).VM_String = vm_s; if (name.Length > 30) { name = name.Remove(30); } if (club.Length > 15) { club = club.Remove(15); } if (fencer.Abandoned || fencer.Forfait || fencer.Excluded) { vm_s = ""; ind = " "; hs = ""; rank = ""; } graphics.DrawString(name, font, XBrushes.Black, x + 5, currentYCoordinate); graphics.DrawString(club, font, XBrushes.Black, x + 160, currentYCoordinate); graphics.DrawString(vm_s, font, XBrushes.Black, x + 400, currentYCoordinate); if (ind[0] == '-') { graphics.DrawString(ind, font, XBrushes.Black, x + 447 - (ind.Length - 1) * 5, currentYCoordinate); } else { graphics.DrawString(ind, font, XBrushes.Black, x + 450 - ind.Length * 5, currentYCoordinate); } graphics.DrawString(hs, font, XBrushes.Black, x + 482 - hs.Length * 5, currentYCoordinate); graphics.DrawString(rank, font, XBrushes.Black, x + 513 - rank.Length * 5, currentYCoordinate); currentYCoordinate += fontHeight * 1.25; } fillPouleProtocole(graphics, font, poule, x + 250, savedY); currentYCoordinate += fontHeight * 2; }
/// <summary> /// Add a referee to the poule. /// </summary> /// <param name="referee"></param> public void addReferee(FRCReferee referee) { this.referee.Add(referee); }