Exemplo n.º 1
0
        private void Form_Skupina_Load(object sender, EventArgs e)
        {
            DataTable            dataT_jazyky       = dt.getJazyk();
            DataTable            dataT_semestr      = dt.getSemestr();
            DataTable            dataT_forma_studia = dt.getFormaStudia();
            DataTable            dataT_typ_studia   = dt.getTypStudia();
            List <combobox_item> col_jazyky         = new List <combobox_item>();
            List <combobox_item> col_semestr        = new List <combobox_item>();
            List <combobox_item> col_forma_studia   = new List <combobox_item>();
            List <combobox_item> col_typ_studia     = new List <combobox_item>();

            foreach (DataRow dr in dataT_jazyky.Rows)
            {
                col_jazyky.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = dr.ItemArray[1].ToString().Trim(), nazev = dr.ItemArray[2].ToString().Trim()
                });
            }

            foreach (DataRow dr in dataT_semestr.Rows)
            {
                col_semestr.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = dr.ItemArray[1].ToString().Trim(), nazev = dr.ItemArray[2].ToString().Trim()
                });
            }

            foreach (DataRow dr in dataT_forma_studia.Rows)
            {
                col_forma_studia.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = dr.ItemArray[1].ToString().Trim(), nazev = dr.ItemArray[2].ToString().Trim()
                });
            }

            foreach (DataRow dr in dataT_typ_studia.Rows)
            {
                col_typ_studia.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = dr.ItemArray[1].ToString().Trim(), nazev = dr.ItemArray[2].ToString().Trim()
                });
            }
            //Zdroje comboboxů
            comboBox_Jazyk.DataSource        = col_jazyky;
            comboBox_Semestr.DataSource      = col_semestr;
            comboBox_Forma_Studia.DataSource = col_forma_studia;
            comboBox_Typ_Studia.DataSource   = col_typ_studia;

            //Select default empty value
            comboBox_Jazyk.SelectedIndex        = -1;
            comboBox_Semestr.SelectedIndex      = -1;
            comboBox_Forma_Studia.SelectedIndex = -1;
            comboBox_Typ_Studia.SelectedIndex   = -1;
        }
Exemplo n.º 2
0
        public void Form_Seznam_Skupin_Load(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            tableSkupiny = dt.getSkupina();
            int i = 0;

            foreach (DataRow dr in tableSkupiny.Rows)
            {
                DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[i++].Clone();
                row.Cells[0].Value = Convert.ToInt32(dr.ItemArray[0]);
                row.Cells[1].Value = dr.ItemArray[1];
                row.Cells[2].Value = dr.ItemArray[2];
                row.Cells[3].Value = dt.getSemestr(Convert.ToInt32(dr.ItemArray[3])).Rows[0].ItemArray[1];
                row.Cells[4].Value = dr.ItemArray[4];
                row.Cells[5].Value = dt.getFormaStudia(Convert.ToInt32(dr.ItemArray[5])).Rows[0].ItemArray[1];
                row.Cells[6].Value = dt.getTypStudia(Convert.ToInt32(dr.ItemArray[6])).Rows[0].ItemArray[1];;
                row.Cells[7].Value = dt.getJazyk(Convert.ToInt32(dr.ItemArray[7])).Rows[0].ItemArray[1];
                //row.Cells[2].Value = dt.getNazevTypStitek(Convert.ToInt32(dr.ItemArray[3]));
                //if (dr.ItemArray[1].ToString() != string.Empty)
                //    row.Cells[3].Value = dt.getZamestnanecJmeno(Convert.ToInt32(dr.ItemArray[1]));
                dataGridView1.Rows.Add(row);
            }
        }