Example #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            WarehouseSet warehouseSet = new WarehouseSet();

            warehouseSet.idProduct  = Convert.ToInt32(comboBoxProduct.SelectedItem.ToString().Split('.')[0]);
            warehouseSet.idProvider = Convert.ToInt32(comboBoxProvider.SelectedItem.ToString().Split('.')[0]);
            Program.master.WarehouseSet.Add(warehouseSet);
            Program.master.SaveChanges();
            ShowPWarehouseSet();
        }
Example #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listViewWarehouse.SelectedItems.Count == 1)
            {
                WarehouseSet warehouseSet = listViewWarehouse.SelectedItems[0].Tag as WarehouseSet;

                warehouseSet.idProduct  = Convert.ToInt32(comboBoxProduct.SelectedItem.ToString().Split('.')[0]);
                warehouseSet.idProvider = Convert.ToInt32(comboBoxProvider.SelectedItem.ToString().Split('.')[0]);

                Program.master.SaveChanges();
                ShowPWarehouseSet();
            }
        }
Example #3
0
        private void listViewWarehouse_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewWarehouse.SelectedItems.Count == 1)
            {
                WarehouseSet warehouseSet = listViewWarehouse.SelectedItems[0].Tag as WarehouseSet;

                comboBoxProduct.SelectedIndex  = comboBoxProduct.FindString(warehouseSet.idProduct.ToString());
                comboBoxProvider.SelectedIndex = comboBoxProvider.FindString(warehouseSet.idProvider.ToString());
            }
            else
            {
                comboBoxProduct.SelectedItem  = null;
                comboBoxProvider.SelectedItem = null;
            }
        }
Example #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewWarehouse.SelectedItems.Count == 1)
         {
             WarehouseSet warehouseSet = listViewWarehouse.SelectedItems[0].Tag as WarehouseSet;
             Program.master.WarehouseSet.Remove(warehouseSet);
             Program.master.SaveChanges();
             ShowPWarehouseSet();
         }
         comboBoxProduct.SelectedItem  = null;
         comboBoxProvider.SelectedItem = null;
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }