init
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.BusinessLogic.Utils;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Web.Areas.Tantargy.ApiControllers;
|
||||
using Kreta.Web.Areas.Tantargy.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Models.EditorTemplates;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Tantargy.Controllers
|
||||
{
|
||||
[MvcRoleClaimsAuthorize(true)]
|
||||
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
||||
[MvcRolePackageAuthorize(TanevEnum.Mind, KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class OraTervController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
OraTervSearchModel model = new OraTervSearchModel();
|
||||
model.IsKovetkezoTanev = ClaimData.KovTanevID == ClaimData.SelectedTanevID;
|
||||
return View("Index", model);
|
||||
}
|
||||
|
||||
public ActionResult OpenOraTervNewPopUp(int tantervId)
|
||||
{
|
||||
PopUpModel pm = new PopUpModel(new OraTervModel()
|
||||
{
|
||||
TantervId = tantervId,
|
||||
EvfolyamList = GetEvfolyamList(tantervId)
|
||||
}, "OraTerv_Bevitel");
|
||||
|
||||
pm = pm.AddCancelBtn(pm, "OraTervHelper.newOraTervCancel");
|
||||
pm = pm.AddOkBtn(pm, "OraTervHelper.newOraTervSave");
|
||||
|
||||
return PartialView(Constants.General.PopupView, pm);
|
||||
}
|
||||
|
||||
public ActionResult OpenOraTervModPopUp(int id)
|
||||
{
|
||||
OraTervApiController api = new OraTervApiController();
|
||||
|
||||
OraTervModel model = api.GetOraTervElem(id);
|
||||
model.EvfolyamList = GetEvfolyamList(model.TantervId.Value);
|
||||
|
||||
PopUpModel pm = new PopUpModel(model, "OraTerv_Bevitel");
|
||||
|
||||
pm = pm.AddCancelBtn(pm, "OraTervHelper.modOraTervCancel");
|
||||
pm = pm.AddOkBtn(pm, "OraTervHelper.modOraTervSave");
|
||||
|
||||
return PartialView(Constants.General.PopupView, pm);
|
||||
}
|
||||
|
||||
public ActionResult OpenOraTervTantargyNewPopUp(int oraTervId)
|
||||
{
|
||||
PopUpModel pm = new PopUpModel(new OraTervTargyModel()
|
||||
{
|
||||
OratervId = oraTervId,
|
||||
TantargyList = GetTantargyList(oraTervId)
|
||||
}, "OraTervTantargy_Bevitel");
|
||||
|
||||
pm = pm.AddCancelBtn(pm, "OraTervHelper.newTantargyCancel");
|
||||
pm = pm.AddOkBtn(pm, "OraTervHelper.newTantargySave");
|
||||
|
||||
return PartialView(Constants.General.PopupView, pm);
|
||||
}
|
||||
|
||||
public ActionResult OpenOraTervTantargyModPopUp(int oraTervTantargyId)
|
||||
{
|
||||
OraTervApiController api = new OraTervApiController();
|
||||
OraTervTargyModel model = api.GetOraTervTantargyElem(oraTervTantargyId);
|
||||
model.OratervTantargyId = oraTervTantargyId;
|
||||
model.TantargyList = GetTantargyList(model.OratervId, oraTervTantargyId);
|
||||
|
||||
PopUpModel pm = new PopUpModel(model, "OraTervTantargy_Bevitel");
|
||||
|
||||
pm = pm.AddCancelBtn(pm, "OraTervHelper.modTantargyCancel");
|
||||
pm = pm.AddOkBtn(pm, "OraTervHelper.modTantargySave");
|
||||
|
||||
return PartialView(Constants.General.PopupView, pm);
|
||||
}
|
||||
|
||||
public ActionResult GetDetailGrid(int? id)
|
||||
{
|
||||
return PartialView("DetailGrid", id);
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private List<SelectListItem> GetEvfolyamList(int tantervID)
|
||||
{
|
||||
List<SelectListItem> items = ((int)GeneratedAdatszotarTipusEnum.EvfolyamTipus).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToSelectItemList();
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
private List<SelectListItem> GetTantargyList(int oraTervId)
|
||||
{
|
||||
OratervHelper helper = new OratervHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
var tantargyDictionary = helper.GetTantargyak(oraTervId);
|
||||
List<SelectListItem> tantargyList = new List<SelectListItem>();
|
||||
|
||||
foreach (var item in tantargyDictionary)
|
||||
{
|
||||
SelectListItem sli = new SelectListItem() { Text = item.Value, Value = item.Key };
|
||||
tantargyList.Add(sli);
|
||||
}
|
||||
return tantargyList;
|
||||
}
|
||||
|
||||
private List<SelectListItem> GetTantargyList(int oraTervId, int oraTervTantargyId)
|
||||
{
|
||||
OratervHelper helper = new OratervHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
var tantargyDictionary = helper.GetTantargyakModOraTervTantargy(oraTervId, oraTervTantargyId);
|
||||
List<SelectListItem> tantargyList = new List<SelectListItem>();
|
||||
|
||||
foreach (var item in tantargyDictionary)
|
||||
{
|
||||
SelectListItem sli = new SelectListItem() { Text = item.Value, Value = item.Key };
|
||||
tantargyList.Add(sli);
|
||||
}
|
||||
return tantargyList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user