Exemple #1
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         ClientSet clientSet = listViewClient.SelectedItems[0].Tag as ClientSet;
         clientSet.INN           = textBoxINN.Text;
         clientSet.Name          = textBoxName.Text;
         clientSet.Adress        = textBoxAddress.Text;
         clientSet.Email         = textBoxEmail.Text;
         clientSet.Phone         = textBoxPhone.Text;
         clientSet.ContactPerson = textBoxContactPerson.Text;
         Program.entities1c.SaveChanges();
         ShowClient();
     }
 }
Exemple #2
0
 private void listViewClient_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         ClientSet clientSet = listViewClient.SelectedItems[0].Tag as ClientSet;
         textBoxINN.Text           = clientSet.INN;
         textBoxName.Text          = clientSet.Name;
         textBoxAddress.Text       = clientSet.Adress;
         textBoxEmail.Text         = clientSet.Email;
         textBoxPhone.Text         = clientSet.Phone;
         textBoxContactPerson.Text = clientSet.ContactPerson;
     }
     else
     {
         textBoxINN.Text           = "";
         textBoxName.Text          = "";
         textBoxAddress.Text       = "";
         textBoxEmail.Text         = "";
         textBoxPhone.Text         = "";
         textBoxContactPerson.Text = "";
     }
 }
Exemple #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.entities1c.ClientSet.Remove(clientSet);
             Program.entities1c.SaveChanges();
             ShowClient();
         }
         textBoxINN.Text           = "";
         textBoxName.Text          = "";
         textBoxAddress.Text       = "";
         textBoxEmail.Text         = "";
         textBoxPhone.Text         = "";
         textBoxContactPerson.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }