private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { Prepods p = new Prepods(); p.OpenConnection(connectionString); People pe = p.GetPrepodByFIO(comboBox1.SelectedItem.ToString()); int idprep = p.GetIdByFIO(pe.name, pe.surname, pe.patronumic); p.CloseConnection(); this.label_Fio.Text = pe.surname + " " + pe.name[0] + '.' + pe.patronumic[0]; this.label_birthday.Text = pe.ConvertDate(); this.richTextBox_Info.Text = pe.information; Predmets pr = new Predmets(); pr.OpenConnection(connectionString); this.richTextBox1.Text = ""; this.richTextBox1.Text = String.Join("\n", pr.GetPredmetsByPrepodId(idprep)); pr.CloseConnection(); this.Text = comboBox1.Text; pictureBox1.Visible = true; label_Fio.Visible = true; label_birthday.Visible = true; label1.Visible = true; richTextBox_Info.Visible = true; richTextBox1.Visible = true; }
public PrepodMain(People p) { InitializeComponent(); //звполнение данными поля connectionString = ConfigurationManager.AppSettings["connectionString"]; Prepods prep = new Prepods(); prep.OpenConnection(connectionString); id=prep.GetIdByFIO(p.name,p.surname,p.patronumic); prep.CloseConnection(); this.Text = p.surname + " " + p.name; this.label_Fio.Text = p.surname + " " + p.name[0] + '.' + p.patronumic[0]; this.label_birthday.Text = p.ConvertDate(); this.richTextBox_Info.Text = p.information; }