private void btnDelete_Click(object sender, EventArgs e)
        {
            IList <UcesnikTakmicenja3> selItems = spravaGridUserControl1.DataGridViewUserControl
                                                  .getSelectedItems <UcesnikTakmicenja3>();

            if (selItems == null || selItems.Count != 1)
            {
                return;
            }

            UcesnikTakmicenja3 selItem = selItems[0];
            string             msg     = String.Format("Da li zelite da izbrisete kvalifikanta \"{0}\"?", selItem.Gimnasticar);

            if (!MessageDialogs.queryConfirmation(msg, "Kvalifikanti - " +
                                                  DeoTakmicenjaKodovi.toString(DeoTakmicenjaKod.Takmicenje3)))
            {
                return;
            }

            int selIndex = spravaGridUserControl1.DataGridViewUserControl.getSelectedItemIndex();

            rezTakmicenje.Takmicenje3.removeKvalifikant(selItem.Gimnasticar, sprava);
            refreshItems();
            spravaGridUserControl1.DataGridViewUserControl.setSelectedItemIndex(selIndex);
        }
 private void initUI()
 {
     Text = "Raspored sudija - " +
            DeoTakmicenjaKodovi.toString(raspored.DeoTakmicenjaKod);
     GridColumnsInitializer.initRasporedSudija(sudijskiOdbor.Id, spravaGridUserControl1.DataGridViewUserControl);
     spravaGridUserControl1.DataGridViewUserControl.DataGridView.ColumnWidthChanged += new DataGridViewColumnEventHandler(DataGridView_ColumnWidthChanged);
 }
 private void initUI()
 {
     Text = "Start lista - " +
            DeoTakmicenjaKodovi.toString(raspored.DeoTakmicenjaKod);
     GridColumnsInitializer.initStartLista(startLista.Id, spravaGridUserControl1.DataGridViewUserControl);
     spravaGridUserControl1.DataGridViewUserControl.DataGridView.ColumnWidthChanged += new DataGridViewColumnEventHandler(DataGridView_ColumnWidthChanged);
 }
Example #4
0
        private void initUI(RezultatskoTakmicenje startRezTakmicenje)
        {
            Text            = "Rezultati - " + DeoTakmicenjaKodovi.toString(deoTakKod);
            this.ClientSize = new Size(1100, 540);

            cmbTakmicenje.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbTakmicenje.DataSource    = rezTakmicenja;
            cmbTakmicenje.DisplayMember = "Naziv";
            cmbTakmicenje.SelectedIndex = 0;
            if (startRezTakmicenje != null)
            {
                ActiveTakmicenje = startRezTakmicenje;
            }
            cmbTakmicenje.SelectedIndexChanged += new EventHandler(cmbTakmicenje_SelectedIndexChanged);

            dataGridViewUserControl1.DataGridView.MouseUp       += new MouseEventHandler(DataGridView_MouseUp);
            dataGridViewUserControl1.GridColumnHeaderMouseClick +=
                new EventHandler <GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);

            if (forViewingOnly)
            {
                btnPrint.Enabled     = btnPrint.Visible = false;
                btnIzracunaj.Enabled = btnIzracunaj.Visible = false;
                prikaziKlubToolStripMenuItem.Enabled   = false;
                prikaziDrzavuToolStripMenuItem.Enabled = false;
                btnStampajKvalifikante.Enabled         = btnStampajKvalifikante.Visible = false;
                btnStampajSaOgranicenjem.Enabled       = btnStampajSaOgranicenjem.Visible = false;
            }
        }
Example #5
0
        private void initUI()
        {
            Text = "Kvalifikanti - "
                   + DeoTakmicenjaKodovi.toString(DeoTakmicenjaKod.Takmicenje3);

            cmbTakmicenje.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbTakmicenje.DataSource    = rezTakmicenja;
            cmbTakmicenje.DisplayMember = "Naziv";

            cmbSprava.DropDownStyle = ComboBoxStyle.DropDownList;
            List <string> sprave = new List <string>(Sprave.getSpraveNazivi(takmicenje.Gimnastika));

            cmbSprava.Items.AddRange(sprave.ToArray());

            spravaGridUserControl1.DataGridViewUserControl.GridColumnHeaderMouseClick +=
                new EventHandler <GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);
            spravaGridUserControl1.DataGridViewUserControl.DataGridView.MultiSelect = true;

            dataGridViewUserControl1.GridColumnHeaderMouseClick += new EventHandler <GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);
            GridColumnsInitializer.initKvalifikantiTak3(dataGridViewUserControl1,
                                                        takmicenje);
            dataGridViewUserControl1.DataGridView.MultiSelect = true;

            this.ClientSize = new Size(ClientSize.Width, 550);
        }
        private void initUI()
        {
            Text = "Kvalifikanti - "
                   + DeoTakmicenjaKodovi.toString(DeoTakmicenjaKod.Takmicenje3) + " - " + rezTakmicenje.Naziv;

            spravaGridUserControl1.init(sprava);
            GridColumnsInitializer.initKvalifikantiTak3(
                spravaGridUserControl1.DataGridViewUserControl, takmicenje);

            refreshItems();
        }
Example #7
0
        private void initUI()
        {
            Text            = "Rezultati ekipno - " + DeoTakmicenjaKodovi.toString(deoTakKod);
            this.ClientSize = new Size(800, 540);

            cmbTakmicenje.DropDownStyle         = ComboBoxStyle.DropDownList;
            cmbTakmicenje.DataSource            = rezTakmicenja;
            cmbTakmicenje.DisplayMember         = "NazivEkipnog";
            cmbTakmicenje.SelectedIndex         = 0;
            cmbTakmicenje.SelectedIndexChanged += new EventHandler(cmbTakmicenje_SelectedIndexChanged);

            dataGridViewUserControl1.DataGridView.CellMouseClick += new DataGridViewCellMouseEventHandler(DataGridViewEkipe_CellMouseClick);
            dataGridViewUserControl1.GridColumnHeaderMouseClick  +=
                new EventHandler <GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);

            dataGridViewUserControl1.DataGridView.MouseUp += new MouseEventHandler(DataGridViewEkipe_MouseUp);
            dataGridViewUserControl2.DataGridView.MouseUp += new MouseEventHandler(DataGridView_MouseUp);
        }
Example #8
0
        private void initUI()
        {
            Text = "Kvalifikanti - "
                   + DeoTakmicenjaKodovi.toString(DeoTakmicenjaKod.Takmicenje2);

            cmbTakmicenje.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbTakmicenje.DataSource    = rezTakmicenja;
            cmbTakmicenje.DisplayMember = "Naziv";

            dataGridViewUserControl1.GridColumnHeaderMouseClick += new EventHandler <GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);
            GridColumnsInitializer.initKvalifikantiTak2(dataGridViewUserControl1,
                                                        takmicenje);
            dataGridViewUserControl1.DataGridView.MultiSelect = true;

            dataGridViewUserControl2.GridColumnHeaderMouseClick += new EventHandler <GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);
            GridColumnsInitializer.initKvalifikantiTak2(dataGridViewUserControl2,
                                                        takmicenje);
            dataGridViewUserControl2.DataGridView.MultiSelect = true;
        }
Example #9
0
        private void initUI(RezultatskoTakmicenje startRezTakmicenje, Sprava startSprava)
        {
            Text            = "Rezultati - " + DeoTakmicenjaKodovi.toString(deoTakKod);
            this.ClientSize = new Size(ClientSize.Width, 540);

            cmbTakmicenje.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbTakmicenje.DataSource    = rezTakmicenja;
            cmbTakmicenje.DisplayMember = "Naziv";
            cmbTakmicenje.SelectedIndex = 0;
            if (startRezTakmicenje != null)
            {
                ActiveTakmicenje = startRezTakmicenje;
            }
            cmbTakmicenje.SelectedIndexChanged += new EventHandler(cmbTakmicenje_SelectedIndexChanged);

            cmbSprava.DropDownStyle = ComboBoxStyle.DropDownList;
            List <string> sprave = new List <string>(Sprave.getSpraveNazivi(rezTakmicenja[0].Gimnastika));

            cmbSprava.Items.AddRange(sprave.ToArray());
            cmbSprava.SelectedIndex = 0;
            if (startSprava != Sprava.Undefined)
            {
                ActiveSprava = startSprava;
            }
            cmbSprava.SelectedIndexChanged += new EventHandler(cmbSprava_SelectedIndexChanged);

            spravaGridUserControl1.DataGridViewUserControl.GridColumnHeaderMouseClick +=
                new EventHandler <GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);
            if (forViewingOnly)
            {
                spravaGridUserControl1.DataGridViewUserControl.DataGridView.MultiSelect = false;
            }
            else
            {
                spravaGridUserControl1.DataGridViewUserControl.DataGridView.MultiSelect = true;
            }

            spravaGridUserControl1.SpravaGridMouseUp += new EventHandler <SpravaGridMouseUpEventArgs>(spravaGridUserControl1_SpravaGridMouseUp);

            if (forViewingOnly)
            {
                btnOk.Enabled                  = select;
                btnOk.Visible                  = select;
                btnCancel.Enabled              = select;
                btnCancel.Visible              = select;
                btnClose.Enabled               = !select;
                btnClose.Visible               = !select;
                btnPrint.Enabled               = btnPrint.Visible = false;
                btnIzracunaj.Enabled           = btnIzracunaj.Visible = false;
                btnStampajKvalifikante.Enabled = btnStampajKvalifikante.Visible = false;
                if (!select)
                {
                    btnClose.Location = new Point(btnCancel.Location.X, btnCancel.Location.Y);
                }
                prikaziKlubToolStripMenuItem.Enabled   = false;
                prikaziDrzavuToolStripMenuItem.Enabled = false;
            }
            else
            {
                btnOk.Enabled     = false;
                btnOk.Visible     = false;
                btnCancel.Enabled = false;
                btnCancel.Visible = false;

                btnStampajKvalifikante.Location = new Point(550, btnClose.Location.Y);

                btnIzracunaj.Enabled  = btnIzracunaj.Visible = true;
                btnIzracunaj.Location = new Point(btnStampajKvalifikante.Location.X + btnStampajKvalifikante.Size.Width + 20,
                                                  btnCancel.Location.Y);
                btnClose.Enabled  = true;
                btnClose.Visible  = true;
                btnClose.Location = new Point(btnIzracunaj.Location.X + btnIzracunaj.Size.Width + 20, btnCancel.Location.Y);
            }
        }
Example #10
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            SelectGimnasticarUcesnikForm form = null;

            try
            {
                form = new SelectGimnasticarUcesnikForm(ActiveKategorija.Takmicenje.Id,
                                                        takmicenje.Gimnastika, ActiveKategorija);
                form.MultiSelect = false;
                if (form.ShowDialog() != DialogResult.OK ||
                    form.SelectedEntities.Count != 1)
                {
                    return;
                }
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }

            GimnasticarUcesnik g = (GimnasticarUcesnik)form.SelectedEntities[0];

            if (!ucestvuje(g, deoTakKod))
            {
                string msg = String.Format(
                    "Gimnasticar '{0}' ne ucestvuje u {1}.",
                    g.ImeSrednjeImePrezime, DeoTakmicenjaKodovi.toString(deoTakKod));
                MessageDialogs.showMessage(msg, this.Text);
                return;
            }

            Ocena    ocena   = null;
            ISession session = null;

            try
            {
                using (session = NHibernateHelper.Instance.OpenSession())
                    using (session.BeginTransaction())
                    {
                        CurrentSessionContext.Bind(session);
                        ocena = DAOFactoryFactory.DAOFactory.GetOcenaDAO().FindOcena(g, deoTakKod, ActiveSprava);
                    }
            }
            catch (Exception ex)
            {
                if (session != null && session.Transaction != null && session.Transaction.IsActive)
                {
                    session.Transaction.Rollback();
                }
                MessageDialogs.showError(ex.Message, this.Text);
                Close();
                return;
            }
            finally
            {
                CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory);
            }

            bool      edit;
            OcenaForm f;

            if (ocena != null)
            {
                edit = true;
                f    = new OcenaForm(ocena.Id, g, ActiveSprava, deoTakKod, takmicenje.Id);
            }
            else
            {
                edit = false;
                f    = new OcenaForm(null, g, ActiveSprava, deoTakKod, takmicenje.Id);
            }

            try
            {
                if (f.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();
            ocena   = null;
            session = null;
            try
            {
                using (session = NHibernateHelper.Instance.OpenSession())
                    using (session.BeginTransaction())
                    {
                        CurrentSessionContext.Bind(session);
                        ocena = DAOFactoryFactory.DAOFactory.GetOcenaDAO().FindByIdFetch(f.Entity.Id);
                    }
            }
            catch (Exception ex)
            {
                if (session != null && session.Transaction != null && session.Transaction.IsActive)
                {
                    session.Transaction.Rollback();
                }
                MessageDialogs.showError(ex.Message, this.Text);
                Close();
                return;
            }
            finally
            {
                Cursor.Hide();
                Cursor.Current = Cursors.Arrow;
                CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory);
            }

            bool opened = gridOpened(g.TakmicarskaKategorija, ActiveSprava);

            showGridOcene(g.TakmicarskaKategorija, ActiveSprava);
            List <Ocena> activeOcene = ocene[calculateOceneKey(g.TakmicarskaKategorija, ActiveSprava)];

            if (!edit)
            {
                // nova ocena se dodaje u listu activeOcene samo ako je grid vec bio
                // prikazivan; ako se grid prvi put prikazuje, ocene se ucitavaju i
                // medju njima se nalazi i ona koja je upravo dodata.
                if (opened)
                {
                    activeOcene.Add(ocena);
                }
            }
            else
            {
                activeOcene[activeOcene.IndexOf(ocena)] = ocena;
            }

            setOcene(activeOcene);
            selectOcena(ocena);
        }
