/// <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();
            }
        }
예제 #2
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);
            }
        }
예제 #3
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);
            }
        }
예제 #4
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;
            }
        }
예제 #5
0
        public static void RefreshProfileCL2FDS(NodeType nodeType, string UID_Profile, string UID_Server, string Ident_Domain, IValueProvider vpCL)
        {
            IColDbObject    colProfileCL;
            ISingleDbObject cProfileCL  = null;
            ISingleDbObject oProfileFDS = null;

            ISqlFormatter fSQL = clsMain.Instance.CurrentConnection.Connection.SqlFormatter;

            try
            {
                // Change mousecursor
                Cursor.Current = Cursors.WaitCursor;

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

                    // fill primarykeys
                    oProfileFDS["UID_Profile"].NewValue = UID_Profile;
                    oProfileFDS.Load();

                    // create the object
                    colProfileCL = clsMain.Instance.CurrentConnection.Connection.CreateCol("ApplicationProfile");
                    colProfileCL.Prototype["UID_Application"].NewValue = oProfileFDS["UID_Application"].New.String;
                    colProfileCL.Prototype["Ident_OS"].NewValue        = oProfileFDS["Ident_OS"].New.String;
                    colProfileCL.Prototype["Ident_InstType"].NewValue  = oProfileFDS["Ident_InstType"].New.String;
                    colProfileCL.Prototype["Ident_DomainRD"].NewValue  = vpCL.GetValue("Ident_Domain").String;

                    break;

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

                    // fill primarykeys
                    oProfileFDS["UID_Profile"].NewValue = UID_Profile;
                    oProfileFDS.Load();

                    // create the object
                    colProfileCL = clsMain.Instance.CurrentConnection.Connection.CreateCol("DriverProfile");
                    colProfileCL.Prototype["UID_Driver"].NewValue     = oProfileFDS["UID_Driver"].New.String;
                    colProfileCL.Prototype["Ident_DomainRD"].NewValue = vpCL.GetValue("Ident_Domain").String;

                    break;

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

                    // fill primarykeys
                    oProfileFDS["UID_MachineType"].NewValue = UID_Profile;
                    oProfileFDS.Load();

                    // create the object
                    colProfileCL = clsMain.Instance.CurrentConnection.Connection.CreateCol("MachineType");
                    colProfileCL.Prototype["Ident_MachineType"].NewValue       = oProfileFDS["Ident_MachineType"].New.String;
                    colProfileCL.Prototype["Ident_DomainMachineType"].NewValue = vpCL.GetValue("Ident_Domain").String;

                    break;

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

                // Source Coll Laden
                colProfileCL.Load();

                if (colProfileCL.Count > 0)
                {
                    cProfileCL = colProfileCL[0].Create();

                    if (nodeType == NodeType.MacType)
                    {
                        cProfileCL.PutValue("MakeFullCopy", true);
                        cProfileCL.Custom.CallMethod("SvrCopy", "COPYCL2FDS", "", "", clsMain.Instance.CurrentConnection.Connection.LocalNow, Ident_Domain);
                    }
                    else
                    {
                        cProfileCL.Custom.CallMethod("SvrCopy", "COPYCL2FDS", "", "", clsMain.Instance.CurrentConnection.Connection.LocalNow, Ident_Domain, false);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionDialog.Show(null, ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }