Beispiel #1
0
        private void addNewItemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ItemForm     itemForm     = new ItemForm("Add");
            DialogResult dialogResult = itemForm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                //Add Item
                databaseConnector.InsertNewItem(itemForm.currentItem);
                availableItems.Add(itemForm.currentItem);
                updateAvailableItems();
            }
        }
Beispiel #2
0
 private void editItemToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (itemView.SelectedItems.Count <= 0)
     {
         MessageBox.Show("No item selected");
         return;
     }
     else
     {
         ItemForm     itemForm     = new ItemForm("Edit", availableItems[itemView.SelectedIndices[0]]);
         DialogResult dialogResult = itemForm.ShowDialog();
         if (dialogResult == DialogResult.OK)
         {
             //TODO: update database record
             databaseConnector.UpdateRecord(itemForm.currentItem);
             updateAvailableItems();
         }
     }
 }