Skip to content

Instantly share code, notes, and snippets.

@juanplopes
Created November 30, 2010 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanplopes/721688 to your computer and use it in GitHub Desktop.
Save juanplopes/721688 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using TVGlobo.SDRH.Config;
using Simple;
using TVGlobo.SDRH.Web.Controllers;
using TVGlobo.SDRH.Web.Helpers;
using Simple.Entities;
using Simple.Reflection;
using Simple.Web.Mvc;
using Simple.Site.Helpers;
using Simple.Data.Context;
using Simple.Threading;
namespace TVGlobo.SDRH.Web
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
MapCampanhaController(routes, "MapaDemandas");
MapCampanhaController(routes, "LocalDeParas");
MapCampanhaController(routes, "Empresas");
MapCampanhaController(routes, "Locais");
MapCampanhaController(routes, "Pedidos");
MapCampanhaController(routes, "KitsExtras");
MapCampanhaController(routes, "PedidosFuncionarios");
MapCampanhaController(routes, "Produtos");
MapCampanhaController(routes, "Relatorios");
MapCampanhaController(routes, "LocalEmpresas");
MapCampanhaController(routes, "Pendencias");
MapCampanhaController(routes, "Entregas");
MapCampanhaController(routes, "Estoques");
MapCampanhaController(routes, "PedidosFornecedor");
MapCampanhaController(routes, "Demissoes");
routes.MapRouteLowercase("Default", "{controller}.aspx/{action}/{id}",
new { controller = "Campanhas", action = "Index", id = 0 });
}
protected static void MapCampanhaController(RouteCollection routes, string controller)
{
routes.MapRouteLowercase("Campanha_" + controller, "campanha.aspx/{campanha}/" + controller + "/{action}/{id}",
new { controller = controller, action = "Index", id = 0 });
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
DefaultModelBinder.ResourceClassKey = "ValidationMessages";
ModelBinders.Binders.DefaultBinder = new EntityModelBinder();
ModelValidatorProviders.Providers.Clear();
SimpleContext.SwitchProvider(new HttpContextProvider());
new Configurator().StartServer<ServerStarter>();
}
protected void Application_BeginRequest()
{
Simply.Do.EnterContext();
}
protected void Application_EndRequest()
{
Simply.Do.GetContext().Exit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment