/* инициализация списка тренеров */ private void init_combo_coach() { CCoach clCoach; string text; try { clCoach = new CCoach(connect); list_coach = clCoach.GetList(); comboBoxCoach1.Items.Add(""); comboBoxCoach2.Items.Add(""); comboBoxCoach3.Items.Add(""); foreach (STCoach item in list_coach) { text = string.Format("{0} {1}", item.family, item.name); comboBoxCoach1.Items.Add(text); comboBoxCoach2.Items.Add(text); comboBoxCoach3.Items.Add(text); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void init_data() { string text; DateTime dt; CCountry clCo = new CCountry(connect); g_f = false; try { dataGridViewCoach.Rows.Clear(); list = new List <STCoach>(); list = clCoach.GetList(); if (list.Count > 0) { g_f = true; dataGridViewCoach.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewCoach.Rows[i].Cells[0].Value = (i + 1).ToString(); text = list[i].family + " " + list[i].name + " " + list[i].payname; dataGridViewCoach.Rows[i].Cells[1].Value = text; if (list[i].datebirth != null) { dt = (DateTime)list[i].datebirth; dataGridViewCoach.Rows[i].Cells[2].Value = dt.ToShortDateString(); } dataGridViewCoach.Rows[i].Cells[3].Value = list[i].personalnum; if (list[i].idcountry != null) { clCo = new CCountry(connect, (int)list[i].idcountry); dataGridViewCoach.Rows[i].Cells[4].Value = clCo.stCountry.shortname; } dataGridViewCoach.Rows[i].Cells[5].Value = list[i].namefoto; dataGridViewCoach.Rows[i].Cells[6].Value = list[i].idcoach.ToString(); dataGridViewCoach.Rows[i].Cells[7].Value = list[i].descript; } dataGridViewCoach.AllowUserToAddRows = false; } toolStripStatusLabel1.Text = string.Format("Число тренеров: {0}", list.Count); } catch (Exception ex) { MessageBox.Show(ex.Message); } }