private void answer_effect(int ans) { try { csHoiThi ob = new csHoiThi(); DataSet ds = ob.fillDataset(string.Format("exec player_answer {0}, {1}", csHoiThi.playerID, ans)); lbError.Text = string.Format("Bạn đã chọn PA. {0} vào giây thứ {1}", ob.PA_convert(ans.ToString()), ds.Tables[0].Rows[0][0].ToString()); btda1.Enabled = (ans != 1); btda2.Enabled = (ans != 2); btda3.Enabled = (ans != 3); btda4.Enabled = (ans != 4); btda5.Enabled = (ans != 5); btda6.Enabled = (ans != 6); } catch { lbError.Text = "Có lỗi xảy ra trong quá trình trả lời"; } }
private void timer1_Tick(object sender, EventArgs e) { try { csHoiThi ob = new csHoiThi(); DataSet ds = ob.fillDataset("EXEC HienThi_Get"); DataRow dr = ds.Tables[0].Rows[0]; textBox1.Text = dr[1].ToString(); tbQuestion.Text = string.Format("Câu {0}. {1}", dr[8].ToString(), dr[2].ToString()) + "\n\tA. " + dr[3].ToString() + "\n\tB. " + dr[4].ToString() + "\n\tC. " + dr[5].ToString() + "\n\tD. " + dr[6].ToString() + "\nĐáp án đúng: PA. " + ob.PA_convert(dr[7].ToString()); if (ds.Tables[1].Rows[0][0].ToString() != "34") this.Close(); } catch { } }
private void btXem_Click(object sender, EventArgs e) { try { dsRow = int.Parse(tbQuestID.Text) - 1; tbQuestID.Text = ""; } catch { dsRow++; } try { csHoiThi ob = new csHoiThi(); // DataSet ds = ob.fillDataset("exec question_get " + tbQuestID.Text); // lbQuestID.Text = ds.Tables[0].Rows[0][0].ToString(); // tbQuestion.Text = ds.Tables[0].Rows[0][1].ToString() // + "\n\tA. " + ds.Tables[0].Rows[0][3].ToString() // + "\n\tB. " + ds.Tables[0].Rows[0][4].ToString() // + "\n\tC. " + ds.Tables[0].Rows[0][5].ToString() // + "\n\tD. " + ds.Tables[0].Rows[0][6].ToString() // + "\n\tE. " + ds.Tables[0].Rows[0][7].ToString() // + "\n\tF. " + ds.Tables[0].Rows[0][8].ToString() // + "\nĐáp án đúng: PA. " + ob.PA_convert(ds.Tables[0].Rows[0][2].ToString()); DataRow dr = dsQuest.Tables[0].Rows[dsRow]; lbQuestID.Text = dr[3].ToString(); tbQuestion.Text = string.Format("{0} _ Câu {1}. {2}", dr[0].ToString(), dr[1].ToString(), dr[4].ToString()) + "\n\tA. " + dr[6].ToString() + "\n\tB. " + dr[7].ToString() + "\n\tC. " + dr[8].ToString() + "\n\tD. " + dr[9].ToString() + "\n\tE. " + dr[10].ToString() + "\n\tF. " + dr[11].ToString() + "\nĐáp án đúng: PA. " + ob.PA_convert(dr[5].ToString()); if (dsRow + 1 < dsQuest.Tables[0].Rows.Count) lbError.Text = string.Format("NEXT: {0} _ Câu {1} / {2}", dsQuest.Tables[0].Rows[dsRow + 1][0].ToString(), dsQuest.Tables[0].Rows[dsRow + 1][1].ToString(), dsQuest.Tables[0].Rows.Count); else lbError.Text = "THE END !!!"; } catch { lbQuestID.Text = ""; lbError.Text = "Có lỗi trong quá trình đọc câu hỏi"; tbQuestion.Text = ""; } }
private void frMayChieu_Diem_Load(object sender, EventArgs e) { this.WindowState = System.Windows.Forms.FormWindowState.Maximized; try { csHoiThi ob = new csHoiThi(); DataSet ds = ob.fillDataset("exec control_markshow"); lbError.Text = "ĐÁP ÁN ĐÚNG: PA. " + ob.PA_convert(ds.Tables[0].Rows[0][1].ToString()); if (ds.Tables[1].Rows.Count > 0) { lbDoiChoi1.Text = ds.Tables[1].Rows[0][0].ToString(); if (ds.Tables[1].Rows[0][1].ToString() == "0") { lbPA1.Text = "-"; lbThoiGian1.Text = "-"; lbDiem1.Text = "0 đ"; } else { lbPA1.Text = "PA. " + ob.PA_convert(ds.Tables[1].Rows[0][1].ToString()); lbThoiGian1.Text = ds.Tables[1].Rows[0][2].ToString() + " s"; lbDiem1.Text = ds.Tables[1].Rows[0][3].ToString() + " đ"; } } else { lbDoiChoi1.Text = ""; lbPA1.Text = ""; lbThoiGian1.Text = ""; lbDiem1.Text = ""; } if (ds.Tables[1].Rows.Count > 1) { lbDoiChoi2.Text = ds.Tables[1].Rows[1][0].ToString(); if (ds.Tables[1].Rows[1][1].ToString() == "0") { lbPA2.Text = "-"; lbThoiGian2.Text = "-"; lbDiem2.Text = "0 đ"; } else { lbPA2.Text = "PA. " + ob.PA_convert(ds.Tables[1].Rows[1][1].ToString()); lbThoiGian2.Text = ds.Tables[1].Rows[1][2].ToString() + " s"; lbDiem2.Text = ds.Tables[1].Rows[1][3].ToString() + " đ"; } } else { lbDoiChoi2.Text = ""; lbPA2.Text = ""; lbThoiGian2.Text = ""; lbDiem2.Text = ""; } if (ds.Tables[1].Rows.Count > 2) { lbDoiChoi3.Text = ds.Tables[1].Rows[2][0].ToString(); if (ds.Tables[1].Rows[2][1].ToString() == "0") { lbPA3.Text = "-"; lbThoiGian3.Text = "-"; lbDiem3.Text = "0 đ"; } else { lbPA3.Text = "PA. " + ob.PA_convert(ds.Tables[1].Rows[2][1].ToString()); lbThoiGian3.Text = ds.Tables[1].Rows[2][2].ToString() + " s"; lbDiem3.Text = ds.Tables[1].Rows[2][3].ToString() + " đ"; } } else { lbDoiChoi3.Text = ""; lbPA3.Text = ""; lbThoiGian3.Text = ""; lbDiem3.Text = ""; } if (ds.Tables[1].Rows.Count > 3) { lbDoiChoi4.Text = ds.Tables[1].Rows[3][0].ToString(); if (ds.Tables[1].Rows[3][1].ToString() == "0") { lbPA4.Text = "-"; lbThoiGian4.Text = "-"; lbDiem4.Text = "0 đ"; } else { lbPA4.Text = "PA. " + ob.PA_convert(ds.Tables[1].Rows[3][1].ToString()); lbThoiGian4.Text = ds.Tables[1].Rows[3][2].ToString() + " s"; lbDiem4.Text = ds.Tables[1].Rows[3][3].ToString() + " đ"; } } else { lbDoiChoi4.Text = ""; lbPA4.Text = ""; lbThoiGian4.Text = ""; lbDiem4.Text = ""; } if (ds.Tables[1].Rows.Count > 4) { lbDoiChoi5.Text = ds.Tables[1].Rows[4][0].ToString(); if (ds.Tables[1].Rows[4][1].ToString() == "0") { lbPA5.Text = "-"; lbThoiGian5.Text = "-"; lbDiem5.Text = "0 đ"; } else { lbPA5.Text = "PA. " + ob.PA_convert(ds.Tables[1].Rows[4][1].ToString()); lbThoiGian5.Text = ds.Tables[1].Rows[4][2].ToString() + " s"; lbDiem5.Text = ds.Tables[1].Rows[4][3].ToString() + " đ"; } } else { lbDoiChoi5.Text = ""; lbPA5.Text = ""; lbThoiGian5.Text = ""; lbDiem5.Text = ""; } if (ds.Tables[1].Rows.Count > 5) { lbDoiChoi6.Text = ds.Tables[1].Rows[5][0].ToString(); if (ds.Tables[1].Rows[5][1].ToString() == "0") { lbPA6.Text = "-"; lbThoiGian6.Text = "-"; lbDiem6.Text = "0 đ"; } else { lbPA6.Text = "PA. " + ob.PA_convert(ds.Tables[1].Rows[5][1].ToString()); lbThoiGian6.Text = ds.Tables[1].Rows[5][2].ToString() + " s"; lbDiem6.Text = ds.Tables[1].Rows[5][3].ToString() + " đ"; } } else { lbDoiChoi6.Text = ""; lbPA6.Text = ""; lbThoiGian6.Text = ""; lbDiem6.Text = ""; } } catch { } }