protected void showPassoverHeir() { PossibleHeirs ph = (PossibleHeirs)Session["PassoverList"]; List <Character> list = ph.getList(); if (list != null) { gvPossibleHeirs.DataSource = list; gvPossibleHeirs.DataBind(); ModalPopupExtenderHeirs.Show(); } }
protected void btnDynasticSequence_Click(object sender, EventArgs e) { if (Session["GameId"] != null) { int gameId = Convert.ToInt32(Session["GameId"]); int ds = ExtraLib.Sql.getDynasticSequence(gameId); ds++; if (ds > 4) { ds = 1; } ExtraLib.Sql.increaseDynasticSequence(gameId, ds); switch (ds) { case 1: //Birth ExtraLib.Sql.increaseTurn(Convert.ToInt32(Session["GameId"])); Session["Turn"] = Convert.ToInt32(Session["Turn"]) + 1; this.lblYear.Text = "Year: " + ((Convert.ToInt32(Session["Turn"]) * 5) + 1300).ToString(); this.panelEventCombat.Visible = false; //breed all here so its only triggered when the button is clicked and not on every refresh of page. ExtraLib.DynasticSequence.BreedAll(gameId, Convert.ToInt32(Session["Turn"])); itsBirthPhase(); break; case 2: //survival itsSurvivalPhase(); List <List <Character> > theListOfLists = new List <List <Character> >(); Model.CharacterCollection allNewDeaths = ExtraLib.DynasticSequence.SurviveAll(Convert.ToInt32(Session["GameId"]), ref theListOfLists); Model.CharacterCollection englandNewDeaths = new Model.CharacterCollection(); Model.CharacterCollection franceNewDeaths = new Model.CharacterCollection(); Model.CharacterCollection germanyNewDeaths = new Model.CharacterCollection(); Model.CharacterCollection italyNewDeaths = new Model.CharacterCollection(); Model.CharacterCollection spainNewDeaths = new Model.CharacterCollection(); foreach (Character element in allNewDeaths) { if (element.country == 'E') { englandNewDeaths.Add(element); } if (element.country == 'F') { franceNewDeaths.Add(element); } if (element.country == 'G') { germanyNewDeaths.Add(element); } if (element.country == 'I') { italyNewDeaths.Add(element); } if (element.country == 'S') { spainNewDeaths.Add(element); } } gvEnglandNewDeath.DataSource = englandNewDeaths; gvEnglandNewDeath.DataBind(); gvFranceNewDeath.DataSource = franceNewDeaths; gvFranceNewDeath.DataBind(); gvGermanyNewDeath.DataSource = germanyNewDeaths; gvGermanyNewDeath.DataBind(); gvItalyNewDeath.DataSource = italyNewDeaths; gvGermanyNewDeath.DataBind(); gvSpainNewDeath.DataSource = spainNewDeaths; gvSpainNewDeath.DataBind(); PossibleHeirs ph = new PossibleHeirs(theListOfLists); Session["PassoverList"] = ph; showPassoverHeir(); break; case 3: // Marriages //show all available to all players this.panelSurvival.Visible = false; itsMarriagePhase(); refreshAvailableAndProposals(); break; case 4: ExtraLib.Sql.emptyMarriageOffers(Convert.ToInt32(Session["GameId"])); itsEventPhase(); this.panelMarriage.Visible = false; showNewDynasty(); break; } } else { Session["Error"] = "Session timed out"; Response.Redirect("default.aspx"); } }