Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        private void MainActivator_OnActivated(object sender, System.EventArgs e)
        {
            try
            {
                m_EditAsLabel2.Text = "";
                m_EditAsLabel3.Text = "";
                m_EditAsLabel4.Text = "";

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

                if (dbobject == null)
                {
                    return;
                }

                string path = "";

                if (!ProfileTool.GetProfilePathOnTas(dbobject, out path))
                {
                    return;
                }

                m_EditAsLabel4.Text = path;

                string file  = "";
                string error = "";

                if (ProfileTool.ReadFileFromProfile(System.IO.Path.Combine(path, "profiledescription.vii"), out file))
                {
                    m_EditAsLabel2.Text = file;
                }
                else
                {
                    error = GetString("SDL_FormApplicationProfileSyncViiFiles_Message_ErrorNoProfileDescriptionVII") + Environment.NewLine;
                }

                if (ProfileTool.ReadFileFromProfile(System.IO.Path.Combine(path, "profile.vii"), out file))
                {
                    m_EditAsLabel3.Text = file;
                }
                else
                {
                    error += GetString("SDL_FormApplicationProfileSyncViiFiles_Message_ErrorNoProfileVII") + Environment.NewLine;
                }

                if (error.Length > 0)
                {
                    FormTool.ShowError(error);
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }