Example #1
0
 // Đừng nhấn chuông trước >"<
 // btNhanChuong_Click
 private void btNhanChuong_MouseDown(object sender, MouseEventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         DataSet ds = ob.fillDataset("exec control_set 15, " + csHoiThi.playerID);
         if (ds.Tables[0].Rows[0][0].ToString() == "15" || ds.Tables[0].Rows[0][0].ToString() == "33") lbError.Text = "Đã có đội chơi nhấn chuông";
         else
             if (ds.Tables[0].Rows[0][0].ToString() == "14")
                 if (ds.Tables[0].Rows[0][1].ToString() == "1")
                 {
                     lbError.Text = "Bạn đã giành được quyền trả lời câu hỏi";
                     btNhanChuong.Enabled = false;
                 }
                 else lbError.Text = "Nhấn chuông thất bại";
             else if (ds.Tables[0].Rows[0][0].ToString() == "32")
                 if (ds.Tables[0].Rows[0][1].ToString() == "1")
                 {
                     lbError.Text = "Bạn đã nhấn chuông";
                     btNhanChuong.Enabled = false;
                 }
                 else lbError.Text = "Nhấn chuông thất bại";
             else
             {
                 lbError.Text = "Bạn đã phạm quy";
                 btNhanChuong.Text = "PHẠM QUY";
                 btNhanChuong.Enabled = false;
             }
     }
     catch { lbError.Text = "Có lỗi xảy ra trong quá trình nhấn chuông"; }
 }
Example #2
0
 private void btBoDe_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         dsQuest = ob.fillDataset("exec group_get " + tbGroup.Text);
         tbGroup.Text = "";
         lbQuestID.Text = "";
         dsRow = -1;
         tbQuestion.Text = "";
         lbError.Text = string.Format("NEXT: {0} _ Câu {1}. Bộ đề {2} ({3})",
             dsQuest.Tables[0].Rows[dsRow + 1][0].ToString(),
             dsQuest.Tables[0].Rows[dsRow + 1][1].ToString(),
             dsQuest.Tables[0].Rows[dsRow + 1][2].ToString(),
             dsQuest.Tables[0].Rows.Count);
     }
     catch
     {
         dsQuest = new DataSet();
         lbQuestID.Text = "";
         dsRow = -1;
         tbQuestion.Text = "";
         lbError.Text = "Có lỗi xảy ra trong quá trình đọc bộ đề";
     }
 }
Example #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         StreamReader file = new StreamReader(openFileDialog1.FileName);
         string line = file.ReadLine();
         string[] split;
         csHoiThi ob = new csHoiThi();
         string cmd, grID, quest, ans1, ans2, ans3, ans4, ans5, ans6;
         while (line != null)
             try
             {
                 grID = "0";
                 quest = "";
                 ans1 = ""; ans2 = ""; ans3 = ""; ans4 = ""; ans5 = ""; ans6 = "";
                 split = line.Split('\t');
                 for (int i = 0; i < split.Length; i++)
                     if (i == 0) grID = split[i];
                     else if (i == 1) quest = split[i];
                     else if (i == 2) ans1 = split[i];
                     else if (i == 3) ans2 = split[i];
                     else if (i == 4) ans3 = split[i];
                     else if (i == 5) ans4 = split[i];
                     else if (i == 6) ans5 = split[i];
                     else if (i == 7) ans6 = split[i];
                 cmd = string.Format("EXEC tbQuestion_Insert {0}, N'{1}', N'{2}', N'{3}', N'{4}', N'{5}', N'{6}', N'{7}'",
                     grID, quest, ans1, ans2, ans3, ans4, ans5, ans6);
                 ob.fillDataset(cmd);
                 line = file.ReadLine();
             }
             catch { }
         file.Close();
         button1.Enabled = false;
     }
 }
Example #4
0
 private void btClear_XH_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("exec control_set 11, 0");
     }
     catch { lbError.Text = "Có lỗi trong quá trình xóa câu hỏi"; }
 }
Example #5
0
 private void btChuong2_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("exec control_set 18, 0");
         timer1.Enabled = true;
     }
     catch { lbError.Text = "ERROR: control_set 18"; }
 }
Example #6
0
 private void btHienThi_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset(string.Format("EXEC HienThi_Set {0}, {1}", lbID.Text, i));
         lbError.Text = "Hiển thị câu hỏi: " + lbID.Text;
     }
     catch { lbError.Text = "Không thể hiển thị"; }
 }
