Exemplo n.º 1
0
        private void btnMjerenjeUnos_Click(object sender, EventArgs e)
        {
            Statistika stat = new Statistika();

            stat.Entity_Id   = igr.Id;
            stat.Entity_type = 'I';
            stat.Visina      = Int32.Parse(txtbMjerenjeVisina.Text);
            stat.Tezina      = Int32.Parse(txtbMjerenjaTezina.Text);
            stat.Raspon_ruku = Int32.Parse(txtbMjerenjeRaspon.Text);
            stat.Brz_Spr     = Int32.Parse(txtbMjerenjeBrzina01.Text);
            stat.Brz_SU      = Int32.Parse(txtbMjerenjeBrzina02.Text);
            stat.Skok_ud     = Int32.Parse(txtbMjerenjeSkok.Text);
            if (chcbMjerenjePrvo.Checked)
            {
                stat.Prvo_mjerenje = true;
            }
            else
            {
                stat.Prvo_mjerenje = false;
            }

            try
            {
                //spremanje podataka
                DB_connection.OpenConn();
                DB_PUT.Statistika_Put(stat);
                DB_connection.CloseConn();
                this.Close();
            }
            catch (ArgumentException err)
            {
                lblMjerenjaResult.ForeColor = Color.Red;
                Change_label("Greška kod spremanja podataka: " + err.ToString());
            }
        }
Exemplo n.º 2
0
        private void gvEkipe()
        {
            ek = new List <Ekipa>();
            DB_connection.OpenConn();
            ek = DB_GET.Ekipa_Get_All();
            DB_connection.CloseConn();

            var collection = new ObservableCollection <Ekipa>(ek);

            datasource = new BindingSource(collection, null);

            gv.ColumnCount                 = 1;
            gv.Columns[0].HeaderText       = "Naziv";
            gv.Columns[0].DataPropertyName = "Naziv";

            gv.CellClick += (s, e) =>
            {
                ekipa_id = (Ekipa)this.ek[e.RowIndex];
            };

            gv.DataSource          = datasource;
            gv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            gv.AutoResizeColumns();
            gv.AllowUserToAddRows = false;
        }
Exemplo n.º 3
0
        private void btnTreningKreiraj01_Click(object sender, EventArgs e)
        {
            List <Igraci>     igrac = new List <Igraci>();
            List <Prisutnost> pris  = new List <Prisutnost>();

            List <Vjezbe> tren = new List <Vjezbe>();

            foreach (DataGridViewRow row in dgvTreningKreiraj01.Rows)
            {
                if (Convert.ToBoolean(row.Cells["Koristi"].Value) == true)
                {
                    tren.Add(row.DataBoundItem as Vjezbe);
                }
            }
            Trening tr    = new Trening(txtbTreningKreiraj01.Text, (int)tren.Count);
            Trening tr_id = new Trening();

            //Spremanje i dohvacanje spremljenog treninga
            try
            {
                DB_connection.OpenConn();
                DB_PUT.Trening_Put(tr);
                tr_id = DB_GET.Trening_Get_Last_Add();
                DB_connection.CloseConn();
                tr.Id = tr_id.Id;
            }
            catch (ArgumentException err)
            {
                lblTreningKreirajResult.ForeColor = Color.Red;
                Change_label("Greška kod spremanja treninga" + err.ToString());
            }


            foreach (DataGridViewRow row in gv.Rows)
            {
                Prisutnost p = new Prisutnost();
                p.Igrac_id   = Convert.ToInt32(row.Cells[0].Value);
                p.Trening_id = tr.Id;
                p.Prisutan   = Convert.ToBoolean(row.Cells["Prisutan"].Value);
                if (Convert.ToBoolean(row.Cells["Prisutan"].Value) == true)
                {
                    igrac.Add(row.DataBoundItem as Igraci);
                }
                pris.Add(p);
            }
            //Spremanje prisutnosti
            try
            {
                DB_connection.OpenConn();
                DB_PUT.Prisutnost_Put_List(pris);
                DB_connection.CloseConn();
                new Trening_dashboard(tr, igrac, tren).Show();
                this.Close();
            }
            catch (ArgumentException err)
            {
                lblTreningKreirajResult.ForeColor = Color.Red;
                Change_label("Greška kod spremanja prisutnosti: " + err.ToString());
            }
        }
