コード例 #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            DataProcess db = new DataProcess();

            dataGridView1.DataSource = db.GetQs().DefaultView;
            ResetData();
        }
コード例 #2
0
ファイル: ManageExam.cs プロジェクト: taingkhac/Database
        private void button1_Click(object sender, EventArgs e)
        {
            string type = comboBox1.SelectedItem.ToString();

            type = comboBox1.Text;
            if (type.Equals("Top Notch 1"))
            {
                type = "TN1";
            }
            if (type.Equals("Top Notch 2"))
            {
                type = "TN2";
            }
            if (type.Equals("Top Notch 3"))
            {
                type = "TN3";
            }
            if (type.Equals("Summit 1"))
            {
                type = "S1";
            }
            DataProcess dp = new DataProcess();

            lt = dp.Get25Questions(type);
            dataGridView1.DataSource = lt;
            button2.Enabled          = true;
        }
コード例 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            string id   = txtManaQSid.Text;
            string type = cbBSu.Text;

            if (type.Equals("Top Notch 1"))
            {
                type = "TN1";
            }
            if (type.Equals("Top Notch 2"))
            {
                type = "TN2";
            }
            if (type.Equals("Top Notch 3"))
            {
                type = "TN3";
            }
            if (type.Equals("Summit 1"))
            {
                type = "S1";
            }
            string content = rtbContent.Text;
            string a       = txtA.Text;
            string b       = txtB.Text;
            string c       = txtC.Text;
            string d       = txtD.Text;
            string ans     = "";

            if (rdA.Checked)
            {
                ans = "_a";
            }
            if (rdB.Checked)
            {
                ans = "_b";
            }
            if (rdC.Checked)
            {
                ans = "_c";
            }
            if (rdD.Checked)
            {
                ans = "_d";
            }
            DataProcess dt = new DataProcess();

            if (dt.UpdateQuestion(id, type, content, a, b, c, d, ans))
            {
                MessageBox.Show("Update Success!!");
                dataGridView1.DataSource = dt.GetQs().DefaultView;
                ResetData();
            }
            else
            {
                MessageBox.Show("Update Faild!!");
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string id   = txtID.Text;
            string type = comboBox1.SelectedItem.ToString();

            type = comboBox1.Text;
            if (type.Equals("Top Notch 1"))
            {
                type = "TN1";
            }
            if (type.Equals("Top Notch 2"))
            {
                type = "TN2";
            }
            if (type.Equals("Top Notch 3"))
            {
                type = "TN3";
            }
            if (type.Equals("Summit 1"))
            {
                type = "S1";
            }
            string content = rtbContent.Text;
            string a       = txtA.Text;
            string b       = txtB.Text;
            string c       = txtC.Text;
            string d       = txtD.Text;
            string ans     = "";

            if (rdA.Checked)
            {
                ans = "_a";
            }
            if (rdB.Checked)
            {
                ans = "_b";
            }
            if (rdC.Checked)
            {
                ans = "_c";
            }
            if (rdD.Checked)
            {
                ans = "_d";
            }
            DataProcess dt = new DataProcess();

            if (dt.AddQuestion(id, type, content, a, b, c, d, ans))
            {
                MessageBox.Show("Addnew Success!!");
            }
            else
            {
                MessageBox.Show("Addnew Faild!!");
            }
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            string      id = txtSearchQSid.Text;
            DataProcess dp = new DataProcess();
            DataTable   dt = dp.SearchData(id);

            if (dt.Rows.Count != 0)
            {
                dataGridView1.DataSource = dt;
            }
            else
            {
                MessageBox.Show("No Data!!");
            }
        }
コード例 #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            string      id  = txtManaQSid.Text;
            DataProcess dtb = new DataProcess();

            if (dtb.DeleteQuestion(id))
            {
                dataGridView1.DataSource = dtb.GetQs();
                ResetData();
                MessageBox.Show("Delete Success!!");
            }
            else
            {
                MessageBox.Show("Faild");
            }
        }
コード例 #7
0
ファイル: ManageExam.cs プロジェクト: taingkhac/Database
        private void button2_Click(object sender, EventArgs e)
        {
            DataProcess dp = new DataProcess();
            string      id = txtidexam.Text;

            //for (int i = 0; i < dataGridView1.Rows.Count; i++)
            //{
            //	string question = dataGridView1.Rows[i].Cells[0].Value.ToString();
            //	dp.AddExam(id, question);
            //}
            for (int i = 0; i < lt.Count; i++)
            {
                dp.AddQuestion2Exam(id, lt[i].ID);
            }
            dp.AddExam(id, txtDate.Text);
            MessageBox.Show("Added");
        }
コード例 #8
0
ファイル: Login.cs プロジェクト: taingkhac/Database
        private void button1_Click(object sender, EventArgs e)
        {
            string      user = txtuser.Text;
            string      pass = txtpass.Text;
            DataProcess dp   = new DataProcess();

            if (dp.login(user, pass))
            {
                hethong ht = new hethong();
                ht.FormClosed += new FormClosedEventHandler(ht_FormClosed);
                ht.Show();
                this.Hide();
            }
            else
            {
                lblincorrect.Text = "Username Or Passwword Incorrect";
                txtuser.Text      = "";
                txtpass.Text      = "";
            }
        }
コード例 #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            string      type = txtex.Text;
            DataProcess dp   = new DataProcess();

            if (!dp.CheckExam(type))
            {
                MessageBox.Show("Exam not started!!");
            }
            else
            {
                MessageBox.Show("Load data ok!!");
                list = dp.GetQuestionsByExam(type);
                BindingData2List();
                LoadQuestion(index, list);
                timer1.Start();
                giay = 1;
                phut = 40;
                gio  = 0;
            }
        }