Example #7
0
 public HienThi_MayChu()
 {
     InitializeComponent();
     try
     {
         csHoiThi ob = new csHoiThi();
         DataSet ds = ob.fillDataset("EXEC HienThi_Get_TieuDe");
         comboBox1.DataSource = ds.Tables[0];
         comboBox1.DisplayMember = "TieuDe";
     }
     catch { }
 }
Example #8
0
 private void btTai_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ds = ob.fillDataset("EXEC HienThi_Get_NoiDung " + (comboBox1.SelectedIndex + 1).ToString());
         i = 0;
         lbID.Text = "0";
         lbError.Text = "Số lượng câu hỏi: " + ds.Tables[0].Rows.Count.ToString();
         lbQuestion.Text = "";
     }
     catch { }
 }
Example #9
0
 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"; }
 }
Example #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string conTxt = string.Format(@"Data Source={0}; Initial Catalog={1}; User Id={2}; Password={3};", tbServer.Text, tbDatabase.Text, tbUser.Text, tbPass.Text);
         string cmdTxt = string.Format("exec player_insert N'{0}'", ddPlayer.Text);
         csHoiThi.conString = conTxt;
         csHoiThi ob = new csHoiThi();
         DataSet ds = ob.fillDataset(cmdTxt);
         if (ds.Tables[0].Rows[0][0].ToString() == "") lbError.Text = "Có lỗi trong quá trình đăng nhập";
         else
         {
             csHoiThi.playerID = ds.Tables[0].Rows[0][0].ToString();
             this.Close();
         }
     }
     catch { lbError.Text = "Có lỗi trong quá trình đăng nhập"; }
 }
Example #11
0
        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 { }
        }
Example #12
0
 private void btFinish_XH_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("exec control_set 20, 0");
         timer1.Enabled = false;
     }
     catch { lbError.Text = "ERROR: control_set 20"; }
 }
Example #13
0
 private void frDoiChoi_Load(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         DataSet ds = ob.fillDataset("select Player from tbPlayer where PlayID=" + csHoiThi.playerID);
         lbPlayer.Text = ds.Tables[0].Rows[0][0].ToString();
     }
     catch { lbError.Text = "Không xác định tên đội chơi"; }
     this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
     timer1.Enabled = true;
 }
Example #14
0
 private void frDoiChoi_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("delete from tbPlayer where PlayID=" + csHoiThi.playerID);
     }
     catch { }
 }
Example #15
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                csHoiThi ob = new csHoiThi();
                DataSet ds = ob.fillDataset("exec control_timer");
                if (ds.Tables[0].Rows[0][1].ToString() == "13" || ds.Tables[0].Rows[0][1].ToString() == "16")
                    lbTimePlus.Text = ds.Tables[0].Rows[0][2].ToString();
                else lbTime.Text = ds.Tables[0].Rows[0][2].ToString();

                if (ds.Tables[0].Rows[0][0].ToString() == "0") timer1.Enabled = false;
            }
            catch
            {
                lbError.Text = "Có lỗi trong quá trình đếm thời gian";
                timer1.Enabled = false;
            }
        }
