public ActionResult PublishGameOnline(Game game) { try { if (GameManager.PublishGameOnline(game.GameId, true)) return Redirect(Url.Content("~/game/manage/" + game.PrivateKeyForGame.ToString().Replace("-", "") + "/" + game.GameId.ToString().Replace("-", ""))); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, GetType()); } return Redirect(Url.Content("~/?u=" + SiteMessagesEnum.na)); }
public ActionResult EmbedSilverlightWithGame(Game game) { try { if (HttpContext.Request.Form["addSilverlight"] != null) { if (GameManager.EmbedSilverlightWithGame(game.GameId, game.StreamingUrlSilverlight, game.StreamingMobileUrlSilverlight, Scoreboard.Library.ViewModel.GameVideoTypeEnum.SilverLightLive)) return Redirect(Url.Content("~/scoreboard/manage/" + game.PrivateKeyForGame.ToString().Replace("-", "") + "/" + game.GameId.ToString().Replace("-", ""))); } else if (HttpContext.Request.Form["removeSilverlight"] != null) { if (GameManager.RemoveSilverlightVideoWithGame(game.GameId)) return Redirect(Url.Content("~/scoreboard/manage/" + game.PrivateKeyForGame.ToString().Replace("-", "") + "/" + game.GameId.ToString().Replace("-", ""))); } } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return Redirect(Url.Content("~/")); }
public ActionResult ManagePost(Game game) { try { var gameDb = GameManager.GetGameForManagement(game.GameId, game.PrivateKeyForGame, RDN.Library.Classes.Account.User.GetMemberId()); if (game == null) return Redirect(Url.Content("~/")); gameDb.GameName = game.GameName; gameDb.GameDate = game.GameDate; for (int i = 0; i < gameDb.MembersOfGame.Count; i++) { string linkId = HttpContext.Request.Form[gameDb.MembersOfGame[i].MemberId.ToString().Replace("-", "") + "hidden"]; if (String.IsNullOrEmpty(linkId)) gameDb.MembersOfGame[i].MemberLinkId = new Guid(); else { if (new Guid(linkId) != gameDb.MembersOfGame[i].MemberLinkId) { gameDb.MembersOfGame[i].MemberLinkId = new Guid(linkId); } } } gameDb.SelectedShop = game.SelectedShop; gameDb.SelectedTournament = game.SelectedTournament; gameDb.PassCodeEnteredForTournament = game.PassCodeEnteredForTournament; for (int i = 0; i < gameDb.MemberOwners.Count + 5; i++) { if (HttpContext.Request.Form["MemberOwner" + i + "hidden"] != null && !String.IsNullOrEmpty(HttpContext.Request.Form["MemberOwner" + i + "hidden"].ToString())) { MemberDisplayBasic mem = new MemberDisplayBasic(); mem.MemberId = new Guid(HttpContext.Request.Form["MemberOwner" + i + "hidden"].ToString()); gameDb.MemberOwners.Add(mem); } if (HttpContext.Request.Form["LeagueOwner" + i + "hidden"] != null && !String.IsNullOrEmpty(HttpContext.Request.Form["LeagueOwner" + i + "hidden"].ToString())) { RDN.Portable.Classes.League.Classes.League mem = new Portable.Classes.League.Classes.League(); mem.LeagueId = new Guid(HttpContext.Request.Form["LeagueOwner" + i + "hidden"].ToString()); gameDb.LeagueOwners.Add(mem); } if (HttpContext.Request.Form["FederationOwner" + i + "hidden"] != null && !String.IsNullOrEmpty(HttpContext.Request.Form["FederationOwner" + i + "hidden"].ToString())) { FederationDisplay mem = new FederationDisplay(); mem.FederationId = new Guid(HttpContext.Request.Form["FederationOwner" + i + "hidden"].ToString()); gameDb.FederationOwners.Add(mem); } } if (!String.IsNullOrEmpty(game.EmbededVideoString)) gameDb.IsThereVideoOfGame = GameVideoTypeEnum.EmbededVideo; else if (!String.IsNullOrEmpty(game.StreamingUrlSilverlight)) gameDb.IsThereVideoOfGame = GameVideoTypeEnum.SilverLightLive; gameDb.StreamingMobileUrlSilverlight = game.StreamingMobileUrlSilverlight; gameDb.StreamingUrlSilverlight = game.StreamingUrlSilverlight; gameDb.EmbededVideoString = game.EmbededVideoString; gameDb.SelectedPaywall = game.SelectedPaywall; GameManager.UpdateGameFromManagement(gameDb); try { //clears the live game once we complete the update. WebClient client = new WebClient(); client.DownloadString(ServerConfig.URL_TO_CLEAR_LIVE_GAME_CACHE + game.GameId.ToString()); } catch { } try { //clears the live game once we complete the update. WebClient client = new WebClient(); client.DownloadString(ServerConfig.WEBSITE_CLEAR_TOURNAMENT_CACHE_API); } catch { } return Redirect(Url.Content("~/game/manage/" + game.PrivateKeyForGame.ToString().Replace("-", "") + "/" + game.GameId.ToString().Replace("-", "") + "?u=" + SiteMessagesEnum.s)); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, GetType()); } return Redirect(Url.Content("~/?u=" + SiteMessagesEnum.na)); }