private ViewEligibleSwimmers GetEligibleSwimmerList(int HeatSheetEventID) { ViewEligibleSwimmers vess = new ViewEligibleSwimmers(); vess.HeatSheetEventID = HeatSheetEventID; SwimmerCollection swimmers = BizMgr.GetAvailableSwimmersByHeatSheetEventID(HeatSheetEventID); SwimMeet sm = BizMgr.GetSwimMeetByHeatSheetEventID(HeatSheetEventID); Result mrResult; Result pbResult; Result sbResult; PoolConfig pc = BizMgr.GetPoolConfigByHeatSheetEventID(HeatSheetEventID); // Parallel.ForEach<Swimmer>(swimmers, delegate(Swimmer swimmer) foreach (Swimmer swimmer in swimmers) { ViewEligibleSwimmer ves = new ViewEligibleSwimmer(); ves.SwimmerID = swimmer.SwimmerID; ves.SwimmerTeamSeasonID = swimmer.SwimmerTeamSeasonID; ves.LastFirstName = swimmer.LastFirstName; ves.TeamNameAbbrev = swimmer.Abbrev; ves.AgeAtMeet = BizMgr.GetAgeAtDate(swimmer.BirthDate, sm.StartDate); mrResult = BizMgr.GetSeedTime(HeatSheetEventID, swimmer.SwimmerID, SwimomaticBusinessManager.SeedTimeType.MostRecent); pbResult = BizMgr.GetSeedTime(HeatSheetEventID, swimmer.SwimmerID, SwimomaticBusinessManager.SeedTimeType.PersonalBest); sbResult = BizMgr.GetSeedTime(HeatSheetEventID, swimmer.SwimmerID, SwimomaticBusinessManager.SeedTimeType.SeasonBest); ves.MostRecent = BizMgr.GetConvertedTime(mrResult.LaneLength, mrResult.UOMID, mrResult.ElapsedTime, pc.LaneLength, pc.UOMID); ves.PersonalBest = BizMgr.GetConvertedTime(pbResult.LaneLength, pbResult.UOMID, pbResult.ElapsedTime, pc.LaneLength, pc.UOMID); ves.SeasonBest = BizMgr.GetConvertedTime(sbResult.LaneLength, sbResult.UOMID, sbResult.ElapsedTime, pc.LaneLength, pc.UOMID); vess.ViewEligibleSwimmerList.Add(ves); } //}); return vess; }
public ActionResult SeedHeatSheetEvent(ViewEligibleSwimmers vess) { HeatSheetEvent hse = BizMgr.GetHeatSheetEvent(vess.HeatSheetEventID); try { List<int> selectedSwimmerTeamSeasonIDs = new List<int>(); foreach (ViewEligibleSwimmer swimmer in vess.ViewEligibleSwimmerList) { selectedSwimmerTeamSeasonIDs.Add(swimmer.SwimmerTeamSeasonID); } BizMgr.SeedHeatSheetEvent(vess.HeatSheetEventID, selectedSwimmerTeamSeasonIDs); //Clear the cache so new event will be included in response DataCache.Remove("HeatSheetEvents" + hse.HeatSheetID.ToString()); DataCache.Remove("Heats" + vess.HeatSheetEventID.ToString()); } catch (Exception ex) { LogController.LogError(ex, LogEntryType.NormalError, "", "", "SystemUserID=" + base.CurrentUser.SystemUserID.ToString(), "HeatSheetID=" + vess.HeatSheetEventID.ToString()); } return Heats(vess.HeatSheetEventID); }