Ejemplo n.º 1
0
        //Create objects

        static Repository()
        {
            //Books
            Book b1 = new Book("Bob Dylan Chronicles", "James Stone", 20, "Books(2015)", "2332323", "ChroniclesBobDilan.jpg");
            Book b2 = new Book("Miles Autobiography", "Miles Arthur", 30, "Books(2018)", "445667", "MilesAutobiography.jpg");
            Book b3 = new Book("Revolution in the head", "Nick Stone", 30, "Books(2018)", "445667", "RevolutionInTheHead.jpg");


            ///////CDs
            //CD1
            MusicCD cd1 = new MusicCD("With the Beatles", "Beatles", 30, "CDBeatles.png");

            cd1.addTrack(new Track("I Will", "Richard Rodgers", new TimeSpan(0, 2, 20)));
            cd1.addTrack(new Track("Blue Moon", "Richard Rodgers", new TimeSpan(0, 2, 52)));
            cd1.addTrack(new Track("Step Inside Love", "Richard Rodgers", new TimeSpan(0, 2, 15)));
            cd1.addTrack(new Track("Los Paranoias", "John Lennon", new TimeSpan(0, 2, 05)));
            cd1.addTrack(new Track("I Will", "Richard Rodgers", new TimeSpan(0, 2, 20)));
            cd1.addTrack(new Track("Blue Moon", "Richard Rodgers", new TimeSpan(0, 2, 52)));
            cd1.addTrack(new Track("Step Inside Love", "Richard Rodgers", new TimeSpan(0, 2, 15)));
            cd1.addTrack(new Track("Los Paranoias", "John Lennon", new TimeSpan(0, 2, 05)));

            //CD2

            MusicCD cd2 = new MusicCD("Bob Dylan - The collection", "Bob Dylan", 30, "BobDilanCD.jpg");

            cd2.addTrack(new Track("Blowin' in the Wind", "Don Hunstein", new TimeSpan(0, 2, 48)));
            cd2.addTrack(new Track("Girl from the North Country", "Don Hunstein", new TimeSpan(0, 2, 38)));
            cd2.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));
            cd2.addTrack(new Track("Blowin' in the Wind", "Don Hunstein", new TimeSpan(0, 2, 48)));
            cd2.addTrack(new Track("Girl from the North Country", "Don Hunstein", new TimeSpan(0, 2, 38)));
            cd2.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));

            //CD3
            MusicCD cd3 = new MusicCD("The real Miles Davis", "Miles Davis", 30, "MilesDavisCD.jpg");

            cd3.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));
            cd3.addTrack(new Track("I Will", "Richard Rodgers", new TimeSpan(0, 2, 20)));
            cd3.addTrack(new Track("Blue Moon", "Richard Rodgers", new TimeSpan(0, 2, 52)));
            cd3.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));
            cd3.addTrack(new Track("I Will", "Richard Rodgers", new TimeSpan(0, 2, 20)));
            cd3.addTrack(new Track("Blue Moon", "Richard Rodgers", new TimeSpan(0, 2, 52)));

            ///Movie objects
            Movie jungleBook     = new Movie("Jungle Book", 160.50m, "junglebook.jpg", "Ridley Scott");
            Movie becomingAstrid = new Movie("Becoming Astrid", 200.10m, "becomingAstrid.png", "Ridley Scott");
            Movie starBorn       = new Movie("A star is born", 180.10m, "starBorn.png", "Ridley Scott");
        }
