Пример #1
0
        public StvoriNovoNatjecanje()
        {
            InitializeComponent();
            var seasonProc       = new SeasonProcessor();
            var organizationProc = new OrganizationProcessor();

            comboBox1.DataSource            = seasonProc.RetrieveCompetitions();
            comboBox2.DataSource            = seasonProc.RetrieveSeasons(DateTime.Now);
            comboBox1.DisplayMember         = "Name";
            comboBox1.ValueMember           = "Id";
            comboBox2.DisplayMember         = "Name";
            comboBox2.ValueMember           = "Id";
            comboBox1.SelectedIndexChanged += SelectedIndexChanged;
            comboBox2.SelectedIndexChanged += SelectedIndexChanged;
            var organizations         = organizationProc.getOrganizations();
            var orglic                = organizationProc.RetrieveOrganizationWithLicence(int.Parse(comboBox2.SelectedValue.ToString()), int.Parse(comboBox1.SelectedValue.ToString()));
            List <Organization> lista = new List <Organization>();

            foreach (var org in organizations)
            {
                if (orglic.Contains(org.Id))
                {
                    lista.Add(org);
                }
            }

            listBox1.DataSource    = lista;
            listBox1.DisplayMember = "Name";
            listBox1.ValueMember   = "Id";
            listBox1.SelectionMode = SelectionMode.MultiExtended;
        }
Пример #2
0
        private void SelectedIndexChanged(object sender, EventArgs e)
        {
            var organizationProc      = new OrganizationProcessor();
            var organizations         = organizationProc.getOrganizations();
            var orglic                = organizationProc.RetrieveOrganizationWithLicence(int.Parse(comboBox2.SelectedValue.ToString()), int.Parse(comboBox1.SelectedValue.ToString()));
            List <Organization> lista = new List <Organization>();

            foreach (var org in organizations)
            {
                if (orglic.Contains(org.Id))
                {
                    lista.Add(org);
                }
            }
            listBox1.DataSource = lista;
        }