Example #11
0
        public RasporedSudijaForm(int takmicenjeId, DeoTakmicenjaKod deoTakKod)
        {
            InitializeComponent();
            this.ClientSize    = new Size(1150, 540);
            this.StartPosition = FormStartPosition.CenterScreen;
            this.deoTakKod     = deoTakKod;

            this.Text = "Raspored sudija - " +
                        DeoTakmicenjaKodovi.toString(deoTakKod);

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();
            ISession session = null;

            try
            {
                using (session = NHibernateHelper.Instance.OpenSession())
                    using (session.BeginTransaction())
                    {
                        CurrentSessionContext.Bind(session);
                        kategorijeCount = DAOFactoryFactory.DAOFactory.GetTakmicarskaKategorijaDAO()
                                          .GetCountForTakmicenje(takmicenjeId);
                        if (kategorijeCount == 0)
                        {
                            throw new Exception("Greska u programu.");
                        }
                        rasporedi = DAOFactoryFactory.DAOFactory.GetRasporedSudijaDAO()
                                    .FindByTakmicenjeDeoTak(takmicenjeId, deoTakKod);

                        takmicenje = DAOFactoryFactory.DAOFactory.GetTakmicenjeDAO().FindById(takmicenjeId);
                        NHibernateUtil.Initialize(takmicenje);
                        // Potrebno za slucaj da ne postoje sudije na spravama vec samo vrhovni sudija.
                        NHibernateUtil.Initialize(takmicenje.VrhovniSudija);

                        // create tabs
                        for (int i = 0; i < rasporedi.Count; i++)
                        {
                            createTab(rasporedi[i]);
                        }

                        tabOpened = new List <bool>();
                        for (int i = 0; i < rasporedi.Count; i++)
                        {
                            tabOpened.Add(false);
                        }

                        // show first tab
                        if (rasporedi.Count > 0)
                        {
                            if (tabControl1.SelectedIndex != 0)
                            {
                                tabControl1.SelectedIndex = 0;
                            }
                            else
                            {
                                onSelectedIndexChanged();
                            }
                        }
                        else
                        {
                            tabControl1.TabPages.Remove(tabPage1);
                        }
                    }
            }
            catch (Exception ex)
            {
                if (session != null && session.Transaction != null && session.Transaction.IsActive)
                {
                    session.Transaction.Rollback();
                }
                throw new InfrastructureException(ex.Message, ex);
            }
            finally
            {
                Cursor.Hide();
                Cursor.Current = Cursors.Arrow;
                CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory);
            }
        }