Esempio n. 1
0
 public void UpdateValeursCalculees()
 {
     foreach (Control ctrl in m_panelSousFormulaires.Controls)
     {
         CPanelChildElement sousFormulaire = ctrl as CPanelChildElement;
         if (sousFormulaire != null)
         {
             sousFormulaire.UpdateValeursCalculees();
         }
     }
 }
Esempio n. 2
0
        public void AppliqueRestriction(
            CRestrictionUtilisateurSurType restrictionSurObjetEdite,
            CListeRestrictionsUtilisateurSurType listeRestriction,
            IGestionnaireReadOnlySysteme gestionnaireReadOnly)
        {
            if (listeRestriction == null || gestionnaireReadOnly == null)
            {
                return;
            }
            m_listeRestrictionsAppliquées    = listeRestriction.Clone() as CListeRestrictionsUtilisateurSurType;
            m_restrictionSurObjetEditeParent = restrictionSurObjetEdite;
            m_gestionnaireReadOnly           = gestionnaireReadOnly;
            bool bAllReadOnly = false;

            if ((restrictionSurObjetEdite.RestrictionGlobale & ERestriction.ReadOnly) == ERestriction.ReadOnly)
            {
                gestionnaireReadOnly.SetReadOnly(this, true);
                bAllReadOnly = true;
            }
            //Récupère la restriction sur le type des éléments
            if (m_zoneMultiple != null && m_zoneMultiple.SourceFormula != null)
            {
                C2iExpression source = m_zoneMultiple.SourceFormula;
                Type          tp     = source.TypeDonnee.TypeDotNetNatif;
                if (tp != null)
                {
                    //Chope la restriction et l'envoie à tous ses fils
                    CRestrictionUtilisateurSurType rest = listeRestriction.GetRestriction(tp);
                    if (bAllReadOnly)//Si readonly forcé sur toute la zone
                    {
                        rest.RestrictionUtilisateur |= ERestriction.ReadOnly;
                    }
                    m_bPreventAddFromRestriction    = (rest.RestrictionGlobale & ERestriction.NoCreate) == ERestriction.NoCreate;
                    m_bPreventDeleteFromRestriction = (rest.RestrictionGlobale & ERestriction.NoDelete) == ERestriction.NoDelete;
                    m_lnkAdd.Visible   = !m_bPreventAddFromRestriction && m_zoneMultiple.HasAddButton;
                    m_panelTop.Visible = m_nbPages > 1 || m_zoneMultiple.HasAddButton;
                    foreach (Control ctrl in m_panelSousFormulaires.Controls)
                    {
                        CPanelChildElement sousFormulaire = ctrl as CPanelChildElement;
                        if (sousFormulaire != null)
                        {
                            sousFormulaire.AppliqueRestrictions(rest,
                                                                listeRestriction,
                                                                gestionnaireReadOnly);
                            if (m_bPreventDeleteFromRestriction)
                            {
                                sousFormulaire.DelegueSuppression = null;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        //---------------------------------------------------------------
        public void SetElementEditeSansChangerLesValeursAffichees(object elementEdite)
        {
            m_elementEdite = elementEdite;
            CResultAErreur result = CResultAErreur.True;

            foreach (Control ctrl in m_panelSousFormulaires.Controls)
            {
                CPanelChildElement sousFormulaire = ctrl as CPanelChildElement;
                if (sousFormulaire != null)
                {
                    sousFormulaire.SetElementEditeSansChangerLesValeursAffichees(elementEdite);
                }
            }
        }
Esempio n. 4
0
        //-----------------------------------------------------------------------------
        public sc2i.common.CResultAErreur MajChamps(bool bControlerLesValeursAvantValidation)
        {
            CResultAErreur result = CResultAErreur.True;

            foreach (Control ctrl in m_panelSousFormulaires.Controls)
            {
                CPanelChildElement sousFormulaire = ctrl as CPanelChildElement;
                if (sousFormulaire != null)
                {
                    CResultAErreur resTmp = sousFormulaire.MajChamps(bControlerLesValeursAvantValidation);
                    if (!resTmp)
                    {
                        result += resTmp;
                    }
                }
            }
            return(result);
        }
Esempio n. 5
0
        //-------------------------------------
        public void OnChangeParentModeEdition(bool bModeEdition)
        {
            switch (m_zoneMultiple.LockMode)
            {
            case C2iWnd.ELockMode.EnableOnEdit:
                LockEdition = !bModeEdition;

                break;

            case C2iWnd.ELockMode.DisableOnEdit:
                LockEdition = bModeEdition;
                break;
            }
            foreach (Control ctrl in m_panelSousFormulaires.Controls)
            {
                CPanelChildElement sousFormulaire = ctrl as CPanelChildElement;
                if (sousFormulaire != null)
                {
                    sousFormulaire.OnChangeParentModeEdition(!LockEdition);
                }
            }
        }
Esempio n. 6
0
        //-------------------------------------------------------------------------
        private bool AffichePage(int nNumPage, bool bMajChampsAvantAffichage)
        {
            if (m_gestionnaireModeEdition.ModeEdition && bMajChampsAvantAffichage)
            {
                CResultAErreur result = MajChamps(true);
                if (!result)
                {
                    CFormAlerte.Afficher(result.Erreur);
                    return(false);
                }
            }
            this.SuspendDrawing();
            m_nPageEnCours = nNumPage;
            //m_panelSousFormulaires.SuspendDrawing();
            List <CPanelChildElement> reserveControles = new List <CPanelChildElement>();
            ArrayList lstControles = new ArrayList(m_panelSousFormulaires.Controls);

            foreach (Control ctrl in lstControles)
            {
                CPanelChildElement sousForm = ctrl as CPanelChildElement;
                if (sousForm != null)
                {
                    reserveControles.Add(sousForm);
                }
            }
            CPanelChildElement.DeleteElementDelegate delegueSuppression = null;
            if (m_elementEdite is IAllocateurSupprimeurElements &&
                m_zoneMultiple.HasDeleteButton && !m_bPreventDeleteFromRestriction)
            {
                delegueSuppression = new CPanelChildElement.DeleteElementDelegate(OnDeleteElement);
            }

            Hashtable tableDejaMis = new Hashtable();

            m_lblPageSurNbPages.Text = (m_nPageEnCours + 1).ToString() + "/" + m_nbPages.ToString();
            for (int i = m_nPageEnCours * m_nbParPage; i < (m_nPageEnCours * m_nbParPage) + m_nbParPage; i++)
            {
                if (i < m_lstObjets.Count)
                {
                    object data = m_lstObjets[i];
                    try
                    {
                        if (!tableDejaMis.ContainsKey(data))
                        {
                            tableDejaMis[data] = true;
                            CPanelChildElement panel = null;
                            if (reserveControles.Count != 0)
                            {
                                panel = reserveControles[reserveControles.Count - 1];
                                reserveControles.RemoveAt(reserveControles.Count - 1);
                            }
                            else
                            {
                                panel              = new CPanelChildElement();
                                panel.SizeChanged += new EventHandler(panelChild_SizeChanged);
                                if (m_gestionnaireReadOnly != null)
                                {
                                    m_gestionnaireReadOnly.AddControl(panel);
                                }
                            }
                            panel.Init(this, m_zoneMultiple.FormulaireFils, m_createur);
                            m_panelSousFormulaires.Controls.Add(panel);
                            if (m_zoneMultiple.Orientation == EOrientaion.Horizontal)
                            {
                                panel.Dock = DockStyle.Left;
                            }
                            else
                            {
                                panel.Dock = DockStyle.Top;
                            }

                            panel.Visible     = true;
                            panel.LockEdition = !m_gestionnaireModeEdition.ModeEdition;
                            panel.OnChangeParentModeEdition(m_gestionnaireModeEdition.ModeEdition);
                            panel.SetElementEdite(data);
                            panel.BringToFront();
                            panel.DelegueSuppression = delegueSuppression;
                        }
                    }
                    catch { }
                }
            }
            //m_panelSousFormulaires.ResumeDrawing();

            //Supprime les contrôles qui ne servent plus
            foreach (Control ctrl in reserveControles.ToArray())
            {
                ctrl.Visible = false;
                m_panelSousFormulaires.Controls.Remove(ctrl);
                ctrl.Dispose();
            }
            if (m_listeRestrictionsAppliquées != null && EditedElement != null)
            {
                AppliqueRestriction(
                    m_restrictionSurObjetEditeParent,
                    m_listeRestrictionsAppliquées,
                    m_gestionnaireReadOnly);
            }
            RecalcAutoSize();
            this.ResumeDrawing();
            return(true);
        }