160 lines
6.2 KiB
C#
160 lines
6.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Web.Mvc;
|
|
using Kreta.BusinessLogic.Security;
|
|
using Kreta.Enums;
|
|
using Kreta.Enums.ManualEnums;
|
|
using Kreta.Framework;
|
|
using Kreta.Framework.Util;
|
|
using Kreta.Web.Areas.Tantargy.ApiControllers;
|
|
using Kreta.Web.Areas.Tantargy.Models;
|
|
using Kreta.Web.Helpers.TabStrip;
|
|
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 TantervekController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
TantervSearchModel model = new TantervSearchModel();
|
|
model.IsKovetkezoTanev = ClaimData.KovTanevID == ClaimData.SelectedTanevID;
|
|
return View("Index", model);
|
|
}
|
|
|
|
public ActionResult OpenTantervProperties(int tantervID)
|
|
{
|
|
TantervModel tmodel = new TantervModel()
|
|
{
|
|
ID = tantervID
|
|
};
|
|
tmodel.TabList = GetTabItems(tmodel);
|
|
|
|
PopUpModel pm = new PopUpModel(tmodel, "TantervPropertiesTab");
|
|
pm = pm.AddCancelBtn(pm, "TantervHelper.propertiesCancel");
|
|
return PartialView(Constants.General.PopupView, pm);
|
|
}
|
|
|
|
public ActionResult OpenTantervOsztalyaiTab(int id)
|
|
{
|
|
TantervModel tmodel = new TantervModel()
|
|
{
|
|
ID = id
|
|
};
|
|
return PartialView("TantervProperties_Osztalyok", tmodel);
|
|
}
|
|
|
|
public ActionResult OpenTantervTanuloiTab(int id)
|
|
{
|
|
TantervModel tmodel = new TantervModel()
|
|
{
|
|
ID = id
|
|
};
|
|
return PartialView("TantervProperties_Tanulok", tmodel);
|
|
}
|
|
|
|
public ActionResult OpenTantervModifyAdd(int? tantervID)
|
|
{
|
|
TantervModel model;
|
|
if (tantervID.HasValue)
|
|
{
|
|
TantervekApiController api = new TantervekApiController();
|
|
model = api.GetTantervProperties(tantervID.Value);
|
|
}
|
|
else
|
|
{
|
|
model = new TantervModel();
|
|
model.CsoportTipusa = (int)CsoportTipusEnum.iskolai_csoport_tanorai_celu_;
|
|
model.KerettantervreEpulo = true;
|
|
}
|
|
|
|
PopUpModel pm = new PopUpModel(model, "TantervModifyAdd_Bevitel");
|
|
pm = pm.AddCancelBtn(pm, "TantervHelper.modifyAddCancel");
|
|
pm = pm.AddOkBtn(pm, "TantervHelper.modifyAddSave");
|
|
return PartialView(Constants.General.PopupView, pm);
|
|
}
|
|
|
|
public ActionResult OpenModPopUp(List<TantervModel> tantervList)
|
|
{
|
|
TantervekApiController api = new TantervekApiController();
|
|
TantervModModel model = new TantervModModel();
|
|
|
|
if (tantervList.Count == 1)
|
|
{
|
|
model = api.GetTantervPropertiesMod(tantervList[0].ID.Value);
|
|
}
|
|
else
|
|
{
|
|
foreach (var item in tantervList)
|
|
{
|
|
model.TantervIDArray += item.ID.ToString() + ",";
|
|
model.TantervNevArray += item.Nev.ToString() + ", ";
|
|
}
|
|
|
|
model.TantervIDArray = model.TantervIDArray.Remove(model.TantervIDArray.Length - 1);
|
|
model.TantervNevArray = model.TantervNevArray.Remove(model.TantervNevArray.Length - 2);
|
|
}
|
|
|
|
PopUpModel pm = new PopUpModel(model, "TantervModify_Bevitel");
|
|
pm = pm.AddCancelBtn(pm, "TantervHelper.modifyAddCancel");
|
|
pm = pm.AddOkBtn(pm, "TantervHelper.confirmCsopModWindow");
|
|
return PartialView(Constants.General.PopupView, pm);
|
|
}
|
|
|
|
public ActionResult OpenTantervAlapadatok(int id)
|
|
{
|
|
TantervekApiController api = new TantervekApiController();
|
|
TantervModel tmodel = api.GetTantervProperties(id);
|
|
|
|
return PartialView("TantervProperties_Info", tmodel);
|
|
}
|
|
|
|
public List<TabStripItemModel> GetTabItems(TantervModel model)
|
|
{
|
|
var items = new List<TabStripItemModel>();
|
|
items.Add(new TabStripItemModel { ItemId = "1", ItemName = StringResourcesUtil.GetString(161) /*Alapadatok*/, Area = "Tantargy", Controller = "Tantervek", Action = "OpenTantervAlapadatok", RouteParameters = new Dictionary<string, string>() { { "Id", model.ID.ToString() } } });
|
|
items.Add(new TabStripItemModel { ItemId = "2", ItemName = StringResourcesUtil.GetString(3848) /*Tanterv osztályai*/, Area = "Tantargy", Controller = "Tantervek", Action = "OpenTantervOsztalyaiTab", RouteParameters = new Dictionary<string, string>() { { "Id", model.ID.ToString() } } });
|
|
items.Add(new TabStripItemModel { ItemId = "3", ItemName = StringResourcesUtil.GetString(3849) /*Tanterv tanulói*/, Area = "Tantargy", Controller = "Tantervek", Action = "OpenTantervTanuloiTab", RouteParameters = new Dictionary<string, string>() { { "Id", model.ID.ToString() } } });
|
|
return items;
|
|
}
|
|
|
|
#region Keresok
|
|
|
|
private List<SelectListItem> GetJellCsopTipListS()
|
|
{
|
|
|
|
var dictionary = FrameworkEnumExtensions.EnumToList((int)GeneratedAdatszotarTipusEnum.CsoportTipus, ClaimData.SelectedTanevID.Value, true);
|
|
List<SelectListItem> list = new List<SelectListItem>();
|
|
|
|
foreach (var item in dictionary)
|
|
{
|
|
SelectListItem sli = new SelectListItem() { Text = item.Value, Value = item.Key };
|
|
list.Add(sli);
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
private List<SelectListItem> GetEvfolyamListS()
|
|
{
|
|
|
|
var dictionary = FrameworkEnumExtensions.EnumToList((int)GeneratedAdatszotarTipusEnum.EvfolyamTipus, ClaimData.SelectedTanevID.Value, true);
|
|
List<SelectListItem> list = new List<SelectListItem>();
|
|
|
|
foreach (var item in dictionary)
|
|
{
|
|
SelectListItem sli = new SelectListItem() { Text = item.Value, Value = item.Key };
|
|
list.Add(sli);
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|