Exemple #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            ClientsSet clientsSet = new ClientsSet();

            clientsSet.Business = textBoxBusiness.Text;
            clientsSet.FIO      = textBoxFIO.Text;
            clientsSet.Phone    = textBoxPhone.Text;
            clientsSet.Email    = textBoxEmail.Text;
            Program.осБизнесСофт.ClientsSet.Add(clientsSet);
            Program.осБизнесСофт.SaveChanges();
            ShowСlients();
        }
Exemple #2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewClients.SelectedItems.Count == 1)
     {
         ClientsSet clientsSet = listViewClients.SelectedItems[0].Tag as ClientsSet;
         clientsSet.Business = textBoxBusiness.Text;
         clientsSet.FIO      = textBoxFIO.Text;
         clientsSet.Phone    = textBoxPhone.Text;
         clientsSet.Email    = textBoxEmail.Text;
         Program.осБизнесСофт.ClientsSet.Add(clientsSet);
         Program.осБизнесСофт.SaveChanges();
         ShowСlients();;
     }
 }
Exemple #3
0
 private void listViewClients_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewClients.SelectedItems.Count == 1)
     {
         ClientsSet clientsSet = listViewClients.SelectedItems[0].Tag as ClientsSet;
         textBoxBusiness.Text = clientsSet.Business;
         textBoxFIO.Text      = clientsSet.FIO;
         textBoxPhone.Text    = clientsSet.Phone;
         textBoxEmail.Text    = clientsSet.Email;
     }
     else
     {
         textBoxBusiness.Text = "";
         textBoxFIO.Text      = "";
         textBoxPhone.Text    = "";
         textBoxEmail.Text    = "";
     }
 }
Exemple #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewClients.SelectedItems.Count == 1)
         {
             ClientsSet clientsSet = listViewClients.SelectedItems[0].Tag as ClientsSet;
             Program.осБизнесСофт.ClientsSet.Remove(clientsSet);
             Program.осБизнесСофт.SaveChanges();
             ShowСlients();
         }
         textBoxBusiness.Text = "";
         textBoxFIO.Text      = "";
         textBoxPhone.Text    = "";
         textBoxEmail.Text    = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }