예제 #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));
        }
예제 #2
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));
            }
        }
예제 #3
0
        public async Task <IActionResult> Index()
        {
            Dot = 1;
            var moDot = await _serviceMoDot.GetEntity(x => x.Status == 1);

            var hoiDong = await _serviceHoiDong.GetAll(x => x.Status == 1);

            var deTai = await _serviceDeTai.GetAll(x => x.TinhTrangPhanCong == (int)StatusPhanCong.ChuaPhanCong && x.TinhTrangDeTai == (int)StatusDeTai.DaDangKy);

            var allDot = await _serviceMoDot.GetAll();

            ViewBag.DeTai = deTai;
            if (!allDot.Any())
            {
                return(View(hoiDong));
            }
            if (moDot != null && moDot.Loai != (int)MoDotLoai.DangKy)
            {
                string temp = "";
                if (moDot.Loai == (int)MoDotLoai.XetDuyetDeTai)
                {
                    temp = "Xét duyệt đề tài (" + moDot.ThoiGianBd.Value.ToString("HH:mm:ss dd/MM/yyyy") + " - "
                           + moDot.ThoiGianKt.Value.ToString("HH:mm:ss dd/MM/yyyy") + ")";
                }
                else
                {
                    temp = "Đánh giá nghiệm thu đề tài (" + moDot.ThoiGianBd.Value.ToString("HH:mm:ss dd/MM/yyyy") + " - "
                           + moDot.ThoiGianKt.Value.ToString("HH:mm:ss dd/MM/yyyy") + ")";
                }
                ViewBag.MoDot   = temp;
                ViewBag.IdMoDot = moDot.Id;
            }
            if (allDot.Count() > 1 && allDot.ToList()[allDot.Count() - 2].Loai == moDot.Loai)
            {
                Dot   = 2;
                deTai = await _serviceDeTai.GetAll(x => x.TinhTrangPhanCong == (int)StatusPhanCong.ChuaPhanCong && x.TinhTrangDeTai == (int)StatusDeTai.DanhGiaLai);

                ViewBag.DeTai = deTai;
            }

            return(View(hoiDong.OrderBy(x => x.StatusPhanCong)));
        }
예제 #4
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());
        }
예제 #5
0
        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));
        }