public frmTienDo()
        {
            InitializeComponent();
            List <Nhom> searchnhom = SinhVienController.getListNhom();

            for (int i = 0; i < searchnhom.Count; i++)
            {
                this.cboNhom.Items.Add(searchnhom[i]);
            }
            //List<DeTai> searchdetai = DeTaiController.getListDeTaicb();

            //for (int i = 0; i < searchdetai.Count; i++)
            //{
            //    this.cboDeTai.Items.Add(searchdetai[i]);
            //}
            this.cTenTienDo.DataPropertyName  = nameof(TienDo.MaTienDo);
            this.cDeTai.DataPropertyName      = nameof(TienDo.MaDT);
            this.cNhom.DataPropertyName       = nameof(TienDo.MaNhom);
            this.cTaiLieu.DataPropertyName    = nameof(TienDo.TaiLieu);
            this.cTrangThai.DataPropertyName  = nameof(TienDo.TrangThai);
            this.cThoiGianKT.DataPropertyName = nameof(TienDo.ThoiGianKT);
            this.cNhanXet.DataPropertyName    = nameof(TienDo.NhanXet);

            BindingSource source = new BindingSource();

            source.DataSource             = TienDoController.getListTienDo();
            this.dataGridView1.DataSource = source;
        }
Exemple #2
0
        public void showTienDo()
        {
            BindingSource source = new BindingSource();

            source.DataSource         = TienDoController.GetListTienDo(currentIDNhom);
            this.dgvTienDo.DataSource = source;
        }
Exemple #3
0
        private void btnXoa_Click_1(object sender, EventArgs e)
        {
            if (currentIDTienDo == -1)
            {
                MessageBox.Show("Vui long chon Tien do");
                return;
            }
            TienDo td = new TienDo();

            td.IDTienDo       = currentIDTienDo;
            td.NoiDung        = rtbNoiDungTienDo.Text.Trim();
            td.TaiLieuBaoCao  = txtTaiLieu.Text.Trim();
            td.ThoiGianBaoCao = dtpNgayBaoCao.Value;
            td.HoanThanh      = Int32.Parse(txtHoanThanh.Text.Trim());
            td.NhanXet        = rtbNhanXet.Text.Trim();
            td.IDDeAn         = currentIDDeAn;
            td.IDNhom         = currentIDNhom;
            td.status         = 0;
            SinhVien sv = cbSinhVien.SelectedItem as SinhVien;

            td.IDSinhVien = sv.IDSinhVien;
            if (TienDoController.CapNhatTienDo(td) == false)
            {
                MessageBox.Show("Khong xoa duoc Tien do");
                return;
            }
            showTienDo();
            currentIDTienDo = -1;
        }
Exemple #4
0
        private void btnThem_Click_1(object sender, EventArgs e)
        {
            errorTienDo.Clear();
            if (txtTaiLieu.Text.Trim().Length <= 0)
            {
                errorTienDo.SetError(txtTaiLieu, "Thêm tài liệu báo cáo");
                return;
            }

            if (rtbNhanXet.Text.Trim().Length <= 0)
            {
                errorTienDo.SetError(rtbNhanXet, "Thêm tài nội dung tiến độ");
                return;
            }
            if (cbSinhVien.SelectedItem as SinhVien == null)
            {
                errorTienDo.SetError(cbSinhVien, "Thêm sinh viên thực hiện");
                return;
            }
            if (Int32.Parse(txtHoanThanh.Text.Trim()) > 100 && Int32.Parse(txtHoanThanh.Text.Trim()) < 0)
            {
                errorTienDo.SetError(txtHoanThanh, "Hoàn thành có giá trị từ 0 đến 100%");
                return;
            }
            if (DateTime.Now > dtpNgayBaoCao.Value)
            {
                errorTienDo.SetError(dtpNgayBaoCao, "Chọn ngày báo cáo phù hợp");
                return;
            }
            TienDo td = new TienDo();

            td.NoiDung        = rtbNoiDungTienDo.Text.Trim();
            td.TaiLieuBaoCao  = txtTaiLieu.Text.Trim();
            td.ThoiGianBaoCao = dtpNgayBaoCao.Value;
            td.HoanThanh      = Int32.Parse(txtHoanThanh.Text.Trim());
            td.NhanXet        = rtbNhanXet.Text.Trim();
            td.IDDeAn         = currentIDDeAn;
            td.IDNhom         = currentIDNhom;
            td.status         = 1;
            SinhVien sv = cbSinhVien.SelectedItem as SinhVien;

            td.IDSinhVien = sv.IDSinhVien;
            if (TienDoController.ThemTienDo(td) == false)
            {
                MessageBox.Show("Khong them Tien Do duoc");
                return;
            }
            showTienDo();
            currentIDTienDo = -1;
        }
 private void cboNhom_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         DeTai dt = TienDoController.layDeTai(cboNhom.Text.ToString());
         cboDeTai.Text = dt.ToString();
     }
     catch
     {
         MessageBox.Show("Nhóm này chưa có đề tài!");
         cboDeTai.Text = "";
         cboNhom.Text  = "";
         return;
     }
 }
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("Hãy chọn dòng cần xóa!");
                return;
            }

            TienDo td = TienDoController.getTienDo(this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString());

            TienDoController.DeleteTienDo(td);
            //Hiển thị
            BindingSource source = new BindingSource();

            source.DataSource             = TienDoController.getListTienDo();
            this.dataGridView1.DataSource = source;
        }
