Exemple #1
0
        /// //////////////////////////////////////
        private void m_btnEdit_Click(object sender, System.EventArgs e)
        {
            if (m_menuCustom == null)
            {
                m_menuCustom = new CMenuCustom(CSc2iWin32DataClient.ContexteCourant);
                m_menuCustom.CreateNew();
                m_menuCustom.Libelle = I.T("Main menu|716");
            }
            CFormEditionMenuCustom form = new CFormEditionMenuCustom(m_menuCustom);

            form.AfterValideModification += new ObjetDonneeEventHandler(AfterModifieMenu);
            CTimosApp.Navigateur.AffichePage(form);
        }
Exemple #2
0
        private void AssureMenu( )
        {
            if (DesignMode)
            {
                return;
            }
            if (m_menuCustom == null && !DesignMode)
            {
                IDatabaseRegistre registre = (IDatabaseRegistre)C2iFactory.GetNew2iObjetServeur(typeof(IDatabaseRegistre), CTimosApp.SessionClient.IdSession);
                int nId = (int)registre.GetValeurLong(c_cleRegistre, -1);
                m_menuCustom = new CMenuCustom(CSc2iWin32DataClient.ContexteCourant);
                if (!m_menuCustom.ReadIfExists(nId))
                {
                    // Si l'ID n'éxiste pas alors on cherche par une requette pour être sûr
                    CListeObjetsDonnees listeMenus = new CListeObjetsDonnees(
                        CSc2iWin32DataClient.ContexteCourant,
                        typeof(CMenuCustom),
                        new CFiltreData(CMenuCustom.c_champIdMenuParent + " IS NULL"));

                    if (listeMenus.Count >= 1)
                    {
                        // On a trouvé le premier menu sans parent
                        m_menuCustom = (CMenuCustom)listeMenus[0];
                    }
                    else
                    {
                        //Construction du menu par défaut
                        m_menuCustom.CreateNew();
                        m_menuCustom.Libelle = I.T("Home|714");
                        m_menuCustom.Action  = null;
                        AddMenuStandard(m_menuCustom, I.T("Assets management|1"), typeof(CFormMenuPatrimoine));
                        AddMenuStandard(m_menuCustom, I.T("Organisation|4"), typeof(CFormMenuOrganisation));
                        AddMenuStandard(m_menuCustom, I.T("Maintenance|8"), typeof(CFormMenuMaintenance));
                        AddMenuStandard(m_menuCustom, I.T("Engineering|6"), typeof(CFormMenuIngenierie));
                        AddMenuStandard(m_menuCustom, I.T("Configuration|7"), typeof(CFormMenuConfiguration));
                        m_menuCustom.CommitEdit();
                        registre.SetValeur(c_cleRegistre, m_menuCustom.Id.ToString());
                    }
                }
            }
        }