82 lines
2.9 KiB
C#
82 lines
2.9 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|