Beispiel #1
0
        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);
        }