Beispiel #1
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewUchet.SelectedItems.Count == 1)
     {
         UchetSet uchet = listViewUchet.SelectedItems[0].Tag as UchetSet;
         uchet.IdBibl = Convert.ToInt32(comboBoxBibl.SelectedItem.ToString().Split('.')[0]);
         uchet.IdChit = Convert.ToInt32(comboBoxChit.SelectedItem.ToString().Split('.')[0]);
         uchet.IdBook = Convert.ToInt32(comboBoxBook.SelectedItem.ToString().Split('.')[0]);
         Program.wftDb.SaveChanges();
         ShowUchet();
     }
 }
Beispiel #2
0
 private void listViewUchet_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewUchet.SelectedItems.Count == 1)
     {
         UchetSet uchet = listViewUchet.SelectedItems[0].Tag as UchetSet;
         comboBoxBibl.SelectedIndex = comboBoxBibl.FindString(uchet.IdBibl.ToString());
         comboBoxChit.SelectedIndex = comboBoxChit.FindString(uchet.IdChit.ToString());
         comboBoxBook.SelectedIndex = comboBoxBook.FindString(uchet.IdBook.ToString());
     }
     else
     {
         comboBoxBibl.SelectedItem = null;
         comboBoxChit.SelectedItem = null;
         comboBoxBook.SelectedItem = null;
     }
 }
Beispiel #3
0
 private void buttonAdd_Click_1(object sender, EventArgs e)
 {
     if (comboBoxBibl.SelectedItem != null && comboBoxChit.SelectedItem != null)
     {
         {
             UchetSet supply = new UchetSet();
             supply.IdBibl = Convert.ToInt32(comboBoxBibl.SelectedItem.ToString().Split('.')[0]);
             supply.IdChit = Convert.ToInt32(comboBoxChit.SelectedItem.ToString().Split('.')[0]);
             supply.IdBook = Convert.ToInt32(comboBoxBook.SelectedItem.ToString().Split('.')[0]);
             Program.wftDb.UchetSet.Add(supply);
             Program.wftDb.SaveChanges();
             ShowUchet();
         }
     }
     else
     {
         MessageBox.Show("Данные не выбраны!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewUchet.SelectedItems.Count == 1)
         {
             UchetSet uchet = listViewUchet.SelectedItems[0].Tag as UchetSet;
             Program.wftDb.UchetSet.Remove(uchet);
             Program.wftDb.SaveChanges();
             ShowUchet();
         }
         comboBoxBibl.SelectedItem = null;
         comboBoxChit.SelectedItem = null;
         comboBoxBook = null;
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }