Ejemplo n.º 1
0
        //---------------------------------------------
        public CResultAErreur Serialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

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

            serializer.TraiteString(ref m_strLibelle);

            result = serializer.TraiteObject <CEasyQuery>(ref m_query);
            if (result)
            {
                result = serializer.TraiteObject <CListeQuerySource>(ref m_listeSources);
            }
            if (!result)
            {
                return(result);
            }
            serializer.TraiteString(ref m_strNomTableSource);
            serializer.TraiteString(ref m_strChampCleElement);
            serializer.TraiteString(ref m_strChampLatitude);
            serializer.TraiteString(ref m_strChampLongitude);
            serializer.TraiteString(ref m_strChampLibelle);
            serializer.TraiteDouble(ref m_fMetresEntrePoints);
            return(result);
        }
Ejemplo n.º 2
0
        /// //////////////////////////////////////////
        private void SerializeTable(C2iSerializer serializer, object[] tableau, bool bIsString)
        {
            switch (serializer.Mode)
            {
            case ModeSerialisation.Ecriture:
                foreach (object obj in tableau)
                {
                    if (bIsString)
                    {
                        string strVal = obj.ToString();
                        serializer.TraiteString(ref strVal);
                    }
                    else
                    {
                        Double dVal = Convert.ToDouble(obj, CultureInfo.InvariantCulture);
                        serializer.TraiteDouble(ref dVal);
                    }
                }
                break;

            case ModeSerialisation.Lecture:
                for (int nTmp = 0; nTmp < tableau.Length; nTmp++)
                {
                    if (bIsString)
                    {
                        string strVal = "";
                        serializer.TraiteString(ref strVal);
                        tableau[nTmp] = strVal;
                    }
                    else
                    {
                        double dVal = 0;
                        serializer.TraiteDouble(ref dVal);
                        tableau[nTmp] = dVal;
                    }
                }
                break;
            }
        }
Ejemplo n.º 3
0
        //---------------------------------------------------------------
        public CResultAErreur Serialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            serializer.TraiteDoubleNullable(ref m_fCoutSaisi);
            serializer.TraiteIntNullable(ref m_nIdTypeProjet);
            serializer.TraiteDouble(ref m_fDureeJours);
            if (nVersion >= 1)
            {
                serializer.TraiteString(ref m_strCleProjetTemplate);
            }
            if (nVersion >= 2)
            {
                serializer.TraiteObject <C2iExpression>(ref m_formuleInitialisation);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            if (serializer.Mode == ModeSerialisation.Ecriture)
            {
                result = VerifieCoherence();
            }
            if (!result)
            {
                return(result);
            }

            serializer.TraiteBool(ref m_bLignesString);
            serializer.TraiteBool(ref m_bColonnesString);
            serializer.TraiteDouble(ref m_dValeurDefaut);

            int nRes = (int)MethodeResolutionLignes;

            serializer.TraiteInt(ref nRes);
            MethodeResolutionLignes = (MethodeResolutionValeurMatrice)nRes;

            nRes = (int)MethodeResolutionColonne;
            serializer.TraiteInt(ref nRes);
            MethodeResolutionColonne = (MethodeResolutionValeurMatrice)nRes;

            int nNbLignes = Lignes.Length;

            serializer.TraiteInt(ref nNbLignes);

            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                m_lignes = new object[nNbLignes];
            }
            SerializeTable(serializer, m_lignes, LignesString);

            int nNbColonnes = Colonnes.Length;

            serializer.TraiteInt(ref nNbColonnes);
            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                m_colonnes = new object[nNbColonnes];
            }
            SerializeTable(serializer, m_colonnes, ColonnesString);

            //Sérialization des valeurs
            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                m_valeurs = new double[nNbLignes, nNbColonnes];
            }
            for (int nLigne = 0; nLigne < nNbLignes; nLigne++)
            {
                for (int nCol = 0; nCol < nNbColonnes; nCol++)
                {
                    double dVal = 0;
                    if (serializer.Mode == ModeSerialisation.Ecriture)
                    {
                        dVal = m_valeurs[nLigne, nCol];
                    }
                    serializer.TraiteDouble(ref dVal);
                    m_valeurs[nLigne, nCol] = dVal;
                }
            }
            return(result);
        }