Ejemplo n.º 1
0
        public void Sauvegarder(string fichier, ListTelephone liste, ListMarque marque, ListCompte compte, ListPrixTelephone prixTelephones)
        {
            XmlSerializer xml = new XmlSerializer(typeof(List <Telephone>));

            foreach (Telephone nom in liste)
            {
                using (Stream wr = File.Create("DocText/" + fichier + ".xml"))
                {
                    xml.Serialize(wr, liste);
                }
            }

            XmlSerializer xmlmarque = new XmlSerializer(typeof(List <Marque>));

            using (Stream wr = File.Create("DocText/marque.xml"))
            {
                xmlmarque.Serialize(wr, marque);
            }

            XmlSerializer xmlcompte = new XmlSerializer(typeof(List <Compte>));

            using (Stream wr = File.Create("DocText/compte.xml"))
            {
                xmlcompte.Serialize(wr, compte);
            }

            XmlSerializer xmlprix = new XmlSerializer(typeof(List <PrixTelephone>));

            using (Stream wr = File.Create("DocText/prix.xml"))
            {
                xmlprix.Serialize(wr, prixTelephones);
            }
        }
Ejemplo n.º 2
0
        public ListTelephone lireFichierTelephone(string nom, ListTelephone liste)
        {
            ListTelephone a  = new ListTelephone();
            Telephone     s9 = new Telephone {
                Title = "s9", TopPrix = "300€"
            };

            liste.Add(s9);
            return(a);
        }
Ejemplo n.º 3
0
        public ListTelephone lireFichierTelephone(string nom, ListTelephone liste)
        {
            ListTelephone a;
            XmlSerializer xmlmarque = new XmlSerializer(typeof(ListTelephone));

            using (Stream wr = File.OpenRead("DocText/" + nom + ".xml"))
            {
                a = xmlmarque.Deserialize(wr) as ListTelephone;
            }
            return(a);
        }
Ejemplo n.º 4
0
        public ListTelephone lireFichierTelephone(string nom, ListTelephone liste)
        {
            string       line1;
            StreamReader file = new StreamReader("DocText/" + nom + ".txt");

            while ((line1 = file.ReadLine()) != null)
            {
                string Title;
                string Image;
                string Note;
                string TopPrix;
                string Conclusion;
                string PointFort1;
                string PointFort2;
                string PointFort3;
                string PointFaible1;
                string PointFaible2;
                string PointFaible3;
                string Article1;
                string Article2;
                Title        = line1;
                Image        = file.ReadLine();
                Note         = file.ReadLine();
                TopPrix      = file.ReadLine();
                Conclusion   = file.ReadLine();
                PointFort1   = file.ReadLine();
                PointFort2   = file.ReadLine();
                PointFort3   = file.ReadLine();
                PointFaible1 = file.ReadLine();
                PointFaible2 = file.ReadLine();
                PointFaible3 = file.ReadLine();
                Article1     = file.ReadLine();
                Article2     = file.ReadLine();
                liste.Add(new Telephone()
                {
                    Title = Title, Image = "/" + Image, Note = Note, TopPrix = TopPrix, Conclusion = Conclusion, PointFort1 = PointFort1, PointFort2 = PointFort2, PointFort3 = PointFort3, PointFaible1 = PointFaible1, PointFaible2 = PointFaible2, PointFaible3 = PointFaible3, Article1 = Article1, Article2 = Article2
                });
            }
            file.Close();
            return(liste);
        }
Ejemplo n.º 5
0
        public void TestMethod()
        {
            Manager m = new Manager(new EasyPhone.Persistance.PersistanceXML());

            for (int i = 0; i < m.apple.Count; i++)
            {
                Console.WriteLine(m.apple[i].Title);
            }

            ListTelephone a      = m.apple;
            Telephone     pixel3 = new Telephone {
                Title = "pixel3"
            };
            bool b = a.Ajouter(pixel3);

            for (int i = 0; i < a.Count; i++)
            {
                Console.WriteLine(a[i].Title);
            }
            Console.WriteLine(b);
        }
Ejemplo n.º 6
0
        public void Sauvegarder(string fichier, ListTelephone liste, ListMarque marque, ListCompte compte, ListPrixTelephone prixTelephones)
        {
            StreamWriter file2 = new StreamWriter("DocText/" + fichier + ".txt");

            foreach (Telephone nom in liste)
            {
                file2.WriteLine(nom.Title);
                file2.WriteLine(nom.Image);
                file2.WriteLine(nom.Note);
                file2.WriteLine(nom.TopPrix);
                file2.WriteLine(nom.Conclusion);
                file2.WriteLine(nom.PointFort1);
                file2.WriteLine(nom.PointFort2);
                file2.WriteLine(nom.PointFort3);
                file2.WriteLine(nom.PointFaible1);
                file2.WriteLine(nom.PointFaible2);
                file2.WriteLine(nom.PointFaible3);
                file2.WriteLine(nom.Article1);
                file2.WriteLine(nom.Article2);
            }
            file2.Close();
        }
Ejemplo n.º 7
0
 public void Sauvegarder(string fichier, ListTelephone liste, ListMarque marque, ListCompte compte, ListPrixTelephone prixTelephones)
 {
 }