コード例 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            AdminModel model  = new AdminModel();
            string     id     = txtExam.Text;
            string     date   = dateTimePicker1.Value.ToShortDateString();
            string     status = txtStatus.Text;

            if (model.UpdateExam(id, date, status))
            {
                LoadExam();
                ResetControl();
            }
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string     id    = txtExam.Text;
            string     date  = dateTimePicker1.Value.ToShortDateString();
            AdminModel model = new AdminModel();

            model.AddExam(id, date);
            for (int i = 0; i < list.Count; i++)
            {
                model.AddQuestion2Exam(id, list[i].ID);
            }

            MessageBox.Show("Added");
        }
コード例 #3
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            string     id    = txtExam.Text;
            AdminModel model = new AdminModel();

            if (model.CheckExist(id) == false)
            {
                MessageBox.Show("this exam is da ton tai!!!");
            }
            else
            {
                //btnAdd.Enabled = true;
                btnLoad.Enabled = true;
            }
        }
コード例 #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string     user  = txtUser.Text;
            string     pass  = txtPass.Text;
            AdminModel model = new AdminModel();

            currentUser = model.CheckLogin(user, pass);
            if (currentUser == null)
            {
                MessageBox.Show("Login failed");
            }
            else
            {
                MessageBox.Show("Login Success");
                this.Dispose();
            }
        }
コード例 #5
0
        private void LoadExam()
        {
            AdminModel model = new AdminModel();

            grvExam.DataSource = model.GetExams();
        }