Ejemplo n.º 1
0
        public static TourneyHeat GetHeatByHeatID(int heatid)
        {
            TourneyHeat theat = new TourneyHeat();

            Heat heat = Heat.Info(heatid);
            Race race = Race.GetRaceInfoByRaceID(heat.RaceID);

            Tournament tournament = Tournament.Info(TournamentTeam.Detail(race.LeftLaneTeam).EventID);

            theat.Race = race;
            theat.Tournament = tournament;
            theat.Heat = heat;
            theat.StartTime1 = GetHeatByHeatOrder(heatid,"Start");
            theat.StartTime2 = GetHeatByHeatOrder(heatid, "ReStart");
            theat.Dog1 = GetHeatByHeatOrder(heatid, "Dog 1");
            theat.Dog2 = GetHeatByHeatOrder(heatid, "Dog 2");
            theat.Dog3 = GetHeatByHeatOrder(heatid, "Dog 3");
            theat.Dog4 = GetHeatByHeatOrder(heatid, "Dog 4");
            theat.Rerun1 = GetHeatByHeatOrder(heatid, "Rerun 1");
            theat.Rerun2 = GetHeatByHeatOrder(heatid, "Rerun 2");
            theat.Rerun3 = GetHeatByHeatOrder(heatid, "Rerun 3");
            theat.Rerun4 = GetHeatByHeatOrder(heatid, "Rerun 4");

            return theat;
        }
        public ActionResult CreateHeat(int heatid,TourneyHeat th)
        {
            TourneyHeat theat = Heat.GetHeatByHeatID(heatid);
            ViewData["tournamentTeamID"] = theat.Heat.TeamID;
            //if (!ModelState.IsValid)
            //{
            //    return View(th);
               // }

            if (th.Heat.Result == "NF")
            {
                th.Heat.NoFinish = true;
                th.Heat.Points = 0;
                th.Heat.TotalTime = 0;
            }

            Heat.UpdateTourneyHeatFromModel(heatid,theat, th);

            return RedirectToAction("ViewHeats", new { controller="TournamentHeat", raceid = theat.Heat.RaceID,teamid=theat.Heat.TeamID });
        }
Ejemplo n.º 3
0
        public static void UpdateTourneyHeatFromModel(int heatid,TourneyHeat oldHeat, TourneyHeat newHeat)
        {
            oldHeat.Heat.TotalTime = newHeat.Heat.TotalTime;
            oldHeat.Heat.Result = newHeat.Heat.Result;
            oldHeat.Heat.Points = newHeat.Heat.Points;
            oldHeat.Heat.Notes = newHeat.Heat.Notes;
            oldHeat.Heat.Update();

            HeatDog.UpdateHeatDog(heatid,oldHeat.StartTime1, newHeat.StartTime1);
            HeatDog.UpdateHeatDog(heatid, oldHeat.StartTime2, newHeat.StartTime2);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Dog1, newHeat.Dog1);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Dog2, newHeat.Dog2);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Dog3, newHeat.Dog3);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Dog4, newHeat.Dog4);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Rerun1, newHeat.Rerun1);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Rerun2, newHeat.Rerun2);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Rerun3, newHeat.Rerun3);
            HeatDog.UpdateHeatDog(heatid, oldHeat.Rerun4, newHeat.Rerun4);
        }