Exemple #7
0
        private void dgvTienDo_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvTienDo.CurrentCell.ColumnIndex != 0)
            {
                return;
            }
            currentIDTienDo = Int32.Parse(dgvTienDo.CurrentRow.Cells[0].Value.ToString());
            TienDo td = TienDoController.GetTienDo(currentIDTienDo);

            txtTaiLieu.Text       = td.TaiLieuBaoCao.Trim();
            rtbNoiDungTienDo.Text = td.NoiDung.Trim();
            txtHoanThanh.Text     = td.HoanThanh.ToString();
            rtbNhanXet.Text       = td.NhanXet.Trim();
            dtpNgayBaoCao.Value   = DateTime.Parse(td.ThoiGianBaoCao.ToString());
            foreach (SinhVien sv in cbSinhVien.Items)
            {
                if (sv.IDSinhVien == td.IDSinhVien)
                {
                    cbSinhVien.SelectedItem = cbSinhVien.Items.IndexOf(sv);
                    return;
                }
            }
        }
        private void btnThemmoi_Click(object sender, EventArgs e)
        {
            int dem = 0;

            if (this.txtTenTienDo.Text.Trim().Length <= 0)
            {
                this.errorProvider1.SetError(this.txtTenTienDo, "Phai nhap ten tien do");
                dem++;
            }
            else
            {
                this.errorProvider1.SetError(this.txtTenTienDo, null);
            }
            if (this.cboDeTai.Text.Trim().Length <= 0)
            {
                this.errorProvider2.SetError(this.cboDeTai, "Phai chon de tai");
                dem++;
            }
            else
            {
                this.errorProvider2.SetError(this.cboDeTai, null);
            }
            if (this.cboNhom.Text.Trim().Length <= 0)
            {
                this.errorProvider3.SetError(this.cboNhom, "Phai chon nhom");
                dem++;
            }
            else
            {
                this.errorProvider3.SetError(this.cboNhom, null);
            }
            if (this.txtTrangThai.Text.Trim().Length <= 0)
            {
                this.errorProvider4.SetError(this.txtTrangThai, "Phai nhap trang thai cua de tai");
                dem++;
            }
            else
            {
                this.errorProvider4.SetError(this.txtTrangThai, null);
            }
            if (dem != 0)
            {
                return;
            }
            TienDo td = new TienDo();

            td.MaTienDo   = this.txtTenTienDo.Text.Trim();
            td.MaDT       = this.cboDeTai.Text.Trim();
            td.MaNhom     = this.cboNhom.Text.Trim();
            td.TaiLieu    = this.txtTaiLieu.Text.Trim();
            td.TrangThai  = this.txtTrangThai.Text.Trim();
            td.ThoiGianKT = this.dataTimeKT.Value;
            td.NhanXet    = this.txtNhanXet.Text.Trim();
            if (TienDoController.AddTienDo(td) == false)
            {
                MessageBox.Show("Mã đề tài bị trùng");
                return;
            }
            //TienDoController.AddTienDo(td);
            BindingSource source = new BindingSource();

            source.DataSource             = TienDoController.getListTienDo();
            this.dataGridView1.DataSource = source;
        }
        private void btnSua_Click(object sender, EventArgs e)
        {
            int dem = 0;

            if (this.txtTenTienDo.Text.Trim().Length <= 0)
            {
                this.errorProvider1.SetError(this.txtTenTienDo, "Phai nhap ten tien do");
                dem++;
            }
            else
            {
                this.errorProvider1.SetError(this.txtTenTienDo, null);
            }
            if (this.cboDeTai.Text.Trim().Length <= 0)
            {
                this.errorProvider2.SetError(this.cboDeTai, "Phai chon de tai");
                dem++;
            }
            else
            {
                this.errorProvider2.SetError(this.cboDeTai, null);
            }
            if (this.cboNhom.Text.Trim().Length <= 0)
            {
                this.errorProvider3.SetError(this.cboNhom, "Phai chon nhom");
                dem++;
            }
            else
            {
                this.errorProvider3.SetError(this.cboNhom, null);
            }
            if (this.txtTrangThai.Text.Trim().Length <= 0)
            {
                this.errorProvider4.SetError(this.txtTrangThai, "Phai nhap trang thai cua de tai");
                dem++;
            }
            else
            {
                this.errorProvider4.SetError(this.txtTrangThai, null);
            }
            if (dem != 0)
            {
                return;
            }
            if (flag == true)
            {
                try
                {
                    this.dataGridView1.SelectedCells[0].Value = this.txtTenTienDo.Text.Trim();
                    this.dataGridView1.SelectedCells[5].Value = this.cboDeTai.Text.Trim();
                    this.dataGridView1.SelectedCells[6].Value = this.cboNhom.Text.Trim();
                    this.dataGridView1.SelectedCells[2].Value = this.txtTaiLieu.Text.Trim();
                    this.dataGridView1.SelectedCells[1].Value = this.txtTrangThai.Text.Trim();
                    this.dataGridView1.SelectedCells[3].Value = this.dataTimeKT.Value;
                    this.dataGridView1.SelectedCells[4].Value = this.txtNhanXet.Text.Trim();
                }
                catch
                {
                    MessageBox.Show("Hãy nhấn vào ô trống đầu tiên của mỗi dòng để chọn dòng cần cập nhật!");
                    return;
                }
            }
            flag = false;
            TienDo td = new TienDo();

            td.MaTienDo   = this.txtTenTienDo.Text.Trim();
            td.MaDT       = this.cboDeTai.Text.Trim();
            td.MaNhom     = this.cboNhom.Text.Trim();
            td.TaiLieu    = this.txtTaiLieu.Text.Trim();
            td.TrangThai  = this.txtTrangThai.Text.Trim();
            td.ThoiGianKT = this.dataTimeKT.Value;
            td.NhanXet    = this.txtNhanXet.Text.Trim();
            TienDoController.UpdateTienDo(td);
            BindingSource source = new BindingSource();

            source.DataSource             = TienDoController.getListTienDo();
            this.dataGridView1.DataSource = source;
        }