예제 #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Menager menager = new Menager();

            menager.FirstName  = textBoxFirstName.Text;
            menager.LastName   = textBoxLastName.Text;
            menager.MiddleName = textBoxMiddleName.Text;
            menager.E_mail     = textBoxEmail.Text;
            Program.qwer.Menager.Add(menager);
            Program.qwer.SaveChanges();
            ShowMenager();
        }
예제 #2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewMenager.SelectedItems.Count == 1)
     {
         Menager menager = listViewMenager.SelectedItems[0].Tag as Menager;
         menager.FirstName  = textBoxFirstName.Text;
         menager.LastName   = textBoxLastName.Text;
         menager.MiddleName = textBoxMiddleName.Text;
         menager.E_mail     = textBoxEmail.Text;
         Program.qwer.SaveChanges();
         ShowMenager();
     }
 }
예제 #3
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewMenager.SelectedItems.Count == 1)
         {
             Menager menager = listViewMenager.SelectedItems[0].Tag as Menager;
             Program.qwer.Menager.Remove(menager);
             Program.qwer.SaveChanges();
             ShowMenager();
         }
         textBoxFirstName.Text  = "";
         textBoxLastName.Text   = "";
         textBoxMiddleName.Text = "";
         textBoxEmail.Text      = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, запись используется!", "Ошибка!",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }