예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            warehouse = Form1.warehouses[IndexOfWarehouse];
            Consignment          newConsignment       = new Consignment();
            NewOrEditConsignment newOrEditConsignment = new NewOrEditConsignment(newConsignment);

            if (newOrEditConsignment.ShowDialog() == DialogResult.OK)
            {
                listOfConsigments.Items.Add(newConsignment.ToString());
                warehouse.Consignments.Add(newConsignment);
            }
        }
예제 #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            warehouse = Form1.warehouses[IndexOfWarehouse];
            int index = listOfConsigments.SelectedIndex;

            if (index == -1)
            {
                index = warehouse.Consignments.Count - 1;
            }
            NewOrEditConsignment newOrEditConsignment = new NewOrEditConsignment(warehouse.Consignments[index]);

            if (newOrEditConsignment.ShowDialog() == DialogResult.OK)
            {
                listOfConsigments.Items[index] = warehouse.Consignments[listOfConsigments.SelectedIndex].ToString();
            }
        }