Esempio n. 1
0
 private void listViewSubjects_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSubjects.SelectedItems.Count == 1)
     {
         SubjectsSet subjectsSet = listViewSubjects.SelectedItems[0].Tag as SubjectsSet;
         comboBoxTeacher.SelectedIndex = comboBoxTeacher.FindString(subjectsSet.id_Teacher.ToString());
     }
     else
     {
         comboBoxTeacher.SelectedItem = null;
     }
 }
Esempio n. 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewSubjects.SelectedItems.Count == 1)
     {
         if (comboBoxTeacher.SelectedItem != null)
         {
             SubjectsSet subjectsSet = listViewSubjects.SelectedItems[0].Tag as SubjectsSet;
             subjectsSet.id_Teacher = Convert.ToInt32(comboBoxTeacher.SelectedItem.ToString().Split('.')[0]);
             Program.abc.SaveChanges();
             ShowSubjects();
         }
         else
         {
             MessageBox.Show("Заполните все поля", "Невозможно внести данные!", MessageBoxButtons.OK);
         }
     }
 }