Ejemplo n.º 1
0
        public void Fill(DataChamber data)
        {
            string[] name      = { "Wojtek", "Kasia", "Michal", "Andrzej", "Mikolaj", "Harper", "George", "Scott", "John", "Maria", "Sylwia", "Kinga" };
            string[] surname   = { "Mincikiewicz", "Kowalska", "Nowak", "Paluch", "Malolepszy", "Sapkowski", "Lee", "Orwell", "Fitzgerald", "Tolkien", "Rowling", "Bak" };
            string[] title     = { "The Witcher", "To Kill a Mockingbird", "1984", "The Great Gatsby", "Hobbit", "Revenge", "The Godfather", "Solaris", "The Lord of the Rings", "Life of PI", "Sillmarion", "Hunger Games" };
            string[] publisher = { "Znak", "Rebis", "PWN", "Amber", "Nowa Era", "Moka" };
            string[] bookState = { "Good", "Average", "Bad" };

            Random rnd = new Random();

            for (int i = 0; i < 10; i++)
            {
                data.getUsersList().Add(new Users(i, name[rnd.Next(12)], surname[rnd.Next(12)], rnd.Next(1900, 2010)));
            }

            for (int i = 0; i < 10; i++)
            {
                data.getCatalogDictionary().Add(i, new Catalog(name[rnd.Next(12)], surname[rnd.Next(12)], rnd.Next(1900, 2010), title[rnd.Next(12)], i));
            }

            for (int i = 0; i < 10; i++)
            {
                data.getProcessStateList().Add(new ProcessState(data.getCatalogDictionary()[rnd.Next(0, 10)], publisher[rnd.Next(6)], rnd.Next(1900, 2018), bookState[rnd.Next(3)]));
            }

            for (int i = 0; i < 10; i++)
            {
                int      years    = rnd.Next(2000, 2016);
                int      months   = rnd.Next(1, 12);
                int      days     = rnd.Next(1, 28);
                DateTime checkOut = new DateTime(years, months, days);
                DateTime checkIn  = new DateTime(years + rnd.Next(1, 2), rnd.Next(1, 12), rnd.Next(1, 28));
                data.getEventsList().Add(new Event(data.getProcessStateList()[rnd.Next(0, 10)], data.getUsersList()[rnd.Next(0, 10)], checkOut, checkIn));
            }
        }
Ejemplo n.º 2
0
        public void Fill(DataChamber data)
        {
            Users user1 = new Users(0, "Wojtek", "Mincikiewicz", 1996);
            Users user2 = new Users(1, "Kasia", "Kowalska", 1993);
            Users user3 = new Users(2, "Michal", "Nowak", 1998);
            Users user4 = new Users(3, "Andrzej", "Paluch", 1996);
            Users user5 = new Users(4, "Mikolaj", "Malolepszy", 1997);

            Catalog book1 = new Catalog("Andrzej", "Sapkowski", 1984, "The Witcher", 0);
            Catalog book2 = new Catalog("Harper", "Lee", 1960, "To Kill a Mockingbird", 1);
            Catalog book3 = new Catalog("George", "Orwell", 1949, "1984", 2);
            Catalog book4 = new Catalog("Scott", "Fitzgerald", 1925, "The Great Gatsby", 3);
            Catalog book5 = new Catalog("John", "Tolkien", 1937, "Hobbit", 4);

            ProcessState ps1 = new ProcessState(book1, "Znak", 1986, "Good");
            ProcessState ps2 = new ProcessState(book1, "Rebis", 1999, "Average");
            ProcessState ps3 = new ProcessState(book4, "PWN", 2006, "Bad");
            ProcessState ps4 = new ProcessState(book2, "Znak", 2001, "Bad");
            ProcessState ps5 = new ProcessState(book3, "Amber", 1986, "Average");

            Event event1 = new Event(ps1, user1, new DateTime(2018, 1, 18), new DateTime(2018, 2, 28));
            Event event2 = new Event(ps1, user3, new DateTime(2016, 4, 18), new DateTime(2017, 3, 7));
            Event event3 = new Event(ps3, user1, new DateTime(2017, 3, 4), new DateTime(2018, 5, 20));
            Event event4 = new Event(ps5, user2, new DateTime(2018, 4, 6), new DateTime(2018, 12, 12));
            Event event5 = new Event(ps4, user5, new DateTime(2014, 11, 14), new DateTime(2015, 9, 9));

            data.getUsersList().Add(user1);
            data.getUsersList().Add(user2);
            data.getUsersList().Add(user3);
            data.getUsersList().Add(user4);
            data.getUsersList().Add(user5);

            data.getCatalogDictionary().Add(book1.getKey(), book1);
            data.getCatalogDictionary().Add(book2.getKey(), book2);
            data.getCatalogDictionary().Add(book3.getKey(), book3);
            data.getCatalogDictionary().Add(book4.getKey(), book4);
            data.getCatalogDictionary().Add(book5.getKey(), book5);

            data.getProcessStateList().Add(ps1);
            data.getProcessStateList().Add(ps2);
            data.getProcessStateList().Add(ps3);
            data.getProcessStateList().Add(ps4);
            data.getProcessStateList().Add(ps5);

            data.getEventsList().Add(event1);
            data.getEventsList().Add(event2);
            data.getEventsList().Add(event3);
            data.getEventsList().Add(event4);
            data.getEventsList().Add(event5);
        }
Ejemplo n.º 3
0
 public void setData(DataChamber data)
 {
     this.data = data;
 }
Ejemplo n.º 4
0
 public DatabaseActions(DataChamber data, DataFiller filler)
 {
     this.data   = data;
     this.filler = filler;
     filler.Fill(data);
 }
Ejemplo n.º 5
0
 public DatabaseActions(DataChamber data)
 {
     this.data = data;
 }