81 lines
3.5 KiB
C#
81 lines
3.5 KiB
C#
using System.Net;
|
|
using System.Web.Mvc;
|
|
using Kreta.BusinessLogic.HelperClasses;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.BusinessLogic.Helpers.SystemSettings;
|
|
using Kreta.BusinessLogic.Security;
|
|
using Kreta.Core.Exceptions;
|
|
using Kreta.Web.Areas.Orarend.Models;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Helpers.Error;
|
|
using Kreta.Web.Models.EditorTemplates;
|
|
using Kreta.Web.Security;
|
|
|
|
namespace Kreta.Web.Areas.Orarend.Controllers
|
|
{
|
|
[MvcRoleClaimsAuthorize(true)]
|
|
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue, KretaClaimPackages.IsDualisKepzohelyiOktato.ClaimValue)]
|
|
[MvcRolePackageAuthorize(KretaClaimPackages.Naplo.ClaimValue)]
|
|
public class TanarOralatogatasController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
var model = new OralatogatasModel();
|
|
var orarendHelper = new OrarendHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
|
|
model.HetirendJson = orarendHelper.GetHetirendek();
|
|
model.NaptariHetekHetirendJson = orarendHelper.GetNaptariHetekHetirendek();
|
|
|
|
#region Calendar megjelenítés
|
|
var co = orarendHelper.GetCalendarMinMax();
|
|
model.CalendarMinTime = co.CalendarMin;
|
|
model.CalendarMaxTime = co.CalendarMax;
|
|
#endregion
|
|
|
|
return View("Index", model);
|
|
}
|
|
|
|
public ActionResult OralatogatasEvent(OralatogatasExtendModel oralatogatasExtendModel)
|
|
{
|
|
try
|
|
{
|
|
OralatogatasokCO co;
|
|
var helper = new OralatogatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
|
co = helper.GetOraOralatogatasa(oralatogatasExtendModel.CalendarModel.EventId, ClaimData.FelhasznaloId);
|
|
var tanoraCo = new TanoraHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetTanorakAdatok(oralatogatasExtendModel.CalendarModel.EventId);
|
|
|
|
var oModel = ConvertCoToModel(co);
|
|
oModel.OralatogatasDatuma = oralatogatasExtendModel.CalendarModel.Start;
|
|
oModel.OraID = oralatogatasExtendModel.CalendarModel.EventId;
|
|
oModel.TanitasiOraTema = tanoraCo.Tema;
|
|
oModel.IsNemKellNemKotottSystemSettings = new SystemSettingsHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetSystemSettingValue<bool>(Enums.RendszerBeallitasTipusEnum.kotott_munkaido_nevelesseloktatassal_le_nem_kotott_resz_kezelesenek_tiltasa);
|
|
|
|
var model = new PopUpModel(oModel, "Oralatogatas_Bevitel");
|
|
model.AddCancelBtn(model, "OralatogatasHelper.windowCancel");
|
|
model.AddOkBtn(model, "OralatogatasHelper.windowSave");
|
|
|
|
if (oralatogatasExtendModel.CalendarModel.OraType == Enums.ManualEnums.CalendarOraTypeEnum.Egyeb)
|
|
model.AddBtn(model, "OralatogatasTorles", 4739, "OralatogatasHelper.windowDelete", "pull-left");
|
|
|
|
return PartialView(Constants.General.PopupView, model);
|
|
}
|
|
catch (BlException ex)
|
|
{
|
|
throw new StatusError(HttpStatusCode.BadRequest, ex.Message);
|
|
}
|
|
}
|
|
|
|
private OralatogatasModel ConvertCoToModel(OralatogatasokCO co)
|
|
{
|
|
OralatogatasModel model = new OralatogatasModel();
|
|
|
|
if (co != null)
|
|
{
|
|
model.OralatogatasSzovege = co.Megjegyzes;
|
|
model.OralatogatasID = co.Id;
|
|
}
|
|
|
|
return model;
|
|
}
|
|
}
|
|
}
|