Ejemplo n.º 1
0
        private void listDeTai_Click(object sender, EventArgs e)
        {
            try
            {
                this.txtMaDT.Text      = this.listDeTai.SelectedItems[0].SubItems[0].Text.Trim();
                this.txtTenDT.Text     = this.listDeTai.SelectedItems[0].SubItems[1].Text.Trim();
                this.rtMoTa.Text       = this.listDeTai.SelectedItems[0].SubItems[2].Text.Trim();
                this.NgayBatDau.Value  = DateTime.Parse(this.listDeTai.SelectedItems[0].SubItems[3].Text.Trim());
                this.NgayKetThuc.Value = DateTime.Parse(this.listDeTai.SelectedItems[0].SubItems[4].Text.Trim());
                this.txtTienDo.Text    = this.listDeTai.SelectedItems[0].SubItems[5].Text.Trim();
                //hiển thị lại trên listsinhvien
                lstSV.Items.Clear();
                if (DeTaiController.checkExistDeTai(listDeTai.SelectedItems[0].SubItems[0].Text))
                {
                    int dem = DeTaiController.demsinhvien(listDeTai.SelectedItems[0].SubItems[0].Text.Trim());
                    for (int i = 0; i < dem; i++)
                    {
                        lstSV.Items.Add(DeTaiController.danhsach(listDeTai.SelectedItems[0].SubItems[0].Text.Trim())[i]);
                    }
                }

                this.cbGV.Text       = this.listDeTai.SelectedItems[0].SubItems[7].Text.Trim();
                this.rtNhanXet.Text  = this.listDeTai.SelectedItems[0].SubItems[9].Text.Trim();
                checkTienDo1.Checked = false;
                checkTienDo2.Checked = false;
                checkTienDo3.Checked = false;
                checkTienDo4.Checked = false;
                if (int.Parse(txtTienDo.Text) == 25)
                {
                    checkTienDo1.Checked = true;
                }
                else if (int.Parse(txtTienDo.Text) == 50)
                {
                    checkTienDo1.Checked = true;
                    checkTienDo2.Checked = true;
                }
                else if (int.Parse(txtTienDo.Text) == 75)
                {
                    checkTienDo1.Checked = true;
                    checkTienDo2.Checked = true;
                    checkTienDo3.Checked = true;
                }
                else if (int.Parse(txtTienDo.Text) == 100)
                {
                    checkTienDo1.Checked = true;
                    checkTienDo2.Checked = true;
                    checkTienDo3.Checked = true;
                    checkTienDo4.Checked = true;
                }
            }
            catch { }
        }
        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");
        }
        public frmDeTaiSinhVien(SinhVien sinhvien)
        {
            InitializeComponent();

            masinhvien = sinhvien.MaSV;
            this.detai = SinhVienController.danhsach(sinhvien.MaSV);
            TimeSpan Val = DateTime.Parse(detai.NgayKetThuc.ToString()).Subtract(DateTime.Now);

            gioketthuc = Val.Days * 24 + Val.Hours;
            if (gioketthuc < 0)
            {
                prThoiGian.Value = 0;
            }
            else if (gioketthuc > 720)
            {
                prThoiGian.Value = 720;
            }
            else
            {
                prThoiGian.Value = gioketthuc;
            }
            lbConLai.Text           = gioketthuc.ToString() + " Giờ";
            lbMaDT.Text             = detai.MaDT;
            lbTenDT.Text            = detai.TenDT;
            rtxtMoTa.Text           = detai.MoTaDT;
            lbNgayBatDau.Text       = detai.NgayBatDau.ToString("dd/MM/yyyy");
            lbNgayKetThuc.Text      = detai.NgayKetThuc.ToString("dd/MM/yyyy");
            lbTienDo.Text           = detai.TienDoDT + "%";
            rtxtNhanXet.Text        = detai.NhanXet;
            this.giaovien           = GiaoVienController.getExistGV(detai.MaGV);
            lbGiaoVienHuongDan.Text = giaovien.MaGV.ToString() + ": " + giaovien.HoTen.ToString();
            prTienDo.Value          = int.Parse(detai.TienDoDT.ToString());
            txtUpLoad.Text          = detai.FileDeTai;
            int dem = DeTaiController.demsinhvien(sinhvien.MaDT);

            for (int i = 0; i < dem; i++)
            {
                danhsachsinhvien.Text += DeTaiController.danhsach(sinhvien.MaDT)[i].HoTen.ToString() + "\n";
            }
        }
        public frmChiTietDeTai(DeTai detai)
        {
            try
            {
                InitializeComponent();
                this.detai1 = detai;
                timer1.Start();
                TimeSpan Val = DateTime.Parse(detai.NgayKetThuc.ToString()).Subtract(DateTime.Now);
                gioketthuc        = Val.Days * 24 + Val.Hours;
                lbConLai.Text     = gioketthuc.ToString() + " Giờ";
                lbMaDT.Text       = detai.MaDT;
                txtTenDT.Text     = detai.TenDT;
                txtMoTa.Text      = detai.MoTaDT;
                NgayBatDau.Value  = detai.NgayBatDau;
                NgayKetThuc.Value = detai.NgayKetThuc;
                txtTienDo.Text    = detai.TienDoDT.ToString();
                rtxtNhanXet.Text  = detai.NhanXet;
                txtUpLoad.Text    = detai.FileDeTai;
                if (gioketthuc < 0)
                {
                    prThoiGian.Value = 0;
                }
                else if (gioketthuc > 720)
                {
                    prThoiGian.Value = 720;
                }
                else
                {
                    prThoiGian.Value = gioketthuc;
                }

                if (detai.TienDoDT == 25)
                {
                    checkTienDo1.Checked = true;
                }
                else if (detai.TienDoDT == 50)
                {
                    checkTienDo1.Checked = true;
                    checkTienDo2.Checked = true;
                }
                else if (detai.TienDoDT == 75)
                {
                    checkTienDo1.Checked = true;
                    checkTienDo2.Checked = true;
                    checkTienDo3.Checked = true;
                }
                else if (detai.TienDoDT == 100)
                {
                    checkTienDo1.Checked = true;
                    checkTienDo2.Checked = true;
                    checkTienDo3.Checked = true;
                    checkTienDo4.Checked = true;
                }
                prTienDo.Value          = int.Parse(detai.TienDoDT.ToString());
                lbGiaoVienHuongDan.Text = detai.GiaoVien.MaGV.ToString() + ": " + detai.GiaoVien.HoTen.ToString();
                int dem = DeTaiController.demsinhvien(detai.MaDT);
                for (int i = 0; i < dem; i++)
                {
                    listSinhVien.Items.Add(DeTaiController.danhsach(detai.MaDT)[i]);
                }
            }
            catch
            {
            }
        }