Exemplo n.º 1
0
        private void ucitajKontrole()
        {
            ISession s = DataLayer.GetSession();

            s.Update(UpdateItem);

            dtpDat.Value = UpdateItem.Datum;
            foreach (RadioButton r in grpIshod.Controls.OfType <RadioButton>())
            {
                if (r.Text.ToUpper() == UpdateItem.Ishod)
                {
                    r.Checked = true;
                }
            }
            txtPartVreme.Text    = UpdateItem.Vreme;
            txtPartTrajanje.Text = UpdateItem.Trajanje.ToString();
            Beli  = UpdateItem.BeliIgrac;
            Crni  = UpdateItem.CrniIgrac;
            Sudac = UpdateItem.Sudija;
            Turn  = UpdateItem.Turnir;
            Ptz   = UpdateItem.Potezi;
            refreshLBX();
            lblCrni.Text = Crni.Ime + " " + Crni.Prezime;
            lblBeli.Text = Beli.Ime + " " + Beli.Prezime;
            label2.Text  = "\"" + Turn.Naziv + "\"" + "  " + Turn.Godina.ToString() + "  " + Turn.Grad;
            lblRbr.Text  = (Ptz.Count() + 1).ToString();
            string sudtext = SudOP.ucitajSudiju(s, Sudac);

            lblSudija.Text = sudtext;
            s.Close();
        }
Exemplo n.º 2
0
        private void ucitajDGV()
        {
            try
            {
                dgvSahista.Columns.Clear();
                ISession s = DataLayer.GetSession();

                int            i   = 0;
                IList <Sudija> sud = (from o in s.Query <Sudija>()
                                      select o).ToList <Sudija>();

                SortableBindingList <Sudija> a1 = new SortableBindingList <Sudija>(sud);
                dgvSudija.DataSource = a1;

                IList <Sahista> shl = (from o in s.Query <Sahista>()
                                       select o).ToList <Sahista>();

                SortableBindingList <Sahista> a2 = new SortableBindingList <Sahista>(shl);
                dgvSahista.DataSource = a2;

                //dgvSahista kod
                foreach (DataGridViewColumn v in dgvSahista.Columns)
                {
                    v.Visible = false;
                }
                dgvSahista.Columns["Ime"].Visible     = true;
                dgvSahista.Columns["Prezime"].Visible = true;
                dgvSahista.Columns["Drzava"].Visible  = true;

                //dgvSudija kod
                dgvSudija.Columns["Id"].Visible              = false;
                dgvSudija.Columns["FlagMajstor"].Visible     = false;
                dgvSudija.Columns["FlagOrganizator"].Visible = false;
                dgvSudija.Columns.Add("tip", "Tip");
                dgvSudija.Columns.Add("ime", "Ime i prezime");

                foreach (Sudija value in a1)
                {
                    string sts = SudOP.ucitajSudiju(s, value);
                    if (value.FlagMajstor == 1)
                    {
                        dgvSudija.Rows[i].Cells["tip"].Value = "Majstor";
                        dgvSudija.Rows[i].Cells["ime"].Value = sts;
                    }
                    else if (value.FlagOrganizator == 1)
                    {
                        dgvSudija.Rows[i].Cells["tip"].Value = "Organizator";
                        dgvSudija.Rows[i].Cells["ime"].Value = sts;
                    }
                    i++;
                }

                s.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }
Exemplo n.º 3
0
        private void osveziSudiju(SortableBindingList <Partija> a)
        {
            ISession s = DataLayer.GetSession();

            foreach (Partija p in a)
            {
                string sts = SudOP.ucitajSudiju(s, p.Sudija);
                dgv1.Rows[a.IndexOf(p)].Cells["sd"].Value = sts;
            }
            s.Close();
        }
Exemplo n.º 4
0
        public PartijaView(Partija o)
        {
            this.Datum     = o.Datum;
            this.Trajanje  = o.Trajanje;
            this.Ishod     = o.Ishod;
            this.BeliIgrac = o.BeliIgrac.ToString();
            this.CrniIgrac = o.CrniIgrac.ToString();
            this.Turnir    = o.Turnir.ToString();

            ISession s = DataLayer.GetSession();

            this.Sudija = SudOP.ucitajSudiju(s, o.Sudija);
            s.Close();

            Potezi = new List <PotezView>();

            foreach (Potez value in o.Potezi)
            {
                this.Potezi.Add(new PotezView(value));
            }
        }
Exemplo n.º 5
0
        private void btnPrikazPartije_Click(object sender, EventArgs e)
        {
            if (!Provera.chkIfSelected(dgv1))
            {
                return;
            }
            lblNaslov.Text           = "Partije";
            btnPromovisi.Visible     = false;
            btnOtpusti.Visible       = false;
            btnPrikazPartije.Visible = false;
            btnVezaOrgSpon.Visible   = false;
            btnDodajPartiju.Visible  = false;
            showPotez.Visible        = true;

            try
            {
                if (dgv1.CurrentRow.DataBoundItem is Sahista)
                {
                    ISession s   = DataLayer.GetSession();
                    Sahista  sah = dgv1.CurrentRow.DataBoundItem as Sahista;

                    IList <Partija> lsp = (from o in s.Query <Partija>()
                                           where (o.BeliIgrac == sah || o.CrniIgrac == sah)
                                           select o).ToList <Partija>();

                    SortableBindingList <Partija> a = new SortableBindingList <Partija>(lsp);

                    dgv1.Columns.Clear();
                    dgv1.DataSource = a;

                    dgv1.Columns["Potezi"].Visible = false;
                    dgv1.Columns["Sudija"].Visible = false;
                    dgv1.Columns.Add("sd", "Sudija");
                    string sts;
                    foreach (Partija p in a)
                    {
                        sts = SudOP.ucitajSudiju(s, p.Sudija);
                        dgv1.Rows[a.IndexOf(p)].Cells["sd"].Value = sts;
                    }

                    //dgv1.Update();
                    //dgv1.Refresh();

                    s.Close();
                }
                else if (dgv1.CurrentRow.DataBoundItem is Turnir)
                {
                    ISession s = DataLayer.GetSession();

                    Turnir trn = dgv1.CurrentRow.DataBoundItem as Turnir;
                    s.Update(trn);

                    SortableBindingList <Partija> a = new SortableBindingList <Partija>(trn.TPartije);

                    dgv1.Columns.Clear();
                    dgv1.DataSource = a;

                    dgv1.Columns["Potezi"].Visible = false;
                    dgv1.Columns["Sudija"].Visible = false;
                    dgv1.Columns["Turnir"].Visible = false;

                    dgv1.Columns.Add("sd", "Sudija");
                    string sts;
                    foreach (Partija p in a)
                    {
                        sts = SudOP.ucitajSudiju(s, p.Sudija);
                        dgv1.Rows[a.IndexOf(p)].Cells["sd"].Value = sts;
                    }

                    //dgv1.Update();
                    //dgv1.Refresh();

                    s.Close();
                }
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }