public ActionResult Create(int id)
 {
     ViewData["tourneyName"] = Tournament.GetTournamentName(id);
     TournamentTeam tt = new TournamentTeam();
     tt.EventID = id;
     return View(tt);
 }
Beispiel #2
0
                public DrawableTeamFlag(TournamentTeam team)
                    : base(team)
                {
                    InternalChild    = Flag;
                    RelativeSizeAxes = Axes.Both;

                    Flag.Anchor = Anchor.Centre;
                    Flag.Origin = Anchor.Centre;
                }
Beispiel #3
0
        private void reset(bool loadLastResults = false)
        {
            groupsContainer.ClearTeams();

            reloadTeams();

            if (!storage.Exists(results_filename))
            {
                return;
            }

            if (loadLastResults)
            {
                try
                {
                    // Read from drawings_results
                    using (Stream stream = storage.GetStream(results_filename, FileAccess.Read, FileMode.Open))
                        using (StreamReader sr = new StreamReader(stream))
                        {
                            string line;

                            while ((line = sr.ReadLine()?.Trim()) != null)
                            {
                                if (string.IsNullOrEmpty(line))
                                {
                                    continue;
                                }

                                if (line.ToUpperInvariant().StartsWith("GROUP", StringComparison.Ordinal))
                                {
                                    continue;
                                }

                                // ReSharper disable once AccessToModifiedClosure
                                TournamentTeam teamToAdd = allTeams.FirstOrDefault(t => t.FullName.Value == line);

                                if (teamToAdd == null)
                                {
                                    continue;
                                }

                                groupsContainer.AddTeam(teamToAdd);
                                teamsContainer.RemoveTeam(teamToAdd);
                            }
                        }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Failed to read last drawings results.");
                }
            }
            else
            {
                writeResults(string.Empty);
            }
        }
        private async void EndMatchButton_Click(object sender, RoutedEventArgs e)
        {
            if (ConvertStringToInt(TeamOneScoreTextBlock.Text) != ConvertStringToInt(TeamTwoScoreTextBlock.Text))
            {
                if (ConvertStringToInt(TeamOneScoreTextBlock.Text) > ConvertStringToInt(TeamTwoScoreTextBlock.Text))
                {
                    tournamentTeams = await tournamentTeamsTable.Where(p => p.TeamId == TeamOneIdTextBlock.Text &&
                                                                       p.TournamentId == TournamentIdTextBlock.Text)
                                      .ToCollectionAsync();

                    TournamentTeam tournamentTeam = tournamentTeams.FirstOrDefault();
                    tournamentTeam.TeamWins = tournamentTeam.TeamWins + 1;

                    await tournamentTeamsTable.UpdateAsync(tournamentTeam);
                }
                else if (ConvertStringToInt(TeamOneScoreTextBlock.Text) < ConvertStringToInt(TeamTwoScoreTextBlock.Text))
                {
                    tournamentTeams = await tournamentTeamsTable.Where(p => p.TeamId == TeamTwoIdTextBlock.Text &&
                                                                       p.TournamentId == TournamentIdTextBlock.Text)
                                      .ToCollectionAsync();

                    TournamentTeam tournamentTeam = tournamentTeams.FirstOrDefault();
                    tournamentTeam.TeamWins = tournamentTeam.TeamWins + 1;

                    await tournamentTeamsTable.UpdateAsync(tournamentTeam);
                }

                tournamentTeams = await tournamentTeamsTable.Where(p => p.TeamId == TeamOneIdTextBlock.Text &&
                                                                   p.TournamentId == TournamentIdTextBlock.Text)
                                  .ToCollectionAsync();

                TournamentTeam tournamentTeamOne = tournamentTeams.FirstOrDefault();
                tournamentTeamOne.TeamPoints = tournamentTeamOne.TeamPoints + ConvertStringToInt(TeamOneScoreTextBlock.Text);
                await tournamentTeamsTable.UpdateAsync(tournamentTeamOne);

                tournamentTeams = await tournamentTeamsTable.Where(p => p.TeamId == TeamTwoIdTextBlock.Text &&
                                                                   p.TournamentId == TournamentIdTextBlock.Text)
                                  .ToCollectionAsync();

                TournamentTeam tournamentTeamTwo = tournamentTeams.FirstOrDefault();
                tournamentTeamTwo.TeamPoints = tournamentTeamTwo.TeamPoints + ConvertStringToInt(TeamTwoScoreTextBlock.Text);
                await tournamentTeamsTable.UpdateAsync(tournamentTeamTwo);

                matches = await matchesTable.Where(p => p.Id == MatchIdTextBlock.Text).ToCollectionAsync();

                Game match = matches.First();
                match.Ended = true;
                await matchesTable.UpdateAsync(match);

                EndMatchButton.IsEnabled = false;
            }
            else
            {
                await new MessageDialog("Nie może być remisu").ShowAsync();
            }
        }
