Beispiel #1
0
        public void Add(DBItem item)
        {
            if (!item.getAllProperties().Any())
            {
                Watchtower.OmniusWarning.Log($"Try to insert no values to table [{RealName}]", Watchtower.OmniusLogSource.Entitron, _db.Application);
                return;
            }

            _itemsToAdd.Add(item);
            _db.SaveTable(this);
        }
Beispiel #2
0
        public int AddGetId(DBItem item)
        {
            if (!item.getAllProperties().Any())
            {
                Watchtower.OmniusWarning.Log($"Try to insert no values to table [{RealName}]", Watchtower.OmniusLogSource.Entitron, _db.Application);
                return(-1);
            }

            item.Tabloid = this;
            using (DBReader reader = _db.ExecuteCommand(_db.CommandSet.INSERT(_db, Name, item)))
            {
                reader.Read();
                int id = Convert.ToInt32(reader[DBCommandSet.PrimaryKey]);
                item[DBCommandSet.PrimaryKey] = id;
                return(id);
            }
        }