Esempio n. 1
0
        // Load in a snapshot to the database model
        public static void LoadSnapshot(DataSnapshot Frame, bool Lock)
        {
            using (DataRepository Repo = new DataRepository(Lock))
            {
                Repo.Bookings.Clear();
                Frame.Bookings.ForEach(b => Repo.Bookings.Add(b));

                Repo.Departments.Clear();
                Frame.Departments.ForEach(d => Repo.Departments.Add(d));

                Repo.Periods.Clear();
                Frame.Periods.ForEach(p => Repo.Periods.Add(p));

                Repo.Rooms.Clear();
                Frame.Rooms.ForEach(t => Repo.Rooms.Add(t));

                Repo.Users.Clear();
                Frame.Users.ForEach(u => Repo.Users.Add(u));

                Repo.Subjects.Clear();
                Frame.Subjects.ForEach(s => Repo.Subjects.Add(s));

                Repo.Classes.Clear();
                Frame.Classes.ForEach(c => Repo.Classes.Add(c));

                // Run through all lists and expand the items within them
                foreach (IList Table in Tables.Values)
                {
                    foreach (DataModel d in Table)
                        d.Expand(Repo);
                }
            }
        }
Esempio n. 2
0
 public InitialiseMessage(DataSnapshot Frame)
 {
     Snapshot = Frame;
 }
Esempio n. 3
0
 // Take a frame of the information in the database model
 public static DataSnapshot TakeSnapshot(bool Lock = true)
 {
     DataSnapshot Frame = new DataSnapshot();
     using (DataRepository Repo = new DataRepository(Lock))
     {
         Frame.Bookings = Repo.Bookings.ToList();
         Frame.Departments = Repo.Departments.ToList();
         Frame.Periods = Repo.Periods.ToList();
         Frame.Rooms = Repo.Rooms.ToList();
         Frame.Users = Repo.Users.ToList();
         Frame.Subjects = Repo.Subjects.ToList();
         Frame.Classes = Repo.Classes.ToList();
     }
     return Frame;
 }