Example #1
0
        public int AddItem(int listID, Item newItem, bool checkID = true)
        {
            if (ExistingId == null)
            {
                ElementUtils.GetExsistingIDs(this);
            }
            var key = GetListKey(listID);

            if (checkID)
            {
                if (ExistingId.Contains(Convert.ToInt32(newItem.GetByKey("ID"))))
                {
                    newItem.SetByKey("ID", GetFreeId());
                }
            }
            //   if (print) PrintInfo(newItem);
            var it = ElementUtils.AdvancedCopy(GetFirstInList(listID), newItem);

            AddItem(key, it);
            return(it.GetByKey("ID"));
        }