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

            teachersSet.Login      = textBoxLogin.Text;
            teachersSet.Password   = textBoxPassword.Text;
            teachersSet.FirstName  = textBoxFirstName.Text;
            teachersSet.MiddleName = textBoxMiddleName.Text;
            teachersSet.LastName   = textBoxLastName.Text;
            teachersSet.Phone      = textBoxPhone.Text;
            teachersSet.Email      = textBoxEmail.Text;
            Program.wftDb.TeachersSet.Add(teachersSet);
            Program.wftDb.SaveChanges();
            ShowTeacher();
        }
Exemplo n.º 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewTeacher.SelectedItems.Count == 1)
     {
         TeachersSet teachersSet = listViewTeacher.SelectedItems[0].Tag as TeachersSet;
         teachersSet.Login      = textBoxLogin.Text;
         teachersSet.Password   = textBoxPassword.Text;
         teachersSet.FirstName  = textBoxFirstName.Text;
         teachersSet.MiddleName = textBoxMiddleName.Text;
         teachersSet.LastName   = textBoxLastName.Text;
         teachersSet.Phone      = textBoxPhone.Text;
         teachersSet.Email      = textBoxEmail.Text;
         Program.wftDb.SaveChanges();
         ShowTeacher();
     }
 }
Exemplo n.º 3
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewTeacher.SelectedItems.Count == 1)
         {
             TeachersSet teachersSet = listViewTeacher.SelectedItems[0].Tag as TeachersSet;
             Program.wftDb.TeachersSet.Remove(teachersSet);
             Program.wftDb.SaveChanges();
             ShowTeacher();
         }
         textBoxLogin.Text      = "";
         textBoxPassword.Text   = "";
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPhone.Text      = "";
         textBoxEmail.Text      = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 4
0
 private void listViewTeacher_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewTeacher.SelectedItems.Count == 1)
     {
         TeachersSet teachersSet = listViewTeacher.SelectedItems[0].Tag as TeachersSet;
         textBoxLogin.Text      = teachersSet.Login;
         textBoxPassword.Text   = teachersSet.Password;
         textBoxFirstName.Text  = teachersSet.FirstName;
         textBoxMiddleName.Text = teachersSet.MiddleName;
         textBoxLastName.Text   = teachersSet.LastName;
         textBoxPhone.Text      = teachersSet.Phone;
         textBoxEmail.Text      = teachersSet.Email;
     }
     else
     {
         textBoxLogin.Text      = "";
         textBoxPassword.Text   = "";
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPhone.Text      = "";
         textBoxEmail.Text      = "";
     }
 }