Example #1
0
        /// <summary>
        /// Hole das zugehörige Account-Objekt zu einem ApplicationInfo.
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public virtual ISingleDbObject GetUserAccount(ApplicationInfo app)
        {
            // SystemAccounts werden nicht verarbeitet
            if (String.Equals(app.UserAccount, "SYSTEM", StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            IColDbObject colUserAccount = CreateColUserAccount(app);

            if (colUserAccount.Count < 1)
            {
                throw new ViException(2662004,
                                      AccountName,
                                      Format("{0}\\{1}", app.UserDomainContext, app.UserAccount));
            }

            if (colUserAccount.Count > 1)
            {
                throw new ViException(2662003,
                                      AccountName,
                                      Format("{0}\\{1}", app.UserDomainContext, app.UserAccount));
            }

            return(colUserAccount[0].Create());
        }
        private void _LoadActivatorCombo()
        {
            using (new UpdateHelper(m_ActivatorCombo))
            {
                m_ActivatorCombo.ComboItems.Clear();

                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                IColDbObject col = Connection.CreateCol("ClientLog");
                col.Prototype.WhereClause = SqlFormatter.UidComparison("UID_Hardware", dbobject["UID_HardWare"].New.String);
                col.Prototype.OrderBy     = "InstallDate DESC";

                col.Load();

                foreach (IColElem elem in col)
                {
                    m_ActivatorCombo.ComboItems.Add(elem);
                }
            }
        }
        private void _LoadActivatorCombo()
        {
            using (new UpdateHelper(m_ActivatorCombo))
            {
                m_ActivatorCombo.ComboItems.Clear();

                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                // das hat nur Sinn, wenn ich die UID_ADSAccount lesen darf
                if (FormTool.CanSee(dbobject, "UID_ADSAccount"))
                {
                    IColDbObject col = Connection.CreateCol("ClientLog");
                    col.Prototype.WhereClause = SqlFormatter.UidComparison("UID_ADSAccount", dbobject["UID_ADSAccount"].New.String);
                    col.Prototype.OrderBy     = "InstallDate DESC";

                    col.Load();

                    foreach (IColElem elem in col)
                    {
                        m_ActivatorCombo.ComboItems.Add(elem);
                    }
                }
            }
        }
Example #4
0
        /// <summary>
        /// Wird aufgerufen, bevor der MainActivator aktiviert wird.
        /// Hier sollten alle von einem DB-Objekt abhängige Initialisierungen
        /// durchgeführt werden.
        /// </summary>
        private void MainActivator_OnActivating(object sender, System.EventArgs e)
        {
            try
            {
                // Aktivierung mit <null> verhindern
                if (m_MainActivator.DbObject == null)
                {
                    return;
                }

                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                m_ListViewProfiles.ListItems.Clear();

                if (!FormTool.CanSee(dbobject, "UID_SDLDomainRD", "DisplayName", "OrderNumber", "UID_OS"))
                {
                    return;
                }

                IColDbObject profiles = Connection.CreateCol("ApplicationProfile");
                profiles.Prototype.WhereClause = SqlFormatter.AndRelation(
                    SqlFormatter.UidComparison("UID_SDLDomainRD", FormTool.GetValueSafe(dbobject, "UID_SDLDomainRD", "")),
                    SqlFormatter.OrRelation(
                        SqlFormatter.UidComparison("UID_OS", FormTool.GetValueSafe(dbobject, "UID_OS", "")),
                        string.Format("UID_Profile in (select UID_Profile from ProfileCanUsedAlso where {0})",
                                      SqlFormatter.UidComparison("UID_OS", FormTool.GetValueSafe(dbobject, "UID_OS", "")))
                        )

                    );
                profiles.Prototype.Columns["OrderNumber"].IsDisplayItem = true;
                profiles.Prototype.Columns["DisplayName"].IsDisplayItem = true;
                profiles.Prototype.OrderBy = "OrderNumber";

                profiles.Load();
                string uidprofile = FormTool.GetValueSafe(dbobject, "UID_Profile", "");

                foreach (IColElem profile in profiles)
                {
                    ListViewItem item = new ListViewItem(new string[] { profile["DisplayName"].ToString(), profile["OrderNumber"].ToString() });
                    item.ForeColor = string.Equals(uidprofile, profile["UID_Profile"].ToString(), StringComparison.OrdinalIgnoreCase) ? Color.Red : Color.Black;
                    item.UseItemStyleForSubItems = true;

                    m_ListViewProfiles.ListItems.Add(item);
                }


                // TODO Whereklauseln setzen
            }
            finally
            {
            }
        }
        /// <exclude/>
        /// <summary>
        /// Es wird geprüft, ob zu der zu diesem Profil zugehörigen Applikation Profile vorhanden sind.
        /// Falls ja, wird das Flag IsProfileApplication in Application auf 1 gesetzt
        /// Falls nicht, wird das Flag IsProfileApplication in Application auf 0 gesetzt.
        /// </summary>
        private void _CheckIsProfileApplication()
        {
            IColDbObject  colApplicationProfile = DbObject.Connection.CreateCol("ApplicationProfile");;
            ISqlFormatter fSQL = DbObject.Connection.SqlFormatter;

            // Objekt wurde gelöscht
            if (DbObject.IsDeleted)
            {
                // geloescht

                // gibt es noch andere Profile ???
                colApplicationProfile.Prototype.WhereClause =
                    fSQL.AndRelation(fSQL.Comparison("UID_Application", DbObject["UID_Application"].New.String,
                                                     ValType.String, CompareOperator.Equal, FormatterOptions.None),
                                     fSQL.Comparison("UID_Profile", DbObject["UID_Profile"].New.String,
                                                     ValType.String, CompareOperator.NotEqual, FormatterOptions.None)
                                     );

                // nein
                if (colApplicationProfile.DBCount == 0)
                {
                    // exists the Application ( we are not in DeleteCascade )
                    // This Check is required because the UID_Application is filled, but the Object is already deleted
                    if (DbObject.Connection.Exists("Application", fSQL.Comparison("UID_Application", DbObject["UID_Application"].New.String,
                                                                                  ValType.String, CompareOperator.Equal, FormatterOptions.None)))
                    {
                        // auf false setzen
                        ISingleDbObject dbApplication = DbObject.GetFK("UID_Application").Create();

                        if (dbApplication != null)
                        {
                            if (dbApplication["IsProfileApplication"].New.Bool == true)
                            {
                                dbApplication["IsProfileApplication"].NewValue = false;
                                dbApplication.Save();
                            }
                        }
                    }
                }
            }

            // Objekt wurde neu angelegt
            if (!DbObject.IsLoaded)
            {
                // Insert
                ISingleDbObject dbApplication = DbObject.GetFK("UID_Application").Create();

                if (dbApplication != null)
                {
                    if (dbApplication["IsProfileApplication"].New.Bool == false)
                    {
                        dbApplication["IsProfileApplication"].NewValue = true;
                        dbApplication.Save();
                    }
                }
            }
        }
        private void _InsertDomains(TreeListNode tlnParent, string identParentDomain)
        {
            ISqlFormatter isql = clsMain.Instance.CurrentConnection.Connection.SqlFormatter;

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                // create the collection
                IColDbObject dbcolDomains = clsMain.Instance.CurrentConnection.Connection.CreateCol("SDLDomain");

                // assign the where-clause
                if (String.IsNullOrEmpty(identParentDomain))
                {
                    dbcolDomains.Prototype.WhereClause = isql.Comparison("UID_SDLDomainParent", "", ValType.String);
                }
                else
                {
                    dbcolDomains.Prototype.WhereClause = isql.FkComparison("UID_SDLDomainParent", "UID_SDLDomain", "SDLDomain",
                                                                           isql.Comparison("Ident_Domain", identParentDomain, ValType.String));
                }

                // appand the userdefined filter
                if (clsMain.Instance.DomainFilter.Length > 0)
                {
                    dbcolDomains.Prototype.WhereClause = "(" + dbcolDomains.Prototype.WhereClause + ") and (" + clsMain.Instance.DomainFilter + ")";
                }

                // mark as DisplayColumn
                dbcolDomains.Prototype["Ident_Domain"].IsDisplayItem = true;

                // load the collection
                dbcolDomains.Load();

                //now do for each domain
                foreach (IColElem colElem in dbcolDomains)
                {
                    // create a doamin-node
                    TreeListNode tlnDomain = tlnParent.Nodes.Add(colElem.Display, 1);
                    tlnDomain.Tag = new NodeData(NodeType.Domain, colElem.GetValue("Ident_Domain"), "");

                    // insert static subitems of domain
                    _PrepareDomainNode(tlnDomain);

                    // insert all childdomains
                    _InsertDomains(tlnDomain, colElem.Display);
                }
            }
            catch (Exception ex)
            {
                ExceptionDialog.Show(this.ParentForm, ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        /// <summary>
        ///
        /// </summary>
        private void FillDestDomains()
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                m_cboDestDomain.ComboItems.Clear();

                if (!FormTool.CanSee(dbobject, "UID_Profile"))
                {
                    return;
                }

                string where = "";

#warning ##RIGHTS## UpdateWhereClause muß anders gelöst werden
                //string updateWhere = Connection.Tables["Domain"].UpdateWhereClause;
                //if ( !string.IsNullOrEmpty(updateWhere) )
                //{
                //    where = string.Format("ident_domain in (select ident_DomainAllowed from " +
                //        " DriverCanUsedByRD where {0} " +
                //        " and ident_domainallowed in ( select ident_domain from domain where {0} ))",
                //        SqlFormatter.UidComparison("uid_profile", dbobject["UID_Profile"].New.String, ValType.String,
                //            CompareOperator.Equal, FormatterOptions.None),
                //        updateWhere);
                //}
                //else
                {
                    where = string.Format("UID_SDLDomain in (select UID_SDLDomainAllowed from " +
                                          " DriverCanUsedByRD where {0} )",
                                          SqlFormatter.UidComparison("UID_Profile", dbobject["UID_Profile"].New.String));
                }


                IColDbObject dom = Connection.CreateCol("SDLDomain");
                dom.Prototype.Columns["Ident_Domain"].IsDisplayItem = true;
                dom.Prototype.WhereClause = where;
                dom.Load();

                foreach (IColElem elem in dom)
                {
                    m_cboDestDomain.ComboItems.Add(elem["Ident_Domain"].ToString());
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
        }
        private void _Load(VI.Controls.Interfaces.ITreeListControl treeList, bool loadApps)
        {
            ITreeListProxy proxy = treeList.Proxy;

            using (new UpdateHelper(treeList))
            {
                proxy.Clear();

                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                IColDbObject col = Connection.CreateCol("MachineAppsInfo");
                col.Prototype["displayname"].IsDisplayItem          = true;
                col.Prototype["CurrentlyActive"].IsDisplayItem      = true;
                col.Prototype["Installdate"].IsDisplayItem          = true;
                col.Prototype["deinstalldate"].IsDisplayItem        = true;
                col.Prototype["revision"].IsDisplayItem             = true;
                col.Prototype["UID_OS"].IsDisplayItem               = true;
                col.Prototype["UID_InstallationType"].IsDisplayItem = true;

                col.Prototype.WhereClause = SqlFormatter.AndRelation(!FormTool.CanSee(dbobject, "UID_HardWare") ? "1=2" :
                                                                     SqlFormatter.UidComparison("UID_Hardware", dbobject["UID_HardWare"].New.String),
                                                                     SqlFormatter.Comparison("AppsNotDriver", loadApps, ValType.Bool));
                col.Prototype.OrderBy = "Displayname, Installdate, DeInstallDate";
                col.Load(CollectionLoadType.ForeignDisplays);

                foreach (IColElem elem in col)
                {
                    ITreeListNode      node = proxy.AddNode(elem.GetDisplayValue("displayname"), (int)VI.ImageLibrary.StockImage.ApplicationProfile);
                    ITreeListItemSmall item = proxy.CreateCheckBoxItem(elem.GetValue("CurrentlyActive").Bool);
                    item.Enabled = false;
                    proxy.AddItem(node, item);

                    DateTime date = elem.GetValue("Installdate").Date;
                    item      = proxy.AddItem(node, DbVal.IsEmpty(date, ValType.Date) ? "" : date.ToString());
                    item.Data = date;

                    date      = elem.GetValue("deinstalldate").Date;
                    item      = proxy.AddItem(node, DbVal.IsEmpty(date, ValType.Date) ? "" : date.ToString());
                    item.Data = date;

                    item      = proxy.AddItem(node, elem["Revision"]);
                    item.Data = elem.GetValue("Revision").Int;

                    proxy.AddItem(node, elem.GetDisplayValue("UID_OS"));
                    proxy.AddItem(node, elem.GetDisplayValue("UID_InstallationType"));
                }
            }
        }
Example #9
0
        private void _GetCentralLibrary()
        {
            ISqlFormatter fSQL = clsMain.Instance.CurrentConnection.Connection.SqlFormatter;
            IColDbObject  colApplicationServer = clsMain.Instance.CurrentConnection.Connection.CreateCol("ApplicationServer");

            colApplicationServer.Prototype.WhereClause = fSQL.Comparison("IsCentralLibrary", true, ValType.Bool);

            colApplicationServer.Load();

            if (colApplicationServer.Count > 0)
            {
                m_dbCentralLibrary = colApplicationServer[0].Create();
            }
            else
            {
                m_dbCentralLibrary = null;
            }
        }
        private void _LoadProtocols()
        {
            ITreeListProxy proxy = m_TreeListProtocols.Proxy;

            using (new UpdateHelper(m_TreeListProtocols))
            {
                proxy.Clear();

                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                IColDbObject col = Connection.CreateCol("ADSAccountAppsInfo");
                col.Prototype["displayname"].IsDisplayItem          = true;
                col.Prototype["CurrentlyActive"].IsDisplayItem      = true;
                col.Prototype["Installdate"].IsDisplayItem          = true;
                col.Prototype["deinstalldate"].IsDisplayItem        = true;
                col.Prototype["revision"].IsDisplayItem             = true;
                col.Prototype["UID_OS"].IsDisplayItem               = true;
                col.Prototype["UID_InstallationType"].IsDisplayItem = true;

                col.Prototype.WhereClause = !FormTool.CanSee(dbobject, "UID_ADSAccount") ? "1=2" :
                                            SqlFormatter.UidComparison("UID_ADSAccount", FormTool.GetValueSafe(dbobject, "UID_ADSAccount", ""));
                col.Prototype.OrderBy = "displayname";
                col.Load(CollectionLoadType.ForeignDisplays);

                foreach (IColElem elem in col)
                {
                    ITreeListNode      node = proxy.AddNode(elem.GetDisplayValue("displayname"), (int)VI.ImageLibrary.StockImage.ApplicationProfile);
                    ITreeListItemSmall item = proxy.CreateCheckBoxItem(elem.GetValue("CurrentlyActive").Bool);
                    item.Enabled = false;
                    proxy.AddItem(node, item);
                    proxy.AddItem(node, elem["Installdate"]);
                    proxy.AddItem(node, elem["deinstalldate"]);
                    proxy.AddItem(node, elem["Revision"]);
                    proxy.AddItem(node, elem.GetDisplayValue("UID_OS"));
                    proxy.AddItem(node, elem.GetDisplayValue("UID_InstallationType"));
                }
            }
        }
        private void _RemoveTableEntries(string tablename, string whereclause)
        {
            // Deaktivierte Tabellen nicht verarbeiten
            var tabDef = ConnectData.Connection.Tables[tablename];

            if (tabDef.IsDeactivated)
            {
                return;
            }

            IColDbObject    col = ConnectData.Connection.CreateCol(tablename);
            ISingleDbObject obj;
            int             pos;
            string          tablecaption;

            col.Prototype.WhereClause = whereclause;
            col.Load();

            pos = 0;

            try
            {
                tablecaption = col.Prototype.TableDef.DialogObjects.Default.CaptionList;
            }
            catch
            {
                tablecaption = tablename;
            }

            foreach (IColElem elem in col)
            {
                if (++pos % 100 == 0)
                {
                    SetProgressInfo(LanguageManager.Instance.FormatString("SDL_RemovingEntry", pos, col.Count, tablecaption));
                }

                obj = elem.Create();

                obj.Delete();
                obj.Save();
            }
        }
Example #12
0
        /// <summary>
        /// Entferne alle ClientLog-Einträge für diese Nutzer-Maschine-Kombination
        /// </summary>
        /// <param name="machine"></param>
        /// <param name="account"></param>
        public void RemoveClientLogEntries(ISingleDbObject machine, ISingleDbObject account)
        {
            IColDbObject colClientLog = Conn.CreateCol("ClientLog");

            if (machine != null)
            {
                colClientLog.Prototype.PutValue("UID_Hardware", machine.GetValue("UID_Hardware"));
            }

            if (account != null)
            {
                colClientLog.Prototype.PutValue(ClientLogKeyColumn, GetAccountUID(account));
            }

            colClientLog.Load();

            foreach (IColElem elem in colClientLog)
            {
                ISingleDbObject clientLog = elem.Create();
                clientLog.Delete();
                clientLog.Save();
            }
        }
Example #13
0
        /// <summary>
        /// Führt die Mengenbehandlung zwischen Feedback-File und DB durch.
        /// Einträge werden dabei neu angelegt bzw. als deinstalliert markiert.
        /// </summary>
        public void SetUserInstallStateInDB(string uid, IDictionary <string, DBAppDrvInfo> appInfos, DateTime lastModified)
        {
            IColDbObject    colAppsInfo = Conn.CreateCol(AppsInfoTable);
            ISingleDbObject proto       = colAppsInfo.Prototype;

            proto["UID_Application"].IsDisplayItem = true;
            proto["Revision"].IsDisplayItem        = true;
            proto.PutValue(AppsInfoKeyColumn, uid);
            proto.PutValue("CurrentlyActive", true);
            proto.OrderBy = "InstallDate desc";

            colAppsInfo.Load();

            /*
             * Überprüfe den Status aller als installiert
             * gesetzten AppInfo-Einträge in der DB.
             * Setze deren Status gegebenenfalls auf
             * deinstalliert, wenn sie im Feedback-File
             * nicht vorkommen oder als deselektiert markiert
             * sind.
             */
            foreach (IColElem elem in colAppsInfo)
            {
                var deinstalled = false;

                // AppsInfo voahnden und Revision gleich
                DBAppDrvInfo appInfo;

                if (appInfos.TryGetValue(elem.GetValue <string>("UID_Application"), out appInfo) &&
                    string.Equals(appInfo.AssociatedAppsDrvProfileInfo.Revision, elem.GetValue("Revision").String, StringComparison.Ordinal))
                {
                    if (appInfo.IsDeselected)
                    {
                        // Applikation is abgewählt -> markiere als deinstalliert
                        deinstalled = true;
                    }
                    else
                    {
                        // Merke: Diese Applikation ist bereits als installiert vermerkt
                        appInfo.IsInstalledInDB = true;
                    }
                }
                else
                {
                    // Applikation war im Feedback-File nicht vorhanden
                    // -> markiere als deinstalled
                    deinstalled = true;
                }

                if (deinstalled)
                {
                    // Wir markieren dieses AppInfo als deinstalliert
                    ISingleDbObject currAppsInfo = elem.Create();

                    currAppsInfo.PutValue("DeInstallByUser", true);
                    currAppsInfo.PutValue("CurrentlyActive", false);
                    currAppsInfo.PutValue("DeInstallDate", lastModified);

                    currAppsInfo.Save();
                }
            }

            /*
             * Lege alle Einträge an, die nicht bereits in der Datenbank
             * als installiert vorhanden sind.
             */
            foreach (DBAppDrvInfo info in appInfos.Values)
            {
                if (!info.IsInstalledInDB && !info.IsDeselected)
                {
                    CreateApplicationEntryInDB(info, lastModified);
                }
            }
        }
        private void LoadData()
        {
            using (new VI.FormBase.UpdateHelper(m_TreeList))
            {
                m_TreeList.Nodes.Clear();

                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null || !dbobject.TableDef.CanSee)
                {
                    return;
                }

                IColDbObject col = Connection.CreateCol(m_DataStore.String1);

                col.Prototype.WhereClause = SqlFormatter.Comparison(m_DataStore.String2, FormTool.GetValueSafe(dbobject, m_DataStore.String2, ""), ValType.String);
                col.Prototype.Columns["CountLicMacDirectTarget"].IsDisplayItem   = true;
                col.Prototype.Columns["CountLicMacIndirectTarget"].IsDisplayItem = true;
                col.Prototype.Columns["CountLicUserTarget"].IsDisplayItem        = true;
                col.Prototype.Columns["CountLicMacPossTarget"].IsDisplayItem     = true;
                col.Prototype.Columns["CountLicMacDirectActual"].IsDisplayItem   = true;
                col.Prototype.Columns["CountLicMacDirectActual"].IsDisplayItem   = true;
                col.Prototype.Columns["CountLicMacIndirectActual"].IsDisplayItem = true;
                col.Prototype.Columns["CountLicUserActual"].IsDisplayItem        = true;
                col.Prototype.Columns["CountLicMacPossActual"].IsDisplayItem     = true;
                col.Prototype.Columns["CountLicMacReal"].IsDisplayItem           = true;
                col.Prototype.Columns["CountLimit"].IsDisplayItem = true;
                col.Load();

                bool   canedit = col.Prototype.Columns["CountLimit"].CanEdit;
                bool[] cansees = new bool[]
                {
                    col.Prototype.Columns["UID_Licence"].CanSee,
                    col.Prototype.Columns["CountLimit"].CanSee,
                    col.Prototype.Columns["CountLicMacDirectActual"].CanSee,
                    col.Prototype.Columns["CountLicMacDirectTarget"].CanSee,
                    col.Prototype.Columns["CountLicMacIndirectActual"].CanSee,
                    col.Prototype.Columns["CountLicMacIndirectTarget"].CanSee,
                    col.Prototype.Columns["CountLicMacPossActual"].CanSee,
                    col.Prototype.Columns["CountLicMacPossTarget"].CanSee,
                    col.Prototype.Columns["CountLicMacReal"].CanSee,
                    col.Prototype.Columns["CountLicUserActual"].CanSee,
                    col.Prototype.Columns["CountLicUserTarget"].CanSee,
                };

                // und Grid füllen
                foreach (IColElem elem in col)
                {
                    ISingleDbObject obj = elem.Create();

                    ISingleDbObject identfk = obj.GetFK("UID_Licence").Create();
                    string          ident   = identfk != null ? identfk["Ident_Licence"].New.String : "";

                    TreeListNode node = m_TreeList.Nodes.Add(cansees[0] ? ident : "", 0);
                    node.ForeColor = SystemColors.ControlDark;

                    ITreeListItem subitem = canedit ? new TreeListItemTextBox(cansees[1] ? elem["CountLimit"].ToString() : "", 8) :
                                            new TreeListItem(cansees[1] ? elem["CountLimit"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = canedit ? SystemColors.ControlText : SystemColors.ControlDark;

                    subitem = new TreeListItem(cansees[2] ? elem["CountLicMacReal"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[3] ? elem["CountLicUserActual"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[4] ? elem["CountLicUserTarget"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[5] ? elem["CountLicMacDirectActual"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[6] ? elem["CountLicMacDirectTarget"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[7] ? elem["CountLicMacIndirectActual"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[8] ? elem["CountLicMacIndirectTarget"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[9] ? elem["CountLicMacPossActual"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;
                    subitem           = new TreeListItem(cansees[10] ? elem["CountLicMacPossTarget"].ToString() : "");
                    node.SubItems.Add(subitem);
                    subitem.ForeColor = SystemColors.ControlDark;

                    node.Tag = obj;
                }
            }
        }
        /// <summary>
        /// Führt die Mengenbehandlung zwischen Feedback-File und DB durch.
        /// Einträge werden dabei neu angelegt bzw. als deinstalliert markiert.
        /// </summary>
        public void _SetMachineInstallStateInDB(string uid, IDictionary <string, DBAppDrvInfo> appInfos, DateTime lastModified)
        {
            IColDbObject    colMachineAppsInfo = ConnectData.Connection.CreateCol("MachineAppsInfo");
            ISingleDbObject proto = colMachineAppsInfo.Prototype;

            proto.Columns["UID_Hardware"].IsDisplayItem    = true;
            proto.Columns["UID_Application"].IsDisplayItem = true;
            proto.Columns["UID_Driver"].IsDisplayItem      = true;
            proto.Columns["AppsNotDriver"].IsDisplayItem   = true;
            proto.Columns["Revision"].IsDisplayItem        = true;

            proto.PutValue("UID_Hardware", uid);
            proto.PutValue("CurrentlyActive", true);
            proto.OrderBy = "InstallDate desc";

            colMachineAppsInfo.Load();

            /*
             * Überprüfe den Status aller als installiert
             * gesetzten AppInfo-Einträge in der DB.
             * Setze deren Status gegebenenfalls auf
             * deinstalliert, wenn sie im Feedback-File
             * nicht vorkommen.
             */
            foreach (IColElem elem in colMachineAppsInfo)
            {
                var uidAppDrv = elem.GetValue <bool>("AppsNotDriver")
                                        ? elem.GetValue <string>("UID_Application")
                                        : elem.GetValue <string>("UID_Driver");

                // AppsInfo vorhanden und Revision gleich
                DBAppDrvInfo appInfo;
                if (appInfos.TryGetValue(uidAppDrv, out appInfo) &&
                    string.Equals(appInfo.AssociatedAppsDrvProfileInfo.Revision, elem.GetValue("Revision").String))
                {
                    // Applikation oder Treiber sind bereits installiert -> merken
                    appInfo.IsInstalledInDB = true;
                }
                else
                {
                    // Diese Applikation oder dieser Treiber ist nicht
                    // mehr installiert -> setze den Status in der DB
                    ISingleDbObject machineAppsInfo = elem.Create();

                    machineAppsInfo.PutValue("CurrentlyActive", false);
                    machineAppsInfo.PutValue("DeInstallDate", lastModified);

                    machineAppsInfo.Save();
                }
            }

            /*
             * Lege alle Einträge an, die nicht bereits in der Datenbank
             * als installiert vorhanden sind.
             */
            foreach (DBAppDrvInfo info in appInfos.Values)
            {
                if (!info.IsInstalledInDB)
                {
                    ISingleDbObject machineAppsInfo = ConnectData.Connection.CreateSingle("MachineAppsInfo");

                    machineAppsInfo.PutValue("CurrentlyActive", true);
                    machineAppsInfo.PutValue("InstallDate", lastModified);
                    machineAppsInfo.PutValue("UID_InstallationType", info.UidInstallationType);
                    machineAppsInfo.PutValue("UID_OS", info.UidOperatingSystem);
                    machineAppsInfo.PutValue("Revision", Convert.ToInt32(info.AssociatedAppsDrvProfileInfo.Revision));
                    machineAppsInfo.PutValue("UID_Hardware", uid);

                    if (info.IsApplication)
                    {
                        machineAppsInfo.PutValue("UID_Application", info.UidAppDrv);
                        //machineAppsInfo.PutValue("DisplayName", info.AppDrvNameFull);
                        machineAppsInfo.PutValue("AppsNotDriver", true);
                    }
                    else
                    {
                        machineAppsInfo.PutValue("UID_Driver", info.UidAppDrv);
                        //machineAppsInfo.PutValue("DisplayName", info.AppDrvNameFull);
                        machineAppsInfo.PutValue("AppsNotDriver", false);
                    }

                    machineAppsInfo.Save();
                }
            }
        }