Beispiel #5
0
        protected DrawableTournamentTeam(TournamentTeam team)
        {
            Team = team;

            Flag        = new DrawableTeamFlag(team);
            AcronymText = new TournamentSpriteText
            {
                Font = OsuFont.Torus.With(weight: FontWeight.Regular),
            };
        }
Beispiel #6
0
        public static TournamentTeam ToModel(this CreateTeamRequest request, Int32 TournamentID)
        {
            TournamentTeam model = new TournamentTeam();

            model.Name         = request.Name;
            model.Password     = !String.IsNullOrEmpty(request.Password) ? request.Password : null;
            model.TournamentID = TournamentID;

            return(model);
        }
    /// <summary>
    /// Initializes a new instance of the TournamentTeamScore class.
    /// </summary>
    /// <param name="team">The team being scored.</param>
    /// <param name="score">The score that the team obtained.</param>
    public TournamentTeamScore(TournamentTeam team, Score score)
    {
        if (team == null)
        {
            throw new ArgumentNullException("team");
        }

        this.team  = team;
        this.Score = score;
    }
    /// <summary>
    /// Creates a new team death match tournament.
    /// </summary>
    public TeamDeathMatch()
        : base()
    {
        TournamentCollection.Add(this);

        BlackTeam = new TournamentTeam(this, Black, "Black", 224, 329);
        WhiteTeam = new TournamentTeam(this, White, "White", 181, 81);
        BlueTeam  = new TournamentTeam(this, Blue, "Blue", 68, 190);
        RedTeam   = new TournamentTeam(this, Red, "Red", 347, 222);
    }
 public TournamentRanking(TournamentTeam team, double rank, int wins, int loses, Score pointSpread, Score totalPoints, string scoreDescription)
 {
     this.team = team;
     this.rank = rank;
     this.Wins = wins;
     this.Loses = loses;
     this.PointSpread = pointSpread;
     this.TotalPoints = totalPoints;
     this.scoreDescription = scoreDescription;
 }
        private void AddTeam(Tournament tournament, int number)
        {
            var team = new TournamentTeam(tournament);

            team.Name = number.ToString();
            tournament.Teams.Add(team);

            var user = TestUtils.CreateUser(number.ToString());

            tournament.AddUser(user, team);
        }
Beispiel #11
0
 public void AddTeam(TournamentTeam team)
 {
     if (FirstTeam == null)
     {
         FirstTeam = team;
     }
     else if (SecondTeam == null)
     {
         SecondTeam = team;
     }
 }
Beispiel #12
0
        public static string CreateStatCheatPDF2RacesPerPage(string path,string filename,string templatePath,TournamentTeam tournamentTeam)
        {
            int count = 1;
            List<string> files = new List<string>();
            foreach (StatSheet statsheet in StatSheet.SetupStatSheet2RacesPerPage(tournamentTeam))
            {
                string tempFileName = path + count.ToString() + "_" + filename;
                using (var existingFileStream = new FileStream(templatePath, FileMode.Open))
                using (var newFileStream = new FileStream(tempFileName, FileMode.Create))
                {
                    // Open existing PDF
                    var pdfReader = new PdfReader(existingFileStream);

                    // PdfStamper, which will create
                    var stamper = new PdfStamper(pdfReader, newFileStream);
                    AcroFields af = stamper.AcroFields;

                    af.SetField("Team", statsheet.Team);
                    af.SetField("Tournament", statsheet.Tournament);
                    af.SetField("Date", statsheet.Date);
                    af.SetField("Dog1", statsheet.Dog1);
                    af.SetField("Dog2", statsheet.Dog2);
                    af.SetField("Dog3", statsheet.Dog3);
                    af.SetField("Dog4", statsheet.Dog4);
                    af.SetField("Dog5", statsheet.Dog5);
                    af.SetField("Dog6", statsheet.Dog6);
                    af.SetField("RaceNumber1",statsheet.RaceNumber1);
                    af.SetField("RaceNumber2",statsheet.RaceNumber2);
                    af.SetField("Lane1", statsheet.Lane1);
                    af.SetField("Lane2", statsheet.Lane2);
                    af.SetField("Opponent1", statsheet.Opponent1);
                    af.SetField("Opponent2", statsheet.Opponent2);
                    af.SetField("SeedTime1", statsheet.SeedTime);

                    // "Flatten" the form so it wont be editable/usable anymore
                    stamper.FormFlattening = true;

                    stamper.Close();
                    pdfReader.Close();
                }

                count++;
                files.Add(tempFileName);
            }

            string mergeFileName = MergePdfs(files,path + filename);

            foreach (string file in files)
            {
                File.Delete(file);
            }

            return mergeFileName;
        }
Beispiel #13
0
        public TeamDecider(TournamentTeam team)
        {
            if (team == null)
            {
                throw new ArgumentNullException("team");
            }

            this.team = team;

            this.Lock();
        }
Beispiel #14
0
        public ActionResult EditTournamentTeam(TournamentTeam tournamentTeam)
        {
            var tournamentTeamId = db.TournamentTeams.Include(t => t.Team).Include(t => t.Tournament).Where(t => t.TournamentTeamId == tournamentTeam.TournamentTeamId).Single();

            tournamentTeamId.TotalWeight     = tournamentTeam.TotalWeight;
            tournamentTeamId.BigBass         = tournamentTeam.BigBass;
            tournamentTeamId.NumberOfFishes  = tournamentTeam.NumberOfFishes;
            db.Entry(tournamentTeamId).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("TournamentTable", new { id = tournamentTeamId.TournamentId }));
        }
Beispiel #15
0
        public void AddTeam(TournamentTeam team)
        {
            if (groups[currentGroup].TeamsCount == maxTeams)
            {
                return;
            }

            groups[currentGroup].AddTeam(team);

            currentGroup = (currentGroup + 1) % groups.Count;
        }
Beispiel #16
0
 public async Task <HttpResponseMessage> UpdateTeamRosterAsync(TournamentTeam team)
 {
     try
     {
         return(await Http.PostAsAsync($"api/Team/update/roster", team));
     }
     catch
     {
         return(null);
     }
 }
Beispiel #17
0
 public async Task <HttpResponseMessage> CreateTeamAsync(TournamentTeam team)
 {
     try
     {
         return(await Http.PostAsAsync($"api/team/create", team));
     }
     catch
     {
         return(null);
     }
 }
Beispiel #18
0
 private int CountWonGamesForTeam(IEnumerable <Game> games, TournamentTeam team)
 {
     // Return number of games that
     // - have ended
     // - a winning team contains
     //  - the first player of the given team (enough to check)
     return(games.Count(x => x.State == Enums.GameState.Ended &&
                        x.Teams.Any(t =>
                                    t.Outcome == Enums.PlayerOutcome.Won &&
                                    t.Players.Select(p => p.UserId).Contains(team.Participants.First().UserId))));
 }
