/// <summary>
        /// Méthode static qui sérialise en binaire un service commercial.
        /// </summary>
        /// <param name="sc">Service commercial à sérialiser</param>
        /// <param name="chemin">Le chemin et le nom.ext du fichier</param>
        public static void sauve(ServiceCommercial sc, String chemin)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      flux      = null;

            try
            {
                flux = new FileStream(chemin, FileMode.Create, FileAccess.Write);
                formatter.Serialize(flux, sc);
                flux.Flush();
            }
            catch { }
            finally
            {
                if (flux != null)
                {
                    flux.Close();
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Ajouter le service commercial du commercial
 /// </summary>
 /// <param name="sc">Le service commercial</param>
 public void ajouterServiceCommercial(ServiceCommercial sc)
 {
     this.leService = sc;
 }