Пример #1
0
        public sc2i.common.CResultAErreur Serialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            serializer.TraiteType(ref m_typeDonnees);
            serializer.TraiteString(ref m_strNom);
            return(result);
        }
Пример #2
0
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            serializer.TraiteString(ref m_strNomChamp);
            serializer.TraiteString(ref m_strNomPropriete);
            serializer.TraiteType(ref m_typeDonnee);
            return(result);
        }
Пример #3
0
        public override sc2i.common.CResultAErreur Serialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            result = base.Serialize(serializer);
            if (!result)
            {
                return(result);
            }
            serializer.TraiteType(ref m_typeElement);
            return(result);
        }
        //---------------------------------------------------
        public CResultAErreur Serialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            //TESTDBKEYTODO : remplace m_nIDChampCustom par
            if (nVersion < 1)
            {
                serializer.ReadDbKeyFromOldId(ref m_dbKeyChampCustom, typeof(CChampCustom));
            }
            else
            {
                serializer.TraiteDbKey(ref m_dbKeyChampCustom);
            }
            serializer.TraiteString(ref m_strNomColonne);
            serializer.TraiteType(ref m_typeDonnee);
            return(result);
        }
Пример #5
0
        /// ////////////////////////////////////////////////////////
        protected override CResultAErreur MySerialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }

            if (serializer.Mode == ModeSerialisation.Lecture &&
                serializer.GetObjetAttache(typeof(CContexteDonnee)) != null)
            {
                ContexteDonnee = (CContexteDonnee)serializer.GetObjetAttache(typeof(CContexteDonnee));
            }
            else
            {
                ContexteDonnee = CContexteDonneeSysteme.GetInstance();
            }


            serializer.TraiteInt(ref m_nIdNextObjet);

            if (nVersion > 0)
            {
                bool bHasType = TypeCible != null;
                serializer.TraiteBool(ref bHasType);
                if (bHasType)
                {
                    serializer.TraiteType(ref m_typeCible);
                }
                else
                {
                    m_typeCible = null;
                }
            }
            else
            {
                m_typeCible = null;
            }

            //Lit les variables en premier car on en a besoin dans les actions
            serializer.AttacheObjet(typeof(IElementAVariablesDynamiquesBase), this);
            if (result)
            {
                result = serializer.TraiteArrayListOf2iSerializable(m_listeVariables, this);
            }

            foreach (IVariableDynamique variable in m_listeVariables)
            {
                if (variable.IdVariable == c_strIdVariableElement) //TESTDBKEYOK
                {
                    m_variableCible = (CVariableProcessTypeComplexe)variable;
                }
            }

            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                foreach (IVariableDynamique var in m_listeVariables)
                {
                    if (var.IdVariable == c_strIdVariableElement && var is CVariableProcessTypeComplexe)
                    {
                        m_variableCible      = (CVariableProcessTypeComplexe)var;
                        m_typeCible          = m_variableCible.TypeDonnee.TypeDotNetNatif;
                        m_bSurTableauDeCible = m_variableCible.TypeDonnee.IsArrayOfTypeNatif;
                    }
                }
            }



            result = serializer.TraiteArrayListOf2iSerializable(m_listeActions, this);
            if (result)
            {
                result = serializer.TraiteArrayListOf2iSerializable(m_listeLiensActions, this);
            }
            serializer.DetacheObjet(typeof(IElementAVariablesDynamiquesBase), this);

            //Lit les valeurs des variables
            if (nVersion > 2)
            {
                result = SerializeValeursVariables(nVersion, serializer);
            }

            if (nVersion >= 3)
            {
                serializer.TraiteBool(ref m_bModeAsynchrone);
            }
            else
            {
                m_bModeAsynchrone = false;
            }

            if (nVersion >= 4)
            {
                serializer.TraiteString(ref m_strLibelle);
            }

            AssureVariableCible();

            if (nVersion >= 5)
            {
                I2iSerializable objet = m_infoDeclencheur;
                serializer.TraiteObject(ref objet);
                m_infoDeclencheur = (CInfoDeclencheurProcess)objet;
            }

            if (nVersion >= 7)
            {
                serializer.TraiteBool(ref m_bSurTableauDeCible);
            }
            else
            {
                m_bSurTableauDeCible = false;
            }

            if (nVersion >= 9)
            {
                serializer.TraiteString(ref m_strLastErreur);
            }
            else
            {
                m_strLastErreur = "";
            }

            if (nVersion >= 10)
            {
                if (nVersion < 14 && serializer.Mode == ModeSerialisation.Lecture)
                {
                    int nIdTemp = -1;
                    serializer.TraiteInt(ref nIdTemp);
                    m_strIdVariableRetour = nIdTemp.ToString();
                }
                else
                {
                    serializer.TraiteString(ref m_strIdVariableRetour);
                }
            }

            Dictionary <int, I2iObjetGraphique> dicIdToObjet = null;

            if (nVersion >= 12)
            {
                int nbEle = m_ordreZ.Count;
                serializer.TraiteInt(ref nbEle);
                if (serializer.Mode == ModeSerialisation.Lecture)
                {
                    dicIdToObjet = new Dictionary <int, I2iObjetGraphique>();
                    foreach (CAction action in ListeActions)
                    {
                        dicIdToObjet[action.IdObjetProcess] = action;
                    }
                    foreach (CLienAction lien in ListeLiens)
                    {
                        dicIdToObjet[lien.IdObjetProcess] = lien;
                    }
                    m_ordreZ.Clear();
                    for (int n = 0; n < nbEle; n++)
                    {
                        int nId = 0;
                        serializer.TraiteInt(ref nId);
                        I2iObjetGraphique objTmp = null;
                        if (dicIdToObjet.TryGetValue(nId, out objTmp))
                        {
                            m_ordreZ.Add((IObjetDeProcess)objTmp);
                        }
                    }
                }
                else if (serializer.Mode == ModeSerialisation.Ecriture)
                {
                    foreach (IObjetDeProcess objet in m_ordreZ)
                    {
                        int nCopy = objet.IdObjetProcess;
                        serializer.TraiteInt(ref nCopy);
                    }
                }
            }
            else
            {
                m_ordreZ = new List <IObjetDeProcess>();
                foreach (CAction action in ListeActions)
                {
                    m_ordreZ.Add(action);
                }
                foreach (CLienAction lien in ListeLiens)
                {
                    m_ordreZ.Add(lien);
                }
            }
            if (nVersion >= 13)
            {
                serializer.TraiteBool(ref m_bModeTransactionnel);
            }
            else
            {
                m_bModeTransactionnel = false;
            }


            return(result);
        }
        /// //////////////////////////////////////
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }

            int nRestriction = (int)RestrictionGlobale;

            serializer.TraiteInt(ref nRestriction);
            RestrictionUtilisateur = (ERestriction)nRestriction;

            serializer.TraiteType(ref m_type);
            int nNb = m_tableRestrictions.Count;

            serializer.TraiteInt(ref nNb);
            switch (serializer.Mode)
            {
            case ModeSerialisation.Ecriture:
                foreach (string strKey in m_tableRestrictions.Keys)
                {
                    string strTmp = strKey;
                    nRestriction = (int)m_tableRestrictions[strKey];
                    serializer.TraiteString(ref strTmp);
                    serializer.TraiteInt(ref nRestriction);
                }
                break;

            case ModeSerialisation.Lecture:
                m_tableRestrictions.Clear();
                for (int nKey = 0; nKey < nNb; nKey++)
                {
                    string strKey = "";
                    int    nRest  = 0;
                    serializer.TraiteString(ref strKey);
                    if (nVersion < 3 && m_convertisseurCle != null)
                    {
                        strKey = m_convertisseurCle.GetCleRestrictionCompatible(strKey);
                    }
                    serializer.TraiteInt(ref nRest);
                    m_tableRestrictions[strKey] = (ERestriction)nRest;
                }
                break;
            }
            if (nVersion >= 1)
            {
                serializer.TraiteInt(ref m_nPriorite);
                serializer.TraiteBool(ref m_bSurchageComplete);
            }
            if (nVersion >= 2)
            {
                int nNbExceptions = m_dicContextesExceptions.Count;
                switch (serializer.Mode)
                {
                case ModeSerialisation.Ecriture:
                    serializer.TraiteInt(ref nNbExceptions);
                    foreach (string strTmp in m_dicContextesExceptions.Keys)
                    {
                        string strText = strTmp;
                        serializer.TraiteString(ref strText);
                    }
                    break;

                case ModeSerialisation.Lecture:
                    serializer.TraiteInt(ref nNbExceptions);
                    List <String> lst = new List <string>();
                    for (int nException = 0; nException < nNbExceptions; nException++)
                    {
                        string strTmp = "";
                        serializer.TraiteString(ref strTmp);
                        lst.Add(strTmp);
                    }
                    ContextesException = lst.ToArray();
                    break;
                }
            }
            return(result);
        }
