예제 #1
0
        public int addItem(CItem item)
        {
            int newID = calcNewID();

            addItem(newID, item.getName(), item.description, item.comment, item.pathToImage, item.visibility, item.singleUse, item.personsId);
            return(newID);
        }
예제 #2
0
 public void updateItem(CItem updated)
 {
     if (!this.items.ContainsKey(updated.getID()))
     {
         throw new System.ArgumentException("Предмета с таким ID не существует!");
     }
     items[updated.getID()] = updated;
     if (updated.pathToImage != null)
     {
         addImageToItem(updated.pathToImage, updated.getID());
     }
 }
예제 #3
0
        private void cmbEditItems_Click(object sender, EventArgs e)
        {
            List <GridViewRowInfo> rows = gridViewItems.SelectedRows.ToList();
            int          id             = int.Parse(rows[0].Cells["columnID"].Value.ToString());
            CItem        item           = itemManager.getItem(id);
            EditItemForm eif            = new EditItemForm(item, ref peopleManager);

            if (eif.ShowDialog() == DialogResult.OK)
            {
                itemManager.updateItem(eif.editedItem);
                UpdateDataOnGridViews();
            }
        }
예제 #4
0
 public void addItemsToPerson(List <int> itemsID, int personID)
 {
     foreach (int itemID in itemsID)
     {
         CItem item = getItem(itemID);
         if (!item.personsId.Contains(personID))
         {
             items[itemID].personsId.Add(personID);
         }
     }
     foreach (CItem item in items.Values)
     {
         if (item.personsId.Contains(personID) && !itemsID.Contains(item.getID()))
         {
             item.personsId.Remove(personID);
         }
     }
 }
예제 #5
0
 public void updateItem(CItem updated)
 {
     if (!this.items.ContainsKey(updated.getID()))
         throw new System.ArgumentException("Предмета с таким ID не существует!");
     items[updated.getID()] = updated;
     if (updated.pathToImage != null)
         addImageToItem(updated.pathToImage, updated.getID());
 }
예제 #6
0
 public int addItem(CItem item)
 {
     int newID = calcNewID();
     addItem(newID, item.getName(), item.description, item.comment, item.pathToImage, item.visibility, item.singleUse, item.personsId);
     return newID;
 }