Example #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            TypeProject typeProject = new TypeProject();

            typeProject.NameTypeProject = textBoxTypeProject.Text;
            Program.projectForSinaptic.TypeProject.Add(typeProject);
            Program.projectForSinaptic.SaveChanges();
            ShowTypeProject();
        }
Example #2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewTypeProject.SelectedItems.Count == 1)
     {
         TypeProject typeProject = listViewTypeProject.SelectedItems[0].Tag as TypeProject;
         typeProject.NameTypeProject = textBoxTypeProject.Text;
         Program.projectForSinaptic.SaveChanges();
         ShowTypeProject();
     }
 }
Example #3
0
 private void listViewTypeProject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewTypeProject.SelectedItems.Count == 1)
     {
         TypeProject typeProject = listViewTypeProject.SelectedItems[0].Tag as TypeProject;
         textBoxTypeProject.Text = typeProject.NameTypeProject;
     }
     else
     {
         textBoxTypeProject.Text = "";
     }
 }
Example #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewTypeProject.SelectedItems.Count == 1)
         {
             TypeProject typeProject = listViewTypeProject.SelectedItems[0].Tag as TypeProject;
             Program.projectForSinaptic.TypeProject.Remove(typeProject);
             Program.projectForSinaptic.SaveChanges();
             ShowTypeProject();
         }
     }
     catch
     {
         MessageBox.Show("Невозможно удалить!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }