private void RefreshGridView() { int count_done = dgTemp.Rows.Count; int count_of_questions = QB.GetCount_of_Question(bank_id); int score_id = 0; double score = double.Parse(txtTempPoin.Text) / count_of_questions; if (count_done == 0) { DialogResult dr = MessageBox.Show("FINISH. Your Score : " + score, "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); if (dr == DialogResult.OK) { timer1.Stop(); this.Close(); if (temp_score_id != 0) { score_id = int.Parse(SC.Get_User_Id(temp_score_id)); FormQuis FQ = new FormQuis(score_id); FQ.ShowDialog(); FQ.RefreshGridView(); } else { int temp_user_id = Convert.ToInt32(SC.Get_User_Create(bank_id)); FormBank FB = new FormBank(temp_user_id); FB.ShowDialog(); } } } }
private void btnClose_Click(object sender, EventArgs e) { double count_question = QB.GetCount_of_Question(int.Parse(txtID.Text)); double score = double.Parse(txtTempPoin.Text) / count_question; DialogResult dr = MessageBox.Show("Are You Sure to End this Question?", "QUESTION", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { this.Close(); if (temp_score_id != 0) { SC.SaveScore(score, Get_Finish_Time(), temp_score_id); int score_id = int.Parse(SC.Get_User_Id(temp_score_id)); FormQuis FQ = new FormQuis(score_id); FQ.ShowDialog(); FQ.RefreshGridView(); } else { int temp_user_id = Convert.ToInt32(SC.Get_User_Create(bank_id)); FormBank FB = new FormBank(temp_user_id); FB.ShowDialog(); } } }
private void timer1_Tick(object sender, EventArgs e) { second = second - 1; if (second == -1) { minutes = minutes - 1; second = 59; } if (minutes == -1) { hours = hours - 1; minutes = 59; } if (hours == 0 && minutes == 00 && second == 00) { timer1.Stop(); int count_of_questions = QB.GetCount_of_Question(bank_id); double score = double.Parse(txtTempPoin.Text) / count_of_questions; DialogResult dr = MessageBox.Show("TIMES UP. Your Score : " + score, "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); if (dr == DialogResult.OK) { this.Close(); SC.SaveScore(score, Get_Finish_Time(), temp_score_id); int score_id = int.Parse(SC.Get_User_Id(temp_score_id)); FormQuis FQ = new FormQuis(score_id); FQ.ShowDialog(); FQ.RefreshGridView(); } } lblHours.Text = Convert.ToString(hours); lblMinutes.Text = Convert.ToString(minutes); lblSecond.Text = Convert.ToString(second); }