Ejemplo n.º 1
0
 private void listViewClient_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         ClientSet clientSet = listViewClient.SelectedItems[0].Tag as ClientSet;
         clientSet.ClientName      = textBoxName.Text;
         clientSet.ClientAdress    = textBoxAdress.Text;
         clientSet.ClientPhone     = textBoxPhone.Text;
         clientSet.ClientEmail     = textBoxEmail.Text;
         clientSet.ClientRequisits = textBoxRequisits.Text;
     }
     else
     {
         textBoxName.Text      = "";
         textBoxAdress.Text    = "";
         textBoxPhone.Text     = "";
         textBoxEmail.Text     = "";
         textBoxRequisits.Text = "";
     }
 }
Ejemplo n.º 2
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewClient.SelectedItems.Count == 1)
         {
             ClientSet clientSet = listViewClient.SelectedItems[0].Tag as ClientSet;
             Program.dinamoDB.ClientSet.Remove(clientSet);                    Program.dinamoDB.SaveChanges();
             ShowClient();
         }
         textBoxName.Text      = "";
         textBoxAdress.Text    = "";
         textBoxPhone.Text     = "";
         textBoxEmail.Text     = "";
         textBoxRequisits.Text = "";
     }
     catch
     {
         MessageBox.Show("невозможно удалить, эта запись используется", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }