Exemple #1
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);
            }
        }
Exemple #2
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);
            }
        }