Exemplo n.º 4
0
        public void Get_naziv_ekipe()
        {
            List <Ekipa> ek = new List <Ekipa>();

            DB_connection.OpenConn();
            ek = DB_GET.Ekipa_Get_Id(Ekipa_id);
            DB_connection.CloseConn();
            this.Ekipa_naziv = ek[0].Naziv.ToString();
        }
Exemplo n.º 5
0
        private void cmbTreningKreiraj01_SelectedIndexChanged(object sender, EventArgs e)
        {
            var todel = Controls.Find("gv", true);

            if (todel.Length != 0)
            {
                this.Controls.Remove(todel[0]);
            }
            igr = new List <Igraci>();
            try
            {
                DB_connection.OpenConn();
                igr = DB_GET.Ekipa_Get_By_Id(ek[cmbTreningKreiraj01.SelectedIndex].Id);
                DB_connection.CloseConn();
            }
            catch (ArgumentException err)
            {
                lblTreningKreirajResult.ForeColor = Color.Red;
                Change_label("Greška kod učitavanja podataka" + err.ToString());
            }


            gv      = new DataGridView();
            gv.Name = "gv";
            gv.AutoGenerateColumns = false;
            gv.Location            = new Point(lblZapisnikKreiraj02.Location.X, lblZapisnikKreiraj02.Location.Y + 20);
            gv.ColumnCount         = 3;

            var           collection = new ObservableCollection <Igraci>(igr);
            BindingSource datasource = new BindingSource(collection, null);

            gv.Columns[0].HeaderText       = "ID";
            gv.Columns[0].DataPropertyName = "ID";
            gv.Columns[1].HeaderText       = "Ime";
            gv.Columns[1].DataPropertyName = "Ime";
            gv.Columns[2].HeaderText       = "Prezime";
            gv.Columns[2].DataPropertyName = "Prezime";
            gv.DataSource = datasource;

            DataGridViewCheckBoxColumn chbCell = new DataGridViewCheckBoxColumn();

            chbCell.ValueType  = typeof(bool);
            chbCell.Name       = "Prisutan";
            chbCell.HeaderText = "Prisutan";
            gv.Columns.Add(chbCell);

            gv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            gv.AutoResizeColumns();
            gv.AllowUserToAddRows = false;
            this.Controls.Add(gv);
        }
Exemplo n.º 6
0
        public Zapisnik_unos()
        {
            InitializeComponent();
            var ek = new List <Ekipa>();

            DB_connection.OpenConn();
            ek = DB_GET.Ekipa_Get_All();
            DB_connection.CloseConn();
            cmbZapisnik01.Items.Clear();
            cmbZapisnik01.DisplayMember = "Naziv";
            foreach (var i in ek)
            {
                cmbZapisnik01.Items.Add(i);
            }
        }
Exemplo n.º 7
0
 private void btnBrisanjeBrisi_Click(object sender, EventArgs e)
 {
     try
     {
         DB_connection.OpenConn();
         DB_DELETE.Delete_row(id_to_delete, selected_item);
         DB_connection.CloseConn();
         dgvBrisanje.Rows.RemoveAt(dgvBrisanje.SelectedRows[0].Index);
         string lbl = "Izbrisan redak iz tablice" + selected_item.ToString() + " sa Id = " + id_to_delete.ToString();
         Change_label(lbl);
     }
     catch (ArgumentException err)
     {
         lblBrisanjeResult.ForeColor = Color.Red;
         Change_label(err.ToString());
     }
 }
Exemplo n.º 8
0
        public Trening_kreiranje()
        {
            InitializeComponent();

            ek = new List <Ekipa>();
            vj = new List <Vjezbe>();
            try
            {
                DB_connection.OpenConn();
                ek = DB_GET.Ekipa_Get_All();
                vj = DB_GET.Vjezbe_Get_All();
                DB_connection.CloseConn();
            }
            catch (ArgumentException err)
            {
                lblTreningKreirajResult.ForeColor = Color.Red;
                Change_label("Greška kod učitavanja podataka: " + err.ToString());
            }


            cmbTreningKreiraj01.Items.Clear();
            cmbTreningKreiraj01.DisplayMember = "Naziv";
            foreach (var i in ek)
            {
                cmbTreningKreiraj01.Items.Add(i);
            }

            var collection = new ObservableCollection <Vjezbe>(vj);

            collection.CollectionChanged += Collection_CollectionChanged;
            BindingSource datasource = new BindingSource(collection, null);

            dgvTreningKreiraj01.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvTreningKreiraj01.AutoResizeColumns();
            dgvTreningKreiraj01.AllowUserToAddRows = false;

            dgvTreningKreiraj01.DataSource            = datasource;
            dgvTreningKreiraj01.Columns["Id"].Visible = false;

            DataGridViewCheckBoxColumn chbCell = new DataGridViewCheckBoxColumn();

            chbCell.ValueType  = typeof(bool);
            chbCell.Name       = "Koristi";
            chbCell.HeaderText = "Koristi";
            dgvTreningKreiraj01.Columns.Add(chbCell);
        }
Exemplo n.º 9
0
 //spremanje svih statistika prije zavrsavanja/zatvaranja treninga
 public void Spremanje_kraj_treninga()
 {
     try
     {
         Check_Kosevi_List();
         Postotak_prisutnosti();
         DB_connection.OpenConn();
         DB_PUT.Statistika_Put_List(statistika);
         DB_connection.CloseConn();
         Change_label("Statistika spremljena");
         this.Close();
     }
     catch (ArgumentException e)
     {
         lblDashboardResult.ForeColor = Color.Red;
         Change_label(Convert.ToString(e));
     }
 }
Exemplo n.º 10
0
        private void btnUnosIgrPut_Click(object sender, EventArgs e)
        {
            var Igr = new Igraci();
            var Ek  = new Ekipa();

            Ek          = (Ekipa)cmbUnosIgr01.SelectedItem;
            Igr.Ime     = txtbUnosIgr01.Text;
            Igr.Prezime = txtbUnosIgr02.Text;
            Igr.Godiste = Int32.Parse(txtbUnosIgr03.Text);

            if (rbtnUnosIgr01.Checked)
            {
                Igr.Spol = Char.Parse(rbtnUnosIgr01.Text);
            }
            else if (rbtnUnosIgr02.Checked)
            {
                Igr.Spol = Char.Parse(rbtnUnosIgr02.Text);
            }

            if (chbUnosIgr01.Checked)
            {
                Igr.Karton = true;
            }
            else
            {
                Igr.Karton = false;
            }
            Igr.Ekipa_id = Ek.Id;

            try
            {
                DB_connection.OpenConn();
                DB_PUT.Igraci_Put(Igr);
                DB_connection.CloseConn();
                Change_label("Igrač " + Igr.Ime.ToString() + " unešen");
                btnUnosIgraca02_Click(sender, e);
            }
            catch (ArgumentException err)
            {
                lblUnosResult.ForeColor = Color.Red;
                Change_label("Greška kod unosa igrača: " + err.ToString());
            }
        }
Exemplo n.º 11
0
        private void btnUnosVj01_Click(object sender, EventArgs e)
        {
            var vj = new Vjezbe();

            vj.Naziv = txtbUnosVj01.Text;
            vj.Opis  = txtbUnosVj02.Text;

            if (chbUnosVj05.Checked && txtbUnosVj03.Text.Length != 0)
            {
                vj.Drugo = txtbUnosVj03.Text;
            }

            if (chbUnosVj01.Checked)
            {
                vj.Sutevi = true;
            }
            if (chbUnosVj02.Checked)
            {
                vj.Brzina = true;
            }
            if (chbUnosVj03.Checked)
            {
                vj.Brojac = true;
            }
            if (chbUnosVj04.Checked)
            {
                vj.Udaljenost = true;
            }
            try
            {
                DB_connection.OpenConn();
                DB_PUT.Vjezbe_Put(vj);
                DB_connection.CloseConn();
                Change_label("Vježba " + vj.Naziv.ToString() + " unesena");
                btnUnosVjezbi02_Click(sender, e);
            }
            catch (ArgumentException err)
            {
                lblUnosResult.ForeColor = Color.Red;
                Change_label("Greška kod unosa vježbe: " + err.ToString());
            }
        }
Exemplo n.º 12
0
        private void btnUnosIgrac_Click(object sender, EventArgs e)
        {
            //za poziciju na ekranu, da se pojavi na sredini slike
            var x = (this.Width / 2) - (panelUnosIgr.Width / 2);
            var y = (this.Height / 2) - (panelUnosIgr.Height / 2);

            panelUnosIgr.Location = new Point(x, y);

            var ek = new List <Ekipa>();

            try
            {
                DB_connection.OpenConn();
                ek = DB_GET.Ekipa_Get_All();
                DB_connection.CloseConn();
                cmbUnosIgr01.Items.Clear();
                cmbUnosIgr01.DisplayMember = "Naziv";
                foreach (var i in ek)
                {
                    cmbUnosIgr01.Items.Add(i);
                }
            }
            catch (ArgumentException err)
            {
                lblUnosResult.ForeColor = Color.Red;
                Change_label("Greška kod punjenja liste: " + err.ToString());
            }


            //enable --> neme interakcije, visible --> ne vidi se
            panelUnosIgr.Visible  = true;
            panelUnosIgr.Enabled  = true;
            btnUnosIgrac.Visible  = false;
            btnUnosIgrac.Enabled  = false;
            btnUnosVjezba.Visible = false;
            btnUnosVjezba.Enabled = false;
            btnUnosEkipa.Visible  = false;
            btnUnosEkipa.Enabled  = false;
            btnUnosBrisi.Visible  = false;
            btnUnosBrisi.Enabled  = false;
        }
Exemplo n.º 13
0
 private void rbtnKoseviPopup04_CheckedChanged(object sender, EventArgs e)
 {
     if (rbtnKoseviPopup04.Checked)
     {
         kos_sut.Br_Bod    = 3;
         this.Bodovi_popup = 3;
         if (chbKoseviPogodeno.Checked)
         {
             kos_sut.Pogodak = true; this.Pogodeno_popup = true;
         }
         else
         {
             kos_sut.Pogodak = false; this.Pogodeno_popup = false;
         }
         this.status = true;
     }
     DB_connection.OpenConn();
     DB_PUT.Kosevi_Put(kos_sut);
     DB_connection.CloseConn();
     this.Close();
 }
Exemplo n.º 14
0
        public void Izracun_postotka_prisutnosti()
        {
            pri = new List <Prisutnost>();
            DB_connection.OpenConn();
            pri = DB_GET.Prisutnost_Get_By_Id(Entity_Id);
            DB_connection.CloseConn();

            decimal count = 0;

            if (pri.Count != 0)
            {
                foreach (var i in pri)
                {
                    if (i.Prisutan == true)
                    {
                        count++;
                    }
                }
                this.Postotak_prisutnost = count / pri.Count();
            }
        }
Exemplo n.º 15
0
        private void btnUnosEkipe01_Click(object sender, EventArgs e)
        {
            var ek = new Ekipa();

            ek.Naziv  = txtbUnosEkipe.Text;
            ek.Trener = txtbUnosEkipe02.Text;

            try
            {
                DB_connection.OpenConn();
                DB_PUT.Ekipa_Put(ek);
                DB_connection.CloseConn();
                Change_label("Ekipa " + ek.Naziv.ToString() + " unešena");
                btnUnosEkipe02_Click(sender, e);
            }
            catch (ArgumentException err)
            {
                lblUnosResult.ForeColor = Color.Red;
                Change_label("Greška kod unosa ekipe: " + err.ToString());
            }
        }
Exemplo n.º 16
0
        private void btnZapisnik02_Click(object sender, EventArgs e)
        {
            var zap = new Zapisnik();

            zap.Datum      = (DateTime)calendarZapisnik.SelectionRange.Start;
            zap.Ekipa_id   = ek.Id;
            zap.Ekipa_gost = txtbZapisnik01.Text;
            zap.Rez_dom    = Int32.Parse(txtbZapisnik02.Text);
            zap.Rez_gost   = Int32.Parse(txtbZapisnik03.Text);
            try
            {
                DB_connection.OpenConn();
                DB_PUT.Zapisnik_Put(zap);
                DB_connection.CloseConn();
                this.Close();
            }
            catch (ArgumentException err)
            {
                lblZapisnikResult.ForeColor = Color.Red;
                Change_label(err.ToString());
            }
        }
Exemplo n.º 17
0
        private void gvIgraci()
        {
            //broj stupca
            gv.ColumnCount = 2;

            igr = new List <Igraci>();
            DB_connection.OpenConn();
            if (get_by_id != 0)
            {
                igr = DB_GET.Ekipa_Get_By_Id(get_by_id); //dohvacanje igraca iz iste ekipe
            }
            else
            {
                igr = DB_GET.Igraci_Get_All(); //dohvacanje igraca
            }

            DB_connection.CloseConn();

            var collection = new ObservableCollection <Igraci>(igr); //stvaranje kolekcije...preko presentera

            datasource = new BindingSource(collection, null);        //vezanje kolekcije za datasource
            //postavljanje vidljivih stupaca
            gv.Columns[0].HeaderText       = "Ime";
            gv.Columns[0].DataPropertyName = "Ime";
            gv.Columns[1].HeaderText       = "Prezime";
            gv.Columns[1].DataPropertyName = "Prezime";

            //lambda funkcija (google it)....za dobivanje igraca kojeg se kliknulo u grid view
            gv.CellClick += (s, e) =>
            {
                igrac_id = (Igraci)this.igr[e.RowIndex];
            };

            gv.DataSource          = datasource;                           //vezanje grid view sa datasource (koji je kolekcija)
            gv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //da se popuni prostor
            gv.AutoResizeColumns();
            gv.AllowUserToAddRows = false;                                 //ne dopusta dodavanje novih redova
        }
Exemplo n.º 18
0
        private void cmbBrisanjeOdabir_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selected_idex = cmbBrisanjeOdabir.SelectedIndex;

            selected_item = cmbBrisanjeOdabir.SelectedItem.ToString();
            try
            {
                DB_connection.OpenConn();
                switch (selected_idex)
                {
                case 0:
                {
                    ekipe = DB_GET.Ekipa_Get_All();
                    var collection = new ObservableCollection <Ekipa>(ekipe);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "EKIPA";
                    break;
                }

                case 1:
                {
                    igrac = DB_GET.Igraci_Get_All();
                    var collection = new ObservableCollection <Igraci>(igrac);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "IGRAC";
                    break;
                }

                case 2:
                {
                    prisutan = DB_GET.Prisutnost_Get_All();
                    var collection = new ObservableCollection <Prisutnost>(prisutan);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "PRISUTNOST";
                    break;
                }

                case 3:
                {
                    trening = DB_GET.Trening_Get_All();
                    var collection = new ObservableCollection <Trening>(trening);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "TRENING";
                    break;
                }

                case 4:
                {
                    statistike = DB_GET.Statistika_Get_All();
                    var collection = new ObservableCollection <Statistika>(statistike);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "STATISTIKA";
                    break;
                }

                case 5:
                {
                    zapisnik = DB_GET.Zapisnik_Get_All();
                    var collection = new ObservableCollection <Zapisnik>(zapisnik);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "ZAPISNIK";
                    break;
                }

                case 6:
                {
                    vjezba = DB_GET.Vjezbe_Get_All();
                    var collection = new ObservableCollection <Vjezbe>(vjezba);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "VJEZBE";
                    break;
                }

                case 7:
                {
                    kosevi = DB_GET.Kosevi_Get_All();
                    var collection = new ObservableCollection <Kosevi>(kosevi);
                    datasource    = new BindingSource(collection, null);
                    selected_item = "KOSEVI";
                    break;
                }
                }
                DB_connection.CloseConn();
            }
            catch (ArgumentException err)
            {
                lblBrisanjeResult.ForeColor = Color.Red;
                Change_label("Greška kod brisanja: " + err.ToString());
            }


            dgvBrisanje.DataSource          = datasource;
            dgvBrisanje.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvBrisanje.AutoResizeColumns();
        }
