Пример #1
0
        //-------------------------------------------------------------------
        protected override void MyInitValeurDefaut()
        {
            //Arrondi l'heure à 30 minutes
            int nHeure = DateTime.Now.Hour;
            int nMin   = DateTime.Now.Minute;

            if (nMin < 15)
            {
                nMin = 0;
            }
            else if (nMin >= 45)
            {
                nMin = 0;
                nHeure++;
            }
            else
            {
                nMin = 30;
            }
            DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
                                       nHeure, nMin, 0);

            DateDebut    = dt;
            DateFin      = dt;
            Etat         = new CEtatEntreeAgenda(EtatEntreeAgenda.AFaire);
            EntreePrivee = false;
            LibellePrive = "*******";
        }
Пример #2
0
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            NettoieFormulesLienEtChamps();
            int nIdTypeEntree = -1;

            if (TypeEntree != null)
            {
                nIdTypeEntree = TypeEntree.Id;
            }
            serializer.TraiteInt(ref nIdTypeEntree);
            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                if (nIdTypeEntree != -1)
                {
                    CTypeEntreeAgenda typeEntree = new CTypeEntreeAgenda((CContexteDonnee)serializer.GetObjetAttache(typeof(CContexteDonnee)));
                    if (typeEntree.ReadIfExists(nIdTypeEntree))
                    {
                        m_typeEntree = typeEntree;
                    }
                }
            }
            if (TypeEntree == null)
            {
                result.EmpileErreur(I.T("The entry type is incorrect|30081"));
                return(result);
            }

            I2iSerializable objet = m_formuleCommentaires;

            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleCommentaires = (C2iExpression)objet;

            objet  = m_formuleDateDebut;
            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleDateDebut = (C2iExpression)objet;

            objet  = m_formuleDateFin;
            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleDateFin = (C2iExpression)objet;

            objet  = m_formuleLibelle;
            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleLibelle = (C2iExpression)objet;

            serializer.TraiteBool(ref m_bSansHoraires);
            serializer.TraiteBool(ref m_bEtatAuto);

            int nEtat = m_etatInitial.EtatInt;

            serializer.TraiteInt(ref nEtat);
            m_etatInitial = new CEtatEntreeAgenda((EtatEntreeAgenda)nEtat);

            serializer.AttacheObjet(typeof(CParametreEntreeAgenda), this);

            result = serializer.TraiteArrayListOf2iSerializable(m_listeParametresRelationsChamps);
            if (!result)
            {
                return(result);
            }
            result = serializer.TraiteArrayListOf2iSerializable(m_listeParametresRelationsTypesElements);
            if (!result)
            {
                return(result);
            }
            foreach (CParametreRelationEntreeAgenda_TypeElement parametre in m_listeParametresRelationsTypesElements.ToArray())
            {
                if (parametre.Relation == null)
                {
                    m_listeParametresRelationsChamps.Remove(parametre);
                }
            }


            serializer.DetacheObjet(typeof(CParametreEntreeAgenda), this);

            //Supprime les relations à type éléments invalides
            foreach (CParametreRelationEntreeAgenda_TypeElement rel in (IEnumerable)m_listeParametresRelationsChamps.Clone())
            {
                if (rel.Relation == null)
                {
                    m_listeParametresRelationsChamps.Remove(rel);
                }
            }


            if (nVersion == 1)
            {
                //Ancienne référence de la date
                objet  = null;
                result = serializer.TraiteObject(ref objet);
                string strDummy = "";
                serializer.TraiteString(ref strDummy);
            }

            if (nVersion >= 3)
            {
                objet  = (I2iSerializable)m_formuleCle;
                result = serializer.TraiteObject(ref objet);
                if (!result)
                {
                    return(result);
                }
                m_formuleCle = (C2iExpression)objet;
            }
            if (nVersion >= 4)
            {
                serializer.TraiteInt(ref m_nMinutesRappel);
            }
            return(result);
        }