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

            managers.idManager  = textBoxidManager.Text;
            managers.Login      = textBoxLogin.Text;
            managers.Password   = textBoxPassword.Text;
            managers.FirstName  = textBoxFirstName.Text;
            managers.MiddleName = textBoxMiddleName.Text;
            managers.LastName   = textBoxLastName.Text;
            Program.eks.Managers.Add(managers);
            Program.eks.SaveChanges();
        }
Exemplo n.º 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewManagers.SelectedItems.Count == 1)
     {
         Managers managers = listViewManagers.SelectedItems[0].Tag as Managers;
         managers.idManager  = textBoxidManager.Text;
         managers.Login      = textBoxLogin.Text;
         managers.Password   = textBoxPassword.Text;
         managers.FirstName  = textBoxFirstName.Text;
         managers.MiddleName = textBoxMiddleName.Text;
         managers.LastName   = textBoxLastName.Text;
         Program.eks.SaveChanges();
         ShowManagers();
     }
 }
Exemplo n.º 3
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewManagers.SelectedItems.Count == 1)
         {
             Managers managers = listViewManagers.SelectedItems[0].Tag as Managers;
             Program.eks.Managers.Remove(managers);
             Program.eks.SaveChanges();
         }
         textBoxidManager.Text  = "";
         textBoxLogin.Text      = "";
         textBoxPassword.Text   = "";
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
     }
     catch
     {
         MessageBox.Show("невозможно удалить, эта запись используется!", "ошибка!",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }