public ActionResult OKButtonClick() { AppData.Refresh(); if (AppData.DBConnectionString == "") { TempData["WarningMessage"] = "Scoring database not yet selected"; return(RedirectToAction("Index", "StartScreen")); } Settings.Refresh(); HandRecords.Set(); return(RedirectToAction("Index", "Section")); }
public ActionResult OKButtonClick() { AppData.Refresh(); if (AppData.DBConnectionString == "") { TempData["warningMessage"] = "Scoring database not yet selected"; return(RedirectToAction("Index", "StartScreen")); } Settings.Refresh(); AppData.SetTabletDevicesPerTable(); if (Settings.ShowHandRecord || Settings.ValidateLeadCard) { HandRecords.Refresh(); } return(RedirectToAction("Index", "EnterSection")); }
public ActionResult OKButtonClick(int tabletDeviceNumber, int newRoundNumber) { TabletDeviceStatus tabletDeviceStatus = AppData.TabletDeviceStatusList[tabletDeviceNumber]; Section section = AppData.SectionsList.Find(x => x.SectionID == tabletDeviceStatus.SectionID); if (section.TabletDevicesPerTable > 1) // Tablet devices are moving, so need to check if new table is ready { // Get the move for this tablet device RoundsList roundsList = new RoundsList(tabletDeviceStatus.SectionID, newRoundNumber); Move move = roundsList.GetMove(tabletDeviceStatus.TableNumber, tabletDeviceStatus.PairNumber, tabletDeviceStatus.Direction); if (move.NewTableNumber == 0) // Move is to phantom table, so go straight to RoundInfo { tabletDeviceStatus.Update(0, Direction.Sitout, newRoundNumber); return(RedirectToAction("Index", "ShowRoundInfo", new { tabletDeviceNumber })); } // Check if the new table (the one we're trying to move to) is ready. Expanded code here to make it easier to understand bool newTableReady; TableStatus newTableStatus = AppData.TableStatusList.Find(x => x.SectionID == section.SectionID && x.TableNumber == move.NewTableNumber); if (newTableStatus == null) { newTableReady = false; // New table not yet registered (unlikely but possible) } else if (newTableStatus.RoundNumber == newRoundNumber) { newTableReady = true; // New table has already been advanced to next round by another tablet device, so is ready } else if (newTableStatus.RoundNumber < newRoundNumber - 1) { newTableReady = false; // New table hasn't yet reached the previous round (unlikely but possible) } else { // New table is on the previous round // It is ready for the move if all tablet device locations are ready. Sitout locations were set to 'ready' previously if (section.TabletDevicesPerTable == 2 && newTableStatus.ReadyForNextRoundNorth && newTableStatus.ReadyForNextRoundEast) { newTableReady = true; } else if (section.TabletDevicesPerTable == 4 && newTableStatus.ReadyForNextRoundNorth && newTableStatus.ReadyForNextRoundSouth && newTableStatus.ReadyForNextRoundEast && newTableStatus.ReadyForNextRoundWest) { newTableReady = true; } else { newTableReady = false; } } if (newTableReady) // Reset tablet device and table statuses for new round { tabletDeviceStatus.Update(move.NewTableNumber, move.NewDirection, newRoundNumber); newTableStatus.Update(move.NewTableNumber, newRoundNumber); } else // Go back and wait { return(RedirectToAction("Index", "ShowMove", new { tabletDeviceNumber, newRoundNumber, tableNotReadyNumber = move.NewTableNumber })); } } else // Tablet device not moving and is the only tablet device at this table { tabletDeviceStatus.RoundNumber = newRoundNumber; TableStatus newTableStatus = AppData.TableStatusList.Find(x => x.SectionID == tabletDeviceStatus.SectionID && x.TableNumber == tabletDeviceStatus.TableNumber); newTableStatus.Update(tabletDeviceStatus.TableNumber, newRoundNumber); } // Refresh settings and hand records for the start of the round Settings.Refresh(); if (Settings.ShowHandRecord || Settings.ValidateLeadCard) { HandRecords.Refresh(); } return(RedirectToAction("Index", "ShowPlayerNumbers", new { tabletDeviceNumber })); }