Ejemplo n.º 2
0
        static Repository()
        {
            Book turner = new Book(1, "A Hard Day's Writer: The Story Behind Every Beatles Song", 150.00M, "Steve Turner", 2005, "It Books", "0060844094", "turner.jpg");

            turner.Category = "Book";
            Book rowling = new Book(2, "Harry Potter and the magic of the sticks", 999.00M, "R. Roll", 1337, "Rickrowl", "0063244094", "harrypotter2.jpg");

            rowling.Category = "Book";

            Movie jungleBook = new Movie(3, "Jungle Book", 160.50M, "junglebook.jpg", "person");

            jungleBook.Category = "Movie";
            Movie forrestgump = new Movie(4, "Forrest Gump", 314.23M, "forrest-gump.jpg", "person2");

            forrestgump.Category = "Movie";
            Movie gladiator = new Movie(5, "Gladiator", 421.23M, "gladiator.jpg", "person3");

            gladiator.Category = "Movie";

            MusicCD beatles = new MusicCD(6, "Abbey Road (Remastered)", 128.00M, "EMI", "Beatles", 2009, "abbey.jpg");

            beatles.AddTrack(new Track("Come Together", "Beatles", new TimeSpan(0, 3, 23)));
            beatles.AddTrack(new Track("Something", "Beatles", new TimeSpan(0, 3, 26)));
            beatles.AddTrack(new Track("Maxwell's Silver Hammer", "Beatles", new TimeSpan(0, 3, 27)));
            beatles.AddTrack(new Track("Oh! Darling", "Beatles", new TimeSpan(0, 3, 22)));
            beatles.AddTrack(new Track("Octopu's Garden", "Beatles", new TimeSpan(0, 3, 2)));
            beatles.AddTrack(new Track("I Want You (She's So Heavy", "Beatles", new TimeSpan(0, 3, 25)));
            beatles.AddTrack(new Track("Here Comes The Sun", "Beatles", new TimeSpan(0, 3, 23)));
            beatles.AddTrack(new Track("Become", "Beatles", new TimeSpan(0, 3, 28)));
            beatles.AddTrack(new Track("You Never Give Me Your Money", "Beatles", new TimeSpan(0, 3, 25)));
            beatles.AddTrack(new Track("Sun King", "Beatles", new TimeSpan(0, 3, 32)));
            beatles.AddTrack(new Track("Mean Mr. Mustard", "Beatles", new TimeSpan(0, 3, 24)));
            beatles.AddTrack(new Track("Ploythane Pam", "Beatles", new TimeSpan(0, 3, 52)));
            beatles.AddTrack(new Track("She Came Through The Bedroom Window", "Beatles", new TimeSpan(0, 3, 52)));
            beatles.AddTrack(new Track("Golden Slumbers", "Beatles", new TimeSpan(0, 3, 42)));
            beatles.AddTrack(new Track("Carry That Weight", "Beatles", new TimeSpan(0, 3, 22)));
            beatles.AddTrack(new Track("The End", "Beatles", new TimeSpan(0, 3, 2)));
            beatles.AddTrack(new Track("Her Majesty", "Beatles", new TimeSpan(0, 3, 42)));
            beatles.Category = "MusicCD";

            MusicCD toto = new MusicCD(7, "Best of ToTo", 252.23M, "Hans", "ToTo", 2002, "toto.jpg");

            for (int i = 0; i < 13; i++)
            {
                toto.AddTrack(new Track("Africa " + i, "ToTo", new TimeSpan(0, 3, 24)));
            }
            toto.Category = "MusicCD";
            Products.Add(turner);
            Products.Add(rowling);
            Products.Add(jungleBook);
            Products.Add(forrestgump);
            Products.Add(gladiator);
            Products.Add(beatles);
            Products.Add(toto);


            //Exercise 3

            Customer nicolai    = new Customer(1, "Nicolai", "Jessen", "Nødkær Alle 100 st. th.", "8270", "Højbjerg");
            Customer julemanden = new Customer(2, "Santa", "Claus", "Hvidkløvervej 1", "1337", "Nordpolen");

            Invoice nicolaiInvoice    = new Invoice(1, DateTime.Now, nicolai);
            Invoice julemandenInvoice = new Invoice(2, DateTime.Now, julemanden);

            Book warren = new Book(8, "What on earth am i here for?", 200.00M, "Rick Warren", 2018, "Zondervan", "0023254253", "rick.jpg");

            warren.Category = "Book";

            Movie avatar = new Movie(9, "Avatar", 500.00M, "avatar.jpg", "James Cameron");

            avatar.Category = "Movie";

            Movie harrypotter = new Movie(10, "Harry Potter", 200.00M, "harrypotter.jpg", "Emil Thorup");

            harrypotter.Category = "Movie";

            Movie martian = new Movie(11, "The Martian", 130.00M, "martian.jpg", "Matt Damon");

            martian.Category = "Movie";

            Movie interstellar = new Movie(12, "Interstellar", 520.00M, "interstella.jpg", "Michael Caine");

            interstellar.Category = "Movie";

            Products.Add(warren);
            Products.Add(interstellar);
            Products.Add(harrypotter);
            Products.Add(avatar);
            Products.Add(martian);

            nicolaiInvoice.AddOrderItem(harrypotter, 2);
            nicolaiInvoice.AddOrderItem(avatar, 1);
            julemandenInvoice.AddOrderItem(warren, 1);
            julemandenInvoice.AddOrderItem(beatles, 1);

            Invoices.Add(nicolaiInvoice);
            Invoices.Add(julemandenInvoice);



            //Exercise 4
        }
