Beispiel #1
0
        public async Task <IActionResult> LatestDiscussion(
            [FromQuery] int p         = 1,
            [FromQuery] string filter = "")
        {
            var getFilter = new GetMessGroupDTO
            {
                Filter         = filter,
                MaxResultCount = 5,
                SkipCount      = (p - 1) * 5
            };

            var res = await _MessGroupService.GetListAsync(getFilter);

            string listRes = string.Format("Showing {0} to {1} of {2} discussion",
                                           res.TotalCount > 0 ? getFilter.SkipCount + 1 : 0, getFilter.SkipCount + res.Items.Count, res.TotalCount);

            if (!filter.IsNullOrEmpty())
            {
                listRes += string.Format(" for \"{0}\"", getFilter.Filter);
            }
            ViewBag.ListState = listRes;

            ViewBag.Filter     = filter;
            ViewBag.Pagination = PaginateHelper.Generate(
                "javascript:syncVt('{0}', '" + filter + "');",
                p, res.TotalCount, AppTheme.Limit);

            return(PartialView("~/Pages/Discussions/Partials/LatestDiscussion.cshtml", res));
        }
Beispiel #2
0
        public async Task <IActionResult> GetQuestionsAsync(
            [FromQuery] Guid?gcId,
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetGrammarDTO
            {
                Filter            = filter ?? "",
                MaxResultCount    = AppTheme.Limit,
                SkipCount         = (p.Value - 1) * AppTheme.Limit,
                GrammarCategoryId = gcId ?? null
            };
            var res = await _Grammarervice.GetBaseListAsync(serchInp);

            if (gcId == null || gcId == Guid.Empty)
            {
                ViewBag.GroupName = L["All"];
            }
            else
            {
                var qg = await _GrammarCategoryService.GetAsync(gcId.Value);

                if (!qg.Success || qg.Data == null)
                {
                    ViewBag.GroupName = L["Unknow"];
                }
                else
                {
                    ViewBag.GroupName = qg.Data.Name;
                }
            }
            if (res.Success)
            {
                PagedResultDto <GrammarBaseDTO> Containers = res.Data;

                string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                               res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);
                if (!filter.IsNullOrEmpty())
                {
                    listRes += string.Format(" for \"{0}\"", serchInp.Filter);
                }
                ViewBag.ListState = listRes;

                ViewBag.Filter     = filter;
                ViewBag.Pagination = PaginateHelper.Generate(
                    "javascript:syncGrammar('" + gcId + "','{0}', '" + filter + "');",
                    p.Value, Containers.TotalCount, AppTheme.Limit);
                return(PartialView("~/Pages/Manager/Grammars/Partials/Grammars.cshtml", Containers));
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }
        }
        public async Task <IActionResult> GetAsync(
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetIdentityRolesInput
            {
                Filter         = filter ?? "",
                MaxResultCount = AppTheme.Limit,
                SkipCount      = (p.Value - 1) * AppTheme.Limit
            };
            var res = await _IdentityRoleAppService.GetListAsync(serchInp);

            string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                           res.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Items.Count, res.TotalCount);

            if (!filter.IsNullOrEmpty())
            {
                listRes += string.Format(" for \"{0}\"", serchInp.Filter);
            }
            ViewBag.ListState = listRes;

            ViewBag.Filter     = filter;
            ViewBag.Pagination = PaginateHelper.Generate(
                "javascript:syncVt('{0}', '" + filter + "');",
                p.Value, res.TotalCount, AppTheme.Limit);
            return(PartialView(TableView, res));
        }
Beispiel #4
0
        public async Task <IActionResult> GetTopicAsync(
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetVocabularyTopicDTO
            {
                Filter         = filter ?? "",
                MaxResultCount = AppTheme.Limit,
                SkipCount      = (p.Value - 1) * AppTheme.Limit,
                IsMustConfirm  = false
            };
            var Containers = await _VocabularyTopicService.GetContributedVocabularyTopicAsync(serchInp);

            string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                           Containers.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + Containers.Items.Count, Containers.TotalCount);

            if (!filter.IsNullOrEmpty())
            {
                listRes += string.Format(" for \"{0}\"", serchInp.Filter);
            }
            ViewBag.ListState = listRes;

            ViewBag.Filter     = filter;
            ViewBag.Pagination = PaginateHelper.Generate(
                "javascript:syncVt('{0}', '" + filter + "');",
                p.Value, Containers.TotalCount, AppTheme.Limit);
            return(PartialView("~/Pages/Dictionary/VocabContributes/Partials/Topics.cshtml", Containers));
        }
        public async Task <IActionResult> GetAsync(
            Guid examCategoryId,
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (examCategoryId == Guid.Empty)
            {
                return(PartialView(AppTheme.ContentNothing));
            }
            var examCat = await _ExamCategoryService.GetSimpify(examCategoryId);

            if (examCat.Success)
            {
                ViewBag.CurrentExamCategory = examCat.Data;
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }

            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetExamCatInstructDTO
            {
                ExamCategoryId    = examCategoryId,
                FilterDisplayName = filter ?? "",
                MaxResultCount    = AppTheme.Limit,
                SkipCount         = (p.Value - 1) * AppTheme.Limit,
            };
            var res = await _ExamCatInstructService.GetListAsync(serchInp);

            if (res.Success)
            {
                PagedResultDto <ExamCatInstructDTO> Containers = res.Data;

                string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                               res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);
                if (!filter.IsNullOrEmpty())
                {
                    listRes += string.Format(" for \"{0}\"", serchInp.FilterDisplayName);
                }
                ViewBag.ListState = listRes;

                ViewBag.Filter     = filter;
                ViewBag.Pagination = PaginateHelper.Generate(
                    "javascript:syncData('" + examCategoryId + "','{0}', '" + filter + "');",
                    p.Value, Containers.TotalCount, AppTheme.Limit);
                return(PartialView(TableView, Containers));
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }
        }
Beispiel #6
0
        public async Task <IActionResult> GetWordClassesAsync(
            [FromQuery] Guid?gcId,
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            ViewBag.Cate = L["All"];
            if (gcId != null && gcId != Guid.Empty)
            {
                var gc = await _GrammarCategoryService.GetAsync(gcId.Value);

                if (gc.Success && gc.Data != null)
                {
                    ViewBag.Cate = gc.Data.Name;
                }
            }

            var serchInp = new GetGrammarDTO
            {
                Filter            = filter ?? "",
                MaxResultCount    = AppTheme.Limit,
                SkipCount         = (p.Value - 1) * AppTheme.Limit,
                GrammarCategoryId = gcId
            };
            var res = await _GrammarService.GetBaseListAsync(serchInp);

            if (res.Success)
            {
                PagedResultDto <GrammarBaseDTO> Containers = res.Data;

                string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                               res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);
                if (!filter.IsNullOrEmpty())
                {
                    listRes += string.Format(" for \"{0}\"", serchInp.Filter);
                }
                ViewBag.ListState = listRes;

                ViewBag.Filter     = filter;
                ViewBag.Pagination = PaginateHelper.Generate(
                    "javascript:syncVt('" + gcId + "','{0}', '" + filter + "');",
                    p.Value, Containers.TotalCount, AppTheme.Limit);
                return(PartialView(TableView, Containers));
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }
        }
        public async Task <bool> SyncUserInstructors()
        {
            if (ExamCategoryId == null || ExamCategoryId.Value == Guid.Empty)
            {
                ToastError(L["Exam category is invalid"]);
                return(false);
            }

            if (CurrentPage <= 0)
            {
                CurrentPage = 1;
            }

            var searchInp = new GetExamCatInstructDTO
            {
                //UserId = null, // Không có phần này để có thể lấy tất cả giáo viên hướng dẫn
                ExamCategoryId    = ExamCategoryId,
                FilterDisplayName = Filter,
                MaxResultCount    = AppTheme.Limit,
                SkipCount         = (CurrentPage - 1) * AppTheme.Limit,
            };

            var res = await _ExamCatInstructService.GetListAsync(searchInp);

            if (res.Success)
            {
                Instructors = res.Data;

                ListState = string.Format("Showing {0} to {1} of {2} entries",
                                          res.Data.TotalCount > 0 ? searchInp.SkipCount + 1 : 0, searchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);

                if (!Filter.IsNullOrEmpty())
                {
                    ListState += string.Format(" for \"{0}\"", searchInp.FilterDisplayName);
                }

                Pagination = PaginateHelper.Generate(
                    "javascript:movePage({0});",
                    CurrentPage, Instructors.TotalCount, AppTheme.Limit);

                return(true);
            }
            else
            {
                ToastError(res.Message);
                return(false);
            }
        }
        public async Task <IActionResult> GetAsync(
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            if (filter.IsNullOrEmpty())
            {
                return(PartialView(TableView, new PagedResultDto <VocabularySearchResultDTO>(0, new List <VocabularySearchResultDTO>())));
            }

            var serchInp = new GetSearchVocabularyDTO
            {
                Filter         = filter ?? "",
                MaxResultCount = AppTheme.Limit,
                SkipCount      = (p.Value - 1) * AppTheme.Limit,
            };
            var res = await _VocabularyService.GetVocabSearchRes(serchInp);

            if (res.Success)
            {
                PagedResultDto <VocabularySearchResultDTO> Containers = res.Data;

                string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                               res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);
                if (!filter.IsNullOrEmpty())
                {
                    listRes += string.Format(" for \"{0}\"", serchInp.Filter);
                }
                ViewBag.ListState = listRes;

                ViewBag.Filter     = filter;
                ViewBag.Pagination = PaginateHelper.Generate(
                    "javascript:syncVt('{0}', '" + filter + "');",
                    p.Value, Containers.TotalCount, AppTheme.Limit);
                return(PartialView(TableView, Containers));
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }
        }
Beispiel #9
0
        public async Task <IActionResult> GetAsync(
            [FromQuery] Guid?topicId,
            [FromQuery] Guid?wcId,
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetVocabularyDTO
            {
                Filter            = filter ?? "",
                MaxResultCount    = AppTheme.Limit,
                SkipCount         = (p.Value - 1) * AppTheme.Limit,
                WordClassId       = wcId,
                VocabularyTopicId = topicId,
                IsMustConfirm     = false
            };
            var res = await _VocabularyService.GetListAsync(serchInp);

            if (res.Success)
            {
                PagedResultDto <VocabularyDTO> Containers = res.Data;

                string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                               res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);
                if (!filter.IsNullOrEmpty())
                {
                    listRes += string.Format(" for \"{0}\"", serchInp.Filter);
                }
                ViewBag.ListState = listRes;

                ViewBag.Filter     = filter;
                ViewBag.Pagination = PaginateHelper.Generate(
                    "javascript:syncVt('{0}', '" + filter + "');",
                    p.Value, Containers.TotalCount, AppTheme.Limit);
                return(PartialView("~/Pages/Manager/Vocabularies/Partials/Vocabularies.cshtml", Containers));
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }
        }
Beispiel #10
0
        public async Task <IActionResult> GetHistoryTable(
            [FromQuery] Guid?studentId,
            [FromQuery] int p = 1)
        {
            var studentExams = await _ExamLogService.GetStudentExams(studentId, new PagedAndSortedResultRequestDto
            {
                SkipCount      = (p - 1) * AppTheme.Limit,
                MaxResultCount = AppTheme.Limit
            });

            ViewBag.pz = p;

            ViewBag.Paginationz = PaginateHelper.Generate(
                "javascript:loadStudentExam('" + studentId + "','{0}');",
                p, studentExams.TotalCount, AppTheme.Limit);

            return(PartialView("~/Pages/Dashboard/Partials/StudentExamLog.Tables.cshtml", studentExams));
        }
        public async Task <IActionResult> GetQuestionGroupsAsync(
            Guid?skillPartId,
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetQuestionGroupDTO
            {
                Filter         = filter ?? "",
                MaxResultCount = AppTheme.Limit,
                SkipCount      = (p.Value - 1) * AppTheme.Limit,
                SkillPartId    = skillPartId.Value
            };
            var res = await _ExamQuestionGroupService.GetListAsync(serchInp);

            if (res.Success)
            {
                PagedResultDto <QuestionGroupDTO> Containers = res.Data;

                string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                               res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);
                if (!filter.IsNullOrEmpty())
                {
                    listRes += string.Format(" for \"{0}\"", serchInp.Filter);
                }
                ViewBag.ListState = listRes;

                ViewBag.Filter     = filter;
                ViewBag.Pagination = PaginateHelper.Generate(
                    "javascript:syncQuestionGroups('" + skillPartId + "', '{0}', '" + filter + "');",
                    p.Value, Containers.TotalCount, AppTheme.Limit);
                return(PartialView("~/Pages/Manager/ExamDataLibraries/Partials/QuestionGroups.cshtml", Containers));
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }
        }
        public async Task OnGetAsync([FromQuery] int?p = 1)
        {
            CurrentPage = p.Value;
            if (CurrentPage < 1)
            {
                CurrentPage = 1;
            }

            var serchInp = new PagedAndSortedResultRequestDto
            {
                MaxResultCount = AppTheme.Limit,
                SkipCount      = (CurrentPage - 1) * AppTheme.Limit
            };

            Notifications = await _NotificationService.GetListAsync(serchInp);

            Pagination = PaginateHelper.Generate(
                "/notifications?p={0}",
                CurrentPage, Notifications.TotalCount, AppTheme.Limit);
        }
        public async Task <IActionResult> GetHistoryTable(
            [FromQuery] Guid?desId,
            [FromQuery] int p = 1)
        {
            var stats = await _ExamLogService.GetExamHistoryStats(desId);

            var histories = await _ExamLogService.GetExamHistories(desId, new PagedAndSortedResultRequestDto
            {
                SkipCount      = (p - 1) * AppTheme.Limit,
                MaxResultCount = AppTheme.Limit
            });

            ViewBag.p = p;

            ViewBag.Pagination = PaginateHelper.Generate(
                "javascript:loadHistories('" + desId + "','{0}');",
                p, histories.TotalCount, AppTheme.Limit);

            return(PartialView("~/Pages/Dashboard/Partials/History.Tables.cshtml", new DashboardHistoryViewModel
            {
                Stats = stats,
                Histories = histories
            }));
        }