Пример #7
0
        /// /////////////////////////////////////////////////////////
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            int nNb = m_tableRestrictions.Count;

            serializer.TraiteInt(ref nNb);
            switch (serializer.Mode)
            {
            case ModeSerialisation.Ecriture:
                foreach (Type tp in m_tableRestrictions.Keys)
                {
                    Type            tpTemp      = tp;
                    I2iSerializable restriction = (I2iSerializable)m_tableRestrictions[tp];
                    serializer.TraiteType(ref tpTemp);
                    result = serializer.TraiteObject(ref restriction);
                    if (!result)
                    {
                        return(result);
                    }
                }
                break;

            case ModeSerialisation.Lecture:
                m_tableRestrictions.Clear();
                for (int nType = 0; nType < nNb; nType++)
                {
                    Type            tp   = null;
                    I2iSerializable rest = null;
                    serializer.TraiteType(ref tp);
                    result = serializer.TraiteObject(ref rest, tp);
                    if (!result)
                    {
                        return(result);
                    }
                    if (tp != null)
                    {
                        m_tableRestrictions[tp] = rest;
                    }
                }
                break;
            }
            if (nVersion >= 1)
            {
                serializer.TraiteBool(ref m_bIsAdministrateur);
            }
            if (nVersion >= 2)
            {
                bool bHasAnnulation = SeuilAnnulationPriorites != null;
                serializer.TraiteBool(ref bHasAnnulation);
                if (bHasAnnulation)
                {
                    int nTmp = SeuilAnnulationPriorites == null ? 0 : (int)m_nSeuilAnnulationPriorites;
                    serializer.TraiteInt(ref nTmp);
                    SeuilAnnulationPriorites = nTmp;
                }
            }
            return(result);
        }