Example #16
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         DataSet ds = ob.fillDataset("exec control_get");
         int conID = int.Parse(ds.Tables[0].Rows[0][0].ToString());
         if (conID == myConID)
         {
             if (conID == 3)
                 lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
             else if (conID == 13)
                 lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
             else if (conID == 14)
                 lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
             else if (conID == 16)
                 lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
             else if (conID == 18)
                 lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
         }
         else // Chuyển trạng thái
         {
             lbError.Text = ds.Tables[0].Rows[0][4].ToString();
             switch (conID)
             {
                 case 0:
                     lbTime.Text = "";
                     lbTimePlus.Text = "";
                     tbQuestion.Text = "";
                     break;
                 case 1:
                     lbTime.Text = "";
                     lbTimePlus.Text = "";
                     tbQuestion.Text = "";
                     break;
                 case 2:
                     lbTime.Text = "";
                     lbTimePlus.Text = "";
                     tbQuestion.Text = ds.Tables[1].Rows[0][1].ToString();
                     if (ds.Tables[1].Rows[0][2].ToString() != "")
                     {
                         tbQuestion.Text += "\n\tA. " + ds.Tables[1].Rows[0][2].ToString();
                         btda1.Visible = true;
                         btda1.Enabled = true;
                     }
                     else btda1.Visible = false;
                     if (ds.Tables[1].Rows[0][3].ToString() != "")
                     {
                         tbQuestion.Text += "\n\tB. " + ds.Tables[1].Rows[0][3].ToString();
                         btda2.Visible = true;
                         btda2.Enabled = true;
                     }
                     else btda2.Visible = false;
                     if (ds.Tables[1].Rows[0][4].ToString() != "")
                     {
                         tbQuestion.Text += "\n\tC. " + ds.Tables[1].Rows[0][4].ToString();
                         btda3.Visible = true;
                         btda3.Enabled = true;
                     }
                     else btda3.Visible = false;
                     if (ds.Tables[1].Rows[0][5].ToString() != "")
                     {
                         tbQuestion.Text += "\n\tD. " + ds.Tables[1].Rows[0][5].ToString();
                         btda4.Visible = true;
                         btda4.Enabled = true;
                     }
                     else btda4.Visible = false;
                     if (ds.Tables[1].Rows[0][6].ToString() != "")
                     {
                         tbQuestion.Text += "\n\tE. " + ds.Tables[1].Rows[0][6].ToString();
                         btda5.Visible = true;
                         btda5.Enabled = true;
                     }
                     else btda5.Visible = false;
                     if (ds.Tables[1].Rows[0][7].ToString() != "")
                     {
                         tbQuestion.Text += "\n\tF. " + ds.Tables[1].Rows[0][7].ToString();
                         btda6.Visible = true;
                         btda6.Enabled = true;
                     }
                     else btda6.Visible = false;
                     btNhanChuong.Visible = false;
                     break;
                 case 3:
                     lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                     break;
                 case 4:
                     btda1.Enabled = false;
                     btda2.Enabled = false;
                     btda3.Enabled = false;
                     btda4.Enabled = false;
                     btda5.Enabled = false;
                     btda6.Enabled = false;
                     break;
                 case 11:
                     lbTime.Text = "";
                     lbTimePlus.Text = "";
                     tbQuestion.Text = "";
                     break;
                 case 12:
                     lbTime.Text = "";
                     lbTimePlus.Text = "";
                     tbQuestion.Text = ds.Tables[1].Rows[0][1].ToString();
                     if (ds.Tables[1].Rows[0][2].ToString() != "")
                         tbQuestion.Text += "\n\tA. " + ds.Tables[1].Rows[0][2].ToString();
                     if (ds.Tables[1].Rows[0][3].ToString() != "")
                         tbQuestion.Text += "\n\tB. " + ds.Tables[1].Rows[0][3].ToString();
                     if (ds.Tables[1].Rows[0][4].ToString() != "")
                         tbQuestion.Text += "\n\tC. " + ds.Tables[1].Rows[0][4].ToString();
                     if (ds.Tables[1].Rows[0][5].ToString() != "")
                         tbQuestion.Text += "\n\tD. " + ds.Tables[1].Rows[0][5].ToString();
                     if (ds.Tables[1].Rows[0][6].ToString() != "")
                         tbQuestion.Text += "\n\tE. " + ds.Tables[1].Rows[0][6].ToString();
                     if (ds.Tables[1].Rows[0][7].ToString() != "")
                         tbQuestion.Text += "\n\tF. " + ds.Tables[1].Rows[0][7].ToString();
                     btda1.Visible = false;
                     btda2.Visible = false;
                     btda3.Visible = false;
                     btda4.Visible = false;
                     btda5.Visible = false;
                     btda6.Visible = false;
                     btNhanChuong.Text = "Nhấn Chuông";
                     btNhanChuong.Visible = true;
                     btNhanChuong.Enabled = true;
                     break;
                 case 13:
                     lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
                     break;
                 case 14:
                     lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                     break;
                 case 15:
                     lbError.Text = ds.Tables[0].Rows[0][1].ToString() + " đã giành được quyền trả lời câu hỏi";
                     // HIỆN TIME khi có đội nhấn chuông
                     lbTimePlus.Text = "0";
                     lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                     break;
                 case 16:
                     lbError.Text = "Thời gian suy nghĩ cho " + ds.Tables[0].Rows[0][1].ToString();
                     lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
                     break;
                 case 17:
                     btNhanChuong.Enabled = false;
                     break;
                 case 18:
                     lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
                     break;
                 case 19:
                     btNhanChuong.Enabled = false;
                     break;
                 case 20:
                     btNhanChuong.Enabled = false;
                     break;
                 case 21:
                     lbError.Text = string.Format(ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][1].ToString());
                     break;
                 case 32:
                     lbTime.Text = "";
                     lbTimePlus.Text = "";
                     tbQuestion.Text = "";
                     btda1.Visible = false;
                     btda2.Visible = false;
                     btda3.Visible = false;
                     btda4.Visible = false;
                     btda5.Visible = false;
                     btda6.Visible = false;
                     btNhanChuong.Text = "Nhấn Chuông";
                     btNhanChuong.Visible = true;
                     btNhanChuong.Enabled = true;
                     break;
                 case 33:
                     lbError.Text = string.Format(ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][1].ToString());
                     break;
                 default:
                     break;
             }
         }
         myConID = conID;
     }
     catch { lbError.Text = "Có lỗi xảy ra trong quá trình đọc dữ liệu"; }
 }
