private void CreatePanelForSort(TipSortiranja tipSortiranja) { List <Player> listaYellowCardsAndGoals = new List <Player>(); List <MatchFull> listaAttendacneSort = new List <MatchFull>(); if (tipSortiranja == TipSortiranja.SortirajZute) { saveFileToolStripMenuItem.Enabled = false; listaYellowCardsAndGoals = Repo.LoadListYellowCards(); CreatePanelForYellowCardsAndGoals(tipSortiranja, listaYellowCardsAndGoals); } else if (tipSortiranja == TipSortiranja.SortirajGolove) { saveFileToolStripMenuItem.Enabled = false; listaYellowCardsAndGoals = Repo.LoadListGoalsScored(); CreatePanelForYellowCardsAndGoals(tipSortiranja, listaYellowCardsAndGoals); } else if (tipSortiranja == TipSortiranja.SortirajPosjetitelje) { saveFileToolStripMenuItem.Enabled = false; listaAttendacneSort = Repo.LoadListAttendance(); CreatePanelForAttendance(listaAttendacneSort); //Repo.ResetListAttendance(); } }
private void PrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { TipSortiranja testEnum = GetTipSortiranjaPrint(); if (printanoStranica == 0) { PripremaPrintaZaSort(e, testEnum); e.HasMorePages = true; printanoStranica++; } else { PripremaPrintaZaSortNext(e, testEnum); } }
private void PripremaPrintaZaSort(PrintPageEventArgs e, TipSortiranja tipSortiranja) { switch (tipSortiranja) { case TipSortiranja.SortirajZute: PrintIgraciZaSort(e, tipSortiranja); break; case TipSortiranja.SortirajGolove: PrintIgraciZaSort(e, tipSortiranja); break; case TipSortiranja.SortirajPosjetitelje: PrintIgraciZaSort(e, tipSortiranja); break; } }
private void NacinSortiranja(TipSortiranja odabirSortiranja) { switch (odabirSortiranja) { case TipSortiranja.SortirajZute: CreatePanelForSort(odabirSortiranja); SetTipSortiranjaPrint(odabirSortiranja); break; case TipSortiranja.SortirajGolove: CreatePanelForSort(odabirSortiranja); SetTipSortiranjaPrint(odabirSortiranja); break; case TipSortiranja.SortirajPosjetitelje: CreatePanelForSort(odabirSortiranja); SetTipSortiranjaPrint(odabirSortiranja); break; } }
private void CreatePanelForYellowCardsAndGoals(TipSortiranja tipSortiranja, List <Player> listaYellowCardsAndGoals) { foreach (var item in listaYellowCardsAndGoals) { var sirina_panela = flpOmiljeniIgraci.Width - 30; Panel pnl = new Panel(); pnl.Location = new Point(pnl_lokacija_x, pnl_lokacija_y); pnl.Size = new Size(sirina_panela, visina_panela); pnl.BorderStyle = BorderStyle.None; pnl.BackColor = Color.Transparent; // pnl.Click += Pnl_Click; int x = 20; int y = 20; Point nameLokacijaInfo = new Point(x, y); Point drugaLabelaInfo = new Point(x, nameLokacijaInfo.Y + y); if (tipSortiranja == TipSortiranja.SortirajZute) { if (FileManager.LoadLanguage() == "hr") { pnl.Controls.Add(CreateLabelInfo("Ime igrača:", nameLokacijaInfo, true)); pnl.Controls.Add(CreateLabelInfo("Broj zutih kartona:", drugaLabelaInfo, true)); } else if (FileManager.LoadLanguage() == "en") { pnl.Controls.Add(CreateLabelInfo("Player name:", nameLokacijaInfo, true)); pnl.Controls.Add(CreateLabelInfo("Yellow cards:", drugaLabelaInfo, true)); } } else if (tipSortiranja == TipSortiranja.SortirajGolove) { if (FileManager.LoadLanguage() == "hr") { pnl.Controls.Add(CreateLabelInfo("Ime igrača:", nameLokacijaInfo, true)); pnl.Controls.Add(CreateLabelInfo("Broj golova:", drugaLabelaInfo, true)); } else if (FileManager.LoadLanguage() == "en") { pnl.Controls.Add(CreateLabelInfo("Player name:", nameLokacijaInfo, true)); pnl.Controls.Add(CreateLabelInfo("Goals:", drugaLabelaInfo, true)); } } int pos_x = 150; int pos_y = 20; Point nameLokacija = new Point(pos_x, pos_y); Point yellowCards = new Point(pos_x, nameLokacija.Y + pos_y); if (tipSortiranja == TipSortiranja.SortirajZute) { pnl.Controls.Add(CreateLabelForSort(item.Name, nameLokacija, LabelName.Name)); pnl.Controls.Add(CreateLabelForSort((item.NumOfYellowCards.ToString()), yellowCards, LabelName.NumOfYellowCards)); } else if (tipSortiranja == TipSortiranja.SortirajGolove) { pnl.Controls.Add(CreateLabelForSort(item.Name, nameLokacija, LabelName.Name)); pnl.Controls.Add(CreateLabelForSort((item.GoalsScored > 0 ? item.GoalsScored.ToString() : "Nije zabio gol"), yellowCards, LabelName.GoalsScored)); } var picturePos_X = pos_x + 150; var picturePos_Y = pos_y; pnl.Controls.Add(CreatePicturBox(picturePos_X, picturePos_Y, true)); flpOmiljeniIgraci.Controls.Add(pnl); } }
private void SetTipSortiranjaPrint(TipSortiranja tipSortiranja) { sortiranjePrint = tipSortiranja; }
private void PrintIgraciZaSort(PrintPageEventArgs e, TipSortiranja tipSortiranja) { Font f = new Font("Arial", 22, FontStyle.Regular, GraphicsUnit.Pixel); int loc_Y = 80; int loc_X = 300; if (tipSortiranja == TipSortiranja.SortirajZute) { List <Player> listaIgracaBrojZutih = Repo.LoadListYellowCards(); foreach (var item in listaIgracaBrojZutih) { e.Graphics.DrawString("Sortiranje igrača prema žutim kartonima:", f, Brushes.Black, new Point(25, 25)); e.Graphics.DrawString("Ime igrača:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(item.Name, f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; e.Graphics.DrawString("Broj žutih kartona:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(item.NumOfYellowCards.ToString(), f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; } } else if (tipSortiranja == TipSortiranja.SortirajGolove) { List <Player> listaIgracaBrojGolova = Repo.LoadListGoalsScored(); foreach (var item in listaIgracaBrojGolova) { e.Graphics.DrawString("Sortiraj igrače prema broju golova:", f, Brushes.Black, new Point(25, 25)); e.Graphics.DrawString("Ime igrača:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(item.Name, f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; e.Graphics.DrawString("Broj zabijenih golova:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(item.GoalsScored.ToString(), f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; } } else if (tipSortiranja == TipSortiranja.SortirajPosjetitelje) { List <MatchFull> listaBrojaPosjetitelja = Repo.LoadListAttendance(); e.Graphics.DrawString("Sortiraj po broju posjetitelja:", f, Brushes.Black, new Point(25, 25)); for (int i = 0; i < listaBrojaPosjetitelja.Count; i++) { if (i < 4) { e.Graphics.DrawString("Stadion:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(listaBrojaPosjetitelja[i].Location, f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; e.Graphics.DrawString("Broj posjetitelja:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(listaBrojaPosjetitelja[i].Attendance.ToString(), f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; e.Graphics.DrawString("Domaćin:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(listaBrojaPosjetitelja[i].HomeTeamCountry, f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; e.Graphics.DrawString("Gost:", f, Brushes.Black, new Point(25, loc_Y)); e.Graphics.DrawString(listaBrojaPosjetitelja[i].AwayTeamCountry.ToString(), f, Brushes.Black, new Point(loc_X, loc_Y)); loc_Y += 50; e.Graphics.DrawString("-----------------------------------------------------------------------------------------------", f, Brushes.Black, new Point(25, loc_Y)); loc_Y += 50; } else { return; } } } }