private void btUpLoad_Click(object sender, EventArgs e)
        {
            DeTai detai1 = new DeTai();

            detai1.MaDT        = detai.MaDT;
            detai1.MaGV        = detai.MaGV;
            detai1.TenDT       = detai.TenDT;
            detai1.MoTaDT      = detai.MoTaDT;
            detai1.NgayBatDau  = detai.NgayBatDau;
            detai1.NgayKetThuc = detai.NgayKetThuc;
            detai1.NhanXet     = detai.NhanXet;
            detai1.TienDoDT    = detai.TienDoDT;
            detai1.FileDeTai   = txtUpLoad.Text;
            detai1.SinhViens   = DeTaiController.danhsach(detai.MaDT);
            DeTaiController.UpdateDeTai(detai1);
            MessageBox.Show("Upload Thành Công");
        }
        private void btnSua_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtMaDT.Text.Trim().Length <= 0)
                {
                    this.errorProvider1.SetError(this.txtMaDT, "Phai nhap Ma De Tai");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }
                if (this.txtTenDT.Text.Trim().Length <= 0)
                {
                    this.errorProvider1.SetError(this.txtTenDT, "Phai nhap Ten De Tai");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }
                if (rtMoTa.Text == "")
                {
                    this.errorProvider1.SetError(this.rtMoTa, "Phai co mo ta");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }

                if (NgayKetThuc.Value <= NgayBatDau.Value)
                {
                    this.errorProvider1.SetError(this.NgayKetThuc, "Phai nhap ngay ket thuc lon hon ngay bat dau");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }

                if (rtNhanXet.Text == "")
                {
                    this.errorProvider1.SetError(this.rtNhanXet, "Phai co nhan xet");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }
                if (cbGV.Text == "")
                {
                    this.errorProvider1.SetError(this.rtNhanXet, "Phai co Giao Vien");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }

                DeTai  detai    = new DeTai();
                double soTienDo = 0;
                detai.MaDT        = txtMaDT.Text;
                detai.TenDT       = txtTenDT.Text;
                detai.MoTaDT      = rtMoTa.Text;
                detai.NgayBatDau  = NgayBatDau.Value;
                detai.NgayKetThuc = NgayKetThuc.Value;
                detai.MaGV        = cbGV.Text;
                string displaySV = "";
                for (int i = 0; i < lstSV.Items.Count; i++)
                {
                    displaySV = displaySV + this.lstSV.Items[i] + " ";
                    detai.SinhViens.Add(this.lstSV.Items[i] as SinhVien);
                }
                if (checkTienDo1.Checked == true)
                {
                    soTienDo = soTienDo + 25;
                }
                if (checkTienDo2.Checked == true && checkTienDo1.Checked == true)
                {
                    soTienDo = 50;
                }
                if (checkTienDo3.Checked == true && checkTienDo2.Checked == true && checkTienDo1.Checked == true)
                {
                    soTienDo = 75;
                }
                if (checkTienDo4.Checked == true && checkTienDo2.Checked == true && checkTienDo1.Checked == true)
                {
                    soTienDo = 100;
                }

                detai.TienDoDT = soTienDo;
                txtTienDo.Text = soTienDo.ToString();
                detai.NhanXet  = rtNhanXet.Text;
                if (DeTaiController.checkExistDeTai(detai.MaDT))
                {
                    DeTaiController.UpdateDeTai(detai);
                }
                else
                {
                    MessageBox.Show("Vui lòng không sửa Mã đề tài", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                listDeTai.Items.Clear();
                displayDeTai();
            }

            catch
            {
            }
        }
        private void btnChinhSua_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtTenDT.Text.Trim().Length <= 0)
                {
                    this.errorProvider1.SetError(this.txtTenDT, "Phai nhap Ten De Tai");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }
                if (txtMoTa.Text == "")
                {
                    this.errorProvider1.SetError(this.txtMoTa, "Phai co mo ta");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }

                if (NgayKetThuc.Value <= NgayBatDau.Value)
                {
                    this.errorProvider1.SetError(this.NgayKetThuc, "Phai nhap ngay ket thuc lon hon ngay bat dau");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }

                if (rtxtNhanXet.Text == "")
                {
                    this.errorProvider1.SetError(this.rtxtNhanXet, "Phai co nhan xet");
                    return;
                }
                else
                {
                    this.errorProvider1.Clear();
                }

                double soTienDo = 0;
                DeTai  detai    = new DeTai();
                detai.MaDT        = lbMaDT.Text;
                detai.TenDT       = txtTenDT.Text;
                detai.MoTaDT      = txtMoTa.Text;
                detai.NgayBatDau  = NgayBatDau.Value;
                detai.NgayKetThuc = NgayKetThuc.Value;
                detai.FileDeTai   = txtUpLoad.Text;
                detai.MaGV        = detai1.MaGV;

                string displaySV = "";
                for (int i = 0; i < listSinhVien.Items.Count; i++)
                {
                    displaySV = displaySV + this.listSinhVien.Items[i] + " ";
                    detai.SinhViens.Add(this.listSinhVien.Items[i] as SinhVien);
                }

                if (checkTienDo1.Checked == true)
                {
                    soTienDo = soTienDo + 25;
                }
                if (checkTienDo2.Checked == true && checkTienDo1.Checked == true)
                {
                    soTienDo = 50;
                }
                if (checkTienDo3.Checked == true && checkTienDo2.Checked == true && checkTienDo1.Checked == true)
                {
                    soTienDo = 75;
                }
                if (checkTienDo4.Checked == true && checkTienDo2.Checked == true && checkTienDo1.Checked == true)
                {
                    soTienDo = 100;
                }

                detai.TienDoDT = soTienDo;
                txtTienDo.Text = soTienDo.ToString();
                detai.NhanXet  = rtxtNhanXet.Text;
                DeTaiController.UpdateDeTai(detai);
                MessageBox.Show("Lưu Thành Công");
            }
            catch { }
        }