public void GetMaxId() { Persistence per = new Persistence(); Console.WriteLine("max cinemaId: "+per.GetCurrentMaxId("cinemas")); Console.WriteLine("max screeningRoomId: " + per.GetCurrentMaxId("screening_rooms")); Console.WriteLine("max seatLocationId: " + per.GetCurrentMaxId("seat_locations")); Console.WriteLine("max moviesId: " + per.GetCurrentMaxId("movies")); Console.WriteLine("max screeningId: " + per.GetCurrentMaxId("screenings")); Console.WriteLine("max customersId: " + per.GetCurrentMaxId("customers")); Console.WriteLine("max customersId: " + per.GetCurrentMaxId("customers")); Console.WriteLine("max bookingId: " + per.GetCurrentMaxId("bookings")); Console.WriteLine("max ticketId: " + per.GetCurrentMaxId("tickets")); Console.ReadKey(); }
public void fffInsertTickets() { int numberOfScreeningsToBook = 1000;//this is multiplied by up to 840 List<string> scriptList = new List<string>(numberOfScreeningsToBook / 1000 + 1); ScriptMaker sm = new ScriptMaker(); per = new Persistence(); int currentMaxCustomerId = per.CountRowsInTable("customers"); int currentMaxScreeningId = per.GetMaxScreenInTickets(); List<int> nonExistingSeatLocationIds = per.GetNonExistingSeatLocations(); for (int currentScreeningId = 1; currentScreeningId < numberOfScreeningsToBook+1; currentScreeningId++) { List<int[]> ids = per.GetSeatsFromScreeningid(currentMaxScreeningId + currentScreeningId); scriptList.Add(sm.MakeTickets(ids, currentMaxCustomerId)); } System.IO.File.WriteAllLines(PATH + FILE_NAME, scriptList); per.InsertBatch(scriptList); }