Exemplo n.º 19
0
        private void Prikaz_statistika()
        {
            try
            {
                DB_connection.OpenConn();
                switch (trenutni)
                {
                case 0:
                {
                    stat = DB_GET.Statistika_Get_By_Id(igrac_id.Id, 'I');
                    break;
                }

                case 1:
                {
                    stat = DB_GET.Statistika_Get_By_Id(ekipa_id.Id, 'E');
                    break;
                }
                }
                DB_connection.CloseConn();
            }
            catch (ArgumentException err)
            {
                lblStatistikaResult.ForeColor = System.Drawing.Color.Red;
                Change_label("Greška kod čitanja podataka: " + err.ToString());
            }


            List <decimal> podaci_Visina     = new List <decimal>();
            List <decimal> podaci_Tezina     = new List <decimal>();
            List <decimal> podaci_Raspon     = new List <decimal>();
            List <decimal> podaci_Brzina     = new List <decimal>();
            List <decimal> podaci_BrzinaSU   = new List <decimal>();
            List <decimal> podaci_Skok       = new List <decimal>();
            List <decimal> podaci_PostotakS  = new List <decimal>();
            List <decimal> podaci_PostotakP  = new List <decimal>();
            decimal        podatak_Prisutnos = 0;

            if (stat.Count > 0)
            {
                stat[0].Izracun_postotka_prisutnosti();
                podatak_Prisutnos = Math.Round(stat[0].Postotak_prisutnost * 100, 2);
            }



            foreach (var s in stat)
            {
                if (s.Postotak_prisutnost != 0)
                {
                    podaci_PostotakP.Add(s.Postotak_prisutnost);
                }
                if (s.Visina != 0)
                {
                    podaci_Visina.Add(s.Visina);
                }
                if (s.Tezina != 0)
                {
                    podaci_Tezina.Add(s.Tezina);
                }
                if (s.Raspon_ruku != 0)
                {
                    podaci_Raspon.Add(s.Raspon_ruku);
                }
                if (s.Brz_Spr != 0)
                {
                    podaci_Brzina.Add(s.Brz_Spr);
                }
                if (s.Brz_SU != 0)
                {
                    podaci_BrzinaSU.Add(s.Brz_SU);
                }
                if (s.Skok_ud != 0)
                {
                    podaci_Skok.Add(s.Skok_ud);
                }
            }

            chartStatistikaVisina.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Visina",
                    Values = new ChartValues <decimal>(podaci_Visina),
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 0, 40, 204))
                }
            };
            chartStatistikaTezina.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Težina",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 221, 3, 3)),
                    Values = new ChartValues <decimal>(podaci_Tezina)
                }
            };
            chartStatistikaSkokU.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Skok udalj",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 33, 170, 33)),
                    Values = new ChartValues <decimal>(podaci_Skok)
                }
            };
            chartStatistikaRasponR.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Raspon ruku",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 126, 11, 126)),
                    Values = new ChartValues <decimal>(podaci_Raspon)
                }
            };
            chartStatistikaBrzinaS.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Brzina šprint",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 20, 220, 200)),
                    Values = new ChartValues <decimal>(podaci_Brzina)
                }
            };
            chartStatistikaBrzinaSU.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Brzina - samoubojstvo",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 243, 235, 27)),
                    Values = new ChartValues <decimal>(podaci_BrzinaSU)
                }
            };
            pieStatistikaPrisutnost.Series = new SeriesCollection
            {
                new PieSeries
                {
                    Title  = "Prisutan",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 23, 211, 111)),
                    Values = new ChartValues <decimal> {
                        podatak_Prisutnos
                    }
                },
                new PieSeries
                {
                    Title  = "Odsutan",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 230, 10, 15)),
                    Values = new ChartValues <decimal> {
                        100 - podatak_Prisutnos
                    }
                }
            };
        }
Exemplo n.º 20
0
        public Prikaz_suteva(int entitet_id, char vrsta, string naslov, List <Statistika> stat)
        {
            InitializeComponent();
            statistika = stat;
            DB_connection.OpenConn();
            List <Kosevi> sut = DB_GET.Kosevi_Get_By_Id(entitet_id, vrsta); //dobivanje suteva po igracu/ekipi

            DB_connection.CloseConn();
            var picb_H = picbPrikazSutevaTeren.Height;
            var picb_W = picbPrikazSutevaTeren.Width;


            foreach (var sutevi in sut)
            {
                if (sutevi.Pogodak == true)
                {
                    count_pogodeno++;
                }
                var poz_X = sutevi.Poz_X * picb_W + picbPrikazSutevaTeren.Location.X;
                var poz_Y = sutevi.Poz_Y * picb_H + picbPrikazSutevaTeren.Location.Y;
                var img   = new PrikazSuteva_pozicije(sutevi.Pogodak, poz_X, poz_Y); //instanciranje novog prikaza za svaki sut
                this.Controls.Add(img.pic);
                img.pic.BringToFront();                                              //da bude ispred prijasnje dodanih
                img.pic.BackColor = System.Drawing.Color.FromArgb(255, 0, 6, 58);
            }

            List <decimal> podaci_sutevi = new List <decimal>();

            foreach (var s in statistika)
            {
                if (s.Postotak_suteva != 0)
                {
                    podaci_sutevi.Add(Math.Round(s.Postotak_suteva * 100, 2));
                }
            }
            decimal rate = Math.Round((count_pogodeno / sut.Count) * 100, 2);

            lblPrikazSutevaIme.Text = naslov.ToString();

            piePrikazSuteva.Series = new SeriesCollection
            {
                new PieSeries
                {
                    Title  = "Pogođeno",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 8, 231, 223)),
                    Values = new ChartValues <decimal> {
                        rate
                    }
                },
                new PieSeries
                {
                    Title  = "Promašeno",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 210, 8, 12)),
                    Values = new ChartValues <decimal> {
                        100 - rate
                    }
                }
            };

            chartPrikazSuteva.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Postotak šuteva po sekcij",
                    Fill   = new SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 7, 232, 180)),
                    Values = new ChartValues <decimal>(podaci_sutevi)
                }
            };
        }