Esempio n. 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            StockroomSet stockroomSet = new StockroomSet();

            stockroomSet.IdProduct  = Convert.ToInt32(comboBoxNameProduct.SelectedItem.ToString().Split('.')[0]);
            stockroomSet.IdProvider = Convert.ToInt32(comboBoxNameProvider.SelectedItem.ToString().Split('.')[0]);
            Program.wFShop.StockroomSet.Add(stockroomSet);
            Program.wFShop.SaveChanges();
            ShowStockRoom();
        }
Esempio n. 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewStockRoom.SelectedItems.Count == 1)
     {
         StockroomSet stockroomSet = listViewStockRoom.SelectedItems[0].Tag as StockroomSet;
         stockroomSet.IdProduct  = Convert.ToInt32(comboBoxNameProduct.SelectedItem.ToString().Split('.')[0]);
         stockroomSet.IdProvider = Convert.ToInt32(comboBoxNameProvider.SelectedItem.ToString().Split('.')[0]);
     }
     Program.wFShop.SaveChanges();
     ShowStockRoom();
 }
Esempio n. 3
0
 private void listViewStockRoom_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewStockRoom.SelectedItems.Count == 1)
     {
         StockroomSet stockroomSet = listViewStockRoom.SelectedItems[0].Tag as StockroomSet;
         comboBoxNameProduct.SelectedIndex  = comboBoxNameProduct.FindString(stockroomSet.IdProduct.ToString());
         comboBoxNameProvider.SelectedIndex = comboBoxNameProvider.FindString(stockroomSet.IdProvider.ToString());
     }
     else
     {
         comboBoxNameProduct  = null;
         comboBoxNameProvider = null;
     }
 }
Esempio n. 4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewStockRoom.SelectedItems.Count == 1)
         {
             StockroomSet stockroomSet = listViewStockRoom.SelectedItems[0].Tag as StockroomSet;
             Program.wFShop.StockroomSet.Remove(stockroomSet);
             Program.wFShop.SaveChanges();
             ShowStockRoom();
         }
         comboBoxNameProduct.SelectedItem  = null;
         comboBoxNameProvider.SelectedItem = null;
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }