This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,82 @@
using System.Collections.Generic;
using System.Web.Mvc;
using Kreta.BusinessLogic.Classes;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Enums.ManualEnums;
using Kreta.Web.Areas.OsztalyCsoport.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Models.EditorTemplates;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.OsztalyCsoport.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue, KretaClaimPackages.IsSzirIntezmeny.ClaimValue)]
[MvcRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
public class OraSorszamozasHalmazController : Controller
{
public ActionResult Index()
{
var model = new OraSorszamozasHalmazSearchModel();
return View("Index", model);
}
public ActionResult GetDetailGrid(int id)
{
return PartialView("DetailGrid", id);
}
public ActionResult OpenEditPopUp(int? id)
{
var model = new OraSorszamozasHalmazModel();
if (id.HasValue)
{
var helper = new OraSorszamozasHalmazHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var co = helper.Get(id.Value);
model = OraSorszamozasHalmazModel.ConvertCoToModel(co);
}
model.TipusList = GetTipusList(model.Tipus);
PopUpModel pm = new PopUpModel(model, "Edit");
pm = pm.AddCancelBtn(pm, "OraSorszamozasHalmazHelper.editCancel");
pm = pm.AddOkBtn(pm, "OraSorszamozasHalmazHelper.validate");
return PartialView(Constants.General.PopupView, pm);
}
public bool OsszerendelesExists(int osztalyCsoportId, int tantargyId, int halmazId, List<int> deletedOsszerendeslIds)
{
deletedOsszerendeslIds = deletedOsszerendeslIds ?? new List<int>();
return new OraSorszamozasHalmazHelper(ConnectionTypeExtensions.GetSessionConnectionType()).OsszerendelesExists(osztalyCsoportId, tantargyId, halmazId, deletedOsszerendeslIds);
}
public string GetEvesOraszamForTantargyAndOsztaly(int osztalyCsoportId, int tantargyId)
{
var sorszamok = new OraSorszamozasHalmazHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetEvesOraszamForTantargyAndOsztaly(ClaimData.IntezmenyId, osztalyCsoportId, tantargyId);
return string.Join(", ", sorszamok);
}
private List<SelectListItem> GetTipusList(int tipus)
{
var result = EnumExtensions.EnumToDictionary<SorszamozasKezdoErtekenekBeallitasa>(ClaimData.SelectedTanevID.Value, false, true).ToSelectListItemList();
foreach (var r in result)
{
if (r.Value == tipus.ToString())
{
r.Selected = true;
break;
}
}
return result;
}
}
}