コード例 #1
0
        //Bài trong từng chương
        private BaiTap_KiemTra_DTO GetInfoTest_Chapter()
        {
            BaiTap_KiemTra_DTO baiTap_KiemTra = new BaiTap_KiemTra_DTO();

            baiTap_KiemTra.MaBT_KT     = tbxIDTest.EditValue.ToString();
            baiTap_KiemTra.TenBT_KT    = tbxNameTest.Text;
            baiTap_KiemTra.MaChuong_BK = cbxChapter.EditValue.ToString();
            if (tbxScore.Text == "")
            {
                tbxScore.Text = "1";
            }

            baiTap_KiemTra.DiemBT_KT = Convert.ToInt16(tbxScore.Text);
            baiTap_KiemTra.MaMH_BK   = cbxSubject.EditValue.ToString();
            baiTap_KiemTra.MaHS_BK   = cbxStudent.EditValue.ToString();
            baiTap_KiemTra.MaNhom_BK = cbxNameGroup.EditValue.ToString();
            if (baiTap_KiemTra.MaNhom_BK == "")
            {
                baiTap_KiemTra.MaNhom_BK = "null";
            }
            else
            {
                string temp = baiTap_KiemTra.MaNhom_BK;
                temp = "'" + temp + "'";
                baiTap_KiemTra.MaNhom_BK = temp;
            }
            baiTap_KiemTra.BaiNhom = (cbxTest.Text == "Nhóm") ? 1 : 0;
            baiTap_KiemTra.BaiTap  = (cbxTestGroup.Text == "Bài tập") ? 1 : 0;

            return(baiTap_KiemTra);
        }
コード例 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            BaiTap_KiemTra_DTO baiTap_KiemTra = GetInfoTest_Chapter();

            if (MessageBox.Show("Bạn có muốn xoá Chương : " + tbxNameTest.Text + " không?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                baiTap_KiemTraBUS.DelTest_Chapter(baiTap_KiemTra);
                InfoTest_Load(sender, e);
            }
        }
コード例 #3
0
ファイル: BaiTap_KiemTra_BLL.cs プロジェクト: dnguyenit96/dev
        public bool DelTest_Chapter(BaiTap_KiemTra_DTO baiTap_KiemTra)
        {
            string sql = string.Format("DELETE FROM BaiTap_KiemTra WHERE MaBT_KT='" + baiTap_KiemTra.MaBT_KT + "'");

            if (connData.RunSQL(sql))
            {
                MessageBox.Show("Xóa thông tin Sách thành công!", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(true);
            }
            return(false);
        }
コード例 #4
0
ファイル: BaiTap_KiemTra_BLL.cs プロジェクト: dnguyenit96/dev
 public bool EditTest_Chapter(BaiTap_KiemTra_DTO baiTap_KiemTra)
 {
     if (CheckBeforeSave(baiTap_KiemTra))
     {
         string sql = string.Format("UPDATE BaiTap_KiemTra SET TenBT_KT =N'{1}' ,MaChuong_BK = '{2}',DiemBT_KT= '{3}',MaMH_BK ='{4}',MaHS_BK='{5}',MaNhom_BK={6},BaiNhom={7},BaiTap={8} WHERE MaBT_KT='{0}' ", baiTap_KiemTra.MaBT_KT, baiTap_KiemTra.TenBT_KT, baiTap_KiemTra.MaChuong_BK, baiTap_KiemTra.DiemBT_KT, baiTap_KiemTra.MaMH_BK, baiTap_KiemTra.MaHS_BK, baiTap_KiemTra.MaNhom_BK, baiTap_KiemTra.BaiNhom, baiTap_KiemTra.BaiTap);
         if (connData.RunSQL(sql))
         {
             MessageBox.Show("Sửa thông tin bài thành công !", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return(true);
         }
     }
     return(false);
 }
コード例 #5
0
ファイル: BaiTap_KiemTra_BLL.cs プロジェクト: dnguyenit96/dev
 public bool AddTest_Chapter(BaiTap_KiemTra_DTO baiTap_KiemTra)
 {
     if (CheckBeforeSave(baiTap_KiemTra))
     {
         string sql = string.Format("INSERT INTO BaiTap_KiemTra (MaBT_KT, TenBT_KT, MaChuong_BK, DiemBT_KT, MaMH_BK, MaHS_BK, MaNhom_BK, BaiNhom, BaiTap) VALUES ('{0}',N'{1}','{2}','{3}','{4}','{5}',{6},{7},{8})", baiTap_KiemTra.MaBT_KT, baiTap_KiemTra.TenBT_KT, baiTap_KiemTra.MaChuong_BK, baiTap_KiemTra.DiemBT_KT, baiTap_KiemTra.MaMH_BK, baiTap_KiemTra.MaHS_BK, baiTap_KiemTra.MaNhom_BK, baiTap_KiemTra.BaiNhom, baiTap_KiemTra.BaiTap);
         if (connData.RunSQL(sql))
         {
             MessageBox.Show("Thêm bài thành công", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return(true);
         }
     }
     return(false);
 }
コード例 #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            BaiTap_KiemTra_DTO baiTap_KiemTra = GetInfoTest_Chapter();

            if (add)
            {
                baiTap_KiemTraBUS.AddTest_Chapter(baiTap_KiemTra);
                InfoTest_Load(sender, e);
            }
            if (update)
            {
                baiTap_KiemTraBUS.EditTest_Chapter(baiTap_KiemTra);
                InfoTest_Load(sender, e);
            }
        }
コード例 #7
0
ファイル: BaiTap_KiemTra_BLL.cs プロジェクト: dnguyenit96/dev
 public bool CheckBeforeSave(BaiTap_KiemTra_DTO baiTap_KiemTra)
 {
     if (baiTap_KiemTra.TenBT_KT.Equals(""))
     {
         MessageBox.Show("Tên bài không hợp lệ ! ");
         return(false);
     }
     if (baiTap_KiemTra.DiemBT_KT.Equals(""))
     {
         MessageBox.Show("Điểm không được để trống!");
         return(false);
     }
     if (baiTap_KiemTra.DiemBT_KT > 10 || baiTap_KiemTra.DiemBT_KT < 0)
     {
         MessageBox.Show("Điểm không hợp lệ! ");
         return(false);
     }
     if (baiTap_KiemTra.MaHS_BK.Equals(""))
     {
         MessageBox.Show("Tên học sinh không được để trống!");
         return(false);
     }
     return(true);
 }