using CRM.Core.BLL.EventBus.EventHandlers; using CRM.Core.Common.EventBus; using System; using System.Web.Mvc; using System.Web.Routing; namespace Core.Web { public class MvcApplication : System.Web.HttpApplication { public MvcApplication() { AuthorizeRequest += MvcApplication_AuthorizeRequest; } private void MvcApplication_AuthorizeRequest(object sender, EventArgs e) { //var id = Context.User.Identity as FormsIdentity; //if (id != null && id.IsAuthenticated) //{ // string[] roles = UserRightsHelper.getUserRights(); // Context.User = new GenericPrincipal(id, roles); //} } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); RegisterEventBus(); } private void RegisterEventBus() { EventBus.Instance.Subscribe(new PayOrderEventHandler()); EventBus.Instance.Subscribe(new OpenOrderEventHandler()); EventBus.Instance.Subscribe(new SupplyOrderEventHandler()); EventBus.Instance.Subscribe(new RefundOrderEventHandler()); EventBus.Instance.Subscribe(new UpGradeOrderEventHandler()); EventBus.Instance.Subscribe(new OpenOrderSendSmsEventHandler()); EventBus.Instance.Subscribe(new DepositOrderEventHandler()); EventBus.Instance.Subscribe(new DepositUseOrderEventHandler()); EventBus.Instance.Subscribe(new DepositRefundOrderEventHandler()); EventBus.Instance.Subscribe(new RejectContractEventHandler()); EventBus.Instance.Subscribe(new AllOpenOrderEventHandler()); EventBus.Instance.Subscribe(new FinishRefundContractEventHandler()); EventBus.Instance.Subscribe(new DeleteRefundOrderEventHandler()); EventBus.Instance.Subscribe(new SubProductEventHandler()); EventBus.Instance.Subscribe(new CloseFreeOrderEventHandler()); EventBus.Instance.Subscribe(new HGKeyWordEventHandler()); EventBus.Instance.Subscribe(new CmsNewsEventHandler()); EventBus.Instance.Subscribe(new AddOrUpdateGiftEventHandler()); EventBus.Instance.Subscribe(new DeleteGiftEventHandler()); EventBus.Instance.Subscribe(new ReSetOrderEventHandler()); EventBus.Instance.Subscribe(new SoftUserRegisterEventHandler()); EventBus.Instance.Subscribe(new HandGiftEventHandler()); EventBus.Instance.Subscribe(new SetPayNameEventHandler()); EventBus.Instance.Subscribe(new PayRejectEventHandler()); EventBus.Instance.Subscribe(new DepositRejectEventHandler()); EventBus.Instance.Subscribe(new DepositDeleteEventHandler()); EventBus.Instance.Subscribe(new OrderAndPayInfoEventHandler()); EventBus.Instance.Subscribe(new AddOrUpdateOrderActiveHandler()); } } }