Beispiel #19
0
        public TeamDecider(TournamentTeam team)
        {
            if (team == null)
            {
                throw new ArgumentNullException("team");
            }

            this.team = team;

            this.Lock();
        }
        public TournamentTeam Update(TournamentTeam team)
        {
            var dbItem = _tournamentTeamDataService.Value.Get(team.Id);

            if (dbItem != null)
            {
                Mapper.Map(team, dbItem);
                _tournamentTeamDataService.Value.Update(dbItem);
                _unitOfWork.Value.Save();
            }
            return(team);
        }
        private bool SetWins(TournamentPairing pairing, TournamentTeam teamA, TournamentTeam teamB, int winsA, int winsB)
        {
            if (pairing.TeamA == teamA && pairing.TeamB == teamB)
            {
                pairing.TeamAWon = winsA;
                pairing.TeamBWon = winsB;

                return(true);
            }

            return(false);
        }
Beispiel #22
0
        public bool RemoveTeam(TournamentTeam team)
        {
            allTeams.RemoveAll(gt => gt.Team == team);

            if (teams.RemoveAll(gt => gt.Team == team) > 0)
            {
                TeamsCount--;
                return(true);
            }

            return(false);
        }
 public ActionResult Edit([Bind(Include = "TournamentTeamId,TournamentId,TeamId")] TournamentTeam tournamentTeam)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tournamentTeam).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TeamId       = new SelectList(db.Teams, "TeamId", "Name", tournamentTeam.TeamId);
     ViewBag.TournamentId = new SelectList(db.Tournaments, "TournamentId", "Name", tournamentTeam.TournamentId);
     return(View(tournamentTeam));
 }
Beispiel #24
0
            public TeamWithPlayers(TournamentTeam team, bool left = false)
            {
                FillFlowContainer players;

                var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;

                InternalChildren = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        Direction    = FillDirection.Vertical,
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            new TournamentSpriteText
                            {
                                Text   = "WINNER",
                                Font   = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold),
                                Colour = Color4.Black,
                            },
                            new TournamentSpriteText
                            {
                                Text   = team?.FullName.Value ?? "???",
                                Font   = OsuFont.Torus.With(size: 30, weight: FontWeight.SemiBold),
                                Colour = Color4.Black,
                            },
                            players = new FillFlowContainer
                            {
                                Direction    = FillDirection.Vertical,
                                AutoSizeAxes = Axes.Both,
                                Padding      = new MarginPadding {
                                    Top = 10
                                },
                            },
                        }
                    },
                };

                if (team != null)
                {
                    foreach (var p in team.Players)
                    {
                        players.Add(new TournamentSpriteText
                        {
                            Text   = p.Username,
                            Font   = OsuFont.Torus.With(size: 24),
                            Colour = colour,
                            Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
                            Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
                        });
                    }
                }
            }
        public async Task <IHttpActionResult> PostTournamentTeam(TournamentTeam tournamentTeam)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TournamentTeams.Add(tournamentTeam);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = tournamentTeam.TournamentTeamId }, tournamentTeam));
        }
        private async Task InsertTournamentTeam(string teamId)
        {
            string         tournamentId   = TournamentIdTextBlock.Text;
            TournamentTeam tournamentTeam = new TournamentTeam {
                TournamentId = tournamentId, TeamId = teamId, TeamWins = 0
            };
            await tournamentTeamsTable.InsertAsync(tournamentTeam);

            tournamentTeams.Add(tournamentTeam);

            //await App.MobileService.SyncContext.PushAsync(); // offline sync
        }
Beispiel #27
0
        public void AddTeam(TournamentTeam team)
        {
            GroupTeam gt = new GroupTeam(team);

            if (TeamsCount < 8)
            {
                teams.Add(gt);
                allTeams.Add(gt);

                TeamsCount++;
            }
        }
Beispiel #28
0
 private async Task RemoveTeamRepClaims(TournamentTeam team)
 {
     foreach (var participant in team.Participants.Where(p => !p.TeamRep))
     {
         // Remove claims from team reps
         if (participant.Player?.AccountId is long accountId)
         {
             await RemoveEditTeamInfoClaim(team, accountId);
             await RemoveEditTeamRosterClaim(team, accountId);
         }
     }
 }
