Ejemplo n.º 1
0
        public void update(UserDatabases ud)
        {
            string        filePath = System.AppDomain.CurrentDomain.BaseDirectory + "XMLFiles\\" + ud.Matricule + ".xml";
            XmlSerializer xs       = new XmlSerializer(typeof(UserDatabases));

            using (StreamWriter wr = new StreamWriter(filePath))
            {
                xs.Serialize(wr, ud);
            }
        }
Ejemplo n.º 2
0
 public bool visiteUserDatabases(UserDatabases ud)
 {
     foreach (DatabaseXML db in ud.Databases)
     {
         if (db.accept(this) == false)
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 3
0
        public UserDatabases findByMatricule(string matricule)
        {
            string        filePath = System.AppDomain.CurrentDomain.BaseDirectory + "XMLFiles\\" + matricule + ".xml";
            XmlSerializer xs       = new XmlSerializer(typeof(UserDatabases));

            if (File.Exists(filePath))
            {
                using (StreamReader wr = new StreamReader(filePath))
                {
                    return(xs.Deserialize(wr) as UserDatabases);
                }
            }
            UserDatabases userDatabases = new UserDatabases
            {
                Matricule = matricule,
                Databases = new List <DatabaseXML>()
            };

            using (StreamWriter sr = new StreamWriter(filePath))
            {
                xs.Serialize(sr, userDatabases);
            }
            return(userDatabases);
        }
Ejemplo n.º 4
0
 public void create(UserDatabases ud)
 {
     update(ud);
 }