Ejemplo n.º 3
0
        static Repository()
        {
            List <MusicCD> musicCDs = new List <MusicCD>();
            List <Book>    books    = new List <Book>();
            List <Movie>   movie    = new List <Movie>();

            Book book = new Book(1, "Hello Kitty", "Manga", 15, 12, "ROMA", "0493090349")
            {
                ImageUrl = "gladiator.jpg"
            };

            Products.Add(book);


            Book book1 = new Book(2, "Paul Anderson", "Radiance", 15, 1812, "Gimmy Scala", "9439489")
            {
                ImageUrl = "JungleBook.jpg"
            };

            Products.Add(book1);

            MusicCD music2 = new MusicCD(3, "Seven Eleven", "Tron Gram", 2006, 300, "Havengrad");
            MusicCD music1 = new MusicCD(4, "Mango Master", "Jon Ben", 2016, 200, "Kosco")
            {
                ImageUrl = "forrest-gump.jpg"
            };

            Products.Add(music1);



            Movie movie1 = new Movie(5, "Amradilo Sacharevsky", 1999, "Goosebumps", 1000)

            {
                ImageUrl = "lord.jpg"
            };

            Products.Add(movie1);

            movie.Add(movie1);
            books.Add(book);
            books.Add(book1);
            musicCDs.Add(music1);

            //IEnumerable<MusicCD> musicCDs = new List<MusicCD>();
            //List<string> tracks = new List<string>();
            //tracks.Add("Skinnus");
            //tracks.Add("Biggus");
            //tracks.Add("Chad");

            music1.AddTrack(new Tracks("Good Riddance", "Ben", new TimeSpan(0, 03, 44)));
            music1.AddTrack(new Tracks("Hello Prison", "Jon", new TimeSpan(0, 10, 44)));
            music1.AddTrack(new Tracks("Nights Out", "Ben", new TimeSpan(0, 03, 44)));
            music1.AddTrack(new Tracks("Lights Before", "Jon", new TimeSpan(0, 10, 44)));
            music1.AddTrack(new Tracks("Selection", "Ben", new TimeSpan(0, 03, 44)));

            Customer cust1 = new Customer(1, "Michal", "Malina", "Bangds 10", "8000", "Aarhus A");

            cust1.AddPhoneNumber("75894375");
            cust1.AddPhoneNumber("543543534");
            cust1.BirthDate = new DateTime(1990, 9, 06);

            Customer cust2 = new Customer(2, "Hellman", "Bracher", "Dansely", "54321", "Dallas");

            cust2.AddPhoneNumber("85594358");
            cust2.BirthDate = new DateTime(2000, 01, 12);

            Invoice inv1 = new Invoice(1, new DateTime(2019, 09, 04), cust1);

            inv1.AddOrderItem(book, 1);
            inv1.AddOrderItem(movie1, 2);
            Invoices.Add(inv1);

            Invoice inv2 = new Invoice(2, new DateTime(2019, 09, 13), cust2);

            inv2.AddOrderItem(music1, 1);
            inv2.AddOrderItem(music2, 2);
            Invoices.Add(inv2);

            Product prd1 = new Product(1, "Gandlaf", 19);
            Product prd2 = new Product(2, "Legolas", 19);
            Product prd3 = new Product(3, "Gimli", 19);
            Product prd4 = new Product(4, "Boromir", 19);
            Product prd5 = new Product(5, "Sauron", 19);
        }
        //contructor
        static Repository()
        {
            //create objects
            Book book = new Book("Ram Mohan Roy", "A Gift of Monotheists", 160.50m, "Its Book", 1998, "00608994488", "monotheists.gif");

            book.ProductId = 1;
            book.Category  = "Book";
            Products.Add(book);
            Book book1 = new Book("V.S.Naipaul", "A House for Mr.Biswas", 155.50m, "Missing", 2001, "005588776655", "biswas.jpg");

            book1.ProductId = 2;
            book1.Category  = "Book";
            Products.Add(book1);

            Movie jungleBook = new Movie("Jungle Book", 160.50m, "junglebook.jpg", "John Favreau");

            jungleBook.ProductId = 3;
            jungleBook.Category  = "Movie";
            Products.Add(jungleBook);
            Movie gameofThrones = new Movie("Game of Thrones", 188.88m, "gmtr.jpg", "Brian Kirk");

            gameofThrones.ProductId = 4;
            gameofThrones.Category  = "Movie";
            Products.Add(gameofThrones);

            MusicCD CD = new MusicCD("Arijit Singh", "Tum Hi ho", 122.50m, 2016, "tumhiho.jpg");

            CD.AddTrack(new Track("Taxman", "McCartney", new TimeSpan(0, 2, 28)));
            CD.AddTrack(new Track("Come Together", "Harrison", new TimeSpan(0, 2, 06)));
            CD.AddTrack(new Track("Something", "Lennon", new TimeSpan(0, 3, 28)));
            CD.AddTrack(new Track("Oh! Darling", "Harrison", new TimeSpan(0, 3, 00)));
            CD.ProductId = 5;
            CD.Category  = "MusicCD";
            Products.Add(CD);

            MusicCD CD3 = new MusicCD("Honey Singh", "Swaag", 170.50m, 2015, "swaag.jpg");

            CD3.AddTrack(new Track("I am Only Sleeping", "Lennon", new TimeSpan(0, 2, 25)));
            CD3.AddTrack(new Track("Yellow Submarine", "Harrison", new TimeSpan(0, 1, 18)));
            CD3.AddTrack(new Track("She said She said", "McCartney", new TimeSpan(0, 2, 29)));
            CD3.AddTrack(new Track("For No One", "Harrison", new TimeSpan(0, 3, 01)));
            CD3.AddTrack(new Track("I Want To Tell You", "McCartney", new TimeSpan(0, 2, 14)));
            CD3.ProductId = 5;
            CD3.Category  = "MusicCD";
            Products.Add(CD3);

            Customer c1 = new Customer(1, "John", "Shaun", "London", "AB01", "Brent", new DateTime(2013, 1, 23));

            c1.addPhone("99887766");
            c1.addPhone("88776655");

            Customer c2 = new Customer(2, "Tom", "Shaw", "Denmark", "CC02", "Aarhus", new DateTime(2000, 1, 20));

            c2.addPhone("76787980");
            c2.addPhone("34354647");

            Invoice I1 = new Invoice(1, new DateTime(2017, 1, 23), c1);


            Invoice I2 = new Invoice(2, new DateTime(2017, 5, 30), c2);


            Product P1 = new Product("Arijit Singh", 122.50m);
            Product P2 = new Product("Jungle Book", 160.50m);
            Product P3 = new Product("Honey Singh", 170.50m);
            Product P4 = new Product("V.S.Naipaul", 155.50m);

            I1.AddOrderItem(P1, 1);
            I1.AddOrderItem(P2, 2);

            I2.AddOrderItem(P3, 2);
            I2.AddOrderItem(P4, 1);

            Invoices.Add(I1);
            Invoices.Add(I2);
        }
Ejemplo n.º 5
0
        //generate ALL objects and put into lists
        static Repository()
        {
            //Create objects


            //Books
            Book b1 = new Book(1, "Bob Dylan Chronicles", "James Stone", 20.50m, "Books(2015)", "2332323", "ChroniclesBobDilan.png");

            b1.Category = "Book";
            Book b2 = new Book(2, "Miles Autobiography", "Miles Arthur", 30.30m, "Books(2018)", "445667", "MilesAutobiography.png");

            b2.Category = "Book";

            ///////CDs
            //CD1
            MusicCD cd1 = new MusicCD(4, "Bob Dylan - The collection", "Bob Dylan", "EMI (2009)", 160.50m, "BobDilanCD.png");

            cd1.addTrack(new Track("Blowin' in the Wind", "Don Hunstein", new TimeSpan(0, 2, 48)));
            cd1.addTrack(new Track("Girl from the North Country", "Don Hunstein", new TimeSpan(0, 2, 38)));
            cd1.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));
            cd1.addTrack(new Track("Blowin' in the Wind", "Don Hunstein", new TimeSpan(0, 2, 48)));
            cd1.addTrack(new Track("Girl from the North Country", "Don Hunstein", new TimeSpan(0, 2, 38)));
            cd1.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));
            cd1.Category = "MusicCD";


            //CD3
            MusicCD cd3 = new MusicCD(6, "The real Miles Davis", "Miles Davis", "EMI (2009)", 160.50m, "MilesDavisCD.png");

            cd3.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));
            cd3.addTrack(new Track("I Will", "Richard Rodgers", new TimeSpan(0, 2, 20)));
            cd3.addTrack(new Track("Blue Moon", "Richard Rodgers", new TimeSpan(0, 2, 52)));
            cd3.addTrack(new Track("Down the Highway", "Don Hunstein", new TimeSpan(0, 2, 07)));
            cd3.addTrack(new Track("I Will", "Richard Rodgers", new TimeSpan(0, 2, 20)));
            cd3.addTrack(new Track("Blue Moon", "Richard Rodgers", new TimeSpan(0, 2, 52)));
            cd3.Category = "MusicCD";

            ///Movie objects
            Movie becomingAstrid = new Movie(8, "Becoming Astrid", 200.10m, "becomingAstrid.png", "Ridley Scott");

            becomingAstrid.Category = "Movie";
            Movie starBorn = new Movie(9, "A star is born", 180.10m, "starBorn.png", "Ridley Scott");

            starBorn.Category = "Movie";
            Products.Add(b1);
            Products.Add(b2);


            Products.Add(cd1);
            Products.Add(cd3);

            Products.Add(becomingAstrid);
            Products.Add(starBorn);



            /// Create objects for Customer class


            ///Customers
            Customer customer1 = new Customer("Sune", "Nielsen", "Jernbanegade 24", "7100", "Vejle");

            customer1.addPhone("3232323");
            customer1.addPhone("7572547");
            customer1.BirthDate  = new DateTime(1996, 03, 03);
            customer1.CustomerId = 1;


            Customer customer2 = new Customer("Maria", "Jensen", "Jernbanegade 30", "7100", "Vejle");

            customer2.addPhone("3232323");
            customer2.addPhone("7572547");
            customer1.CustomerId = 2;


            Customers.Add(customer1);
            Customers.Add(customer2);

            Invoice invoice1 = new Invoice(1, new DateTime(2019, 03, 20), customer1);
            Invoice invoice2 = new Invoice(2, new DateTime(2019, 03, 20), customer2);

            invoice1.addOrderItem(new OrderItem(b1, 2));
            invoice2.addOrderItem(new OrderItem(cd1, 1));


            Invoices.Add(invoice1);
            Invoices.Add(invoice2);

            ///create order items objects
        }