using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using Kreta.BusinessLogic.Helpers; using Kreta.BusinessLogic.Helpers.SystemSettings; using Kreta.BusinessLogic.Security; using Kreta.Core; using Kreta.Enums; using Kreta.Web.Areas.Hianyzas.Models; using Kreta.Web.Areas.Tanulo.Models; using Kreta.Web.Areas.TanuloErtekeles.Models.TanuloErtekeles; using Kreta.Web.Helpers; using Kreta.Web.Security; namespace Kreta.Web.Areas.Tanulo.Controllers { [MvcRoleClaimsAuthorize(true)] [MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)] [MvcRolePackageAuthorize(KretaClaimPackages.CsoportVezeto.ClaimValue, KretaClaimPackages.SzuperOsztalyfonok.ClaimValue)] public class CsoportTanuloiAdatokController : Controller { public ActionResult Index() { var model = new CsoportTanuloiAdatokModel(); var showTanoraCeluCsoport = new SystemSettingsHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetSystemSettingValue(RendszerBeallitasTipusEnum.Csoportvezeto_Tanora_Celu_Csoportok); var helper = new OsztalyCsoportHelper(ConnectionTypeExtensions.GetSessionConnectionType()); var firstCsoportId = helper.GetCsoportListByCsoportVezeto(showTanoraCeluCsoport, (int)CsoportTipusEnum.iskolai_csoport_tanorai_celu_, ClaimData.IsSzuperOsztalyfonok).Select(x => x.Value).FirstOrDefault(); if (!string.IsNullOrWhiteSpace(firstCsoportId)) { int.TryParse(firstCsoportId, out int result); model.OsztalyCsoportId = result; } return View("Index", model); } public ActionResult GetTanuloiAdatokPanelBarItemContent(int? tanuloId, int? osztalyCsoportId) { var model = new TanuloiAdatokModel { TanuloId = tanuloId, OsztalyCsoportId = osztalyCsoportId }; return PartialView("~/Areas/Tanulo/Views/CsoportTanuloiAdatok/TanuloiAdatok.cshtml", model); } public ActionResult GetTanuloErtekelesPanelBarItemContent(int? tanuloId, int osztalyCsoportId) { var model = new List { new TanuloErtekelesByTanuloListModel() { NamePrefix = "TanuloErtekelesPanelBar", IsJegyekAtlagaMegjelenik = true, TanuloId = tanuloId, GridUseToolBar = false, OktatasiNevelesiFeladatId = new OsztalyCsoportHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).GetOsztalyCsoportOktatasNevelesiFeladatTipus(osztalyCsoportId) } }; return PartialView("~/Areas/TanuloErtekeles/Views/TanuloErtekelesByTanulo/Index.cshtml", model); } public ActionResult GetFelmentesekPanelBarItemContent(int? tanuloId) { var model = new TanuloDetailModel { TanuloId = tanuloId ?? 0, GridNamePrefix = "FelmentesPanelBar", GridUseToolBar = false }; return PartialView("~/Areas/Tanulo/Views/Tanulo/Info_TantargyiMentesseg_Tab.cshtml", model); } public ActionResult GetHianyzasokPanelBarItemContent(int? tanuloId) { var model = new MulasztasSearchModel { TanuloId = tanuloId, IsCustomForm = true, CustomFormName = "CsoportTanuloiAdatokForm", GridUseToolBar = false, ChildGridHasDelete = false, ApiControllerName = Constants.ApiControllers.MulasztasokApi }; return PartialView("~/Areas/Hianyzas/Views/Shared/Mulasztasok_TanuloNezet_Tab.cshtml", model); } public ActionResult GetIgazolasokPanelBarItemContent(int? tanuloId) { var model = new TanuloDetailModel { TanuloId = tanuloId ?? 0, GridNamePrefix = "IgazolasPanelBar", GridUseToolBar = false }; return PartialView("~/Areas/Tanulo/Views/Tanulo/Info_Igazolasok_Tab.cshtml", model); } public ActionResult GetFeljegyzesekPanelBarItemContent(int? tanuloId) { var tanuloiFeljegyzesekItemModelList = new List(); if (tanuloId.IsEntityId()) { var helper = new FeljegyzesHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()); var coList = helper.GetTanuloiFeljegyzesekItemList(tanuloId.Value); tanuloiFeljegyzesekItemModelList.AddRange(coList.Select(co => new TanuloiFeljegyzesekItemModel(co))); } var model = new TanuloiFeljegyzesekModel { TanuloId = tanuloId, TanuloiFeljegyzesekItemList = tanuloiFeljegyzesekItemModelList.OrderBy(x => x.Datum).ToList() }; return PartialView("TanuloiFeljegyzesek", model); } public ActionResult GetFeljegyzesekHaviPanelBarItemContent(int? tanuloId, int? osztalyCsoportId) { var model = new TanuloDetailModel { TanuloId = tanuloId ?? 0, OsztalycsoportId = osztalyCsoportId ?? 0, GridNamePrefix = "FeljegyzesHaviPanelBar", GridUseToolBar = false }; return PartialView("~/Areas/Tanulo/Views/Tanulo/Info_FeljegyzesHavi_Tab.cshtml", model); } public ActionResult GetDiakOlimpiaPanelBarItemContent(int? tanuloId, int? osztalyCsoportId) { return PartialView("~/Areas/Tanulo/Views/Tanulo/Info_DiakOlimpia.cshtml", tanuloId ?? 0); } } }