/// <summary>
        ///
        /// </summary>
        private void MainActivator_OnSaved(object sender, System.EventArgs e)
        {
            try
            {
                foreach (TreeListNode node in m_TreeList.Nodes)
                {
                    if (!node.SubItemsContentChanged)
                    {
                        continue;
                    }

                    ISingleDbObject dbobject = node.Tag as ISingleDbObject;

                    if (FormTool.SetValueSafe(dbobject, "CountLimit", int.Parse(node.SubItems[0].Data as string)))
                    {
                        node.SubItems[0].ForeColor = SystemColors.ControlText;
                    }

                    dbobject.Save();
                    dbobject.Load();
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
            finally
            {
                m_TreeList.Invalidate();
            }
        }
        /// <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();
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// Erzeuge einen ClientLog-Eintrag.
        /// </summary>
        /// <param name="machine"></param>
        /// <param name="account"></param>
        /// <param name="lastModified"></param>
        /// <param name="appInfo"></param>
        public void CreateClientLogEntry(ISingleDbObject machine, ISingleDbObject account,
                                         DateTime lastModified, ApplicationInfo appInfo)
        {
            ISingleDbObject clientLog = Conn.CreateSingle("ClientLog");

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

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

            clientLog.PutValue("InstallDate", lastModified);
            clientLog.PutValue("LogContent", appInfo.InstallLog);

            clientLog.Save();
        }
Example #4
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 #5
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);
                }
            }
        }
Example #6
0
        /// <summary>
        /// FormMethode SyncProfile
        /// </summary>
        public void FormMethod_SyncProfile()
        {
            try
            {
                ISingleDbObject app = null;

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

                if (profile == null)
                {
                    return;
                }

                bool SyncProfilesPossible;

                if (profile["UID_SDLDomainRD"].New.String.Length > 0)
                {
                    var dom = profile.GetFK("UID_SDLDomainRD").Create();

                    if (dom != null)
                    {
                        app = profile.GetFK("UID_Driver").Create();
                    }
                }

                string strReturn;

                if (ProfileTool.GetProfilePathOnTas(profile, out strReturn))
                {
                    m_MProfilePathOnTAS = strReturn;

                    if (ProfileTool.ReadFileFromProfile(Path.Combine(m_MProfilePathOnTAS, "profile.vii"), out strReturn))
                    {
                        SyncProfilesPossible = true;
                    }
                    else
                    {
                        FormTool.ShowError("VIP7_SyncAppProfile_ErrNoProfileVII");
                        return;
                    }
                }
                else
                {
                    FormTool.ShowError(strReturn);
                    return;
                }

                if (profile.IsChanged)
                {
                    profile.Save(); profile.Load();
                }

                if (SyncProfilesPossible)
                {
                    ProfileTool.SyncWithProfileVii(profile, Path.Combine(m_MProfilePathOnTAS, "profile.vii"));
                }

                if (profile.IsChanged)
                {
                    profile.Save(); profile.Load();
                }

                if (FormTool.MainForm != null)
                {
                    FormTool.MainForm.BringToFront();
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                VI.FormBase.ExceptionMgr.Instance.HandleException(
                    new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationProfileMasterData_Task_SynchronizeApplicationProfile").Replace("&", "")), this);
            }
        }
Example #7
0
        /// <summary>
        /// FormMethode ProfileEdit
        /// </summary>
        public void FormMethod_ProfileEdit()
        {
            try
            {
                ISingleDbObject dom = null;
                ISingleDbObject app = null;

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

                if (profile == null)
                {
                    return;
                }


                if (profile["UID_SDLDomainRD"].New.String.Length > 0)
                {
                    dom = profile.GetFK("UID_SDLDomainRD").Create();

                    if (dom != null)
                    {
                        app = profile.GetFK("UID_Driver").Create();
                    }
                }

                string strReturn;

                if (ProfileTool.GetProfilePathOnTas(profile, out strReturn))
                {
                    m_MProfilePathOnTAS = strReturn;
                    ProfileTool.ReadFileFromProfile(Path.Combine(m_MProfilePathOnTAS, "profile.vii"), out strReturn);
                }
                else
                {
                    FormTool.ShowError(strReturn);
                    return;
                }

                if (profile.IsChanged)
                {
                    profile.Save(); profile.Load();
                }

                if (ProfileTool.StarteProfileEditor(profile, dom, app))
                {
                    // liefert true, wenn sich die profile.vii geändert hat
                    // profile edit schreibt profile.vii - damit ist sync möglich
                    if (ProfileTool.SyncWithProfileVii(profile, Path.Combine(m_MProfilePathOnTAS, "profile.vii")))
                    {
                        // unbedingt speichern, da sonst die JobKette auf einem alten Profilstand generiert wird.
                        if (profile.IsChanged)
                        {
                            profile.Save(); profile.Load();
                        }

                        profile.Custom.CallMethod("WriteVIIFiles");

                        //// Profile neu laden, da von WriteVIIFiles (Jobkette) geändert
                        //DbObjectKey key = new DbObjectKey(profile);
                        //profile.Clear();
                        //key.FillObject(profile);
                        //profile.Load();

                        // das muss sein, da FillObject beim Setzen des PKs ein COlumnChanged auslöst, bei allen anderen
                        // Spalten nicht, deshalb stimmt die Sheet Bestimmung nicht mehr und das Form heist AppProfile-Objekt ohne Anzeigename.
                        Document.Reload();
                    }
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                VI.FormBase.ExceptionMgr.Instance.HandleException(
                    new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationProfileMasterData_Task_EditApplicationProfile").Replace("&", "")), this);
            }
        }
Example #8
0
        public static void RefreshProfileCopy(NodeType nodeType, string UID_Server, string UID_Profile, string ChgNrSoll)
        {
            ISingleDbObject oSgP = null;

            try
            {
                // Change mouse cursor
                Cursor.Current = Cursors.WaitCursor;

                switch (nodeType)
                {
                case NodeType.AppProfile:
                    // create the object
                    oSgP = clsMain.Instance.CurrentConnection.Connection.CreateSingle("AppServerGotAppProfile");

                    // fill primary keys
                    oSgP["UID_ApplicationServer"].NewValue = UID_Server;
                    oSgP["UID_Profile"].NewValue           = UID_Profile;
                    break;

                case NodeType.DrvProfile:
                    // create the object
                    oSgP = clsMain.Instance.CurrentConnection.Connection.CreateSingle("AppServerGotDriverProfile");

                    // fill primary keys
                    oSgP["UID_ApplicationServer"].NewValue = UID_Server;
                    oSgP["UID_Profile"].NewValue           = UID_Profile;
                    break;

                case NodeType.MacType:
                    // create the object
                    oSgP = clsMain.Instance.CurrentConnection.Connection.CreateSingle("AppServerGotMactypeInfo");

                    // fill primary keys
                    oSgP["UID_ApplicationServer"].NewValue = UID_Server;
                    oSgP["UID_MachineType"].NewValue       = UID_Profile;
                    break;

                default:

                    throw new Exception("Invalid nodeType " + nodeType.ToString() + " for _RefreshProfileCopy.");
                }

                // try to load
                oSgP.Load();

                // Change properties required for Update
                oSgP.PutValue("ProfileStateProduction", "EMPTY");

                // Reverse the ChgNumber for MAC-Types
                if (nodeType == NodeType.MacType)
                {
                    if (oSgP.GetValue("ChgNumber").Int > 0)
                    {
                        oSgP.PutValue("ChgNumber", -oSgP.GetValue("ChgNumber").Int);
                    }
                }

                // now save the object
                oSgP.Save();


                // and now fire the event
                VI.DB.JobGeneration.JobGen.Generate(oSgP, "Copy2PAS");
            }
            catch (Exception ex)
            {
                ExceptionDialog.Show(null, ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        /// <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();
                }
            }
        }