private void buttonEditInfo_Click(object sender, EventArgs e)
 {
     if (listViewSell.SelectedItems.Count == 1)
     {
         SellsAction ssa = listViewSell.SelectedItems[0].Tag as SellsAction;
         ssa.IdAction   = Convert.ToInt32(comboBoxNameAction.SelectedItem.ToString().Split('.')[0]);
         ssa.DateSells  = Convert.ToString(textBoxDateSells.Text);
         ssa.PriceSells = Convert.ToString(textBoxPriceSells.Text);
         Program.ADb.SaveChanges();
         ShowSell();
     }
 }
 private void listViewSell_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSell.SelectedItems.Count == 1)
     {
         SellsAction ssa = listViewSell.SelectedItems[0].Tag as SellsAction;
         comboBoxNameAction.SelectedIndex = comboBoxNameAction.FindString(ssa.IdAction.ToString());
         textBoxDateSells.Text            = ssa.DateSells.ToString();
         textBoxPriceSells.Text           = ssa.PriceSells.ToString();
     }
     else
     {
         comboBoxNameAction.SelectedItem = null;
         textBoxDateSells.Text           = "";
         textBoxPriceSells.Text          = "";
     }
 }
 private void buttonAddInfo_Click(object sender, EventArgs e)
 {
     if (comboBoxNameAction.SelectedItem != null)
     {
         SellsAction ssa = new SellsAction();
         ssa.IdAction   = Convert.ToInt32(comboBoxNameAction.SelectedItem.ToString().Split('.')[0]);
         ssa.DateSells  = Convert.ToString(textBoxDateSells.Text);
         ssa.PriceSells = Convert.ToString(textBoxPriceSells.Text);
         Program.ADb.SellsAction.Add(ssa);
         Program.ADb.SaveChanges();
         ShowSellsAction();
     }
     else
     {
         MessageBox.Show("Данные не выбраны", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 private void buttonDelInfo_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewSell.SelectedItems.Count == 1)
         {
             SellsAction ssa = listViewSell.SelectedItems[0].Tag as SellsAction;
             Program.ADb.SellsAction.Remove(ssa);
             Program.ADb.SaveChanges();
             ShowSell();
         }
         comboBoxNameAction.SelectedItem = null;
         textBoxDateSells.Text           = "";
         textBoxPriceSells.Text          = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }