Пример #1
0
        private void btnAddWarehouse_Click(object sender, EventArgs e)
        {
            Warehouse          newWarehouse       = new Warehouse();
            NewOrEditWarehouse newOrEditWarehouse = new NewOrEditWarehouse(newWarehouse);

            if (newOrEditWarehouse.ShowDialog() == DialogResult.OK)
            {
                listOfWarehouses.Items.Add(newWarehouse.ToString());
                warehouses.Add(newWarehouse);
            }
        }
Пример #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int index = listOfWarehouses.SelectedIndex;

            if (index == -1)
            {
                index = warehouses.Count - 1;
            }
            NewOrEditWarehouse newOrEditWarehouse = new NewOrEditWarehouse(warehouses[index]);

            File.Delete("store/warehouses/warehouse_" + warehouses[index].Number + ".xml");
            if (newOrEditWarehouse.ShowDialog() == DialogResult.OK)
            {
                listOfWarehouses.Items[index] = warehouses[listOfWarehouses.SelectedIndex].ToString();
            }
        }