Ejemplo n.º 1
0
        public async Task OnGetAsync(string system, string systemILP, string academicYear)
        {
            string defaultAcademicYear = await AcademicYearFunctions.GetDefaultAcademicYear(_context);

            string systemDB            = DatabaseSelector.GetDatabase(_configuration, system);
            string systemILPDB         = DatabaseSelector.GetILPDatabase(_configuration, systemILP, system);
            string CurrentAcademicYear = await AcademicYearFunctions.GetAcademicYear(academicYear, _context);

            string ProgressionAcademicYear = await AcademicYearFunctions.GetProgressionYear(academicYear, _context);

            SystemID            = systemDB;
            SystemILPID         = systemILPDB;
            AcademicYear        = CurrentAcademicYear;
            ProgressionYear     = ProgressionAcademicYear;
            DefaultAcademicYear = defaultAcademicYear;
            string selectListDomain = null;

            selectListDomain = "ACADEMIC_YEAR";
            AcademicYearData = await _context.SelectListData
                               .FromSqlInterpolated($"EXEC SPR_PRG_SelectListData @System={systemDB}, @AcademicYear={CurrentAcademicYear}, @Domain={selectListDomain}")
                               .ToListAsync();

            ViewData["AcademicYearID"] = new SelectList(AcademicYearData, "Code", "Description", CurrentAcademicYear);

            selectListDomain = "APPLICATION_OFFER";
            ApplicationOffer = await _context.SelectListData
                               .FromSqlInterpolated($"EXEC SPR_PRG_SelectListData @System={systemDB}, @AcademicYear={CurrentAcademicYear}, @Domain={selectListDomain}")
                               .ToListAsync();

            ViewData["OfferID"] = new SelectList(ApplicationOffer, "Code", "Description");

            selectListDomain     = "APPLICATION_CONDITION";
            ApplicationCondition = await _context.SelectListData
                                   .FromSqlInterpolated($"EXEC SPR_PRG_SelectListData @System={systemDB}, @AcademicYear={CurrentAcademicYear}, @Domain={selectListDomain}")
                                   .ToListAsync();

            ViewData["ConditionID"] = new SelectList(ApplicationCondition, "Code", "Description");

            UserDetails = await Identity.GetFullName(system, academicYear, User.Identity.Name.Split('\\').Last(), _context, _configuration);

            UserGreeting = Identity.GetGreeting();

            SystemVersion = _configuration["Version"];

            Browser = Request.Headers["User-Agent"];

            ShowCharts = _showCharts;

            ShowCoursesWithoutEnrols = _showCoursesWithoutEnrols;
        }
