Пример #1
0
        public void AddItem()
        {
            //gets the record from the itemInformation form
            ItemInformation information = new ItemInformation();

            information.ShowDialog();
            Record rec = information.Rec;

            if (rec != null)
            {
                // add the record to the list
                WorkshopList.Items.Add(rec);
                records.Add(rec);
            }
        }
Пример #2
0
        //method to update an item
        public void UpdateItem()
        {
            //if an item was selected
            if (WorkshopList.SelectedIndex > 0)
            {
                // get item that was updated
                ItemInformation form = new ItemInformation(records[WorkshopList.SelectedIndex - 1]);
                form.ShowDialog();
                Record record = form.Rec;

                // update item in the list and record
                WorkshopList.Items[WorkshopList.SelectedIndex] = record;
                records[WorkshopList.SelectedIndex - 1]        = record;
            }
        }