Example #17
0
 private void button1_Click(object sender, EventArgs e)
 {
     // Quá thời gian
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("exec control_set 21, 0");
         timer1.Enabled = false;
     }
     catch { lbError.Text = "ERROR: control_set 21"; }
 }
Example #18
0
 private void frMayChu_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("delete from tbControl");
     }
     catch { }
 }
Example #19
0
 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 = "";
     }
 }
Example #20
0
 private void btTimer_XH_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("exec control_set 13, 0");
         timer1.Enabled = true;
     }
     catch { lbError.Text = "Có lỗi trong quá trình chạy thời gian"; }
 }
Example #21
0
 private void btThuChuong_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("exec control_set 32, 0");
     }
     catch { lbError.Text = "ERROR: control_set 32"; }
 }
Example #22
0
        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 { }
        }
Example #23
0
 private void btQuest_CM_Click(object sender, EventArgs e)
 {
     if (lbQuestID.Text == "") lbError.Text = "Chưa xem câu hỏi";
     else
         try
         {
             csHoiThi ob = new csHoiThi();
             ob.fillDataset("exec control_set 2, " + lbQuestID.Text);
         }
         catch { lbError.Text = "Có lỗi trong quá trình chiếu câu hỏi"; }
 }
Example #24
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                csHoiThi ob = new csHoiThi();
                DataSet ds = ob.fillDataset("exec control_get");
                int conID = int.Parse(ds.Tables[0].Rows[0][0].ToString());
                if (conID != 4)
                    try { myForm.Close(); }
                    catch { }
                if (conID == myConID)
                {
                    if (conID == 3 || conID == 14)
                    {
                        lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                        if (myTime != lbTime.Text)
                        {
                            if (lbTime.Text == "0") mp3_play("mp3_reng");
                            else mp3_play("mp3_tick");
                            myTime = lbTime.Text;
                        }
                    }
                    else if (conID == 13 || conID == 16 || conID == 18)
                    {
                        lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
                        if (myTime != lbTimePlus.Text)
                        {
                            if (lbTimePlus.Text == "0")
                            {
                                mp3_play("mp3_reng");
                                // HIỆN TIME khi timeplus đếm đến 0
                                lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                            }
                            else mp3_play("mp3_tick");
                            myTime = lbTimePlus.Text;
                        }
                    }
                }
                else // Chuyển trạng thái
                {
                    lbError.Text = ds.Tables[0].Rows[0][4].ToString();
                    switch (conID)
                    {
                        case 0:
                            lbTime.Text = "";
                            lbTimePlus.Text = "";
                            //lbWrong.Text = "";
                            tbQuestion.Text = "";
                            break;
                        case 1:
                            lbTime.Text = "";
                            lbTimePlus.Text = "";
                            //lbWrong.Text = "";
                            tbQuestion.Text = "";
                            break;
                        case 2:
                            lbTime.Text = "";
                            lbTimePlus.Text = "";
                            //lbWrong.Text = "";
                            tbQuestion.Text = ds.Tables[1].Rows[0][1].ToString();
                            if (ds.Tables[1].Rows[0][2].ToString() != "")
                                tbQuestion.Text += "\n\tA. " + ds.Tables[1].Rows[0][2].ToString();
                            if (ds.Tables[1].Rows[0][3].ToString() != "")
                                tbQuestion.Text += "\n\tB. " + ds.Tables[1].Rows[0][3].ToString();
                            if (ds.Tables[1].Rows[0][4].ToString() != "")
                                tbQuestion.Text += "\n\tC. " + ds.Tables[1].Rows[0][4].ToString();
                            if (ds.Tables[1].Rows[0][5].ToString() != "")
                                tbQuestion.Text += "\n\tD. " + ds.Tables[1].Rows[0][5].ToString();
                            if (ds.Tables[1].Rows[0][6].ToString() != "")
                                tbQuestion.Text += "\n\tE. " + ds.Tables[1].Rows[0][6].ToString();
                            if (ds.Tables[1].Rows[0][7].ToString() != "")
                                tbQuestion.Text += "\n\tF. " + ds.Tables[1].Rows[0][7].ToString();
                            break;
                        case 3:
                            lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                            myTime = lbTime.Text;
                            mp3_play("mp3_tick");
                            break;
                        case 4:
                            myForm = new frMayChieu_Diem();
                            myForm.Show();
                            break;
                        case 11:
                            lbTime.Text = "";
                            lbTimePlus.Text = "";
                            //lbWrong.Text = "";
                            tbQuestion.Text = "";
                            break;
                        case 12:
                            lbTime.Text = "";
                            lbTimePlus.Text = "";
                            //lbWrong.Text = "";
                            tbQuestion.Text = ds.Tables[1].Rows[0][1].ToString();
                            if (ds.Tables[1].Rows[0][2].ToString() != "")
                                tbQuestion.Text += "\n\tA. " + ds.Tables[1].Rows[0][2].ToString();
                            if (ds.Tables[1].Rows[0][3].ToString() != "")
                                tbQuestion.Text += "\n\tB. " + ds.Tables[1].Rows[0][3].ToString();
                            if (ds.Tables[1].Rows[0][4].ToString() != "")
                                tbQuestion.Text += "\n\tC. " + ds.Tables[1].Rows[0][4].ToString();
                            if (ds.Tables[1].Rows[0][5].ToString() != "")
                                tbQuestion.Text += "\n\tD. " + ds.Tables[1].Rows[0][5].ToString();
                            if (ds.Tables[1].Rows[0][6].ToString() != "")
                                tbQuestion.Text += "\n\tE. " + ds.Tables[1].Rows[0][6].ToString();
                            if (ds.Tables[1].Rows[0][7].ToString() != "")
                                tbQuestion.Text += "\n\tF. " + ds.Tables[1].Rows[0][7].ToString();
                            break;
                        case 13:
                            lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
                            myTime = lbTimePlus.Text;
                            mp3_play("mp3_tick");
                            break;
                        case 14:
                            lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                            myTime = lbTime.Text;
                            mp3_play("mp3_tick");
                            break;
                        case 15:
                            lbError.Text = ds.Tables[0].Rows[0][1].ToString() + " đã giành được quyền trả lời câu hỏi";
                            mp3_play("mp3_reng");
                            // HIỆN TIME khi có đội nhấn chuông
                            lbTimePlus.Text = "0";
                            lbTime.Text = ds.Tables[0].Rows[0][2].ToString();
                            break;
                        case 16:
                            lbError.Text = "Thời gian suy nghĩ cho " + ds.Tables[0].Rows[0][1].ToString();
                            lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
                            myTime = lbTimePlus.Text;
                            mp3_play("mp3_tick");
                            break;
                        case 18:
                            lbTimePlus.Text = ds.Tables[0].Rows[0][3].ToString();
                            myTime = lbTimePlus.Text;
                            mp3_play("mp3_tick");

                            //lbWrong.Text = ds.Tables[0].Rows[0][1].ToString() + " trả lời sai, trừ 01 điểm";
                            break;
                        case 19:
                            lbError.Text = ds.Tables[0].Rows[0][1].ToString() + " trả lời đúng, được 01 điểm";
                            break;
                        case 28:
                            lbError.Text = ds.Tables[0].Rows[0][1].ToString() + " trả lời sai, trừ 01 điểm";
                            break;
                        case 20:
                            lbError.Text = ds.Tables[0].Rows[0][1].ToString() + " trả lời sai, trừ 01 điểm";
                            break;
                        case 21:
                            lbError.Text = string.Format(ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][1].ToString());
                            break;
                        case 33:
                            lbError.Text = string.Format(ds.Tables[0].Rows[0][4].ToString(), ds.Tables[0].Rows[0][1].ToString());
                            break;
                        default:
                            break;
                    }
                }
                myConID = conID;
            }
            catch { lbError.Text = "Có lỗi xảy ra trong quá trình đọc dữ liệu"; }
        }
Example #25
0
 private void btRight_XH_Click(object sender, EventArgs e)
 {
     try
     {
         csHoiThi ob = new csHoiThi();
         ob.fillDataset("exec control_set 19, 0");
         timer1.Enabled = false;
     }
     catch { lbError.Text = "Có lỗi trong quá trình hiện kết quả"; }
 }