Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DialogResult dlgResult            = DialogResult.None;
            SelectGimnasticarUcesnikForm form = null;

            try
            {
                form      = new SelectGimnasticarUcesnikForm(takmicenjeId, gimnastika, null);
                dlgResult = form.ShowDialog();
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }

            if (dlgResult != DialogResult.OK || form.SelectedEntities.Count == 0)
            {
                return;
            }

            bool   added = false;
            string msg   = String.Empty;

            foreach (GimnasticarUcesnik g in form.SelectedEntities)
            {
                StartListaNaSpravi startLista2 = raspored.getStartLista(g, startLista.Grupa, startLista.Rotacija);
                if (startLista2 != null && startLista2.Sprava != startLista.Sprava)
                {
                    msg += g.ImeSrednjeImePrezime + " (" + Sprave.toString(startLista2.Sprava) + ")\n";
                    continue;
                }
                if (startLista.addGimnasticar(g))
                {
                    added = true;
                }
            }

            if (msg != String.Empty)
            {
                MessageDialogs.showMessage("Sledeci gimnsticari nisu dodati jer vec postoje u rotaciji:\n\n" + msg,
                                           this.Text);
            }

            if (added)
            {
                dirty = true;
                spravaGridUserControl1.setItems(startLista.Nastupi);
                spravaGridUserControl1.clearSelection();
            }
        }