private void ResetAllMatches(List <MatchesEntity> matchList) { if (matchList.Count > 0) { for (int i = 0; i < matchList.Count(); i++) { //Temp save the match @ index i MatchesEntity newMatch = new MatchesEntity() { MatchID = i, CardMatchNumber = matchList[i].CardMatchNumber, MatchTitle = matchList[i].MatchTitle, AttachedCardName = matchList[i].AttachedCardName, MatchType = matchList[i].MatchType, MatchRules = matchList[i].MatchRules, NumOfRounds = matchList[i].NumOfRounds, MinsPerRound = matchList[i].MinsPerRound, MatchMins = matchList[i].MatchMins, NumOfFalls = matchList[i].NumOfFalls, Title = matchList[i].Title, Participant1 = matchList[i].Participant1, Participant2 = matchList[i].Participant2, Participant3 = matchList[i].Participant3, Participant4 = matchList[i].Participant4, Participant5 = matchList[i].Participant5, Participant6 = matchList[i].Participant6, Participant7 = matchList[i].Participant7, Participant8 = matchList[i].Participant8 }; //Save it with new index mHelper.SaveMatchesList(newMatch); } } }
public void SaveGame( List <Brands> brands, List <Cards> cards, List <Matches> matches, List <Promotions> promotions, List <Teams> teams, List <TitlesMain> titles, List <WrestlersMain> wrestlers ) { string dir = string.Concat(Directory.GetCurrentDirectory(), "\\Saves"); if (!Directory.Exists(dir)) { Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Saves")); } else { string main = string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\" + "\\" + "Main"); if (!Directory.Exists(main)) { Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\" + "\\" + "Main")); } else { BrandHelper bHelper = new BrandHelper(); CardHelper cHelper = new CardHelper(); MatchHelper mHelper = new MatchHelper(); PromotionHelper pHelper = new PromotionHelper(); TeamHelper tHelper = new TeamHelper(); TitleHelper tlHelper = new TitleHelper(); WrestlerHelper wHelper = new WrestlerHelper(); foreach (Brands b in brands) { bHelper.SaveBrandsList(b); } foreach (Cards c in cards) { cHelper.SaveCardsList(c); } foreach (Matches m in matches) { mHelper.SaveMatchesList(m); } foreach (Promotions p in promotions) { pHelper.SavePromotionsList(p); } foreach (Teams t in teams) { tHelper.SaveTeamsList(t); } foreach (TitlesMain tl in titles) { tlHelper.SaveTitlesList(tl); } foreach (WrestlersMain w in wrestlers) { wHelper.SaveWrestlersList(w); } } } }
private void button1_Click(object sender, EventArgs e) { IDSetterHelper idHelper = new IDSetterHelper(); int rnds, rndsMins, mMins, mFalls; if (cbxRoundsCount.SelectedItem == null) { rnds = 0; } else { rnds = Convert.ToInt32(cbxRoundsCount.SelectedItem.ToString()); } if (cbxRndsMinPerRnds.SelectedItem == null) { rndsMins = 0; } else { rndsMins = Convert.ToInt32(cbxRndsMinPerRnds.SelectedItem.ToString().ToString()); } if (cbxFallsCount.SelectedItem == null) { mFalls = 0; } else { mFalls = Convert.ToInt32(cbxFallsCount.SelectedItem.ToString().ToString()); } if (cbxMatchMins.SelectedItem == null) { mMins = 0; } else { mMins = Convert.ToInt32(cbxMatchMins.SelectedItem.ToString().ToString()); } string title; if (cbxTitles.SelectedItem == null) { title = ""; } else { title = cbxTitles.SelectedItem.ToString(); } string part1 = ""; string part2 = ""; string part3 = ""; string part4 = ""; string part5 = ""; string part6 = ""; string part7 = ""; string part8 = ""; /* * Singles Match * Tag Team Match * 6-Man Tag Match * 8-Man Tag Match * Battle Royal */ if (cbxMatchType.SelectedItem.ToString() == "Singles Match") { if (cbxPart1.SelectedItem == null) { cbxPart1.BackColor = Color.MistyRose; } else { part1 = cbxPart1.SelectedItem.ToString(); } if (cbxPart2.SelectedItem == null) { cbxPart2.BackColor = Color.MistyRose; } else { part2 = cbxPart2.SelectedItem.ToString(); } part3 = ""; part4 = ""; part5 = ""; part6 = ""; part7 = ""; part8 = ""; } else if (cbxMatchType.SelectedItem.ToString() == "Tag Team Match") { if (cbxPart1.SelectedItem == null) { cbxPart1.BackColor = Color.MistyRose; } else { part1 = cbxPart1.SelectedItem.ToString(); } if (cbxPart3.SelectedItem == null) { cbxPart3.BackColor = Color.MistyRose; } else { part3 = cbxPart3.SelectedItem.ToString(); } if (cbxPart2.SelectedItem == null) { cbxPart2.BackColor = Color.MistyRose; } else { part2 = cbxPart2.SelectedItem.ToString(); } if (cbxPart4.SelectedItem == null) { cbxPart4.BackColor = Color.MistyRose; } else { part4 = cbxPart4.SelectedItem.ToString(); } part5 = ""; part6 = ""; part7 = ""; part8 = ""; } else if (cbxMatchType.SelectedItem.ToString() == "6-Man Tag Match") { if (cbxPart1.SelectedItem == null) { cbxPart1.BackColor = Color.MistyRose; } else { part1 = cbxPart1.SelectedItem.ToString(); } if (cbxPart3.SelectedItem == null) { cbxPart3.BackColor = Color.MistyRose; } else { part3 = cbxPart3.SelectedItem.ToString(); } if (cbxPart5.SelectedItem == null) { cbxPart5.BackColor = Color.MistyRose; } else { part5 = cbxPart5.SelectedItem.ToString(); } if (cbxPart2.SelectedItem == null) { cbxPart2.BackColor = Color.MistyRose; } else { part2 = cbxPart2.SelectedItem.ToString(); } if (cbxPart4.SelectedItem == null) { cbxPart4.BackColor = Color.MistyRose; } else { part4 = cbxPart4.SelectedItem.ToString(); } if (cbxPart6.SelectedItem == null) { cbxPart6.BackColor = Color.MistyRose; } else { part6 = cbxPart6.SelectedItem.ToString(); } part7 = ""; part8 = ""; } else if (cbxMatchType.SelectedItem.ToString() == "8-Man Tag Match" || cbxMatchType.SelectedItem.ToString() == "Battle Royal") { if (cbxPart1.SelectedItem == null) { cbxPart1.BackColor = Color.MistyRose; } else { part1 = cbxPart1.SelectedItem.ToString(); } if (cbxPart3.SelectedItem == null) { cbxPart3.BackColor = Color.MistyRose; } else { part3 = cbxPart3.SelectedItem.ToString(); } if (cbxPart5.SelectedItem == null) { cbxPart5.BackColor = Color.MistyRose; } else { part5 = cbxPart5.SelectedItem.ToString(); } if (cbxPart7.SelectedItem == null) { cbxPart7.BackColor = Color.MistyRose; } else { part7 = cbxPart7.SelectedItem.ToString(); } if (cbxPart2.SelectedItem == null) { cbxPart2.BackColor = Color.MistyRose; } else { part2 = cbxPart2.SelectedItem.ToString(); } if (cbxPart4.SelectedItem == null) { cbxPart4.BackColor = Color.MistyRose; } else { part4 = cbxPart4.SelectedItem.ToString(); } if (cbxPart6.SelectedItem == null) { cbxPart6.BackColor = Color.MistyRose; } else { part6 = cbxPart6.SelectedItem.ToString(); } if (cbxPart8.SelectedItem == null) { cbxPart8.BackColor = Color.MistyRose; } else { part8 = cbxPart8.SelectedItem.ToString(); } } MatchesEntity newMatch = new MatchesEntity() { MatchID = idHelper.CurrentID(false, false, true, false, false, false, false), CardMatchNumber = storeHelper.MatchesList.Count() + 1, MatchTitle = tbMatchTitle.Text, AttachedCardName = CardName, MatchType = cbxMatchType.SelectedItem.ToString(), MatchRules = cbxMatchRules.SelectedItem.ToString(), NumOfRounds = rnds, MinsPerRound = rndsMins, MatchMins = mMins, NumOfFalls = mFalls, Title = title, Participant1 = part1, Participant2 = part2, Participant3 = part3, Participant4 = part4, Participant5 = part5, Participant6 = part6, Participant7 = part7, Participant8 = part8 }; mHelper.SaveMatchesList(newMatch); NewCard n = new NewCard(OrgName, false, thisCard.CardName); n.Show(); this.Hide(); }
private void SaveCurrentMatch(MatchesEntity match) { if (match.MatchRules != "SWA Match" || match.MatchRules != "Gruesome Match") { match.FinalFallCount = Convert.ToInt32(udFallNum.Value); match.FinalMatchMins = Convert.ToInt32(udMatchMins.Value); match.FinalMatchSecs = Convert.ToInt32(udMatchSecs.Value); match.MatchRating = Convert.ToInt32(udMatchRating.Value); if (match.MatchType == "Singles Match" || match.MatchType == "Tag Team Match" || match.MatchType == "6-Man Tag Match" || match.MatchType == "8-Man Tag Match") { if (cbRed1.Checked) { match.RedSideResult = "Won"; match.BlueSideResult = "Loss"; if (match.MatchType == "Singles Match") { match.MatchWinners = tbPart1.Text; } else if (match.MatchType == "Tag Team Match") { match.MatchWinners = tbPart1.Text + " & " + tbPart3.Text; } else if (match.MatchType == "6-Man Tag Match") { match.MatchWinners = tbPart1.Text + " & " + tbPart3.Text + " & " + tbPart5.Text; } else if (match.MatchType == "8-Man Tag Match") { match.MatchWinners = tbPart1.Text + " & " + tbPart3.Text + " & " + tbPart5.Text + " & " + tbPart7.Text; } } else if (cbBlue1.Checked) { match.RedSideResult = "Loss"; match.BlueSideResult = "Won"; if (match.MatchType == "Singles Match") { match.MatchWinners = tbPart2.Text; } else if (match.MatchType == "Tag Team Match") { match.MatchWinners = tbPart2.Text + " & " + tbPart4.Text; } else if (match.MatchType == "6-Man Tag Match") { match.MatchWinners = tbPart2.Text + " & " + tbPart4.Text + " & " + tbPart6.Text; } else if (match.MatchType == "8-Man Tag Match") { match.MatchWinners = tbPart2.Text + " & " + tbPart4.Text + " & " + tbPart6.Text + " & " + tbPart8.Text; } } else { match.RedSideResult = "Draw"; match.BlueSideResult = "Draw"; match.MatchWinners = "Match Draw"; } } else if (match.MatchType == "Battle Royal") { if (cbRed1.Checked) { match.RedSideResult = "Won"; match.BlueSideResult = "Loss"; match.MatchWinners = tbPart1.Text; } else if (cbRed2.Checked) { match.RedSideResult = "Won"; match.BlueSideResult = "Loss"; match.MatchWinners = tbPart3.Text; } else if (cbRed3.Checked) { match.RedSideResult = "Won"; match.BlueSideResult = "Loss"; match.MatchWinners = tbPart5.Text; } else if (cbRed4.Checked) { match.RedSideResult = "Won"; match.BlueSideResult = "Loss"; match.MatchWinners = tbPart7.Text; } else if (cbBlue1.Checked) { match.RedSideResult = "Loss"; match.BlueSideResult = "Won"; match.MatchWinners = tbPart2.Text; } else if (cbBlue2.Checked) { match.RedSideResult = "Loss"; match.BlueSideResult = "Won"; match.MatchWinners = tbPart4.Text; } else if (cbBlue3.Checked) { match.RedSideResult = "Loss"; match.BlueSideResult = "Won"; match.MatchWinners = tbPart6.Text; } else if (cbBlue4.Checked) { match.RedSideResult = "Loss"; match.BlueSideResult = "Won"; match.MatchWinners = tbPart8.Text; } else { match.RedSideResult = "Draw"; match.BlueSideResult = "Draw"; match.MatchWinners = "Match Draw"; } } mHelper.SaveMatchesList(match); } else { match.FinalNumOfRounds = Convert.ToInt32(udRndNum.Value); match.FinalMatchMins = Convert.ToInt32(udMatchMins.Value); match.FinalMatchSecs = Convert.ToInt32(udMatchSecs.Value); match.MatchRating = Convert.ToInt32(udMatchRating.Value); if (cbRed1.Checked) { match.RedSideResult = "Won"; match.BlueSideResult = "Loss"; match.MatchWinners = tbPart1.Text; } else if (cbBlue1.Checked) { match.RedSideResult = "Loss"; match.BlueSideResult = "Won"; match.MatchWinners = tbPart2.Text; } else { match.RedSideResult = "Draw"; match.BlueSideResult = "Draw"; match.MatchWinners = "Match Draw"; } mHelper.SaveMatchesList(match); } }