Esempio n. 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            List <s_students> q = (from stud in db.s_students
                                   select stud).ToList();

            if (dataGridView1.SelectedCells.Count == 1)
            {
                if (Application.OpenForms.Count == 2)
                {
                    s_students students = q.First(c => c.id.ToString() == dataGridView1.SelectedCells[0]
                                                  .OwningRow.Cells[0].Value.ToString());
                    EditStudentForm formEditStudent = new EditStudentForm(students);
                    formEditStudent.Owner = this;
                    formEditStudent.Show();
                }
            }
        }
Esempio n. 2
0
        public EditStudentForm(s_students stud)
        {
            st = stud;
            InitializeComponent();
            var groups = (from g in db.s_in_group
                          select g.id_group).Distinct();

            foreach (int it in groups)
            {
                comboBox1.Items.Add(it);
            }
            textBox1.Text = st.surname.ToString();
            textBox2.Text = st.name.ToString();
            textBox3.Text = st.middlename.ToString();

            var query1 = (from g in db.s_in_group
                          where g.id_group == st.id_group
                          select g.group_num).ToList();

            comboBox1.SelectedItem = query1[0];
        }