Esempio n. 1
0
 private void ButtonEdit_Click(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         ClientSet clientSet = listViewClient.SelectedItems[0].Tag as ClientSet;
         clientSet.FirstName  = textBoxFirstName.Text;
         clientSet.MiddleName = textBoxMiddleName.Text;
         clientSet.LastName   = textBoxLastName.Text;
         clientSet.Phone      = textBoxPhone.Text;
         clientSet.Email      = textBoxEmail.Text;
         Program.psDb.SaveChanges();
         ShowClient();
     }
 }
Esempio n. 2
0
 private void ListViewClient_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         ClientSet clientSet = listViewClient.SelectedItems[0].Tag as ClientSet;
         textBoxFirstName.Text  = clientSet.FirstName;
         textBoxMiddleName.Text = clientSet.MiddleName;
         textBoxLastName.Text   = clientSet.LastName;
         textBoxPhone.Text      = clientSet.Phone;
         textBoxEmail.Text      = clientSet.Email;
     }
     else
     {
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPhone.Text      = "";
         textBoxEmail.Text      = "";
     }
 }
Esempio n. 3
0
 private void ButtonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewClient.SelectedItems.Count == 1)
         {
             ClientSet clientSet = listViewClient.SelectedItems[0].Tag as ClientSet;
             Program.psDb.ClientSet.Remove(clientSet);
             Program.psDb.SaveChanges();
             ShowClient();
         }
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPhone.Text      = "";
         textBoxEmail.Text      = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }