private void button1_Click(object sender, EventArgs e) { Cities = new DataTable(); string sql = "select city.id, nm = naspunkt_type.name + ' ' + city.name from city " + " join naspunkt_type on naspunkt_type.id = city.naspunkt_type_id " + " where city.region_id = " + region_id + " order by naspunkt_type.out_order"; (new SqlDataAdapter(sql, main.global_connection)).Fill(Cities); ListWindow lw = new ListWindow(); lw.Text = "Выберите нас. пункт"; lw.tbl = Cities; DialogResult res = lw.ShowDialog(); if (res == DialogResult.OK) { gorod_id = lw.resId.ToString(); nas_punkt_box.Text = lw.str_res; } lw.Dispose(); GC.Collect(); streets = new DataTable(); sql = "select street.id, street.name from street " + " where street.city_id = " + gorod_id + " order by name"; (new SqlDataAdapter(sql, main.global_connection)).Fill(streets); street.Text = string.Empty; }
private void button1_Click(object sender, EventArgs e) { DataTable preps = new DataTable(); q = "select prepod.id, " + " fio = prepod.fam + ' ' + prepod.im + ' ' + prepod.ot " + " from prepod " + " join kafedra on kafedra.id = prepod.kafedra_id " + " where prepod.actual = 1 and fam<>'-' " + " order by priority, fam, im, ot"; main.global_adapter = new SqlDataAdapter(q, main.global_connection); main.global_adapter.Fill(preps); ListWindow lw = new ListWindow(); lw.Text = "Выбор руководителя"; lw.tbl = preps; DialogResult res = lw.ShowDialog(); if (res == DialogResult.Cancel) { return; } ruk_id = lw.resId; ruk.Text = lw.str_res; lw.Dispose(); }
private void button3_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("id"); dt.Columns.Add("name"); string[] fams = new string[] { "" }; if (male.Checked) { fams = mailot; } if (female.Checked) { fams = femailot; } int i = 0; foreach (string nm in fams) { object[] parms = new object[] { i, nm }; dt.Rows.Add(parms); i++; } ListWindow lw = new ListWindow(); lw.tbl = dt; lw.Text = "Выбор отчества"; DialogResult res = lw.ShowDialog(); if (res == DialogResult.Cancel) { return; } ot.Text = dt.Rows[lw.resId][1].ToString(); lw.Dispose(); }
private void born_place__button_Click(object sender, EventArgs e) { regions = new DataTable(); string sql = "select id, name from region"; (new SqlDataAdapter(sql, main.global_connection)).Fill(regions); ListWindow lw = new ListWindow(); lw.Text = "Выберите название региона из списка"; lw.tbl = regions; DialogResult res = lw.ShowDialog(); if (res == DialogResult.OK) { region_id = lw.resId.ToString(); region_box.Text = lw.str_res; } lw.Dispose(); GC.Collect(); }