Example #1
0
        public async Task <IActionResult> Index(string mess)
        {
            IEnumerable <MoDot> listDotDangKy = await _service.GetAll(x => x.Loai == (int)MoDotLoai.DangKy);

            if (!listDotDangKy.Any())
            {
                return(View());
            }
            MoDot DotDangKyMoiNhat = listDotDangKy.ToList().Last();

            MoDot moDot = await _service.GetEntity(x => x.Status == (int)MoDotStatus.Mo);

            DeTaiNghienCuu detai = await _serviceDeTai.GetEntity(x => x.NgayThucHien != null && x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt);

            if (mess != "")
            {
                ViewBag.mess = mess;
            }
            if (detai != null)
            {
                ViewBag.NgayBdDeTai = detai.NgayThucHien.Value.ToString("yyyy-MM-dd'T'HH:mm:ss");
                ViewBag.NgayKtDeTai = detai.NgayKetThuc.Value.ToString("yyyy-MM-dd'T'HH:mm:ss");
            }

            if (moDot != null)
            {
                if (DateTime.Now > moDot.ThoiGianKt.Value)
                {
                    moDot.Status = (int)MoDotStatus.Dong;
                    await _service.Update(moDot);
                }
            }

            return(View(moDot));
        }
Example #2
0
        public async Task <IActionResult> Delete(int id)
        {
            MoDot moDot = await _service.GetById(id);

            moDot.Status = 0;
            await _service.Update(moDot);

            return(RedirectToAction("Index"));
        }
Example #3
0
        public async Task <IActionResult> Index()
        {
            var allDot = await _serviceMoDot.GetAll();

            if (!allDot.Any())
            {
                return(View());
            }
            DotHienTai = await _serviceMoDot.GetEntity(x => x.Status == (int)MoDotStatus.Mo && x.Loai == (int)MoDotLoai.XetDuyetDeTai);

            if (DotHienTai == null)
            {
                return(View());
            }
            ViewBag.MoDot = DotHienTai;
            Dot           = 1;
            ViewBag.Dot   = Dot;
            if (allDot.Count() > 1 && allDot.ToList()[allDot.Count() - 2].Loai == DotHienTai.Loai)
            {
                Dot         = 2;
                ViewBag.Dot = Dot;
            }

            List <TinhTrangXDDG> data = LoadList();

            if (Dot == 1)
            {
                List <TinhTrangXDDG> tabDot1 = data.ToList();
                TabDotViewModel      viewx   = new TabDotViewModel();
                //viewx.ListDeTaiDuocPhanCong = listDetaiXetDuyet;
                viewx.tabDot1 = tabDot1;

                return(View(viewx));
            }
            else
            {
                List <TinhTrangXDDG> tabDot2 = data.ToList();
                List <TinhTrangXDDG> tabDot1 = new List <TinhTrangXDDG>(); //edit lại
                foreach (var item in tabDot2)
                {
                    TinhTrangXDDG t = new TinhTrangXDDG();
                    t.IdDeTai        = item.IdDeTai;
                    t.TenDeTai       = item.TenDeTai;
                    t.TinhTrangDeTai = item.TinhTrangDeTai;
                    t.TinhTrang      = "Đã đánh giá";
                    tabDot1.Add(t);
                }
                TabDotViewModel viewx = new TabDotViewModel();
                //viewx.ListDeTaiDuocPhanCong = listDetaiXetDuyet;
                viewx.tabDot1 = tabDot1;
                viewx.tabDot2 = tabDot2;
                return(View(viewx));
            }
        }
Example #4
0
        public async Task <IActionResult> Create(MoDot moDot)
        {
            var allXDDG = await _serviceXDDG.GetAll();

            if (allXDDG.Any())
            {
                foreach (var item in allXDDG)
                {
                    item.Status = 0;
                    await _serviceXDDG.Update(item);
                }
            }
            var HoiDong = await _serviceHoiDong.GetAll();

            if (HoiDong.Any())
            {
                foreach (var item in HoiDong)
                {
                    item.StatusPhanCong = (int)StatusPhanCong.ChuaPhanCong;
                    await _serviceHoiDong.Update(item);
                }
            }
            var DeTai = await _serviceDeTai.GetAll();

            if (DeTai.Any())
            {
                foreach (var item in DeTai)
                {
                    item.TinhTrangPhanCong = (int)StatusPhanCong.ChuaPhanCong;
                    await _serviceDeTai.Update(item);
                }
            }
            if (moDot.Loai == (int)MoDotLoai.DangKy)
            {
                var Nhom = await _serviceNhom.GetAll();

                if (Nhom.Any())
                {
                    foreach (var item in Nhom)
                    {
                        item.Status = (int)BaseStatus.Disable;
                        await _serviceNhom.Update(item);
                    }
                }
            }
            moDot.Status   = 1;
            moDot.IdquanLy = long.Parse(User.Identity.Name);
            await _service.Add(moDot);

            return(RedirectToAction("Index", new { mess = "Mở đợt thành công" }));
        }
