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