Esempio n. 1
0
        public ActionResult Index(int raceId)
        {
            var race = RaceModel.GetById(raceId);

            TimerModel timer;
            if (race.GetTimerId().HasValue)
                timer = TimerModel.GetTimerById(race.GetTimerId().Value);
            else
            {
                timer = new TimerModel();
                timer.RaceID = raceId;
            }
            timer.SaveToDb();

            TimeStartnumberModel timeStartnumberModel;
            timeStartnumberModel = new TimeStartnumberModel(timer);
            var checkpointOrder = new CheckpointOrderModel();

            ViewBag.Checkpoints = CheckpointModel.GetCheckpoints(raceId);
            ViewBag.RaceId = raceId;
            ViewBag.RaceName = race.Name;
            timeStartnumberModel.ChangeCheckpoint(timer.GetFirstCheckpointId());
            timeStartnumberModel.CheckpointOrder = checkpointOrder;
            Session["TimeStartnumber"] = timeStartnumberModel;
            return View("Index", timeStartnumberModel);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates the new timer model with checkpoints.
 /// </summary>
 /// <returns></returns>
 private void Setup()
 {
     eventModel = new EventModel("Testevent", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("Testrace", DateTime.Today);
     race.EventId = eventModel.EventId;
     race.Save();
     timer = new TimerModel();
     timer.RaceID = race.RaceId;
     checkpoint = new CheckpointModel("Checkpoint1", timer, race, 1);
     checkpoint.SaveToDb();
     checkpointorder = new CheckpointOrderModel();
     checkpointorder.AddCheckpointOrderDB(checkpoint.Id, 12);
     checkpointorder.StartingNumber = 12;
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
     timer.SaveToDb();
     timestart = new TimeStartnumberModel(timer);
     timestart.CheckpointOrder = checkpointorder;
     //timestart.AddStartnumber(checkpoint.Id, checkpointorder.StartingNumber, 500);
 }
Esempio n. 3
0
 public void TestSetup()
 {
     timeMerger = new TimeMergerModel();
     timer = new TimerModel();
     eventModel = new EventModel("Testevent", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("SomeRace", new DateTime(2007, 10, 3));
     race.EventId = eventModel.EventId;
     race.Save();
     checkpoint1 = new CheckpointModel("Checkpoint1", timer, race, 1);
     checkpoint2 = new CheckpointModel("Checkpoint2", timer, race, 2);
     timer.RaceID = race.RaceId;
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
     checkpointOrderModel = new CheckpointOrderModel();
     timestartnumberModel = new TimeStartnumberModel(timer);
     timestartnumberModel.ChangeCheckpoint(timer.GetFirstCheckpointId());
     timestartnumberModel.CheckpointOrder = checkpointOrderModel;
 }