init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
42
KretaWeb/Security/MvcFeatureMaintenanceAttribute.cs
Normal file
42
KretaWeb/Security/MvcFeatureMaintenanceAttribute.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.Web.Models;
|
||||
|
||||
namespace Kreta.Web.Security
|
||||
{
|
||||
/// <summary>
|
||||
/// "Karbantartás"-hoz használható attribute, ami
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||
public class MvcFeatureMaintenanceAttribute : ActionFilterAttribute
|
||||
{
|
||||
private readonly string _featureName;
|
||||
|
||||
public MvcFeatureMaintenanceAttribute(string featureName)
|
||||
{
|
||||
_featureName = featureName;
|
||||
}
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
var result = AuthorizeHelper.CheckMaintenanceInProgress(_featureName);
|
||||
if (result != null && !string.IsNullOrWhiteSpace(SDAConvert.ToString(result["C_TARTALOM"])))
|
||||
{
|
||||
var view = new PartialViewResult
|
||||
{
|
||||
ViewName = "~/Views/HibaOldal/MaintenancePartial.cshtml",
|
||||
ViewData = new ViewDataDictionary<MaintenanceModel>(new MaintenanceModel()
|
||||
{
|
||||
Title = SDAConvert.ToString(result["C_CIM"]),
|
||||
Message = SDAConvert.ToString(result["C_TARTALOM"])
|
||||
})
|
||||
};
|
||||
filterContext.Result = view;
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnActionExecuting(filterContext);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue