Exemplo n.º 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Predm subjectsSet = new Predm();

            subjectsSet.Name = textBoxN.Text;
            Program.sss.Predm.Add(subjectsSet);
            Program.sss.SaveChanges();
            ShowSubjects();
        }
Exemplo n.º 2
0
 private void listViewSub_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSub.SelectedItems.Count == 1)
     {
         Predm subjectsSet = listViewSub.SelectedItems[0].Tag as Predm;
         textBoxN.Text = subjectsSet.Name;
     }
     else
     {
         textBoxN.Text = "";
     }
 }
Exemplo n.º 3
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewSub.SelectedItems.Count == 1)
         {
             Predm subjectsSet = listViewSub.SelectedItems[0].Tag as Predm;
             Program.sss.Predm.Remove(subjectsSet);
             Program.sss.SaveChanges();
             ShowSubjects();
         }
         textBoxN.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }