Esempio n. 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            SotrudnikiSet sotrudnikiSet = new SotrudnikiSet();

            sotrudnikiSet.Name      = textBoxNames.Text;
            sotrudnikiSet.Dolzhnost = textBoxDolzhnost.Text;
            sotrudnikiSet.Dob       = textBoxDob.Text;
            sotrudnikiSet.Email     = textBoxEmail.Text;
            Program.rbs.SotrudnikiSet.Add(sotrudnikiSet);
            Program.rbs.SaveChanges();
            ShowSotrudniki();
        }
Esempio n. 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewSotrudniki.SelectedItems.Count == 1)
     {
         SotrudnikiSet sotrudnikiSet = listViewSotrudniki.SelectedItems[0].Tag as SotrudnikiSet;
         sotrudnikiSet.Name      = textBoxNames.Text;
         sotrudnikiSet.Dolzhnost = textBoxDolzhnost.Text;
         sotrudnikiSet.Dob       = textBoxDob.Text;
         sotrudnikiSet.Email     = textBoxEmail.Text;
         Program.rbs.SaveChanges();
         ShowSotrudniki();
     }
 }
Esempio n. 3
0
 private void listViewSotrudniki_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSotrudniki.SelectedItems.Count == 1)
     {
         SotrudnikiSet sotrudnikiSet = listViewSotrudniki.SelectedItems[0].Tag as SotrudnikiSet;
         textBoxNames.Text     = sotrudnikiSet.Name;
         textBoxDolzhnost.Text = sotrudnikiSet.Dolzhnost;
         textBoxDob.Text       = sotrudnikiSet.Dob;
         textBoxEmail.Text     = sotrudnikiSet.Email;
     }
     else
     {
         textBoxNames.Text     = "";
         textBoxDolzhnost.Text = "";
         textBoxDob.Text       = "";
         textBoxEmail.Text     = "";
     }
 }
Esempio n. 4
0
        private void buttonDel_Click(object sender, EventArgs e)
        {
            try
            {
                if (listViewSotrudniki.SelectedItems.Count == 1)
                {
                    SotrudnikiSet sotrudnikiSet = listViewSotrudniki.SelectedItems[0].Tag as SotrudnikiSet;
                    Program.rbs.SotrudnikiSet.Remove(sotrudnikiSet);
                    Program.rbs.SaveChanges();
                    ShowSotrudniki();
                }

                textBoxNames.Text     = "";
                textBoxDolzhnost.Text = "";
                textBoxDob.Text       = "";
                textBoxEmail.Text     = "";
            }
            catch
            {
                MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }