private void button3_Click(object sender, EventArgs e) { bool IsDisable = false; string AcademicYear = Program.CurrAcademicYear; int LevelId = Convert.ToInt32(Level.Split(',')[1]); int RoundId = Convert.ToInt32(Round.Split(',')[1]); var NoOfQuestionPerTeam = _noQuesPerLeavelRoundService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId).Select(x => x.NoOfQuestion).FirstOrDefault(); if (NoOfQuestionPerTeam != 0) { var NoOfAttemptQues = _attamtedQuestionsService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId && x.AcademicYear == AcademicYear).ToList(); if (NoOfAttemptQues.Count() == NoOfQuestionPerTeam * teamCount) { IsDisable = true; } else { IsDisable = false; } } if (IsDisable == true && Round.Split(',')[0] != "tie Breaker") { button3.Enabled = false; NexrRoundForm nextRoundForm = new NexrRoundForm(); nextRoundForm.LevelROundLbl.Text = Level.Split(',')[0] + " " + Round.Split(',')[0] + " finished , Please go to next level"; nextRoundForm.button1.Text = "Next Level >>"; nextRoundForm.ShowDialog(); this.Close(); Program.chooseLevelForm.Text = "Choose quiz level and round"; if (Program.chooseLevelForm.IsDisposed) { Program.chooseLevelForm = new ChooseLevelForm(); } Program.chooseLevelForm.ChooseLevelForm_Load(sender, e); Program.chooseLevelForm.Activate(); Program.chooseLevelForm.Show(); } else { GetQuestion(); } }
private void button1_Click(object sender, EventArgs e) { bool IsDisable = false; string AcademicYear = Program.CurrAcademicYear; int LevelId = Convert.ToInt32(Level.Split(',')[1]); int RoundId = Convert.ToInt32(Round.Split(',')[1]); var NoOfQuestionPerTeam = _noQuesPerLeavelRoundService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId).Select(x => x.NoOfQuestion).FirstOrDefault(); if (NoOfQuestionPerTeam != 0) { if (!String.IsNullOrEmpty(Program.TeamA)) { int TeamId = _quizTeamService.GetAll().Where(x => x.Name == Program.TeamA).Select(x => x.Id).FirstOrDefault(); var NoOfAttemptQues = _attamtedQuestionsService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId && x.TeamId == TeamId && x.AcademicYear == AcademicYear).ToList(); if (NoOfAttemptQues.Count() == NoOfQuestionPerTeam) { IsDisable = true; } else { IsDisable = false; } } if (!String.IsNullOrEmpty(Program.TeamB)) { int TeamId = _quizTeamService.GetAll().Where(x => x.Name == Program.TeamB).Select(x => x.Id).FirstOrDefault(); var NoOfAttemptQues = _attamtedQuestionsService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId && x.TeamId == TeamId && x.AcademicYear == AcademicYear).ToList(); if (NoOfAttemptQues.Count() == NoOfQuestionPerTeam) { IsDisable = true; } else { IsDisable = false; } } if (!String.IsNullOrEmpty(Program.TeamC)) { int TeamId = _quizTeamService.GetAll().Where(x => x.Name == Program.TeamC).Select(x => x.Id).FirstOrDefault(); var NoOfAttemptQues = _attamtedQuestionsService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId && x.TeamId == TeamId && x.AcademicYear == AcademicYear).ToList(); if (NoOfAttemptQues.Count() == NoOfQuestionPerTeam) { IsDisable = true; } else { IsDisable = false; } } if (!String.IsNullOrEmpty(Program.TeamD)) { int TeamId = _quizTeamService.GetAll().Where(x => x.Name == Program.TeamD).Select(x => x.Id).FirstOrDefault(); var NoOfAttemptQues = _attamtedQuestionsService.GetAll().Where(x => x.LevelId == LevelId && x.RoundId == RoundId && x.TeamId == TeamId && x.AcademicYear == AcademicYear).ToList(); if (NoOfAttemptQues.Count() == NoOfQuestionPerTeam) { IsDisable = true; } else { IsDisable = false; } } } if (IsDisable == true && Round.Split(',')[0] != "tie Breaker") { button1.Enabled = false; NexrRoundForm nextRoundForm = new NexrRoundForm(); nextRoundForm.LevelROundLbl.Text = Level.Split(',')[0] + " " + Round.Split(',')[0] + " finished , Please click on next button"; nextRoundForm.ShowDialog(); this.Close(); Program.Level = Level.Split(',')[0] + "," + LevelId.ToString(); Program.Round = "Round4," + _quizRoundService.GetAll().Where(x => x.Name == "Round4").Select(x => x.Id).FirstOrDefault().ToString(); Level2Round4Form Question = new Level2Round4Form(); Question.Text = "Question"; Question.Show(); } else { GetQuestion(); } }