static repository() { TimeSpan time = new TimeSpan(5, 15, 15); DateTime randomDate = new DateTime(2019, 12, 31); MusicCD John = new MusicCD("System of a down", "Mezmerize", 15, 123); John.AddTrack("Question", "Daron Malakian", time); John.AddTrack("B.Y.O.B.", "Daron Malakian", time); John.AddTrack("Violent Pornography", "Daron Malakian", time); John.AddTrack("Lost in Hollywood", "Daron Malakian", time); Book OnTheRoad = new Book("Jack Kerouac", "On The Road", 15M, 1957); Book BladeRunner = new Book("Philip K. Dick", "Do Androids Dream Of Electric Sheep", 15M, 1968); Movie Annihilation = new Movie("Annihilation", 20, "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcS1RJJUBGRZFEzfSmdG4biDlXDAhsrpvgwLWkO-wSIfyePuZJAj", "Alex Garland"); John.ImageURL = "https://i.pinimg.com/originals/81/6a/8f/816a8f315b46181231d4f42524322a5f.jpg"; OnTheRoad.ImageURL = "https://i.pinimg.com/originals/92/b6/c0/92b6c06203fedad753fdebefa2c62624.jpg"; BladeRunner.ImageURL = "https://pictures.abebooks.com/BIBLIOSOPHER/22778546150.jpg"; Products.Add(John); Products.Add(OnTheRoad); Products.Add(BladeRunner); Products.Add(Annihilation); Customer Neo = new Customer(1, "Neo", "The One", "Chicago", "0000", "Zion"); Customer Shephard = new Customer(2, "John", "Sephard", "Mindoir", "999999", "N7"); OrderId newMusic = new OrderId(John, 22); OrderId newBook = new OrderId(OnTheRoad, 4); OrderId newBookTwo = new OrderId(BladeRunner, 6); OrderId newMovie = new OrderId(Annihilation, 2); OrderId otherBook = new OrderId(BladeRunner, 1); OrderId otherMovie = new OrderId(Annihilation, 4); Invoice newInvoice = new Invoice(1, randomDate, Neo); newInvoice.AddOrderItem(newMusic.Product, newMusic.Quantity); newInvoice.AddOrderItem(newBook.Product, newBook.Quantity); newInvoice.AddOrderItem(newBookTwo.Product, newBookTwo.Quantity); newInvoice.AddOrderItem(newMovie.Product, newMovie.Quantity); Invoice otherInvoice = new Invoice(2, randomDate, Shephard); otherInvoice.AddOrderItem(otherBook.Product, otherBook.Quantity); otherInvoice.AddOrderItem(otherMovie.Product, otherMovie.Quantity); Invoices.Add(newInvoice); Invoices.Add(otherInvoice); }
static Repository() { Book b1 = new Book("Georg Martin", "With a Little Help from My Friends: The Making of Sgt. Pepper", 19.95M, 1995); Book b2 = new Book("Mr Smith", "Californication", 59.95M, 2001); Book b3 = new Book("Magnus", "The life rules", 39.95M, 2013); b1.ISBN = "978-3-16-148410-0"; b2.ISBN = "456-3-16-148410-0"; b3.ISBN = "678-3-16-148410-0"; Products.Add(b1); Products.Add(b2); Products.Add(b3); Products.Add(new Movie("Run in 60", 60.50M, "https://picsum.photos/200/300", "Steven")); Products.Add(new Movie("The Street", 154.50M, "https://picsum.photos/200/300", "Mozart")); Products.Add(new Movie("Forrest Gump", 99.50M, "https://picsum.photos/200/300", "Someone elese")); MusicCD cd1 = new MusicCD("Taylor Swift", "The Man", 6.95M, 2019); cd1.Label = "CG Records"; cd1.AddTrack(new Track("The candle", new TimeSpan(0, 3, 35))); cd1.AddTrack(new Track("The avocado", new TimeSpan(0, 2, 25))); cd1.AddTrack(new Track("With tuna", new TimeSpan(0, 5, 25))); MusicCD cd2 = new MusicCD("Lady Gaga", "The wrecking ball", 6.95M, 2019); cd2.Label = "Universal Music Group"; cd2.AddTrack(new Track("Lights goes off", new TimeSpan(0, 1, 35))); cd2.AddTrack(new Track("OnePlus", new TimeSpan(0, 2, 35))); cd2.AddTrack(new Track("Cucumber", new TimeSpan(0, 4, 25))); Products.Add(cd1); Products.Add(cd2); Customer c1 = new Customer(11, "Mohamed", "Jensen", "Kilen 62", "9510", "Arden"); Customer c2 = new Customer(22, "Laurits", "Petersen", "Ribelandevej 50", "6372", "Bylderup-Bov"); Customer c3 = new Customer(33, "Mads", "Madsen", "Nyhavn 59", "2880", "Bagsværd "); Customer c4 = new Customer(44, "Cecilie S.", "Bruun", "Gammel Byvej 93", "4681", "Herfølge"); Invoice i1 = new Invoice(1, new DateTime(), c1); Invoice i2 = new Invoice(2, new DateTime(), c2); Invoice i3 = new Invoice(3, new DateTime(), c3); Invoice i4 = new Invoice(4, new DateTime(), c4); i1.AddOrderItem(Products[2], 1).AddOrderItem(Products[0], 1); i2.AddOrderItem(Products[3], 1).AddOrderItem(Products[4], 1); Invoices.Add(i1); Invoices.Add(i2); Invoices.Add(i3); Invoices.Add(i4); }
//empty Construtor static Repository() { //(Created all objects here and add them to Products and Invoices) // Books Book b1 = new Book("Steve Turner", "A hard day's write", 150M, 2005) { Publisher = "It Books", ISBN = "9781858680330", ImageFileName = "/Images/steve.jpg" }; Book b2 = new Book("Georg martin", "With a Little Help from My Friends: The Making of Sgt. Pepper", 1800, 1995) { Publisher = "Little Brown & Co", ISBN = "978-0316547833", ImageFileName = "/Images/georg.jpg" }; // Movies Movie jungleBook = new Movie("Jungle Book", 160.50m) { ImageFileName = "JungleBook.jpg", Director = "Jon Favreau" }; Movie tarzan = new Movie("tarzan", 75m) { ImageFileName = "tarzan.jpg", Director = "Steve jacobsen" }; Movie frozen = new Movie("Frozen", 60m) { ImageFileName = "frozen.jpg", Director = "Mikkel Schmidt" }; //MusicCD MusicCD cd1 = new MusicCD("The Beatles", "Abbey Road (Remastered)", 128M, 2009) { Label = "EMI", ImageFileName = "/Images/beatles.jpg" }; Track t1 = new Track("come togther", new TimeSpan(0, 2, 0)); Track t2 = new Track("come togther", new TimeSpan(0, 2, 0)); Track t3 = new Track("come togther", new TimeSpan(0, 2, 0)); Track t4 = new Track("come togther", new TimeSpan(0, 2, 0)); cd1.AddTrack(t1); cd1.AddTrack(t2); cd1.AddTrack(t3); cd1.AddTrack(t4); //products added Products.Add(b1); Products.Add(b2); Products.Add(jungleBook); Products.Add(tarzan); Products.Add(frozen); Products.Add(cd1); //costumer Customer cust1 = new Customer(1, "Burhan", "TAhmasbi", "Lundingsgade227", "8000", "Aarhus"); Customer cust2 = new Customer(2, "Jane", "Doe", "Otherstreet 13", "2000", "Othercity"); Customer cust3 = new Customer(3, "Moe", "Lester", "Shadystreet 69", "4200", "Shadycity"); //invoice Invoice invoice1 = new Invoice(1, new DateTime(), cust1); invoice1.AddOrderItem(cd1, 2); Invoices.Add(invoice1); Invoice invoice2 = new Invoice(2, new DateTime(), cust2); invoice2.AddOrderItem(tarzan, 2); invoice2.AddOrderItem(b1, 2); Invoices.Add(invoice2); Invoice invoice3 = new Invoice(3, new DateTime(), cust3); invoice3.AddOrderItem(frozen, 1); invoice3.AddOrderItem(b2, 2); invoice3.AddOrderItem(jungleBook, 1); Invoices.Add(invoice3); }
static Repository() { // Books Book book = new Book(); book.ProductID = 1; book.Title = "A Hard Day's Write: The Stories Behind Every Beatles Song "; book.Author = "Steve Turner"; book.Price = 150.00M; book.Publisher = "It Books"; book.Published = 2005; book.ISBN = "978-0060844097"; book.ImageUrl = "A_Hard_Days_Write.jpg"; Products.Add(book); book.Category = "Book"; Book book2 = new Book(2, "Georg Martin", "With a Little Help from My Friends: The Making of Sgt. Pepper", 180.00M, 1995); book2.ProductID = 1; book2.Title = "A Hard Day's Write: The Stories Behind Every Beatles Song "; book2.Author = "Steve Turner"; book.Price = 150.00M; book2.Publisher = "Little Brown & Co"; book2.ISBN = "0316547832"; book2.ImageUrl = "The Making of Sgt. Pepper.jpg"; Products.Add(book2); book2.Category = "Book"; // MusicCDs MusicCD cd = new MusicCD(); cd.Title = "Abbey Road (Remastered)"; cd.ProductID = 3; cd.Artist = "Beatles"; cd.Price = 128.00M; cd.Released = 2009; cd.Label = "EMI"; cd.ImageUrl = "abbey_road.jpg"; cd.Category = "MusicCD"; cd.AddTrack(new Track("Come Together", new TimeSpan(0, 4, 20), "Lennon, McCartney")); cd.AddTrack(new Track("Something", new TimeSpan(0, 3, 03), "Harrison")); cd.AddTrack(new Track("Maxwell's Silver Hammer", new TimeSpan(0, 3, 29), "Lennon, McCartney")); cd.AddTrack(new Track("Oh! Darling", new TimeSpan(0, 3, 26), "Lennon, McCartney")); cd.AddTrack(new Track("Octopus's Garden", new TimeSpan(0, 2, 51), "Starkey")); cd.AddTrack(new Track("I Want You (She's So Heavy)", new TimeSpan(0, 7, 47), "Lennon, McCartney")); cd.AddTrack(new Track("Here Comes The Sun", new TimeSpan(0, 3, 05), "Harrison")); cd.AddTrack(new Track("Because", new TimeSpan(0, 2, 45), "Lennon, McCartney")); cd.AddTrack(new Track("You Never Give Me Your Money", new TimeSpan(0, 4, 02), "Lennon, McCartney")); cd.AddTrack(new Track("Sun King", new TimeSpan(0, 2, 26), "Lennon, McCartney")); cd.AddTrack(new Track("Mean Mr. Mustard", new TimeSpan(0, 1, 6), "Lennon, McCartney")); cd.AddTrack(new Track("Polythene Pam", new TimeSpan(0, 1, 12), "Lennon, McCartney")); cd.AddTrack(new Track("She Came In Through The Bathroom Window", new TimeSpan(0, 1, 57), "Lennon, McCartney")); cd.AddTrack(new Track("Golden Slumbers", new TimeSpan(0, 1, 31), "Lennon, McCartney")); cd.AddTrack(new Track("Carry That Weight", new TimeSpan(0, 1, 36), "Lennon, McCartney")); cd.AddTrack(new Track("The End", new TimeSpan(0, 2, 19), "Lennon, McCartney")); cd.AddTrack(new Track("Her Majesty", new TimeSpan(0, 0, 23), "Lennon, McCartney")); Products.Add(cd); MusicCD cd2 = new MusicCD(4, "The Beatles", "Revolver (Remastered)", 128.00M, 2009); cd2.Label = "EMI"; cd2.ImageUrl = "revolver.jpg"; cd2.Category = "MusicCD"; Track track01 = new Track("Taxman", new TimeSpan(0, 2, 28)); track01.Composer = "Harrison"; cd2.AddTrack(track01); Track track02 = new Track("Eleanor Rigby", new TimeSpan(0, 2, 6), "Lennon, McCartney"); track02.Composer = "Lennon, McCartney"; cd2.AddTrack(track02); Track track03 = new Track("I'm Only Sleeping", new TimeSpan(0, 3, 0), "Lennon, McCartney"); track03.Composer = "Lennon, McCartney"; cd2.AddTrack(track03); Track track04 = new Track("Love You To", new TimeSpan(0, 2, 59)); track04.Composer = "Harrison"; cd2.AddTrack(track04); Track track05 = new Track("Here, There And Everywhere", new TimeSpan(0, 2, 23)); track05.Composer = "Harrison"; cd2.AddTrack(track05); Track track06 = new Track("Yellow Submarine", new TimeSpan(0, 2, 38)); track06.Composer = "Lennon, McCartney"; cd2.AddTrack(track06); Track track07 = new Track("She Said She Said", new TimeSpan(0, 2, 36)); track07.Composer = "Lennon, McCartney"; cd2.AddTrack(track07); Track track08 = new Track("Good Day Sunshine", new TimeSpan(0, 2, 9)); track08.Composer = "Lennon, McCartney"; cd2.AddTrack(track08); Track track09 = new Track("And Your Bird Can Sing", new TimeSpan(0, 2, 0)); track09.Composer = "Lennon, McCartney"; cd2.AddTrack(track09); Track track10 = new Track("For No One", new TimeSpan(0, 1, 59)); track10.Composer = "Lennon, McCartney"; cd2.AddTrack(track10); Track track11 = new Track("Doctor Robert", new TimeSpan(0, 1, 14)); track11.Composer = "Lennon, McCartney"; cd2.AddTrack(track11); Track track12 = new Track("I Want To Tell You", new TimeSpan(0, 2, 27)); track12.Composer = "Harrison"; cd2.AddTrack(track12); Track track13 = new Track("Got To Get You Into My Life", new TimeSpan(0, 2, 29)); track13.Composer = "Lennon, McCartney"; cd2.AddTrack(track13); Track track14 = new Track("Tomorrow Newer Knows", new TimeSpan(0, 3, 01)); track14.Composer = "Lennon, McCartney"; cd2.AddTrack(track14); Products.Add(cd2); MusicCD cd3 = new MusicCD(9, "Florin Salam", "Nebunia lui Salam", 999M, 2018) { Label = "Music Sound Production LTD", ImageUrl = "nebunia-lui-salam.jpg", Category = "MusicCD" }; cd3.AddTrack(new Track("Du-ma unde vrei", new TimeSpan(0, 4, 20), "Lennon, McCartney")); cd3.AddTrack(new Track("Sa vina toata lumea", new TimeSpan(0, 3, 03), "Harrison")); cd3.AddTrack(new Track("Frumoasa ispita Daniela Crudu", new TimeSpan(0, 3, 29), "Lennon, McCartney")); cd3.AddTrack(new Track("Zile pentru mama mea", new TimeSpan(0, 3, 26), "Lennon, McCartney")); cd3.AddTrack(new Track("Abrasame Mi Amor", new TimeSpan(0, 2, 51), "Starkey")); cd3.AddTrack(new Track("Cine mi-a schimbat viata", new TimeSpan(0, 7, 47), "Lennon, McCartney")); cd3.AddTrack(new Track("Regina din Maroc", new TimeSpan(0, 3, 05), "Harrison")); cd3.AddTrack(new Track("Zana buna, corp perfect", new TimeSpan(0, 2, 45), "Lennon, McCartney")); cd3.AddTrack(new Track("Da - l bine regele meu", new TimeSpan(0, 4, 02), "Lennon, McCartney")); cd3.AddTrack(new Track("Nu are ce cauta", new TimeSpan(0, 2, 26), "Lennon, McCartney")); Products.Add(cd3); // Movies Movie movie1 = new Movie(5, "Jungle Book", 160.50M, "junglebook.jpg", "Jon Favreau"); movie1.Category = "Movie"; Products.Add(movie1); Movie movie2 = new Movie(6, "Gladiator", 49.95M, "gladiator.jpg", "Ridley Scott"); movie2.Category = "Movie"; Products.Add(movie2); Movie movie3 = new Movie(7, "Forrest Gump", 154.50M, "forrest-gump.jpg", "Robert Zemeckis"); movie3.Category = "Movie"; Products.Add(movie3); Customer customer1 = new Customer(0, "Sabina", "Albu", "Stationspladsen 2B", "8883", "Silkeborg"); Customer customer2 = new Customer(1, "Catalin", "Ispas", "Sondervangen 73", "8260", "Viby J"); Invoice invoice1 = new Invoice(1, new DateTime(2020, 9, 01), customer1); Invoice invoice2 = new Invoice(2, new DateTime(2019, 12, 24), customer2); invoice1.AddOrderItem(movie3, 1); invoice1.AddOrderItem(book2, 1); invoice2.AddOrderItem(book, 1); invoice2.AddOrderItem(cd2, 1); Invoices.Add(invoice1); Invoices.Add(invoice2); }
static Repository() { Book book = new Book("George Orwell", "Animal farm", 120.5m, 1945, "Secker and Warburg", "01322240", "https://upload.wikimedia.org/wikipedia/commons/f/fb/Animal_Farm_-_1st_edition.jpg", 1); Book book2 = new Book("Arthur C. Clarke", "Childhood's End", 122.5m, 1953, "Ballantine Books", "21322240", "https://upload.wikimedia.org/wikipedia/en/7/72/ChildhoodsEnd%281stEd%29.jpg", 2); book.Category = "Books"; book2.Category = "Books"; MusicCD cd = new MusicCD("Christian Löffler", "Mare", 73.5m, 2016, "https://img.discogs.com/N0Nzh3PCaPnHvDD66y8ZOJmcYh8=/fit-in/600x600/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-9199362-1476532535-7378.jpeg.jpg", 3); MusicCD cd2 = new MusicCD("Deadmau5", "4x4=12", 74.5m, 2010, "https://morphuk.com/wp-content/uploads/2018/03/Deadmau5-02.jpg", 4); cd.Category = "Music"; cd2.Category = "Music"; Track track1 = new Track("Myiami", "Christian Löffler", new TimeSpan(0, 4, 38)); Track track2 = new Track("Haul", "Christian Löffler", new TimeSpan(0, 5, 30)); Track track3 = new Track("Mosaics", "Christian Löffler", new TimeSpan(0, 4, 22)); Track track4 = new Track("Neo", "Christian Löffler", new TimeSpan(0, 3, 30)); Track track5 = new Track("Youth", "Christian Löffler", new TimeSpan(0, 4, 10)); Track track6 = new Track("Lid", "Christian Löffler", new TimeSpan(0, 2, 30)); Track track7 = new Track("Some Chords", "DeadMau5", new TimeSpan(0, 2, 28)); Track track8 = new Track("Sofi Needs a Ladder", "DeadMau5", new TimeSpan(0, 3, 30)); Track track9 = new Track("A City in Florida", "DeadMau5", new TimeSpan(0, 4, 31)); Track track10 = new Track("Bad Selection", "DeadMau5", new TimeSpan(0, 2, 31)); // create a new Movie object with instance name jungleBook Movie movie1 = new Movie("Terminal", 160.50m, "https://m.media-amazon.com/images/M/MV5BYmEzOGVmNWQtZDBiMC00OTk4LTg3OWQtMzc2MzgxNjlkY2JjXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SY1000_SX675_AL_.jpg", "Vaughn Stein", 5); Movie movie2 = new Movie("Mr. Nobody", 170m, "https://m.media-amazon.com/images/M/MV5BMTg4ODkzMDQ3Nl5BMl5BanBnXkFtZTgwNTEwMTkxMDE@._V1_SY1000_CR0,0,675,1000_AL_.jpg", "Jaco Van Dormael", 6); Movie movie3 = new Movie("Guardians of the Galaxy", 175m, "https://m.media-amazon.com/images/M/MV5BMTAwMjU5OTgxNjZeQTJeQWpwZ15BbWU4MDUxNDYxODEx._V1_SY1000_CR0,0,674,1000_AL_.jpg", "James Gunn", 7); movie1.Category = "Movies"; movie2.Category = "Movies"; movie3.Category = "Movies"; Customer customer1 = new Customer("Hans", "Hansen", "Vestergade 2", "8600", "Silkeborg", new DateTime(1990, 04, 11), 1); Customer customer2 = new Customer("Søren", "Sørensen", "østergade 4", "8600", "Silkeborg", new DateTime(1980, 12, 18), 2); Invoice invoice1 = new Invoice(1, new DateTime(2018, 03, 22), customer1); Invoice invoice2 = new Invoice(2, new DateTime(2018, 06, 11), customer2); Invoice invoice3 = new Invoice(3, new DateTime(2018, 06, 12), customer1); invoice1.AddOrderItem(cd, 1); invoice2.AddOrderItem(cd2, 1); invoice3.AddOrderItem(cd2, 2); customer1.addInvoices(invoice1); customer1.addInvoices(invoice3); customer2.addInvoices(invoice2); // OrderItem orderItem = new OrderItem(cd, 1); // OrderItem orderItem2 = new OrderItem(cd2, 2); Invoices.Add(invoice1); Invoices.Add(invoice2); Invoices.Add(invoice3); cd.AddTrack(track1); cd.AddTrack(track2); cd.AddTrack(track3); cd.AddTrack(track4); cd.AddTrack(track5); cd.AddTrack(track6); cd2.AddTrack(track7); cd2.AddTrack(track8); cd2.AddTrack(track9); cd2.AddTrack(track10); Products.Add(book); Products.Add(book2); Products.Add(cd); Products.Add(cd2); Products.Add(movie1); Products.Add(movie2); Products.Add(movie3); }
static Repository() { // Book Mockups Objects var book1 = new Book("Cal Newport", "Deep Work", 150.00m, "Improvement Zone"); book1.ImageFileName = "Deep_Work.jpg"; book1.ISBN = "978-0-349-41190-3"; // Add to the product list Products.Add(book1); var book2 = new Book("David Schwartz", "The Magic Of Thinking Big", 160.00m, "Vermillion"); book2.ImageFileName = "The_Magic.jpeg"; book2.ISBN = "978-1-78504-047-4"; Products.Add(book2); var book3 = new Book("Yuval Noah Harari", "Sapiens", 175.00m, "Harper Perennial"); book3.ImageFileName = "Sapiens.jpeg"; book3.ISBN = "978-0-06-231611-0"; Products.Add(book3); // MusicCD Mockups Objects var cd1 = new MusicCD("Ed Sheeran", "Delux", 128.00m, 2017); cd1.AddTrack(new Track("Eraser", new TimeSpan(0, 6, 40))); cd1.AddTrack(new Track("Castle on the Hill", new TimeSpan(0, 10, 40))); cd1.AddTrack(new Track("Dive", new TimeSpan(0, 6, 40))); cd1.AddTrack(new Track("Shape of You", new TimeSpan(0, 5, 20))); cd1.AddTrack(new Track("Galway Girl", new TimeSpan(0, 12, 40))); cd1.AddTrack(new Track("New Man", new TimeSpan(0, 4, 50))); cd1.ImageFileName = "Delux.png"; Products.Add(cd1); var cd2 = new MusicCD("Jahnavi Harrison", "Rise", 123.00m, 2020); cd2.AddTrack(new Track("Rise", new TimeSpan(0, 6, 40))); cd2.AddTrack(new Track("Gajendra", new TimeSpan(0, 6, 40))); cd2.AddTrack(new Track("Adore", new TimeSpan(0, 3, 40))); cd2.AddTrack(new Track("Born to Give", new TimeSpan(0, 8, 40))); cd2.AddTrack(new Track("Brhamas Song", new TimeSpan(0, 10, 40))); cd2.AddTrack(new Track("Eraser", new TimeSpan(0, 4, 40))); cd2.AddTrack(new Track("Kairavs", new TimeSpan(0, 17, 40))); cd2.ImageFileName = "Rise.jpg"; Products.Add(cd2); var cd3 = new MusicCD("Kina", "Wish I Was", 115.00m, 2020); cd3.AddTrack(new Track("Wish I could", new TimeSpan(0, 6, 40))); cd3.AddTrack(new Track("Never Again", new TimeSpan(0, 8, 40))); cd3.AddTrack(new Track("The Moon", new TimeSpan(0, 12, 40))); cd3.AddTrack(new Track("Sun is going down", new TimeSpan(0, 19, 40))); cd3.AddTrack(new Track("Sun is going up", new TimeSpan(0, 4, 40))); cd3.AddTrack(new Track("Sky is Blue", new TimeSpan(0, 3, 40))); cd3.ImageFileName = "Kina.jpg"; Products.Add(cd3); // Movie Mockup Objects var movie1 = new Movie("Jungle Book", 160.50m, "junglebook.jpg", "Jon Favreu"); Products.Add(movie1); var movie2 = new Movie("Gladiator", 171.50m, "gladiator.jpg", "Ridley Scott"); Products.Add(movie2); var movie3 = new Movie("Forrest Gump", 140.20m, "forrest-gump.jpg", "Mark Potter"); Products.Add(movie3); // Customers Mockup Mockup Customer customer1 = new Customer(1, "Mike", "Larsen", "Skolegade 15", "8200", "Aarhus"); customer1.AddPhone("42220327"); customer1.SetBirthDate("01-02-1990"); Customer customer2 = new Customer(2, "John", "Johansen", "Storegade 3", "8200", "Aarhus"); customer2.AddPhone("42220327"); customer2.SetBirthDate("01-02-1990"); Customer customer3 = new Customer(3, "Mette", "Harrison", "Landevej 9", "8200", "Aarhus"); customer3.AddPhone("42220327"); customer3.SetBirthDate("01-02-1990"); Customer customer4 = new Customer(4, "Mia", "Horsholm", "Sydvej 5", "8200", "Aarhus"); customer4.AddPhone("42220327"); customer4.SetBirthDate("01-02-1990"); Customer customer5 = new Customer(5, "John", "Mike", "Storegade 15", "6000", "Aarhus"); customer5.AddPhone("42220327"); customer5.SetBirthDate("01-02-1990"); Customer customer6 = new Customer(6, "Christian", "Christansen", "Nørregade 12", "6100", "Viby"); customer6.AddPhone("52117975"); customer6.AddPhone("20203025"); customer6.SetBirthDate("11-03-1980"); Customer customer7 = new Customer(7, "Mette", "Larsen", "Skolegade 28", "6200", "Brabrand"); customer7.AddPhone("3201254"); customer7.SetBirthDate("3-21-1975"); // Add to the Customers list Customers.Add(customer1); Customers.Add(customer2); Customers.Add(customer3); Customers.Add(customer4); Customers.Add(customer5); Customers.Add(customer6); Customers.Add(customer7); // Invoices Mockups Invoice invoice1 = new Invoice(1, DateTime.Now, customer1); Invoice invoice2 = new Invoice(2, DateTime.Now, customer2); Invoice invoice3 = new Invoice(3, DateTime.Now, customer3); Invoice invoice4 = new Invoice(4, DateTime.Now, customer4); customer1.AddInvoice(invoice1); customer1.AddInvoice(invoice4); customer2.AddInvoice(invoice2); customer3.AddInvoice(invoice3); // Add OrderItems to the invoice invoice1.AddOrderItem(movie1, 1); invoice1.AddOrderItem(book2, 2); invoice2.AddOrderItem(cd2, 2); invoice2.AddOrderItem(book3, 1); invoice3.AddOrderItem(movie2, 1); invoice3.AddOrderItem(cd3, 1); invoice4.AddOrderItem(movie3, 1); invoice4.AddOrderItem(book1, 3); // Add to Invoices list Invoices.Add(invoice1); Invoices.Add(invoice2); Invoices.Add(invoice3); Invoices.Add(invoice4); }
//Constructor static Repository() { //Customers Customer c1 = new Customer(1, "Bo", "Høeg", "Postvej 9", "8200", "Århus", new DateTime(1997, 8, 12)); c1.AddPhone("12345678"); c1.AddPhone("23456789"); Customer c2 = new Customer(2, "Jacob-Emil", "Hansen", "Gugvej 19", "9000", "Aalborg", new DateTime(1985, 07, 04)); c2.AddPhone("11223344"); c2.AddPhone("22334455"); Customer c3 = new Customer(2, "Hans-Peter", "Hansen", "Strandvejen 88", "7800", "Skive", new DateTime(1985, 07, 04)); c3.AddPhone("11223344"); c3.AddPhone("22334355"); customers.Add(c1); customers.Add(c2); customers.Add(c3); //Books Book Harddays = new Book("Steve Turner", 1994, "A Hard Day's Write: The Stories Behind Every Beatles Song", 128m, "Harddays.jpg", 1); Harddays.ISBN = "0060844094"; Harddays.Publisher = "It Books"; Harddays.Category = "Book"; Book WithALittle = new Book("George Martin", 1995, "With a Little Help from My Friends: The Making of Sgt. Pepper ", 165m, "WithALittle.jpg", 2); WithALittle.ISBN = "0316547832"; WithALittle.Publisher = "Little Brown & Co"; WithALittle.Category = "Book"; Products.Add(Harddays); Products.Add(WithALittle); MusicCD AbbeyRoad = new MusicCD("The Beatles", 1969, "Abbey Road", 128m, "AbbeyRoad.jpg", 3); Track m1t1 = new Track("Come Together", "Lennon", new TimeSpan(0, 2, 3)); Track m1t2 = new Track("Something", "Lennon", new TimeSpan(0, 3, 03)); Track m1t3 = new Track("Maxwell's Silver Hammer", "Lennon", new TimeSpan(0, 3, 27)); Track m1t4 = new Track("Oh! Darling", "Lennon", new TimeSpan(0, 3, 27)); Track m1t5 = new Track("Octopus's Garden", "Lennon", new TimeSpan(0, 2, 51)); Track m1t6 = new Track("I Want You (She's So Heavy)", "Lennon", new TimeSpan(0, 7, 47)); Track m1t7 = new Track("Because", "Lennon", new TimeSpan(0, 2, 46)); Track m1t8 = new Track("Medley", "Lennon", new TimeSpan(0, 3, 46)); Track m1t9 = new Track("Her Majesty", "Lennon", new TimeSpan(0, 0, 23)); AbbeyRoad.AddTrack(m1t1); AbbeyRoad.AddTrack(m1t2); AbbeyRoad.AddTrack(m1t3); AbbeyRoad.AddTrack(m1t4); AbbeyRoad.AddTrack(m1t5); AbbeyRoad.AddTrack(m1t6); AbbeyRoad.AddTrack(m1t7); AbbeyRoad.AddTrack(m1t8); AbbeyRoad.AddTrack(m1t9); AbbeyRoad.Label = "Apple"; AbbeyRoad.Category = "Music"; MusicCD Revolver = new MusicCD("The Beatles", 1966, "Revolver", 128m, "Revolver.jpg", 4); Track m2t1 = new Track("Taxman", "Lennon", new TimeSpan(0, 2, 41)); Track m2t2 = new Track("Eleanor Rigby", "Lennon", new TimeSpan(0, 3, 5)); Track m2t3 = new Track("I'm Only Sleeping", "Lennon", new TimeSpan(0, 3, 27)); Track m2t4 = new Track("Love You To", "Lennon", new TimeSpan(0, 3, 27)); Track m2t5 = new Track("Here, There and Everywhere", "Lennon", new TimeSpan(0, 2, 51)); Track m2t6 = new Track("Yellow Submarine", "Lennon", new TimeSpan(0, 7, 47)); Track m2t7 = new Track("She Said She Said", "Lennon", new TimeSpan(0, 2, 46)); Track m2t8 = new Track("Good Day Sunshine", "Lennon", new TimeSpan(0, 3, 46)); Track m2t9 = new Track("And Your Bird Can Sing", "Lennon", new TimeSpan(0, 0, 23)); Revolver.AddTrack(m2t1); Revolver.AddTrack(m2t2); Revolver.AddTrack(m2t3); Revolver.AddTrack(m2t4); Revolver.AddTrack(m2t5); Revolver.AddTrack(m2t6); Revolver.AddTrack(m2t7); Revolver.AddTrack(m2t8); Revolver.AddTrack(m2t9); Revolver.Label = "Parlophone"; Revolver.Category = "Music"; Products.Add(AbbeyRoad); Products.Add(Revolver); Movie jungleBook = new Movie("Jungle Book", 160.506m, "junglebook.jpg", "Director jungle", 5); jungleBook.Category = "Movie"; Movie forrestGump = new Movie("Forrest Gump", 120.50m, "forrest-gump.jpg", "Director forrest", 6); forrestGump.Category = "Movie"; Movie gladiator = new Movie("Gladiator", 142.50m, "gladiator.jpg", "Director gladiator", 7); gladiator.Category = "Movie"; Products.Add(jungleBook); Products.Add(forrestGump); Products.Add(gladiator); //Invoices Invoice i1 = new Invoice(1, new DateTime(2004, 10, 21), c1); i1.AddOrderItem(AbbeyRoad, 1); i1.AddOrderItem(Revolver, 1); Invoice i2 = new Invoice(2, new DateTime(2005, 12, 15), c2); i2.AddOrderItem(WithALittle, 1); i2.AddOrderItem(Harddays, 1); Invoices.Add(i1); Invoices.Add(i2); }
static Repository() { var mov1 = new Movie(100, "Jungle Book", 160.50m, "Zac Snyder"); mov1.ImageUrl = "junglebook.jpg"; mov1.Category = "Movie"; var mov2 = new Movie(101, "Little Woman", 120m, "James Cameron"); mov2.ImageUrl = "lilwmn.jpg"; mov2.Category = "Movie"; var mov3 = new Movie(102, "Harry Potter", 190m, "Christopher Nolan"); mov3.ImageUrl = "hrptr.jpg"; mov3.Category = "Movie"; Products.Add(mov1); Products.Add(mov2); Products.Add(mov3); // assign a ViewBag property to the new Movie object //instantiated subclasses - objects created // var book = new Book("Aldous Huxley", "Brave New World" // ,90.5m,22/3/2010); //might be mm/dd/yyyy //books.Add(new Book("Aldous Huxley", "Brave New World", 90.5m, 22 / 3 / 2010)); var book1 = new Book(200, "Ray Bradbury", "Fahrenheit 451" , 190.5m, 1984); book1.Publisher = "Rybka Publishers"; book1.ImageUrl = "fahren.jfif"; book1.ISBN = "0112911666"; book1.Category = "Book"; var book2 = new Book(201, "Michael Pollan", "How to Change The New Science" , 190.5m, 1950); book2.Publisher = "Rybka Publishers"; book2.ImageUrl = "lsd.jfif"; book2.ISBN = "01244557889"; book2.Category = "Book"; var book3 = new Book(202, "James Clear", "Atomic Habits" , 190.5m, 1984); book3.Publisher = "Donuta Pubs"; book3.ImageUrl = "atmc.jpg"; book3.ISBN = "1555789666"; book3.Category = "Book"; Products.Add(book1); Products.Add(book2); Products.Add(book3); var cd1 = new MusicCD(300, "The Growlers", "Casual Aquaintances" , 3.50m, "Warner bros", 2016); cd1.ImageUrl = "grwlrs.jfif"; cd1.Category = "Music"; cd1.AddTrack(new Track("Good Advice", new TimeSpan(0, 3, 50))); cd1.AddTrack(new Track("Dull Boy", new TimeSpan(0, 3, 50))); cd1.AddTrack(new Track("Dope on Rope", new TimeSpan(0, 3, 50))); var cd2 = new MusicCD(301, "Pink Floyd", "Wish You Were Here" , 50m, "Warner bros", 1985); cd2.ImageUrl = "pnkfld.jfif"; cd2.Category = "Music"; cd2.AddTrack(new Track("Shine On You Crazy Diamond" , new TimeSpan(0, 3, 50))); cd2.AddTrack(new Track("Wish You Were Here", new TimeSpan(0, 3, 50))); var cd3 = new MusicCD(302, "Allah-Las", "Allah-Las" , 5.50m, "Warner bros", 2012); cd3.ImageUrl = "allah.jfif"; cd3.Category = "Music"; cd3.AddTrack(new Track("Catamaran", new TimeSpan(0, 4, 50))); cd3.AddTrack(new Track("Sandy", new TimeSpan(0, 5, 25))); cd3.AddTrack(new Track("No Voodoo", new TimeSpan(0, 3, 50))); Products.Add(cd1); Products.Add(cd2); Products.Add(cd3); //customers var c1 = new Customer("Juan", "Don", "Sonderhoj", "666", "Aarhus"); var c2 = new Customer("Tuan", "Pon", "Byghoj", "666", "Aarhus"); var c3 = new Customer("Dan", "Con", "Derhoj", "666", "Aarhus"); c1.AddPhone("91100"); c1.CustomerId = 1; c2.CustomerId = 2; //orders var ori1 = new OrderItem(book1, 2); var ori2 = new OrderItem(cd1, 3); var ori3 = new OrderItem(mov2, 1); var ori4 = new OrderItem(book2, 3); //Invoices var inv1 = new Invoice(1, new DateTime(2020, 01, 20), c1); inv1.AddOrderItem(ori1.Product, ori1.Quantity); inv1.AddOrderItem(ori3.Product, ori3.Quantity); c1.AddInvoice(inv1); var inv2 = new Invoice(2, new DateTime(2019, 02, 21), c2); inv2.AddOrderItem(ori2.Product, ori2.Quantity); inv2.AddOrderItem(ori4.Product, ori4.Quantity); c2.AddInvoice(inv2); Invoices.Add(inv1); Invoices.Add(inv2); }
protected void Page_Load(object sender, EventArgs e) { MusicCD myCD = new MusicCD("The Beatles", "Revolver (Remastered)", 128.00M, 2009); myCD.Label = "EMI"; myCD.ImageURL = "images/revolver.jpg"; Track track01 = new Track("Taxman", "2:28"); track01.Composer = "Harrison"; myCD.AddTrack(track01); Track track02 = new Track("Eleanor Rigby", "2:06"); track02.Composer = "Lennon, McCartney"; myCD.AddTrack(track02); Track track03 = new Track("I'm Only Sleeping", "3:00"); track03.Composer = "Lennon, McCartney"; myCD.AddTrack(track03); Track track04 = new Track("Love You To", "2:59"); track04.Composer = "Harrison"; myCD.AddTrack(track04); Track track05 = new Track("Here, There And Everywhere", "2:23"); track05.Composer = "Harrison"; myCD.AddTrack(track05); Track track06 = new Track("Yellow Submarine", "2:38"); track06.Composer = "Lennon, McCartney"; myCD.AddTrack(track06); Track track07 = new Track("She Said She Said", "2:36"); track07.Composer = "Lennon, McCartney"; myCD.AddTrack(track07); Track track08 = new Track("Good Day Sunshine", "2:09"); track08.Composer = "Lennon, McCartney"; myCD.AddTrack(track08); Track track09 = new Track("And Your Bird Can Sing", "2:00"); track09.Composer = "Lennon, McCartney"; myCD.AddTrack(track09); Track track10 = new Track("For No One", "1:59"); track10.Composer = "Lennon, McCartney"; myCD.AddTrack(track10); Track track11 = new Track("Doctor Robert", "1:14"); track11.Composer = "Lennon, McCartney"; myCD.AddTrack(track11); Track track12 = new Track("I Want To Tell You", "2:27"); track12.Composer = "Harrison"; myCD.AddTrack(track12); Track track13 = new Track("Got To Get You Into My Life", "2:29"); track13.Composer = "Lennon, McCartney"; myCD.AddTrack(track13); Track track14 = new Track("Tomorrow Newer Knows", "3:01"); track14.Composer = "Lennon, McCartney"; myCD.AddTrack(track14); ltrProductInfo.Text += myCD.GetHTML(); ltrProductInfo.Text += "<p><strong>Total playing time: </strong>" + myCD.GetPlayingTime() + "</p>"; }
public Repository() { //--------------------- //Books starts here! //--------------------- //string author, string title, decimal price, short published Book myBook = new Book("J.K. Rowling", "Harry Potter", 60, 15); myBook.ProductId = 1; myBook.Publisher = "Little, Brown Book Group"; myBook.ISBN = "1-333-5555555"; myBook.ImageUrl = "harry.jpg"; myBook.Category = "Book"; Products.Add(myBook); Book myBook2 = new Book("J.R.R. Tolkien", "The Lord Of The Rings", 50, 14); myBook2.ProductId = 2; myBook2.Publisher = "George Allen & Unwin"; myBook2.ISBN = "1-333-6666666"; myBook2.ImageUrl = "lord.jpg"; myBook2.Category = "Book"; Products.Add(myBook2); //--------------------- //CD's starts here! //--------------------- //string artist, string title, decimal price, short released) MusicCD cd1 = new MusicCD("Metallica", "The Black Album", 60, 15); cd1.ProductId = 3; cd1.Released = 1991; cd1.Label = "Blackened Recordings"; cd1.ImageUrl = "metallica.jpg"; cd1.Category = "CD"; cd1.AddTrack(new Track("Enter Sandman", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("Sad But True", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("Holier Than Thou", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("The Unforgiven", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("Whereever I May Roam", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("Don't Tread On Me", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("Through The Never", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("Nothing Else Matters", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("Of Wolf and Man", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("The God That Failed", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("My Friend Of Misery", "--", new TimeSpan(2, 14, 18))); cd1.AddTrack(new Track("The Struggle Within", "--", new TimeSpan(2, 14, 18))); //cd1.AddTrack(new Track("So What", "--", new TimeSpan(2, 14, 18))); Products.Add(cd1); //string artist, string title, decimal price, short released) MusicCD cd2 = new MusicCD("Nirvana", "Nevermind", 50, 16); cd2.ProductId = 4; cd2.Label = "Blackened Recordings"; cd2.ImageUrl = "nirvana.jpg"; cd2.Category = "CD"; //cd2.AddTrack(new Track("Sad But True", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Smells Like Teen Spirit", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Come as You Are", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Breed", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Lithium", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Polly", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Territorial Pissings", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Drain You", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Lounge Act", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Stay Away", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("On a Plain", "--", new TimeSpan(2, 14, 18))); cd2.AddTrack(new Track("Something in the Way", "--", new TimeSpan(2, 14, 18))); Products.Add(cd2); //--------------------- //Movies starts here!! //--------------------- // create a new Movie object with instance name jungleBook Movie jungleBook = new Movie("Jungle Book", 160.50m, "Jon Favreau"); jungleBook.ProductId = 5; jungleBook.ImageUrl = "JungleBook.jpg"; jungleBook.Category = "Movie"; Products.Add(jungleBook); Movie gladiator = new Movie("Gladiator", 49.95m, "Ridley Scott"); gladiator.ProductId = 6; gladiator.ImageUrl = "gladiator.jpg"; gladiator.Category = "Movie"; Products.Add(gladiator); Movie forrestGump = new Movie("Forrest Gump", 154.50m, "Robert Zemeckis"); forrestGump.ProductId = 7; forrestGump.ImageUrl = "forrest-gump.jpg"; forrestGump.Category = "Movie"; Products.Add(forrestGump); Customer c1 = new Customer("Simon", "Jakobsen", "Risdalsvej", "8260", "Viby J"); Customer c2 = new Customer("Helle", "Jakobsen", "Frigsvej", "8680", "Ry"); Invoice i1 = new Invoice(1, new DateTime(2016, 4, 6), c1); Invoices.Add(i1); Invoice i2 = new Invoice(2, new DateTime(2016, 4, 5), c2); Invoices.Add(i2); //order items i1.AddOrderItem(jungleBook, 1); i1.AddOrderItem(cd1, 1); i2.AddOrderItem(gladiator, 1); i2.AddOrderItem(cd2, 1); }
// constructor static Repository() { // customers Customer customer1 = new Customer(0, "Veselin", "Veselinov", "Langgade 65", "8920", "Randers NV", new DateTime(1996, 02, 08)); Customer customer2 = new Customer(1, "Milan", "Georgiev", "Langgade 4", "8920", "Randers NV", new DateTime(1996, 02, 04)); Customer customer3 = new Customer(2, "Ivan", "Ivanov", "Molleskovvej 4", "8270", "Hojbjerg", new DateTime(1992, 03, 14)); Customer customer4 = new Customer(3, "Georgi", "Georgiev", "Holmevej 221", "8270", "Hojbjerg", new DateTime(1995, 10, 03)); Customer customer5 = new Customer(4, "Todor", "Bojinov", "Holme Byvej 26", "8270", "Hojbjerg", new DateTime(1991, 01, 17)); Customers.Add(customer1); Customers.Add(customer2); Customers.Add(customer3); Customers.Add(customer4); Customers.Add(customer5); customer1.AddPhoneNumber("(+45) 71797783"); customer1.AddPhoneNumber("(+45) 71456760"); customer1.AddPhoneNumber("(+45) 74180569"); customer2.AddPhoneNumber("(+45) 71807783"); customer2.AddPhoneNumber("(+45) 71808783"); customer3.AddPhoneNumber("(+45) 71806583"); customer3.AddPhoneNumber("(+45) 71124766"); customer4.AddPhoneNumber("(+45) 55801667"); customer4.AddPhoneNumber("(+45) 61831870"); customer4.AddPhoneNumber("(+45) 74646233"); customer5.AddPhoneNumber("(+45) 61404617"); // books Book book1 = new Book(0, "The Hunger Games:Trilogy", 9.99M, "book0.jpg", "Suzanne Collins", 2008); Book book2 = new Book(1, "The Da Vinci Code", 9.49M, "book1.jpg", "Dan Brownn", 2003); Book book3 = new Book(2, "Harry Potter: The Prisoner of Azkaban", 29.99M, "book2.jpg", "J. K. Rowling", 1997); book1.Category = "Book"; book2.Category = "Book"; book3.Category = "Book"; Products.Add(book1); Products.Add(book2); Products.Add(book3); // movies Movie movie1 = new Movie(3, "Need for Speed", 134.00M, "NeedforSpeed.jpg", "Scott Waugh"); Movie movie2 = new Movie(4, "Deadpool", 187.50M, "deadpool.jpg", "James Gunn"); Movie movie3 = new Movie(5, "Forrest Gump", 15.50M, "forrest-gump.jpg", "Robert Zemeckis"); Movie movie4 = new Movie(6, "Gladiator", 11.99M, "gladiator.jpg", "Ridley Scott"); Movie movie5 = new Movie(7, "Jungle Book", 21.99M, "JungleBook.jpg", "Jon Favreau"); movie1.Category = "Movie"; movie2.Category = "Movie"; movie3.Category = "Movie"; movie4.Category = "Movie"; movie5.Category = "Movie"; Products.Add(movie1); Products.Add(movie2); Products.Add(movie3); Products.Add(movie4); Products.Add(movie5); // music cds MusicCD CD1 = new MusicCD(8, "Revival", 11.39M, "cd1.jpg", "Eminem", 2017); MusicCD CD2 = new MusicCD(9, "Southpaw", 16.43M, "cd2.jpg", "Eminem", 2015); MusicCD CD3 = new MusicCD(10, "8 Mile", 22.99M, "cd3.jpg", "Eminem", 2002); CD1.Category = "MusicCD"; CD2.Category = "MusicCD"; CD3.Category = "MusicCD"; Products.Add(CD1); Products.Add(CD2); Products.Add(CD3); CD1.AddTrack("Walk on Water", "Marshall Mathers", new TimeSpan(0, 5, 04)); CD1.AddTrack("Believe", "Mathers", new TimeSpan(0, 5, 15)); CD1.AddTrack("Chloraseptic", "Mathers", new TimeSpan(0, 5, 01)); CD1.AddTrack("Untouchable", "Mathers", new TimeSpan(0, 6, 10)); CD1.AddTrack("River", "Mathers", new TimeSpan(0, 3, 41)); CD1.AddTrack("Framed", "David John Byron", new TimeSpan(0, 4, 13)); CD2.AddTrack("Kings Never Die", "Marshall Mathers", new TimeSpan(0, 4, 56)); CD2.AddTrack("Beast (Southpaw Remix)", "Dominick Wickliffe", new TimeSpan(0, 4, 39)); CD2.AddTrack("This Corner", "Denaun Porter", new TimeSpan(0, 3, 53)); CD2.AddTrack("What About the Rest of Us", "Jo-Vaughn Virginie", new TimeSpan(0, 4, 12)); CD2.AddTrack("Raw", "Ryan Montgomery", new TimeSpan(0, 3, 40)); CD2.AddTrack("R.N.S.", "O'Shea Jackson", new TimeSpan(0, 3, 39)); CD3.AddTrack("Lose Yourself", "Marshall Mathers", new TimeSpan(0, 5, 20)); CD3.AddTrack("Love Me", "Mathers", new TimeSpan(0, 4, 30)); CD3.AddTrack("8 Mile", "Mathers", new TimeSpan(0, 5, 57)); CD3.AddTrack("Adrenaline Rush", "Andy Thelusma", new TimeSpan(0, 3, 48)); CD3.AddTrack("Places to Go", "Mathers", new TimeSpan(0, 4, 15)); CD3.AddTrack("Rap Game", "Mathers", new TimeSpan(0, 5, 53)); CD3.AddTrack("8 Miles and Runnin", "Shaun Carter", new TimeSpan(0, 4, 08)); CD3.AddTrack("Spit Shine", "Alvin Joiner", new TimeSpan(0, 3, 39)); CD3.AddTrack("Wanksta", "Michael Clervoix", new TimeSpan(0, 3, 38)); // invoices Invoice invoice1 = new Invoice(0, new DateTime(2018, 5, 1, 8, 30, 52), customer1); Invoice invoice2 = new Invoice(1, DateTime.Now, customer2); invoice1.AddOrderItem(CD1, 2); invoice1.AddOrderItem(book1, 5); invoice1.AddOrderItem(movie5, 5); invoice2.AddOrderItem(movie1, 1); invoice2.AddOrderItem(movie3, 1); invoice2.AddOrderItem(CD1, 1); invoice2.AddOrderItem(CD2, 1); invoice2.AddOrderItem(CD3, 1); Invoices.Add(invoice1); Invoices.Add(invoice2); }
//ctr static Repository() { // create objects Book Book1 = new Book(1, "JK Rowling", "Harry Potter", 180.00M, 1992); Book1.ISBN = "9780439554930"; Book1.Publisher = "Scholastic"; Book1.ImageFileName = "/Images/harrypotter.jpg"; Book1.Category = "Book"; Book Book2 = new Book(2, "Zachary Auburn", "How To Talk To Your Cat About Gun Safety", 150.00M, 2016); Book2.ISBN = "978-0451494924"; Book2.Publisher = "Three Rivers Press"; Book2.ImageFileName = "/Images/gunsafety.jpg"; Book2.Category = "Book"; MusicCD CD1 = new MusicCD(3, "Hansi Hinterseer", "Javol aus Tyrol", 99, 1994); CD1.ImageFileName = "/Images/hansi.jpg"; CD1.Category = "Music"; CD1.AddTrack(new Track("Wir Trinken Alkohol")); CD1.AddTrack(new Track("Wir Trinken Sehr Viel Alkohol")); CD1.AddTrack(new Track("Ich möchte tanzen, tanzen")); MusicCD CD2 = new MusicCD(4, "Britney Spears", "...Baby One More Time", 80, 1999); CD2.ImageFileName = "/Images/britney.jpg"; CD2.Category = "Music"; CD2.AddTrack(new Track("...Baby One More Time")); CD2.AddTrack(new Track("(You Drive Me) Crazy")); CD2.AddTrack(new Track("Sometimes")); CD2.AddTrack(new Track("Soda Pop")); CD2.AddTrack(new Track("Email My Heart")); CD2.AddTrack(new Track("The Beat Goes On")); MusicCD CD3 = new MusicCD(5, "Backstreet Boys", "Backstreets Back", 599, 1997); CD3.ImageFileName = "/Images/backstreet.jpg"; CD3.Category = "Music"; CD3.AddTrack(new Track("Everybody")); CD3.AddTrack(new Track("As Long As You Love Me")); CD3.AddTrack(new Track("I Want It That Way")); CD3.AddTrack(new Track("Dingus Lingus")); CD3.AddTrack(new Track("Mr. Poopypants")); CD3.AddTrack(new Track("All I Have To Give")); Movie Movie1 = new Movie(6, "Jungle Book", 160, "/Images/junglebook.jpg", "Walt Disney"); Movie1.Category = "Movie"; Movie Movie2 = new Movie(7, "Tarzan", 120, "/Images/tarzan.jpg", "Walt Disney"); Movie2.Category = "Movie"; Movie Movie3 = new Movie(8, "Frozen", 230, "/Images/frozen.jpg", "Walt Disney"); Movie3.Category = "Movie"; Products.Add(CD1); Products.Add(CD2); Products.Add(CD3); Products.Add(Book1); Products.Add(Book2); Products.Add(Movie1); Products.Add(Movie2); Products.Add(Movie3); Customer cust1 = new Customer(1, "John", "Doe", "Somestreet 27", "8464", "Somecity"); Customer cust2 = new Customer(2, "Jane", "Doe", "Otherstreet 13", "2000", "Othercity"); Customer cust3 = new Customer(3, "Adam", "Smith", "Nextstreet 69", "4200", "Nextcity"); cust1.AddPhone("11223344"); cust2.AddPhone("12345678"); cust2.AddPhone("00998877"); cust3.AddPhone("69696969"); cust1.BirthDate = new DateTime(2016, 7, 15); cust2.BirthDate = new DateTime(1992, 7, 15); cust3.BirthDate = new DateTime(1990, 7, 15); Invoice Invoice1 = new Invoice(1, new DateTime(2020, 7, 16), cust1); Invoice1.AddOrderItem(CD3, 1); Invoice1.AddOrderItem(Book2, 3); Invoice Invoice2 = new Invoice(2, new DateTime(2020, 5, 13), cust2); Invoice2.AddOrderItem(Movie2, 2); Invoice2.AddOrderItem(Book1, 7); Invoice Invoice3 = new Invoice(3, new DateTime(2020, 9, 9), cust3); Invoice3.AddOrderItem(Movie2, 2); Invoice Invoice4 = new Invoice(4, new DateTime(2020, 4, 9), cust1); Invoice4.AddOrderItem(Movie2, 2); Invoices.Add(Invoice1); Invoices.Add(Invoice2); Invoices.Add(Invoice3); Invoices.Add(Invoice4); }
// when called the constructor instantiates all the objects and the lists static Repository() { // create Movie objects and add them to the Products catalogue list Movie jungleBook = new Movie("Jungle Book", 175m, "junglebook.jpg", "Jon Favreau"); Movie gladiator = new Movie("Gladiator", 150.20m, "gladiator.jpg", "Ridley Scott"); Movie forrest_gump = new Movie("Forest Gump", 100.10m, "forrest-gump.jpg", "Robert Zemeckis"); Products.Add(jungleBook); Products.Add(gladiator); Products.Add(forrest_gump); // create Book objects and add them to the Products catalogue list. Book has one constructor with 4 arguments. Book hardDay = new Book("Steve Turner", "A Hard Day's Write: The Stories Behind Every Beatles Song", 190.75m, 2005); //There are 3 extra properties that we need to be set. We can use the book object and call the property setter to assign the values hardDay.ImageFileName = "hard_day.jpg"; hardDay.ISBN = "978-0060844097"; hardDay.Publisher = "It Books"; //Or we can use Object initialization - set any number of fields on the object trough the properties to specified values after it's been constructed Book sgtPepper = new Book("George Martin", "With a Little Help from My Friends: The Making of Sgt. Pepper", 120.60m, 1995) { ImageFileName = "pepper.jpg", ISBN = "978-0316547833", Publisher = "Little Brown & Co" }; // Add the books to the Products list Products.Add(hardDay); Products.Add(sgtPepper); // create Track objects Track abbeyRoadTrack1 = new Track("Come Together", new TimeSpan(0, 2, 40)) { Composer = "Lenon, McCartney" }; Track abbeyRoadTrack2 = new Track("Something", new TimeSpan(0, 3, 03)) { Composer = "Harrison" }; Track abbeyRoadTrack3 = new Track("Maxwell's Silver Hammer", new TimeSpan(0, 2, 27)) { Composer = "Lenon, McCartney" }; // create the "blank" Music CD MusicCD abbeyRoad = new MusicCD("Beatles", "Abbey Road (Remastered)", 128m, 2009) { ImageFileName = "abbey_road.jpg", Label = "Capitol" }; MusicCD revolver = new MusicCD("Beatles", "Revolver", 183m, 2009) { ImageFileName = "revolver.jpg", Label = "Capitol" }; // call the AddTrack method abbeyRoad.AddTrack(abbeyRoadTrack1); abbeyRoad.AddTrack(abbeyRoadTrack2); abbeyRoad.AddTrack(abbeyRoadTrack3); // same as above but this time we use collection-initializer syntax and add object without the need to instantate them first abbeyRoad.AddTrack(new Track("Oh! Darling", new TimeSpan(0, 3, 26)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Octopus's Garden", new TimeSpan(0, 2, 51)) { Composer = "Starkey" }); abbeyRoad.AddTrack(new Track("I Want You (She's So Heavy)", new TimeSpan(0, 7, 47)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Here Comes The Sun", new TimeSpan(0, 3, 05)) { Composer = "Harrison" }); abbeyRoad.AddTrack(new Track("Because", new TimeSpan(0, 2, 45)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("You Never Give me Your Money", new TimeSpan(0, 4, 02)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Sun King", new TimeSpan(0, 2, 26)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Mean Mr. Mustard", new TimeSpan(0, 1, 06)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Polythene Pam", new TimeSpan(0, 1, 12)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("She Came In Trough The Bathroom Window", new TimeSpan(0, 1, 57)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Golden Slumbers", new TimeSpan(0, 1, 31)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Carry That Weight", new TimeSpan(0, 1, 36)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("The End", new TimeSpan(0, 2, 19)) { Composer = "Lenon, McCartney" }); abbeyRoad.AddTrack(new Track("Her Majesty", new TimeSpan(0, 0, 23)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("Taxman", new TimeSpan(0, 2, 28)) { Composer = "Harrison" }); revolver.AddTrack(new Track("Eleanor Rigby", new TimeSpan(0, 2, 06)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("I'm Only Sleeping", new TimeSpan(0, 3, 00)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("Love You To", new TimeSpan(0, 2, 59)) { Composer = "Harrison" }); revolver.AddTrack(new Track("Here, There And Everywhere", new TimeSpan(0, 2, 23)) { Composer = "Harrison" }); revolver.AddTrack(new Track("Yellow Submarine", new TimeSpan(0, 2, 38)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("She Said She Said", new TimeSpan(0, 2, 36)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("Good Day Sunshine", new TimeSpan(0, 2, 09)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("And You Bird Can Sing", new TimeSpan(0, 2, 00)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("For No One", new TimeSpan(0, 1, 59)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("Doctor Robert", new TimeSpan(0, 1, 14)) { Composer = "Lenon, McCartney" }); revolver.AddTrack(new Track("I Want To Tell You", new TimeSpan(0, 2, 27)) { Composer = "Harrison" }); revolver.AddTrack(new Track("Got To Get You Into My Life", new TimeSpan(0, 2, 29)) { Composer = "Harrison" }); revolver.AddTrack(new Track("Tomorrow Never Knows", new TimeSpan(0, 3, 01)) { Composer = "Harrison" }); // add the complete Music CD to the Products catalogue list Products.Add(abbeyRoad); Products.Add(revolver); // create Customers Customer customer1 = new Customer(1, "Anzhel", "Petrov", "Gudrunsvej 28", "8220", "Aarhus") { // Use the two dates below to check the age check in Customer model //BirthDate = new DateTime(1900, 06, 27) //BirthDate = new DateTime(2222, 06, 27) BirthDate = new DateTime(1984, 06, 27) }; Customer customer2 = new Customer(2, "Kristian", "Kubis", "Banegårdsgade 72", "8000", "Aarhus") { BirthDate = new DateTime(1998, 03, 15) }; Customer customer3 = new Customer(3, "Michael", "Commerou", "Kirkegade 13", "7100", "Vejle") { BirthDate = new DateTime(1996, 10, 22) }; //create Invoices Invoice invoice1 = new Invoice(1, new DateTime(2020, 08, 27), customer1); Invoice invoice2 = new Invoice(2, new DateTime(2020, 08, 26), customer2); Invoice invoice3 = new Invoice(2, new DateTime(2020, 09, 13), customer3); //// create OrderItem (we don't need to do that separately as we use the AddOrderItem method below) //OrderItem orderItem1 = new OrderItem(hardDay, 2); //OrderItem orderItem2 = new OrderItem(gladiator, 1); //OrderItem orderItem3 = new OrderItem(sgtPepper, 3); //OrderItem orderItem4 = new OrderItem(forrest_gump, 1); // add OrderItem to Invoice by using the OrderItem contructor as parameter to the method invoice1.AddOrderItem(hardDay, 2); invoice1.AddOrderItem(gladiator, 1); invoice2.AddOrderItem(sgtPepper, 3); invoice2.AddOrderItem(forrest_gump, 2); invoice3.AddOrderItem(jungleBook, 1); invoice3.AddOrderItem(abbeyRoad, 2); // add Invoice to Invoices list Invoices.Add(invoice1); Invoices.Add(invoice2); Invoices.Add(invoice3); // add invoice using the customer object. It is not used but it acts as a filter to get all invoices by specifying a customer //customer1.AddInvoice(invoice1); }
// Constructor that will create all the data and store it in local lists. No data is persisted. public Repository() { // Books Book book = new Book("James C. Collins", "Good to Great: Why Some Companies Make the Leap... and Others Don't", 150m, 2001); book.Publisher = "HarperBusiness"; book.ISBN = "9780066620992"; book.ImageUrl = "goodtogreat.jpg"; Products.Add(book); book = new Book("David Brooks", "The Social Animal: The Hidden Sources of Love, Character, and Achievement", 199m, 2011); book.Publisher = "Random House"; book.ISBN = "9781400067602"; book.ImageUrl = "socialanimal.jpg"; Products.Add(book); // Music CDs MusicCD cd = new MusicCD("Beatles", "Abbey Road (Remastered)", 128m, 2009); cd.Label = "EMI"; cd.ImageUrl = "AbbeyRoadAlbumCover.jpg"; cd.AddTrack(new Track { Title = "Come Together", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 4, 20) }); cd.AddTrack(new Track { Title = "Something", Composer = "Harrison", Length = new TimeSpan(0, 3, 3) }); cd.AddTrack(new Track { Title = "Maxwell's Silver Hammer", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 3, 27) }); cd.AddTrack(new Track { Title = "Oh! Darling", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 3, 26) }); cd.AddTrack(new Track { Title = "Octopus's Garden", Composer = "Starr", Length = new TimeSpan(0, 2, 51) }); cd.AddTrack(new Track { Title = "I Want You (She's So Heavy)", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 7, 47) }); cd.AddTrack(new Track { Title = "Here Comes The Sun", Composer = "Harrison", Length = new TimeSpan(0, 3, 5) }); cd.AddTrack(new Track { Title = "Because", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 2, 45) }); cd.AddTrack(new Track { Title = "You Never Give Me Your Money", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 4, 2) }); cd.AddTrack(new Track { Title = "Sun King", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 2, 26) }); cd.AddTrack(new Track { Title = "Mean Mr. Mustard", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 1, 6) }); cd.AddTrack(new Track { Title = "Polythene Pam", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 1, 12) }); cd.AddTrack(new Track { Title = "She Came In Through The Bathroom Window", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 1, 57) }); cd.AddTrack(new Track { Title = "Golden Slumbers", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 1, 31) }); cd.AddTrack(new Track { Title = "Carry The Weight", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 1, 36) }); cd.AddTrack(new Track { Title = "The End", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 2, 5) }); cd.AddTrack(new Track { Title = "Her Majesty", Composer = "Lennon/McCartney", Length = new TimeSpan(0, 0, 23) }); Products.Add(cd); cd = new MusicCD("Fields of the Nepthilim", "Earth Inferno", 99m, 1991); cd.Label = "Beggars Banquet"; cd.ImageUrl = "Earth_Inferno_Fields_of_the_Nephilim.jpeg"; cd.AddTrack(new Track { Title = "Intro (Dead But Dreaming)", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 16, 8) }); cd.AddTrack(new Track { Title = "Moonchild", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 5, 25) }); cd.AddTrack(new Track { Title = "Submission", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 7, 34) }); cd.AddTrack(new Track { Title = "Preacher Man", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 4, 51) }); cd.AddTrack(new Track { Title = "Love Under Will", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 6, 17) }); cd.AddTrack(new Track { Title = "Sumerland", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 8, 26) }); cd.AddTrack(new Track { Title = "Last Exit for the Lost", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 10, 18) }); cd.AddTrack(new Track { Title = "Psychonaut", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 9, 5) }); cd.AddTrack(new Track { Title = "Dawnrazor", Composer = "Fields of the Nephilim", Length = new TimeSpan(0, 9, 9) }); Products.Add(cd); // Movies Movie movie = new Movie("Captain Marvel", 124.50m, "captain_marvel.jpg", "Ryan Fleck"); Products.Add(movie); movie = new Movie("Deadpool", 128.95m, "deadpool.jpg", "Tim Miller"); Products.Add(movie); movie = new Movie("Avengers", 189.50m, "avengers.jpg", "David Leitch"); Products.Add(movie); //Customers Customer AdrianLupescu = new Customer(10, "Adrian", "Lupescu", "Home", "1", "Place"); AdrianLupescu.Birthdate = new DateTime(1989, 6, 19); AdrianLupescu.AddPhone("040-457342"); Customers.Add(AdrianLupescu); Customer GuilermoManuel = new Customer(19, "Guilermo", "Manuel", "His Home", "27", "Baker Street"); GuilermoManuel.Birthdate = new DateTime(1992, 7, 15); Customers.Add(GuilermoManuel); Customer ElenaOse = new Customer(2014, "Elena", "Ose", "Dr Fichs Vej", "21", "Kolding"); ElenaOse.AddPhone("123-2134355"); ElenaOse.Birthdate = new DateTime(1992, 4, 9); Customers.Add(ElenaOse); //Invoices & OrderItems Invoice invoice = new Invoice(190228, new DateTime(2019, 2, 28), AdrianLupescu); invoice.AddOrderItem(Products.Where(p => p.GetType() == typeof(Book) && p.Title.Contains("Good to Great")).Single(), 1); invoice.AddOrderItem(Products.Where(p => p.GetType() == typeof(Movie) && p.Title.Contains("Deadpool")).Single(), 1); Invoices.Add(invoice); invoice = new Invoice(12939, new DateTime(2015, 12, 21), GuilermoManuel); invoice.AddOrderItem(Products.Where(p => p.GetType() == typeof(Book) && p.Title.Contains("Good to Great")).Single(), 1); invoice.AddOrderItem(Products.Where(p => p.GetType() == typeof(MusicCD) && p.Title.Contains("Earth Inferno")).Single(), 2); invoice.AddOrderItem(Products.Where(p => p.GetType() == typeof(Movie) && p.Title.Contains("Avengers")).Single(), 1); invoice.AddOrderItem(Products.Where(p => p.GetType() == typeof(Book) && p.Title.Contains("The Social Animal")).Single(), 1); Invoices.Add(invoice); }
// constructor static Repository() { // Customers Customer customer1 = new Customer(1, "Catalin", "Ispas", "Sondervangen 73", "86023", "Viby J"); Customer customer2 = new Customer(2, "Sebastian", "Bastion", "Sondervangen 68", "86023", "Viby J"); // create objects // Books Book myBook = new Book("Georg Martin", "The Making of Sgt.Pepper", 180.00M, 1995); Products.Add(myBook); Products.Add(new Book("Steve Turner", "Hard Day's Write", 150.00M, 2005)); Products.Add(myBook); // MusicCDs /////// cd1 MusicCD cd1 = new MusicCD("Pink Floyd", "Wish you were here", 250.00M, 1975); Track cd1tr1 = new Track("Shine On You Crazy Diamond(Parts I–V)", new TimeSpan(0, 0, 0)); cd1.AddTrack(cd1tr1); Track cd1tr2 = new Track("Welcome to the Machine", new TimeSpan(0, 0, 0)); cd1.AddTrack(cd1tr2); Products.Add(cd1); /////// cd2 MusicCD cd2 = new MusicCD("Disturbed", "Ten Thousand Fists", 259.00M, 2005); Track cd2tr1 = new Track("Stricken", new TimeSpan(0, 0, 0)); cd2.AddTrack(cd2tr1); Track cd2tr2 = new Track("Just Stop", new TimeSpan(0, 0, 2)); cd2.AddTrack(cd2tr2); Products.Add(cd2); // Movies /////// movie1 Movie movie1 = new Movie(1, "Jungle Book", 150.00M, "/images/JungleBook.jpg"); Products.Add(movie1); Movie movie2 = new Movie(2, "Forrest Gump", 250.00M, "images/forrest-gump.jpg"); Products.Add(movie2); Movie movie3 = new Movie(3, "Gladiator", 30.00M, "images/gladiator.jpg"); Products.Add(movie3); // Invoices Invoice invoice1 = new Invoice(1, new DateTime(2020, 10, 09), customer1); invoice1.AddOrderItem(movie1, 2); invoice1.AddOrderItem(cd2, 1); Invoice invoice2 = new Invoice(2, new DateTime(2020, 09, 01), customer2); invoice2.AddOrderItem(movie3, 6); invoice2.AddOrderItem(myBook, 2); Invoices.Add(invoice1); Invoices.Add(invoice2); }
static Repository() { // Books // Book no 1 Book myBook = new Book(); myBook.Title = "A Hard Day's Write: The Stories Behind Every Beatles Song "; myBook.Author = "Steve Turner"; myBook.Price = 150.00M; myBook.Publisher = "It Books"; myBook.Published = 2005; myBook.ISBN = "978-0060844097"; myBook.ImageUrl = "A_Hard_Days_Write.jpg"; Products.Add(myBook); // Book no 2 Book myBook2 = new Book("Georg Martin", "With a Little Help from My Friends: The Making of Sgt. Pepper", 180.00M, 1995); myBook2.Publisher = "Little Brown & Co"; myBook2.ISBN = "0316547832"; myBook2.ImageUrl = "The Making of Sgt. Pepper.jpg"; Products.Add(myBook2); // CDs // CD no 1 MusicCD myCD = new MusicCD(); myCD.Title = "Abbey Road (Remastered)"; myCD.Artist = "Beatles"; myCD.Price = 128.00M; myCD.Released = 2009; myCD.Label = "EMI"; myCD.ImageUrl = "abbey_road.jpg"; myCD.AddTrack(new Track("Come Together", new TimeSpan(0, 4, 20), "Lennon, McCartney")); myCD.AddTrack(new Track("Something", new TimeSpan(0, 3, 03), "Harrison")); myCD.AddTrack(new Track("Maxwell's Silver Hammer", new TimeSpan(0, 3, 29), "Lennon, McCartney")); myCD.AddTrack(new Track("Oh! Darling", new TimeSpan(0, 3, 26), "Lennon, McCartney")); myCD.AddTrack(new Track("Octopus's Garden", new TimeSpan(0, 2, 51), "Starkey")); myCD.AddTrack(new Track("I Want You (She's So Heavy)", new TimeSpan(0, 7, 47), "Lennon, McCartney")); myCD.AddTrack(new Track("Here Comes The Sun", new TimeSpan(0, 3, 05), "Harrison")); myCD.AddTrack(new Track("Because", new TimeSpan(0, 2, 45), "Lennon, McCartney")); myCD.AddTrack(new Track("You Never Give Me Your Money", new TimeSpan(0, 4, 02), "Lennon, McCartney")); myCD.AddTrack(new Track("Sun King", new TimeSpan(0, 2, 26), "Lennon, McCartney")); myCD.AddTrack(new Track("Mean Mr. Mustard", new TimeSpan(0, 1, 6), "Lennon, McCartney")); myCD.AddTrack(new Track("Polythene Pam", new TimeSpan(0, 1, 12), "Lennon, McCartney")); myCD.AddTrack(new Track("She Came In Through The Bathroom Window", new TimeSpan(0, 1, 57), "Lennon, McCartney")); myCD.AddTrack(new Track("Golden Slumbers", new TimeSpan(0, 1, 31), "Lennon, McCartney")); myCD.AddTrack(new Track("Carry That Weight", new TimeSpan(0, 1, 36), "Lennon, McCartney")); myCD.AddTrack(new Track("The End", new TimeSpan(0, 2, 19), "Lennon, McCartney")); myCD.AddTrack(new Track("Her Majesty", new TimeSpan(0, 0, 23), "Lennon, McCartney")); Products.Add(myCD); // CD no 2 MusicCD myCD2 = new MusicCD("The Beatles", "Revolver (Remastered)", 128.00M, 2009); myCD2.Label = "EMI"; myCD2.ImageUrl = "revolver.jpg"; Track track01 = new Track("Taxman", new TimeSpan(0, 2, 28)); track01.Composer = "Harrison"; myCD2.AddTrack(track01); Track track02 = new Track("Eleanor Rigby", new TimeSpan(0, 2, 6), "Lennon, McCartney"); track02.Composer = "Lennon, McCartney"; myCD2.AddTrack(track02); Track track03 = new Track("I'm Only Sleeping", new TimeSpan(0, 3, 0), "Lennon, McCartney"); track03.Composer = "Lennon, McCartney"; myCD2.AddTrack(track03); Track track04 = new Track("Love You To", new TimeSpan(0, 2, 59)); track04.Composer = "Harrison"; myCD2.AddTrack(track04); Track track05 = new Track("Here, There And Everywhere", new TimeSpan(0, 2, 23)); track05.Composer = "Harrison"; myCD2.AddTrack(track05); Track track06 = new Track("Yellow Submarine", new TimeSpan(0, 2, 38)); track06.Composer = "Lennon, McCartney"; myCD2.AddTrack(track06); Track track07 = new Track("She Said She Said", new TimeSpan(0, 2, 36)); track07.Composer = "Lennon, McCartney"; myCD2.AddTrack(track07); Track track08 = new Track("Good Day Sunshine", new TimeSpan(0, 2, 9)); track08.Composer = "Lennon, McCartney"; myCD2.AddTrack(track08); Track track09 = new Track("And Your Bird Can Sing", new TimeSpan(0, 2, 0)); track09.Composer = "Lennon, McCartney"; myCD2.AddTrack(track09); Track track10 = new Track("For No One", new TimeSpan(0, 1, 59)); track10.Composer = "Lennon, McCartney"; myCD2.AddTrack(track10); Track track11 = new Track("Doctor Robert", new TimeSpan(0, 1, 14)); track11.Composer = "Lennon, McCartney"; myCD2.AddTrack(track11); Track track12 = new Track("I Want To Tell You", new TimeSpan(0, 2, 27)); track12.Composer = "Harrison"; myCD2.AddTrack(track12); Track track13 = new Track("Got To Get You Into My Life", new TimeSpan(0, 2, 29)); track13.Composer = "Lennon, McCartney"; myCD2.AddTrack(track13); Track track14 = new Track("Tomorrow Newer Knows", new TimeSpan(0, 3, 01)); track14.Composer = "Lennon, McCartney"; myCD2.AddTrack(track14); Products.Add(myCD2); // Movies // create a new Movie objects Movie movie1 = new Movie("Jungle Book", 160.50M, "junglebook.jpg", "Jon Favreau"); Products.Add(movie1); Movie movie2 = new Movie("Gladiator", 49.95M, "gladiator.jpg", "Ridley Scott"); Products.Add(movie2); Movie movie3 = new Movie("Forrest Gump", 154.50M, "forrest-gump.jpg", "Robert Zemeckis"); Products.Add(movie3); Customer c1 = new Customer(1, "Tina", "Petterson", "Irisdahlsvej 32", "8200", "Århus N"); Customer c2 = new Customer(2, "Thomas", "Larsson", "Solsikkevej 32", "8000", "Århus C"); Invoice i1 = new Invoice(1, new DateTime(2016, 9, 12), c1); Invoice i2 = new Invoice(2, new DateTime(2016, 9, 24), c2); i1.AddOrderItem(movie3, 1); i1.AddOrderItem(myBook2, 1); i2.AddOrderItem(myBook, 1); i2.AddOrderItem(myCD2, 1); Invoices.Add(i1); Invoices.Add(i2); }
// constructors static Repository() { //////// // Books //////// Book b1 = new Book(7, "Steve Turner", "A hard day's write", 150M, 2005) { Publisher = "It Books", ISBN = "9781858680330", ImageUrl = "a-hard-days-write.jpg", Category = "Book" }; Products.Add(b1); Book b2 = new Book(6, "William Pearson", "With a Little Help from My Friends: The Making of Sgt. Pepper", 1800, 1995) { Publisher = "Little Brown & Co", ISBN = "978-0316547833", ImageUrl = "little-help.jpg", Category = "Book" }; Products.Add(b2); //////// // Music CDs //////// MusicCD cd1 = new MusicCD(5, "The Beatles", "Abbey Road (Remastered)", 128M, 2009) { Label = "EMI", ImageUrl = "abbey-road.jpg", Category = "Music" }; cd1.AddTrack("Come Together", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Something", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Maxwell's Silver Hammer", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Oh! Darling", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Octopus' Garden", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("I Want You (She's So Heavy)", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Here Comes The Sun", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Because", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("You Never Give Me Your Money", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Sun King", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Mean Mr. Mustard", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Polythene Pam", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("She Came In Through The Bathroom Window", new List <string>() { }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Golden Slumbers", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Carry That Weight", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("The End", new List <string>() { "" }, new TimeSpan(0, 0, 0)); cd1.AddTrack("Her Majesty", new List <string>() { "" }, new TimeSpan(0, 0, 0)); Products.Add(cd1); MusicCD cd2 = new MusicCD(4, "The Beatles", "Revolver (Remastered)", 128M, 2009) { Label = "EMI", ImageUrl = "revolver.jpg", Category = "Music" }; cd2.AddTrack("Taxman", new List <string>() { "Harrisson" }, new TimeSpan(0, 2, 28)); cd2.AddTrack("Eleanor Rigby", new List <string>() { "Lennon", "McCartney" }, new TimeSpan(0, 2, 6)); cd2.AddTrack("I'm Only Sleeping", new List <string>() { "Lennon", "McCartney" }, new TimeSpan(0, 3, 0)); cd2.AddTrack("Love You Too", new List <string>() { }, new TimeSpan(0, 2, 59)); cd2.AddTrack("Here, There and Everywhere", new List <string>() { }, new TimeSpan(0, 2, 23)); cd2.AddTrack("Yellow Submarine", new List <string>() { }, new TimeSpan(0, 2, 38)); cd2.AddTrack("She Said She Said", new List <string>() { }, new TimeSpan(0, 2, 36)); cd2.AddTrack("Good Day Sunshine", new List <string>() { }, new TimeSpan(0, 2, 09)); cd2.AddTrack("And Your Bird Can Sing", new List <string>() { }, new TimeSpan(0, 2, 0)); cd2.AddTrack("For No One", new List <string>() { }, new TimeSpan(0, 1, 59)); cd2.AddTrack("Doctor Robert", new List <string>() { }, new TimeSpan(0, 2, 14)); cd2.AddTrack("I Want To Tell You", new List <string>() { }, new TimeSpan(0, 2, 27)); cd2.AddTrack("Got To Get You Into My Life", new List <string>() { }, new TimeSpan(0, 2, 29)); cd2.AddTrack("Tomorrow Never Knows", new List <string>() { }, new TimeSpan(0, 3, 01)); Products.Add(cd2); //////// // Movies //////// Movie jungleBook = new Movie(1, "Jungle Book", 160.50m) { ImageUrl = "junglebook.jpg", Director = "Jon Favreau", Category = "Movie" }; Products.Add(jungleBook); Movie johnWick3 = new Movie(2, "John Wick 3", 75m) { ImageUrl = "jw.jpg", Director = "Chad Stahelski", Category = "Movie" }; Products.Add(johnWick3); Movie it2 = new Movie(3, "It 2", 60m) { ImageUrl = "it.jpg", Director = "Andrés Muschietti", Category = "Movie" }; Products.Add(it2); //////// // Invoices //////// // Customers Customer cust1 = new Customer(0, "Petr", "Mrkvicka", "Vestervang 10", "8000", "Aarhus C"); cust1.AddPhoneNumber("91887697"); cust1.AddPhoneNumber("74882938"); cust1.BirthDate = new DateTime(1997, 11, 26); Customer cust2 = new Customer(1, "Martina", "Mesopotama", "Oreostrasse 22", "840123", "Mezmez"); cust2.AddPhoneNumber("83339202"); cust2.BirthDate = new DateTime(1997, 11, 26); Customer cust3 = new Customer(2, "John", "Doe", "Notting Hill 12", "19291", "London"); cust3.AddPhoneNumber("74939393"); cust3.BirthDate = new DateTime(1997, 11, 26); // Invoices Invoice inv1 = new Invoice(0, new DateTime(2019, 09, 04), cust1); inv1.AddOrderItem(cd2, 2); Invoices.Add(inv1); Invoice inv2 = new Invoice(0, new DateTime(2019, 09, 13), cust3); inv2.AddOrderItem(johnWick3, 1); inv2.AddOrderItem(b2, 1); Invoices.Add(inv2); Invoice inv3 = new Invoice(0, new DateTime(2019, 09, 16), cust2); inv3.AddOrderItem(it2, 2); inv3.AddOrderItem(cd1, 1); inv3.AddOrderItem(b1, 2); Invoices.Add(inv3); Invoice inv4 = new Invoice(0, new DateTime(2019, 09, 27), cust1); inv4.AddOrderItem(jungleBook, 21); inv4.AddOrderItem(b2, 1); Invoices.Add(inv4); }
static Repository() { Book book1 = new Book(4, "George R. R. Martin", "Fire and Blood", 9.99m, 1997, "123456", "book01.jpg"); book1.Category = "Book"; Book book2 = new Book(5, "George R. R. Martin", "The Mystery Knight", 19.99m, 1998, "654321", "book02.jpg"); book2.Category = "Book"; Book book3 = new Book(6, "George R. R. Martin", "A Feast for Crows", 29.99m, 1999, "321654", "book03.jpg"); book3.Category = "Book"; MusicCD cd1 = new MusicCD(7, "Metallica", "Load", 50.60m, 1996, "cd01.jpg"); cd1.Category = "Music"; Track track1 = new Track("Ain't my bitch", "Metallica", new TimeSpan(0, 5, 04)); Track track2 = new Track("2 X 4", "Metallica", new TimeSpan(0, 5, 28)); Track track3 = new Track("The house Jack built", "Metallica", new TimeSpan(0, 6, 39)); Track track4 = new Track("Until it sleeps", "Metallica", new TimeSpan(0, 4, 28)); Track track5 = new Track("King Nothing", "Metallica", new TimeSpan(0, 5, 30)); Track track6 = new Track("Hero of the day", "Metallica", new TimeSpan(0, 4, 22)); Track track7 = new Track("Bleeding me", "Metallica", new TimeSpan(0, 8, 18)); MusicCD cd2 = new MusicCD(8, "Megadeth", "Countdown to Extinction", 55.60m, 1965, "cd02.jpg"); cd2.Category = "Music"; Track track8 = new Track("Skin o'My Teeth", "Megadeth", new TimeSpan(0, 3, 14)); Track track9 = new Track("Symphony of Destruction", "Megadeth", new TimeSpan(0, 4, 02)); Track track10 = new Track("Architecture of Aggression", "Megadeth", new TimeSpan(0, 3, 34)); Track track11 = new Track("Foreclosure of a dream", "Megadeth", new TimeSpan(0, 4, 17)); Track track12 = new Track("Sweating bullets", "Megadeth", new TimeSpan(0, 5, 03)); Track track13 = new Track("This was my life", "Megadeth", new TimeSpan(0, 3, 42)); Track track14 = new Track("Countdown to Extinction", "Megadeth", new TimeSpan(0, 4, 16)); MusicCD cd3 = new MusicCD(9, "W.A.S.P.", "The Headless Children", 59.60m, 1970, "cd03.jpg"); cd3.Category = "Music"; Track track15 = new Track("The Heretic", "W.A.S.P.", new TimeSpan(0, 7, 16)); Track track16 = new Track("The real me", "W.A.S.P.", new TimeSpan(0, 3, 21)); Track track17 = new Track("The headless children", "W.A.S.P.", new TimeSpan(0, 5, 47)); Track track18 = new Track("Thunderhead", "W.A.S.P.", new TimeSpan(0, 6, 45)); Track track19 = new Track("Mean Man", "W.A.S.P.", new TimeSpan(0, 4, 50)); Track track20 = new Track("The Neutron Bomber", "W.A.S.P.", new TimeSpan(0, 4, 04)); Track track21 = new Track("Mephisto Waltz", "W.A.S.P.", new TimeSpan(0, 1, 26)); Movie movie1 = new Movie(10, "Jungle Book", 160.50m, "junglebook.jpg", "Jon Favreau"); movie1.Category = "Movie"; Movie movie2 = new Movie(11, "Gladiator", 120.60m, "gladiator.jpg", "Ryan Coogler"); movie2.Category = "Movie"; Movie movie3 = new Movie(12, "Forrest Gump", 180.50m, "forrest-gump.jpg", "James Gunn"); movie3.Category = "Movie"; cd1.AddTrack(track1); cd1.AddTrack(track2); cd1.AddTrack(track3); cd1.AddTrack(track4); cd1.AddTrack(track5); cd1.AddTrack(track6); cd1.AddTrack(track7); cd2.AddTrack(track8); cd2.AddTrack(track9); cd2.AddTrack(track10); cd2.AddTrack(track11); cd2.AddTrack(track12); cd2.AddTrack(track13); cd2.AddTrack(track14); cd3.AddTrack(track15); cd3.AddTrack(track16); cd3.AddTrack(track17); cd3.AddTrack(track18); cd3.AddTrack(track19); cd3.AddTrack(track20); cd3.AddTrack(track21); Products.Add(movie1); Products.Add(movie2); Products.Add(movie3); Products.Add(book1); Products.Add(book2); Products.Add(book3); Products.Add(cd1); Products.Add(cd2); Products.Add(cd3); Customer cust1 = new Customer("Denitsa", "Zhekova", "Godsbanen", "9000", "Aalborg C", Convert.ToDateTime("1997.07.22")); Customer cust2 = new Customer("Alexandru", "Paun", "Godsbanen", "9000", "Aalborg C", Convert.ToDateTime("1997.09.18")); Invoice invoice1 = new Invoice(1, new DateTime(2019, 09, 20), cust1); Invoice invoice2 = new Invoice(2, new DateTime(2019, 09, 21), cust2); invoice1.AddOrderItem(book1, 1); invoice1.AddOrderItem(book2, 2); invoice2.AddOrderItem(movie1, 1); invoice2.AddOrderItem(movie2, 2); Invoices.Add(invoice1); Invoices.Add(invoice2); }