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); }
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()); } }
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(); } }
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); } } }
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()); }
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; }