Ejemplo n.º 2
0
        public async Task OnGetAsync(string academicYear, string collegeGroup, string fac, string team, string username, string dataMode)
        {
            string academicYearID = null;

            if (academicYear != null)
            {
                academicYearID = academicYear.Replace("-", "/");
            }

            AcademicYearID = await AcademicYearFunctions.GetAcademicYear(academicYearID, _context);

            DefaultAcademicYearID = await AcademicYearFunctions.GetDefaultAcademicYear(_context);

            if (username != null)
            {
                AppUserID = username;
            }
            else
            {
                AppUserID = User.GetUsername();
            }

            if (team != null)
            {
                StructureLevelID = 4;
            }
            else if (fac != null)
            {
                StructureLevelID = 3;
            }
            else if (collegeGroup != null)
            {
                StructureLevelID = 2;
            }
            else
            {
                StructureLevelID = 1;
            }
            CollegeGroupID = collegeGroup;
            FacID          = fac;
            TeamID         = team;

            if (dataMode == null)
            {
                dataMode = "STATIC";
            }
            DataModeID = dataMode;

            //UserDetails = await Identity.GetFullName(academicYear, User.Identity.Name.Split('\\').Last(), _context);
            UserDetails = await Identity.GetFullName(academicYearID, "r.wilson2", _context);

            string selectListDomain = null;

            selectListDomain = "ACADEMIC_YEAR";
            AcademicYearData = await _context.SelectListData
                               .FromSqlInterpolated($"EXEC SPR_GPR_SelectListData @AcademicYear={AcademicYearID}, @Domain={selectListDomain}")
                               .ToListAsync();

            ViewData["AcademicYearID"] = new SelectList(AcademicYearData, "Code", "Description", AcademicYearID);

            Staff = await _context.Staff
                    .FromSqlInterpolated($"EXEC SPR_GPR_StaffList @AcademicYear={AcademicYearID}")
                    .ToListAsync();
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnGetAsync(string academicYear, string courseCode, string groupCode, string dataMode)
        {
            if (courseCode == null)
            {
                return(NotFound());
            }

            AcademicYearID        = academicYear;
            DefaultAcademicYearID = await AcademicYearFunctions.GetDefaultAcademicYear(_context);

            if (AcademicYearID == null)
            {
                AcademicYearID = DefaultAcademicYearID;
            }

            string academicYearID = AcademicYearID.Replace("-", "/");
            string username       = User.Identity.Name.Split('\\').Last();

            //Course = await _context.Course.FirstOrDefaultAsync(m => m.CourseID == id);

            if (dataMode == "STATIC")
            {
                Course = (await _context.Course
                          .FromSqlInterpolated($"EXEC SPR_GPR_CourseList_Static @AcademicYear={academicYearID}, @Username={username}, @CoursesITeach={null}, @CourseCode={courseCode}, @GroupCode={groupCode}, @CollegeGroup={null}, @Fac={null}, @Team={null}, @CourseSearch={null}, @StaffSearch={null}")
                          .ToListAsync())
                         .FirstOrDefault();
            }
            else
            {
                Course = (await _context.Course
                          .FromSqlInterpolated($"EXEC SPR_GPR_CourseList @AcademicYear={academicYearID}, @Username={username}, @CoursesITeach={null}, @CourseCode={courseCode}, @GroupCode={groupCode}, @CollegeGroup={null}, @Fac={null}, @Team={null}, @CourseSearch={null}, @StaffSearch={null}")
                          .ToListAsync())
                         .FirstOrDefault();
            }

            if (Course == null)
            {
                return(NotFound());
            }

            FolderPath = (await _context.FolderPath
                          .FromSqlInterpolated($"EXEC SPR_GPR_FolderPath @AcademicYear={academicYearID}, @CollegeGroup={Course.CollegeCode}, @Fac={Course.FacCode}, @Team={Course.TeamCode}, @Course={Course.CourseCode}")
                          .ToListAsync())
                         .FirstOrDefault();

            if (FolderPath != null)
            {
                Path = FolderPath.Path;

                Path = Path.Replace("[FOLDER]", "<i class=\"fas fa-folder-open\"></i>");
                Path = Path.Replace("[DIVIDER]", "<i class=\"fas fa-chevron-right\"></i>");
            }

            string selectListDomain = null;

            selectListDomain = "YES_NO";
            YesNoData        = await _context.SelectListData
                               .FromSqlInterpolated($"EXEC SPR_GPR_SelectListData @AcademicYear={AcademicYearID}, @Domain={selectListDomain}")
                               .ToListAsync();

            ViewData["YesNoID"] = new SelectList(YesNoData, "Code", "Description");

            selectListDomain         = "PREDICTED_TO_ACHIEVE_BY";
            PredictedToAchieveByData = await _context.SelectListData
                                       .FromSqlInterpolated($"EXEC SPR_GPR_SelectListData @AcademicYear={AcademicYearID}, @Domain={selectListDomain}")
                                       .ToListAsync();

            ViewData["PredictedToAchieveByID"] = new SelectList(PredictedToAchieveByData, "Code", "Description");

            selectListDomain   = Course.PredictedGradeLookupType;
            PredictedGradeData = await _context.SelectListData
                                 .FromSqlInterpolated($"EXEC SPR_GPR_SelectListData @AcademicYear={AcademicYearID}, @Domain={selectListDomain}")
                                 .ToListAsync();

            ViewData["PredictedGradeID"] = new SelectList(PredictedGradeData, "Code", "Description");

            CourseGroupCode = Course.CourseCode;

            if (dataMode == null)
            {
                dataMode = "STATIC";
            }
            DataModeID = dataMode;

            if (Course.GroupCode != null)
            {
                CourseGroupCode += "-" + Course.GroupCode;
            }

            return(Page());
        }