Example #5
0
        public async Task <IActionResult> Index(string mess)
        {
            IEnumerable <MoDot> listDotDangKy = await _serviceMoDot.GetAll(x => x.Loai == (int)MoDotLoai.DangKy);

            if (!listDotDangKy.Any())
            {
                return(View());
            }
            MoDot DotDangKyMoiNhat = listDotDangKy.ToList().LastOrDefault();

            IEnumerable <DeTaiNghienCuu> listDeTaiHienTai = await _service.GetAll(x => x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet ||
                                                                                  x.TinhTrangDeTai == (int)StatusDeTai.DaDangKy ||
                                                                                  x.TinhTrangDeTai == (int)StatusDeTai.HoanThanh ||
                                                                                  x.TinhTrangDeTai == (int)StatusDeTai.Huy &&
                                                                                  (x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt) ||
                                                                                  (x.NgayDangKy == null && x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet));

            IEnumerable <DeTaiNghienCuu> listDeTaiDeXuatHienTai = await _service.GetAll(x => x.Loai == LoaiDeTai.DeXuat &&
                                                                                        x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd &&
                                                                                        x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt);

            IEnumerable <GiangVien> listGiangVien = await _serviceGiangVien.GetAll();

            DeTaiNghienCuuAdminViewModel viewModel = new DeTaiNghienCuuAdminViewModel()
            {
                DotDangKyHienTai       = DotDangKyMoiNhat,
                listDeTaiHienTai       = listDeTaiHienTai,
                listDeTaiDeXuatHienTai = listDeTaiDeXuatHienTai,
                listGiangVien          = listGiangVien.Select(a => new SelectListItem()
                {
                    Value = a.Id.ToString(),
                    Text  = a.Ho + " " + a.Ten
                }).ToList()
            };

            if (mess != "")
            {
                ViewBag.mess = mess;
            }

            return(View(viewModel));
        }
Example #6
0
        public async Task <IActionResult> EditTGThucHienDeTai(DateTime NgayBdDeTai, DateTime NgayKtDeTai)
        {
            IEnumerable <MoDot> listDotDangKy = await _service.GetAll(x => x.Loai == (int)MoDotLoai.DangKy);

            MoDot DotDangKyMoiNhat = listDotDangKy.ToList().Last();

            IEnumerable <DeTaiNghienCuu> deTaiNghienCuus = await _serviceDeTai.GetAll(x => x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt);

            if (deTaiNghienCuus.Any())
            {
                foreach (var item in deTaiNghienCuus)
                {
                    item.NgayThucHien = NgayBdDeTai;
                    item.NgayKetThuc  = NgayKtDeTai;
                    await _serviceDeTai.Update(item);
                }
            }

            return(RedirectToAction("Index", new { mess = "Cập nhật thành công" }));
        }
Example #7
0
        public async Task <IActionResult> Index()
        {
            MoDot moDot = await _serviceMoDot.GetEntity(x => x.Status == (int)MoDotStatus.Mo && x.Loai == (int)MoDotLoai.DangKy);

            if (moDot != null)
            {
                if (DateTime.Now >= moDot.ThoiGianBd && DateTime.Now <= moDot.ThoiGianKt)
                {
                    double thoigian = (moDot.ThoiGianKt - DateTime.Now).Value.TotalSeconds;
                    HttpContext.Response.Headers.Add("refresh", "" + thoigian + "; url=" + Url.Action("Index"));
                    ViewBag.DangMoDot = true;
                }
                else
                {
                    ViewBag.DangMoDot = false;
                }
            }
            else
            {
                ViewBag.DangMoDot = false;
            }
            return(View());
        }
Example #8
0
        public async Task <IActionResult> XuatBaoCaoTongQuat()
        {
            IEnumerable <MoDot> listDotDangKy = await _serviceMoDot.GetAll(x => x.Loai == (int)MoDotLoai.DangKy);

            MoDot DotDangKyMoiNhat = listDotDangKy.ToList().Last();

            IEnumerable <DeTaiNghienCuu> listDeTaiHienTai = await _service.GetAll(x => x.TinhTrangDeTai != (int)StatusDeTai.MoiTao &&
                                                                                  (x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd &&
                                                                                   x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt) ||
                                                                                  (x.NgayDangKy == null && x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet));

            List <DeTaiNghienCuu> listDeTaiDaDangKy = listDeTaiHienTai.Where(x => x.TinhTrangDangKy == (int)StatusDangKyDeTai.Het).ToList();

            List <DeTaiNghienCuu> listDeTaiChuaDangKy = listDeTaiHienTai.Where(x => x.TinhTrangDeTai != (int)StatusDeTai.MoiTao && x.TinhTrangDangKy == (int)StatusDangKyDeTai.Con).ToList();

            var stream = new MemoryStream();

            using (var package = new ExcelPackage(stream))
            {
                #region -- Danh sách đề tài được mở --
                var Sheet1 = package.Workbook.Worksheets.Add("Danh sách đề tài được mở");

                #region -- Header --

                Sheet1.Cells["A1"].Style.Font.Bold           = true;
                Sheet1.Cells["A1"].Value                     = "TRƯỜNG ĐẠI HỌC SÀI GÒN";
                Sheet1.Cells["E1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Right;
                Sheet1.Cells["E1"].Value                     = DateTime.Now.ToString("HH:mm, dd/MM/yyyy");
                Sheet1.Cells["A3:E3"].Merge                  = true;
                Sheet1.Cells["A3"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                Sheet1.Cells["A3"].Style.Font.Bold           = true;
                Sheet1.Cells["A3"].Value                     = "BÁO CÁO TỔNG QUÁT ĐỀ TÀI NGHIÊN CỨU";

                Sheet1.Cells["A5"].Style.Font.Bold = true;
                Sheet1.Cells["A5"].Value           = "Danh sách đề tài được mở";

                Sheet1.Cells["A7:E7"].Style.Font.Bold           = true;
                Sheet1.Cells["A7:E7"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                Sheet1.Cells["A7"].Value = "Mã đề tài";
                Sheet1.Cells["B7"].Value = "Tên đề tài";
                Sheet1.Cells["C7"].Value = "Mô tả";
                Sheet1.Cells["D7"].Value = "Ngày lập";
                Sheet1.Cells["E7"].Value = "Giảng viên";

                #endregion

                #region -- Details --
                int rowSheet1 = 8;
                foreach (var item in listDeTaiHienTai)
                {
                    Sheet1.Cells[string.Format("A{0}", rowSheet1)].Value = item.Id;
                    Sheet1.Cells[string.Format("B{0}", rowSheet1)].Value = item.TenDeTai;
                    Sheet1.Cells[string.Format("C{0}", rowSheet1)].Value = item.MoTa;
                    Sheet1.Cells[string.Format("D{0}", rowSheet1)].Value = item.NgayLap.Value.ToString("dd/MM/yyyy");
                    if (item.IdgiangVien != null)
                    {
                        Sheet1.Cells[string.Format("E{0}", rowSheet1)].Value = item.IdgiangVienNavigation.Ho + " " + item.IdgiangVienNavigation.Ten;
                    }

                    rowSheet1++;
                }
                #endregion

                #region -- Footer --


                Sheet1.Cells["A7" + ":" + string.Format("E{0}", rowSheet1 - 1)].Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet1.Cells["A7" + ":" + string.Format("E{0}", rowSheet1 - 1)].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet1.Cells["A7" + ":" + string.Format("E{0}", rowSheet1 - 1)].Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet1.Cells["A7" + ":" + string.Format("E{0}", rowSheet1 - 1)].Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;

                Sheet1.Cells["A:AZ"].AutoFitColumns();
                #endregion
                #endregion

                #region -- Danh sách đề tài đã đăng ký --
                var Sheet2 = package.Workbook.Worksheets.Add("Danh sách đề tài đã đăng ký");

                #region -- Header --

                Sheet2.Cells["A1"].Style.Font.Bold = true;
                Sheet2.Cells["A1"].Value           = "Danh sách đề tài đã đăng ký";

                Sheet2.Cells["A3:I3"].Style.Font.Bold           = true;
                Sheet1.Cells["A3:I3"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                Sheet2.Cells["A3"].Value = "Mã đề tài";
                Sheet2.Cells["B3"].Value = "Tên đề tài";
                Sheet2.Cells["C3"].Value = "Mô tả";
                Sheet2.Cells["D3"].Value = "Ngày lập";
                Sheet2.Cells["E3"].Value = "Sinh viên đăng ký";
                Sheet2.Cells["F3"].Value = "Giảng viên";
                Sheet2.Cells["G3"].Value = "Hội đồng xét duyệt";
                Sheet2.Cells["H3"].Value = "Hội đồng đánh giá nghiệm thu";
                Sheet2.Cells["I3"].Value = "Trạng thái";

                #endregion

                #region -- Details --
                int rowSheet2 = 4;
                foreach (var item in listDeTaiDaDangKy)
                {
                    Sheet2.Cells[string.Format("A{0}", rowSheet2)].Value = item.Id;
                    Sheet2.Cells[string.Format("B{0}", rowSheet2)].Value = item.TenDeTai;
                    Sheet2.Cells[string.Format("C{0}", rowSheet2)].Value = item.MoTa;
                    Sheet2.Cells[string.Format("D{0}", rowSheet2)].Value = item.NgayLap.Value.ToString("dd/MM/yyyy");
                    Sheet2.Cells[string.Format("E{0}", rowSheet2)].Value = ThanhVienNhom(item.Id).Result;
                    if (item.IdgiangVien != null)
                    {
                        Sheet2.Cells[string.Format("F{0}", rowSheet2)].Value = item.IdgiangVienNavigation.Ho + " " + item.IdgiangVienNavigation.Ten;
                    }
                    Sheet2.Cells[string.Format("G{0}", rowSheet2)].Value = HoiDong("XetDuyet", item.Id).Result;
                    Sheet2.Cells[string.Format("H{0}", rowSheet2)].Value = HoiDong("DanhGiaNghiemThu", item.Id).Result;
                    if (item.TinhTrangDeTai == (int)StatusDeTai.HoanThanh)
                    {
                        Sheet2.Cells[string.Format("I{0}", rowSheet2)].Value = "Đạt";
                    }
                    else
                    {
                        Sheet2.Cells[string.Format("I{0}", rowSheet2)].Value = "Chưa đạt";
                    }
                    rowSheet2++;
                }
                #endregion

                #region -- Footer --


                Sheet2.Cells["A3" + ":" + string.Format("I{0}", rowSheet2 - 1)].Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet2.Cells["A3" + ":" + string.Format("I{0}", rowSheet2 - 1)].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet2.Cells["A3" + ":" + string.Format("I{0}", rowSheet2 - 1)].Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet2.Cells["A3" + ":" + string.Format("I{0}", rowSheet2 - 1)].Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;


                Sheet2.Cells["A:AZ"].AutoFitColumns();
                #endregion
                #endregion

                #region -- Danh sách đề tài chưa đăng ký --
                var Sheet3 = package.Workbook.Worksheets.Add("Danh sách đề tài chưa đăng ký");

                #region -- Header --

                Sheet3.Cells["A1"].Style.Font.Bold = true;
                Sheet3.Cells["A1"].Value           = "Danh sách đề tài chưa đăng ký";

                Sheet3.Cells["A3:I3"].Style.Font.Bold           = true;
                Sheet3.Cells["A3:I3"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                Sheet3.Cells["A3"].Value = "Mã đề tài";
                Sheet3.Cells["B3"].Value = "Tên đề tài";
                Sheet3.Cells["C3"].Value = "Mô tả";
                Sheet3.Cells["D3"].Value = "Ngày lập";
                Sheet3.Cells["E3"].Value = "Giảng viên";

                #endregion

                #region -- Details --
                int rowSheet3 = 4;
                foreach (var item in listDeTaiChuaDangKy)
                {
                    Sheet3.Cells[string.Format("A{0}", rowSheet3)].Value = item.Id;
                    Sheet3.Cells[string.Format("B{0}", rowSheet3)].Value = item.TenDeTai;
                    Sheet3.Cells[string.Format("C{0}", rowSheet3)].Value = item.MoTa;
                    Sheet3.Cells[string.Format("D{0}", rowSheet3)].Value = item.NgayLap.Value.ToString("dd/MM/yyyy");
                    if (item.IdgiangVien != null)
                    {
                        Sheet3.Cells[string.Format("E{0}", rowSheet3)].Value = item.IdgiangVienNavigation.Ho + " " + item.IdgiangVienNavigation.Ten;
                    }
                    rowSheet3++;
                }
                #endregion

                #region -- Footer --


                Sheet3.Cells["A3" + ":" + string.Format("E{0}", rowSheet3 - 1)].Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet3.Cells["A3" + ":" + string.Format("E{0}", rowSheet3 - 1)].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet3.Cells["A3" + ":" + string.Format("E{0}", rowSheet3 - 1)].Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                Sheet3.Cells["A3" + ":" + string.Format("E{0}", rowSheet3 - 1)].Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;


                Sheet3.Cells["A:AZ"].AutoFitColumns();
                #endregion
                #endregion

                package.Save();
            }

            stream.Position = 0;
            var filename = $"BaoCaoTongQuat.xlsx";
            return(File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename));
        }
Example #9
0
        public async Task <IActionResult> Edit(MoDot moDot)
        {
            await _service.Update(moDot);

            return(RedirectToAction("Index", new { mess = "Cập nhật thành công" }));
        }
        public async Task <IActionResult> Index()
        {
            DeTaiNghienCuu DetaiXetDuyet = (from t0 in _context.DeTaiNghienCuu
                                            join t1 in _context.XetDuyetVaDanhGia on t0.Id equals t1.IddeTai
                                            join t2 in _context.NhomSinhVien on t0.Id equals t2.IddeTai
                                            where t2.IdsinhVien == long.Parse(User.Identity.Name) &&
                                            t2.IdnhomNavigation.Status == 1 && t1.Status == 1
                                            select t0).SingleOrDefault();
            List <CtxetDuyetVaDanhGia> ct = new List <CtxetDuyetVaDanhGia>();

            if (DetaiXetDuyet != null)
            {
                ViewBag.TenDeTai = DetaiXetDuyet.TenDeTai;
                var xetDuyetVaDanhGia = DetaiXetDuyet.XetDuyetVaDanhGia.SingleOrDefault(x => x.Status == 1);
                if (xetDuyetVaDanhGia != null)
                {
                    ViewBag.XDDG = xetDuyetVaDanhGia;
                    ct           = xetDuyetVaDanhGia.CtxetDuyetVaDanhGia.ToList();
                    double diemtb = 0;
                    int    chia   = 0;
                    foreach (var item in ct)
                    {
                        if (item.Diem.HasValue)
                        {
                            if (item.VaiTro == (int)LoaiVaiTro.PhanBien)
                            {
                                diemtb = diemtb + (2 * item.Diem.Value);
                                chia   = chia + 2;
                            }
                            else
                            {
                                diemtb = diemtb + item.Diem.Value;
                                chia++;
                            }
                        }
                    }
                    if (chia == 0)
                    {
                        ViewBag.DiemTB = 0;
                    }
                    else
                    {
                        ViewBag.DiemTB = diemtb / chia * 1.0;
                    }
                }
            }

            MoDot moDot = await _serviceMoDot.GetEntity(x => x.Status == (int)MoDotStatus.Mo && x.Loai == (int)MoDotLoai.NghiemThuDeTai);

            if (moDot != null)
            {
                ViewBag.Dot = moDot;
                if (DateTime.Now >= moDot.ThoiGianBd && DateTime.Now <= moDot.ThoiGianKt)
                {
                    double thoigian = (moDot.ThoiGianKt - DateTime.Now).Value.TotalSeconds;
                    HttpContext.Response.Headers.Add("refresh", "" + thoigian + "; url=" + Url.Action("Index"));
                    ViewBag.DangMoDot = true;
                }
                else
                {
                    ViewBag.DangMoDot = false;
                }
            }
            else
            {
                ViewBag.DangMoDot = false;
            }
            return(View(ct));
        }
Example #11
0
 public IViewComponentResult Invoke(MoDot model)
 {
     return(View(model));
 }