本文整理汇总了C#中IRailsEngineContext类的典型用法代码示例。如果您正苦于以下问题:C# IRailsEngineContext类的具体用法?C# IRailsEngineContext怎么用?C# IRailsEngineContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRailsEngineContext类属于命名空间,在下文中一共展示了IRailsEngineContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokeNext
/// <summary>
/// Invokes the next handler.
/// </summary>
/// <param name="context">The context.</param>
protected void InvokeNext(IRailsEngineContext context)
{
if (nextHandler != null)
{
nextHandler.Process(context);
}
}
示例2: RenderViewFor
public void RenderViewFor(Presentation presentation, IRailsEngineContext context)
{
TabularPresentation tabularPresentation = presentation as TabularPresentation;
Controller controller = context.CurrentController;
// configuration as json output = { baseParams: {...}, tables: [...] }
Hashtable configuration = new Hashtable(2);
configuration["filters"] = CollectFilterParameters(controller.Params);
configuration["tables"] = new ArrayList();
foreach (TabularQuery table in tabularPresentation.GetQueries())
{
Hashtable tableConfig = new Hashtable();
tableConfig["url"] = controller.UrlBuilder.BuildUrl(
context.UrlInfo,
controller.Name,
"table",
DictHelper.Create("table=" + table.Id.ToString())
);
tableConfig["download"] = controller.UrlBuilder.BuildUrl(
context.UrlInfo,
controller.Name,
"download",
DictHelper.Create("table=" + table.Id.ToString())
);
tableConfig["title"] = table.Title;
tableConfig["columns"] = table.ColumnNames();
((ArrayList)configuration["tables"]).Add(tableConfig);
}
controller.PropertyBag["presentation"] = tabularPresentation;
controller.PropertyBag["configuration"] = JavaScriptConvert.SerializeObject(configuration);
controller.RenderSharedView("presentation/tables");
}
示例3: RenderMailMessage
/// <summary>
/// Renders the mail message.
/// </summary>
/// <param name="templateName">Name of the template.</param>
/// <param name="engineContext">The engine context.</param>
/// <param name="controller">The controller.</param>
/// <param name="doNotApplyLayout">if set to <c>true</c> [do not apply layout].</param>
/// <returns></returns>
public Message RenderMailMessage(string templateName, IRailsEngineContext engineContext, Controller controller,
bool doNotApplyLayout)
{
context.AddMailTemplateRendered(templateName, controller.PropertyBag);
return new Message("from", "to", "subject", "body");
}
示例4: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
// Read previous authenticated principal from session
// (could be from cookie although with more work)
User user = (User) context.Session["user"];
// Sets the principal as the current user
context.CurrentUser = user;
// Checks if it is OK
if (context.CurrentUser == null || !context.CurrentUser.Identity.IsAuthenticated)
{
// Not authenticated, redirect to login
NameValueCollection parameters = new NameValueCollection();
parameters.Add("ReturnUrl", context.Url);
controller.Redirect("login", "index", parameters);
// Prevent request from continue
return false;
}
// Everything is ok
return true;
}
示例5: Perform
/// <summary>
/// Executa o filtro.
/// </summary>
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (!Enabled)
return true;
UserAgent ua = null;
var uaString = context.UnderlyingContext.Request.UserAgent;
if (uaString != null)
{
ua = (UserAgent) cache[uaString];
if (ua == null)
cache[uaString] = ua = new UserAgent(uaString);
}
if (IsValid(ua))
return true;
if (!logged)
{
Log.Error("Tentativa de acesso através de browser não suportado: {0}", uaString);
logged = true;
}
controller.PropertyBag["invalidGecko"] = true;
if (!Redirect)
return true;
throw new Exception("redir: " + Redirect);
//RedirectToNotice(controller);
//return false;
}
示例6: ItemToProcess
public ItemToProcess(WebResourceProcessor proc, string contents, IRailsEngineContext ctx, IDictionary parameters)
{
this.proc = proc;
this.contents = contents;
this.ctx = ctx;
this.parameters = parameters;
}
示例7: CreateView
public AspViewBase CreateView(Type type, TextWriter output, IRailsEngineContext context, Controller controller)
{
ConstructorInfo constructor = (ConstructorInfo)constructors[type];
AspViewBase self = (AspViewBase)FormatterServices.GetUninitializedObject(type);
constructor.Invoke(self, new object[] { this, output, context, controller });
return self;
}
示例8: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext ctx, Controller c)
{
if (!controllersToSkip.IsMatch(GetControllerName(c)))
if (ctx.CurrentUser == null || !ctx.CurrentUser.Identity.IsAuthenticated)
return TryAutoLogin();
return true;
}
示例9: Process
/// <summary>
/// Implementors should perform the action
/// on the exception. Note that the exception
/// is available in <see cref="IRailsEngineContext.LastException"/>
/// </summary>
/// <param name="context"></param>
public override void Process(IRailsEngineContext context)
{
ILoggerFactory factory = (ILoggerFactory) context.GetService(typeof (ILoggerFactory));
ILogger logger = factory.Create(context.CurrentController.GetType());
logger.Error(BuildStandardMessage(context));
InvokeNext(context);
}
示例10: BrailBase
/// <summary>
/// Initializes a new instance of the <see cref="BrailBase"/> class.
/// </summary>
/// <param name="viewEngine">The view engine.</param>
/// <param name="output">The output.</param>
/// <param name="context">The context.</param>
/// <param name="__controller">The controller.</param>
public BrailBase(BooViewEngine viewEngine, TextWriter output, IRailsEngineContext context, Controller __controller)
{
this.viewEngine = viewEngine;
this.outputStream = output;
this.context = context;
this.__controller = __controller;
InitProperties(context, __controller);
}
示例11: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
User user = (User)context.Session["logonUser"];
if (user == null)
{
return false;
}
return true;
}
示例12: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.Params["printable"] != null)
{
controller.LayoutName = "printabletheme";
}
return true;
}
示例13: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.Request.Headers["mybadheader"] != null)
{
context.Response.Write("Denied!");
return false;
}
return true;
}
示例14: GetSteps
public WizardStepPage[] GetSteps(IRailsEngineContext context)
{
return new WizardStepPage[]
{
(WizardStepPage) kernel[typeof(Page1)],
(WizardStepPage) kernel[typeof(Page2)],
(WizardStepPage) kernel[typeof(Page3)],
(WizardStepPage) kernel[typeof(Page4)],
};
}
示例15: Perform
public virtual bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (!PerformAuthentication(context))
{
context.Response.Redirect("account", "authentication");
return false;
}
return true;
}