예제 #1
0
        private void EditeElement()
        {
            CObjetDonneeAIdNumeriqueAuto objet = null;

            bool            bIsNewContexte = false;
            CContexteDonnee contexteDonnee = CSc2iWin32DataClient.ContexteCourant;

            if (m_parametreEdition.IdVersionAForcer != contexteDonnee.IdVersionDeTravail)
            {
                contexteDonnee = (CContexteDonnee)CSc2iWin32DataClient.ContexteCourant.Clone();// GetNewContexteDonneeInSameThread(m_parametreEdition.IdSession, true);
                contexteDonnee.SetEnableAutoStructure(true);
                contexteDonnee.SetVersionDeTravail(m_parametreEdition.IdVersionAForcer, false);
                bIsNewContexte = true;
            }
            objet = m_parametreEdition.ReferenceObjet.GetObjet(contexteDonnee) as CObjetDonneeAIdNumeriqueAuto;
            if (objet == null)
            {
                m_resultEdit.EmpileErreur(I.T("The object to edit doesn't exist|1078"));
                return;
            }

            CReferenceTypeForm refTypeForm = null;

            if (m_strCodeFormulaire != string.Empty)
            {
                refTypeForm = CFormFinder.GetRefFormToEdit(objet.GetType(), m_strCodeFormulaire);
            }
            else
            {
                refTypeForm = CFormFinder.GetRefFormToEdit(objet.GetType());
            }

            if (refTypeForm == null)
            {
                m_resultEdit.EmpileErreur(I.T("The system is not able to edit elements from type @1|1076", m_parametreEdition.GetType().ToString()));
                return;
            }

            try
            {
                CFormEditionStandard form = refTypeForm.GetForm(objet) as CFormEditionStandard;
                if (form != null)
                {
                    CFormNavigateurPopup.Show(form);//, CTimosApp.Navigateur);
                }
            }
            catch (Exception e)
            {
                m_resultEdit.EmpileErreur(new CErreurException(e));
            }
            finally
            {
                if (bIsNewContexte)
                {
                    contexteDonnee.Dispose();
                    contexteDonnee = null;
                }
            }
        }