117 lines
4 KiB
C#
117 lines
4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.BusinessLogic.Security;
|
|
using Kreta.Web.Areas.TanuloErtekeles.Models;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Security;
|
|
|
|
namespace Kreta.Web.Areas.TanuloErtekeles.Controllers
|
|
{
|
|
[MvcRoleClaimsAuthorize(true)]
|
|
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
|
[MvcRolePackageAuthorize(KretaClaimPackages.Osztalyfonok.ClaimValue, KretaClaimPackages.SzuperOsztalyfonok.ClaimValue)]
|
|
public class ErettsegiEredmenyekController : Controller
|
|
{
|
|
#region Properties
|
|
|
|
public static string StartPopupFormName => "ErettsegiEredmenyekStartPopupForm";
|
|
public static string StartPopupId => "ErettsegiEredmenyekStartWindow";
|
|
|
|
public static string GridName => "ErettsegiEredmenyekGrid";
|
|
|
|
#endregion Properties
|
|
|
|
protected ErettsegiEredmenyekModel GetErettsegiEredmenyekModel()
|
|
{
|
|
var model = new ErettsegiEredmenyekModel
|
|
{
|
|
OsztalyList = GetOsztCsopList()
|
|
};
|
|
|
|
return model;
|
|
}
|
|
|
|
// GET: Ertekeles/ErettsegiEredmenyek
|
|
public ActionResult Index()
|
|
{
|
|
var osztalyList = GetOsztCsopList();
|
|
|
|
var model = new ErettsegiEredmenyekModel
|
|
{
|
|
OsztalyList = osztalyList
|
|
};
|
|
|
|
if (osztalyList.Count == 1)
|
|
{
|
|
model.OsztalyId = Convert.ToInt32(osztalyList.Single().Value);
|
|
model.OsztalyNev = osztalyList.Single().Text;
|
|
}
|
|
else
|
|
{
|
|
model.OsztalyId = null;
|
|
model.OsztalyNev = string.Empty;
|
|
}
|
|
|
|
return View(model);
|
|
}
|
|
|
|
public ActionResult ErettsegiEredmenyekDetailGrid(ErettsegiEredmenyekGridModel model)
|
|
{
|
|
var helper = new ErettsegiEredmenyekHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
|
|
model.ErettsegiTantargyList = GetErettsegiTantargyList(helper);
|
|
model.ErettsegiSzintList = GetErettsegiSzintList(helper);
|
|
model.ErettsegiTipusList = GetErettsegiTipusList(helper);
|
|
|
|
var dictionary = helper.GetErettsegiMaxPontszamList();
|
|
model.IrasbeliMaxPontszam = dictionary["IrasbeliMaxPontszam"];
|
|
model.SzobeliMaxPontszam = dictionary["SzobeliMaxPontszam"];
|
|
model.GyakorlatiMaxPontszam = dictionary["GyakorlatiMaxPontszam"];
|
|
|
|
return PartialView("DetailGrid", model);
|
|
}
|
|
|
|
#region Popup actions
|
|
|
|
[HttpPost]
|
|
[MvcValidateAjaxAntiForgeryToken]
|
|
public ActionResult OpenStartPopup()
|
|
{
|
|
var model = GetErettsegiEredmenyekModel();
|
|
return PartialView("Start_Popup", model);
|
|
}
|
|
|
|
#endregion Popup actions
|
|
|
|
private List<SelectListItem> GetErettsegiTantargyList(ErettsegiEredmenyekHelper helper)
|
|
{
|
|
var dictionary = helper.GetErettsegiTantargyakForComboBox(string.Empty);
|
|
var result = dictionary.ToSelectListItemList();
|
|
return result;
|
|
}
|
|
|
|
private List<SelectListItem> GetErettsegiSzintList(ErettsegiEredmenyekHelper helper)
|
|
{
|
|
var dictionary = helper.GetErettsegiSzintekForComboBox(string.Empty);
|
|
var result = dictionary.ToSelectListItemList();
|
|
return result;
|
|
}
|
|
|
|
private List<SelectListItem> GetErettsegiTipusList(ErettsegiEredmenyekHelper helper)
|
|
{
|
|
var dictionary = helper.GetErettsegiTipusokForComboBox(string.Empty);
|
|
var result = dictionary.ToSelectListItemList();
|
|
return result;
|
|
}
|
|
|
|
private List<SelectListItem> GetOsztCsopList()
|
|
{
|
|
IDictionary<string, string> csakOsztalyok = OsztalyokEsCsoportokHelpers.GetCsakOsztalyok(ClaimData.FelhasznaloId, feladatKategoriaId: null);
|
|
|
|
return csakOsztalyok.ToSelectListItemList();
|
|
}
|
|
}
|
|
}
|