protected void proteinSubmitBtn_Click(object sender, EventArgs e) { CalcScores calculate = new CalcScores(); int correctAnswer = 0; string answer1 = TextBox1.Text; string answer2 = TextBox2.Text; string answer3 = TextBox3.Text; string answer4 = TextBox4.Text; string answer5 = TextBox5.Text; if (answer1 == "transcription" || answer1 == "translation") { correctAnswer++; } if (answer2 == "translation" || answer2 == "transcription") { correctAnswer++; } if (answer3 == "dna") { correctAnswer++; } if (answer4 == "helix") { correctAnswer++; } if (answer5 == "anticodon") { correctAnswer++; } if (correctAnswer >= 4) { lblProteinResult.Text = "Congratulations! You score: " + correctAnswer.ToString() + " correctly out of 5. Your grade is: " + calculate.CalculateScore(correctAnswer) + "%" + " Please wait. You will be given a downloadable link in 5 seconds."; HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; meta.Content = "5;gameLink2.aspx"; this.Page.Controls.Add(meta); } else { lblProteinResult.Text = "You score: " + correctAnswer.ToString() + "correctly out of 5. Your grade is: " + calculate.CalculateScore(correctAnswer) + "%" + " Please try again."; } int score = correctAnswer; SqlDataSource userQuizDataSource = new SqlDataSource(); userQuizDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); userQuizDataSource.InsertCommand = "INSERT INTO [QuizScore] ([UserId], [Score], [DateTaken]) VALUES (@UserId, @Score, @DateTaken)"; userQuizDataSource.InsertParameters.Add("UserID", Session["UserId"].ToString()); userQuizDataSource.InsertParameters.Add("Score", score.ToString()); userQuizDataSource.InsertParameters.Add("DateTaken", DateTime.Now.ToString()); userQuizDataSource.Insert(); }
protected void dnaSubmitBtn_Click(object sender, EventArgs e) { CalcScores calculate = new CalcScores(); int correctAnswer = 0; string answer1 = TextBox1.Text; string answer2 = TextBox2.Text; string answer3 = TextBox3.Text; string answer4 = TextBox4.Text; string answer5 = TextBox5.Text; if (answer1 == "eukaryotic") { correctAnswer++; } if (answer2 == "nucleus") { correctAnswer++; } if (answer3 == "mitochondria") { correctAnswer++; } if (answer4 == "vacuole") { correctAnswer++; } if (answer5 == "chloroplast") { correctAnswer++; } if (correctAnswer >= 4) { lblCellResult.Text = "Congratulations! You score: " + correctAnswer.ToString() + " correctly out of 5. Your grade is: " + calculate.CalculateScore(correctAnswer) + "%" + " Please wait. You will be given a downloadable link in 5 seconds."; HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; meta.Content = "5;gameLink3.aspx"; this.Page.Controls.Add(meta); } else { lblCellResult.Text = "You score: " + correctAnswer.ToString() + "correctly out of 5. Your grade is: " + calculate.CalculateScore(correctAnswer) + "%" + " Please try again."; } int score = correctAnswer; }
protected void dnaSubmitBtn_Click(object sender, EventArgs e) { CalcScores calculate = new CalcScores(); int correctAnswer = 0; string answer1 = TextBox1.Text; string answer2 = TextBox2.Text; string answer3 = TextBox3.Text; string answer4 = TextBox4.Text; string answer5 = TextBox5.Text; if (answer1 == "replication") { correctAnswer++; } if (answer2 == "cytosine") { correctAnswer++; } if (answer3 == "adenine") { correctAnswer++; } if (answer4 == "helicase") { correctAnswer++; } if (answer5 == "ligase") { correctAnswer++; } if (correctAnswer >= 4) { lblResult.Text = "Congratulations! You score: " + correctAnswer.ToString() + " correctly out of 5. Your grade is: " + calculate.CalculateScore(correctAnswer) + "% Please wait. You will be given a downloadable link in 5 seconds."; HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; meta.Content = "5;gameLink1.aspx"; this.Page.Controls.Add(meta); } else { lblResult.Text = "You score: " + correctAnswer.ToString() + "correctly out of 5. Your grade is: " + calculate.CalculateScore(correctAnswer) + "%" + " Please try again."; } }