Exemple #1
0
 /*
  * Exits the admin interface
  */
 private void ItemEditBtn_Click(object sender, EventArgs e)
 {
     int index = ItemList.SelectedIndex;
     if (index != -1)
     {
         using (ItemForm itemForm = new ItemForm(Items[index]))
         {
             switch (itemForm.ShowDialog())
             {
                 case DialogResult.OK:
                     UnitOfWork.ItemService.EditItem(itemForm.Item);
                     RefreshItems();
                     AddLogMessage(2, "Edited item");
                     break;
                 case DialogResult.Yes:
                     UnitOfWork.ItemService.RemoveItem(itemForm.Item);
                     RefreshItems();
                     AddLogMessage(2, "Deleted item");
                     break;
             }
         }
     }
     else
     {
         AddLogMessage(2, "No item was selected");
         MessageBox.Show(
             "Please select an item to edit",
             "Error",
             MessageBoxButtons.OK,
             MessageBoxIcon.Error);
     }
 }
Exemple #2
0
 /*
  * Exits the admin interface
  */
 private void ItemAddBtn_Click(object sender, EventArgs e)
 {
     using (ItemForm itemForm = new ItemForm())
     {
         switch (itemForm.ShowDialog())
         {
             case DialogResult.OK:
                 UnitOfWork.ItemService.AddItem(itemForm.Item);
                 RefreshItems();
                 AddLogMessage(2, "Added new item");
                 break;
         }
     }
 }