/// <summary>
        /// Inventory a Module. It adds the EA Interface reference to the Interface Element if exists.
        /// </summary>
        public void Inventory()
        {
            // get interface: Interface
            string sql = $@"select object_id 
                              from t_object 
                              where name = '{Name}'             AND
                                    object_type = 'Interface' ";

            // Get Element list from sql=2
            EA.Collection col = Rep.GetElementSet(sql, 2);
            if (col.Count > 1)
            {
                MessageBox.Show("More than one 'Interface' available.", "Can't inventory Interface {Name}");
                return;
            }
            if (col.Count == 0)
            {
                El = null;
            }
            else
            {  // Interface existing
                El = (EA.Element)col.GetAt(0);
                List <MethodItem> methods = new List <MethodItem>();
                foreach (EA.Method m in El.Methods)
                {
                    methods.Add(new MethodItem(m, m.Name));
                }
                // update existing methods
                var existingMethods = from provided in ProvidedFunctions
                                      join ea in methods on provided.Name equals ea.Name
                                      select new { ea.Method, provided };
                foreach (var f in existingMethods)
                {
                    f.provided.Op = f.Method;
                }
            }
        }
        /// <summary>
        /// Inventory a Module. It adds the EA Module reference if exists.
        /// </summary>
        public void InventoryAddEaModuleReference()
        {
            // get module: Component, Stereotype: 'LE Modul'
            string sql = $@"select object_id 
                              from t_object 
                              where name = '{Name}'             AND
                                    object_type = 'Component'   AND
                                    Stereotype = 'LE Modul'";

            EA.Collection col = Rep.GetElementSet(sql, 2);
            if (col.Count > 1)
            {
                MessageBox.Show("More than one 'LE Module' available.", "Can't inventory Module {Name}");
                return;
            }
            if (col.Count == 0)
            {
                El = null;
            }
            else
            {
                El = (EA.Element)col.GetAt(0);
            }
        }
        //
        public bool InventoryDesignInterfaces()
        {
            // Get all interfaces
            // 'object_id' has to be included in select
            string sql = $@"select object_id, name
            from t_object 
            where object_type = 'Interface' AND
            package_id in ( { _designPackagedIds} )
            order by 2";

            EA.Collection interfaceList = Rep.GetElementSet(sql, 2);
            foreach (EA.Element el in interfaceList)
            {
                InterfaceItem ifItem = (InterfaceItem)_designFiles.Add($"{el.Name}.h");
                ifItem.El = el;

                foreach (EA.Method m in el.Methods)
                {
                    // create function
                    FunctionItem functionItem = new FunctionItem(m.Name, m.ReturnType, m.IsStatic, new List <ParameterItem>(), ifItem, m);
                    if (_designFunctions.FunctionList.ContainsKey(m.Name))
                    {
                        var function = _designFunctions.FunctionList[m.Name];
                        MessageBox.Show($"Interface:\t{function.Interface?.Name}\r\nModule:\t{function.Module?.Name}",
                                        $"Duplicated Function {m.Name}, skipped!");
                    }
                    else
                    {
                        _designFunctions.FunctionList.Add(m.Name, functionItem);
                    }

                    // update interface
                    ifItem.ProvidedFunctions.Add(functionItem);
                }
            }

            // Show deleted Interface
            var deletedInterfaces = from s in _designFiles.FileList
                                    where !_files.FileList.Any(t => (s.Value.Name == t.Value.Name) &&
                                                               t.Value.GetType().Name.Equals(typeof(InterfaceItem).Name))
                                    select s.Value.El;

            var createdInterfaces = from s in _files.FileList
                                    where !_designFiles.FileList.All(t => (s.Value.Name == t.Value.Name) &&
                                                                     t.Value.GetType().Name.Equals(typeof(InterfaceItem).Name))
                                    select s.Value.El;

            _deletedInterfaces = 0;
            string deleteMe = "DeleteMe";

            foreach (var el in deletedInterfaces)
            {
                if (!el.Name.EndsWith(deleteMe))
                {
                    el.Name = el.Name + deleteMe;
                    el.Update();
                }
                _deletedInterfaces++;
            }
            _createdInterfaces = createdInterfaces.Count();

            return(true);
        }