Beispiel #1
0
 public CResultAErreur VerifieDonnees()
 {
     if (ObjetEdite == null)
     {
         return(CResultAErreur.True);
     }
     return(ObjetEdite.VerifieDonnees(true));
 }
        /// ////////////////////////////////////////
        protected virtual CResultAErreur VerifieDonneesAndMAJSiIlFaut()
        {
            MemoryStream stream    = new MemoryStream();
            BinaryWriter binWriter = new BinaryWriter(stream);

            sc2i.common.CSerializerSaveBinaire saver = new CSerializerSaveBinaire(binWriter);

            CResultAErreur result = ObjetEdite.Serialize(saver);
            //NE se sérialise pas, surement un nouvel objet
            bool bSansFilet = !result.Result;

            result = CResultAErreur.True;
            try
            {
                result = MAJ_Champs();
                if (result)
                {
                    result = ObjetEdite.VerifieDonnees();
                }
            }
            catch (Exception e)
            {
                result.EmpileErreur(new CErreurException(e));
            }
            if (!result)
            {
                if (!bSansFilet)
                {
                    stream.Seek(0, SeekOrigin.Begin);
                    BinaryReader           binReader = new BinaryReader(stream);
                    CSerializerReadBinaire reader    = new CSerializerReadBinaire(binReader);
                    ObjetEdite.Serialize(reader);
                    binReader.Close();
                }
            }
            binWriter.Close();
            stream.Close();
            return(result);
        }