Beispiel #29
0
        public void AddTeam(TournamentTeam team)
        {
            if (availableTeams.Contains(team))
            {
                return;
            }

            availableTeams.Add(team);

            RemoveAll(c => c is ScrollingTeam);
            setScrollState(ScrollState.Idle);
        }
        public ActionResult Create([Bind(Include = "TournamentTeamId,TournamentId,TeamId")] TournamentTeam tournamentTeam)
        {
            if (ModelState.IsValid)
            {
                db.TournamentTeams.Add(tournamentTeam);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TeamId       = new SelectList(db.Teams, "TeamId", "Name", tournamentTeam.TeamId);
            ViewBag.TournamentId = new SelectList(db.Tournaments, "TournamentId", "Name", tournamentTeam.TournamentId);
            return(View(tournamentTeam));
        }
        public async Task <ActionResult> Edit([Bind(Include = "TournamentTeamId,TournamentGroupId,TeamId,MatchesPlayed,MatchesWon,MatchesLost,MatchesTied,FavorGoals,AgainstGoals,Points,Position")] TournamentTeam tournamentTeam)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tournamentTeam).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.TeamId            = new SelectList(db.Teams, "TeamId", "Name", tournamentTeam.TeamId);
            ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups, "TournamentGroupId", "Name", tournamentTeam.TournamentGroupId);
            return(View(tournamentTeam));
        }
        // GET: TournamentTeams/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TournamentTeam tournamentTeam = await db.TournamentTeams.FindAsync(id);

            if (tournamentTeam == null)
            {
                return(HttpNotFound());
            }
            return(View(tournamentTeam));
        }
Beispiel #33
0
        public DrawableTeamWithPlayers(TournamentTeam team, TeamColour colour)
        {
            AutoSizeAxes = Axes.Both;

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Spacing      = new Vector2(30),
                    Children     = new Drawable[]
                    {
                        new DrawableTeamTitleWithHeader(team, colour),
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Padding      = new MarginPadding {
                                Left = 10
                            },
                            Spacing  = new Vector2(30),
                            Children = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    Direction          = FillDirection.Vertical,
                                    AutoSizeAxes       = Axes.Both,
                                    ChildrenEnumerable = team?.Players.Select(createPlayerText).Take(5) ?? Enumerable.Empty <Drawable>()
                                },
                                new FillFlowContainer
                                {
                                    Direction          = FillDirection.Vertical,
                                    AutoSizeAxes       = Axes.Both,
                                    ChildrenEnumerable = team?.Players.Select(createPlayerText).Skip(5) ?? Enumerable.Empty <Drawable>()
                                },
                            }
                        },
                    }
                },
            };

            TournamentSpriteText createPlayerText(TournamentUser p) =>
            new TournamentSpriteText
            {
                Text   = p.Username,
                Font   = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold),
                Colour = Color4.White,
            };
        }
Beispiel #34
0
 private void showTeam(TournamentTeam team)
 {
     mainContainer.Children = new Drawable[]
     {
         new LeftInfo(team)
         {
             Position = new Vector2(55, 150),
         },
         new RightInfo(team)
         {
             Position = new Vector2(500, 150),
         },
     };
 }
Beispiel #35
0
        private void AddTeam_Click(object sender, EventArgs e)
        {
            if (this.rounds.Count == 0)
            {
                var id = ++this.teamIdentity;

                var team = new TournamentTeam(id, 100);
                this.teams.Add(team);
                this.teamNames.Add(id, "New Team");

                var item = new ListViewItem(new string[] { this.teamNames[team.TeamId], team.Rating.ToString() });
                item.Tag = team;
                this.TeamsList.Items.Add(item);

                this.UpdateState();

                this.TeamsList.SelectedIndices.Clear();
                item.BeginEdit();
            }
        }
 public ActionResult Create(int id,TournamentTeam tourneyTeam)
 {
     tourneyTeam.EventID = id;
         tourneyTeam.Create();
         return RedirectToAction("Details", new { controller = "Tournament", id = tourneyTeam.EventID });
 }
Beispiel #37
0
        private static PdfPTable AddStatHeader(TournamentTeam tournamentTeam)
        {
            PdfPTable tourneyInfo = new PdfPTable(3);
            tourneyInfo.WidthPercentage = 100;
            tourneyInfo.AddCell(AddTeamStatsHeaderTableItem("Team: ",Team.Detail(tournamentTeam.TeamNumber).TeamName + " - " + tournamentTeam.TournamentTeamName));
            tourneyInfo.AddCell(AddTeamStatsHeaderTableItem("Tournament: ",Tournament.Detail(tournamentTeam.EventID).Tournament.TournamentName));
            tourneyInfo.AddCell(AddTeamStatsHeaderTableItem("Date: ",Tournament.Detail(tournamentTeam.EventID).Tournament.TournamentDate.ToShortDateString()));

            return tourneyInfo;
        }
        public static Guid AddTeamToTournament(Guid tournamentId, string team, int rating, int pool)
        {
            try
            {
                var dc = new ManagementContext();
                var tourny = dc.GameTournaments.Where(x => x.TournamentId == tournamentId).FirstOrDefault();
                if (tourny == null)
                    return new Guid();

                TournamentTeam t = new TournamentTeam();
                t.TeamName = team;
                t.Tournament = tourny;
                t.SeedRating = rating;
                t.PoolNumber = pool;
                if (!String.IsNullOrEmpty(team))
                    tourny.Teams.Add(t);

                int c = dc.SaveChanges();

                return t.TeamId;
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return new Guid();
        }
 /// <summary>
 /// Initializes a new instance of the TournamentRanking class.
 /// </summary>
 /// <param name="team">The team being ranked.</param>
 /// <param name="rank">The actual rank number of the ranking.</param>
 /// <param name="scoreDescription">The score description or justification of the ranking.</param>
 public TournamentRanking(TournamentTeam team, double rank, string scoreDescription)
 {
     this.team = team;
     this.rank = rank;
     this.scoreDescription = scoreDescription;
 }
        public static bool AddTeamsToTournament(Guid tournamentId, List<string> teams)
        {
            try
            {
                var dc = new ManagementContext();
                var tourny = dc.GameTournaments.Where(x => x.TournamentId == tournamentId).FirstOrDefault();
                if (tourny == null)
                    return false;

                foreach (var team in teams)
                {
                    TournamentTeam t = new TournamentTeam();
                    t.TeamName = team;
                    t.Tournament = tourny;
                    if (!String.IsNullOrEmpty(team))
                        tourny.Teams.Add(t);
                }

                int c = dc.SaveChanges();

                return c > 0;
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return false;
        }
 private bool TeamsMatch(TournamentTeam teamA, TournamentTeam teamB)
 {
     if (object.ReferenceEquals(teamA, teamB))
     {
         return true;
     }
     else if (teamA == null || teamB == null)
     {
         return false;
     }
     else
     {
         return (teamA.TeamId == teamB.TeamId);
     }
 }
 public bool HasTeam(TournamentTeam team)
 {
     return this.HasTeam(team.TeamId);
 }
Beispiel #43
0
        public static void CreateTeamDogsPDF( String filename,TournamentTeam tournamentTeam)
        {
            Document d = new Document(iTextSharp.text.PageSize.LETTER);

            PdfWriter writer;

            Font font_content = FontFactory.GetFont(iTextSharp.text.Font.FontFamily.COURIER.ToString(), 6, iTextSharp.text.Font.NORMAL);
            Font font_content_bold = FontFactory.GetFont(iTextSharp.text.Font.FontFamily.COURIER.ToString(), 6, iTextSharp.text.Font.BOLD);
            Font font_header = FontFactory.GetFont(iTextSharp.text.Font.FontFamily.COURIER.ToString(), 8, iTextSharp.text.Font.NORMAL);

            writer = PdfWriter.GetInstance(d, new FileStream(filename, FileMode.Create));

            d.Open();

            PdfPTable t = new PdfPTable(6);

            t.AddCell(AddTeamDogsHeader(tournamentTeam.EventID.ToString() + " - " + Tournament.Detail(tournamentTeam.EventID).Tournament.TournamentName + " -  " + Tournament.Detail(tournamentTeam.EventID).Tournament.TournamentDate.ToShortDateString(), 6));

            t.AddCell(AddTeamDogsHeader(Team.Detail(tournamentTeam.TeamNumber).TeamName + " -  " + tournamentTeam.TournamentTeamName + " - " + tournamentTeam.DivisionName, 6));

            t.AddCell(AddTeamDogsHeader("", 6));

            t.AddCell(AddTeamDogsItemCell(""));
            t.AddCell(AddTeamDogsItemCell("Dog"));
            t.AddCell(AddTeamDogsItemCell("Breed"));
            t.AddCell(AddTeamDogsItemCell("Jump Height"));
            t.AddCell(AddTeamDogsItemCell("Handler/Owner"));
            t.AddCell(AddTeamDogsItemCell("CRN"));

            foreach (TournamentTeamDog dog in tournamentTeam.TournamentTeamDogs)
            {
                Dog dogDetail = Dog.Detail(dog.DogCRN);
                t.AddCell(AddTeamDogsItemCell(dog.DogOrder.ToString()));
                t.AddCell(AddTeamDogsItemCell(dogDetail.DogName));
                t.AddCell(AddTeamDogsItemCell(dogDetail.Breed));
                t.AddCell(AddTeamDogsItemCell(dogDetail.JumpHeight.ToString() + " Inches"));
                t.AddCell(AddTeamDogsItemCell(Person.Detail(dogDetail.DogOwner).FullName));
                t.AddCell(AddTeamDogsItemCell(dogDetail.FormattedCRN));

            }

            d.Add(t);
            d.Close();
        }
Beispiel #44
0
        public static List<StatSheet> SetupStatSheet1RacePerPage(TournamentTeam tournamentTeam)
        {
            int count = 1;

            List<StatSheet> statSheet = new List<StatSheet>();

            string team = tournamentTeam.TournamentTeamName;
            string tournament = FlyballStats.Web.Tournament.Detail(tournamentTeam.EventID).Tournament.TournamentName;
            string date = FlyballStats.Web.Tournament.Detail(tournamentTeam.EventID).Tournament.TournamentDate.ToShortDateString();
            string seedtime = tournamentTeam.SeedTime.ToString();
            List<string> listDogs = new List<string>();
            foreach (TournamentTeamDog tdog in tournamentTeam.TournamentTeamDogs)
            {
                listDogs.Add(tdog.DogsName);
            }

            StatSheet stats = null;
            foreach (Race race in TournamentTeam.GetRaces(tournamentTeam.TournamentTeamID))
            {
                stats = new StatSheet();
                stats.Team = team;
                stats.Tournament = tournament;
                stats.Date = date;
                stats.SeedTime = seedtime;
                int dogcount = 1;
                foreach (string dog in listDogs)
                {
                    switch (dogcount)
                    {
                        case 1:
                            stats.Dog1 = dog;
                            break;
                        case 2:
                            stats.Dog2 = dog;
                            break;
                        case 3:
                            stats.Dog3 = dog;
                            break;
                        case 4:
                            stats.Dog4 = dog;
                            break;
                        case 5:
                            stats.Dog5 = dog;
                            break;
                        case 6:
                            stats.Dog6 = dog;
                            break;
                    }
                    dogcount++;
                }
                stats.RaceNumber1 = race.RaceNumber.ToString();
                if (race.LeftLaneTeam == tournamentTeam.TournamentTeamID)
                {
                    stats.Lane1 = "Left";
                    stats.Opponent1 = TournamentTeam.Detail(race.RightLaneTeam).TournamentTeamName;
                }
                else
                {
                    stats.Lane1 = "Right";
                    stats.Opponent1 = TournamentTeam.Detail(race.LeftLaneTeam).TournamentTeamName;
                }

                statSheet.Add(stats);

                count++;
            }
            return statSheet;
        }
Beispiel #45
0
        private static PdfPTable AddDogsStatsHeader(TournamentTeam tournamentTeam)
        {
            PdfPTable dogInfo = new PdfPTable(3);

            dogInfo.WidthPercentage = 100;

            foreach (TournamentTeamDog dog in tournamentTeam.TournamentTeamDogs)
            {
                dogInfo.AddCell(AddTeamStatsHeaderTableItem(dog.DogOrder.ToString() + ":", dog.DogsName));
            }

            return dogInfo;
        }