示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DormandPrince853"/> class.
        /// </summary>
        /// <param name="n">Dimension of the system.</param>
        /// <param name="controller">The error controller.</param>
        /// <param name="stiff">The stiffness detector.</param>
        public DormandPrince853(int n, Action <double, double[], double[]> fcn, double rtol, double atol,
                                IErrorController controller, StiffnessChecker stiff)
        {
            this.n    = n;
            this.fcn  = fcn;
            this.rtol = rtol;
            this.atol = atol;

            this.controller = controller;
            this.stiff      = stiff;

            this.Order = 8;

            xout  = new double[n];
            xtemp = new double[n];
            dxdt  = new double[n];
            xerr  = new double[n];
            xerr2 = new double[n];

            k2  = new double[n];
            k3  = new double[n];
            k4  = new double[n];
            k5  = new double[n];
            k6  = new double[n];
            k7  = new double[n];
            k8  = new double[n];
            k9  = new double[n];
            k10 = new double[n];

            r = new double[8 * n];
        }
示例#2
0
 public DataController(JsonConverter[] converters, ISummarizer repository, ISitesRepository sitesRepository, IErrorController errorController, IUsersRepository userRepository)
     : base(errorController)
 {
     m_Converters = converters;
     m_TimeSeriesRepository = repository;
     m_SiteRepository = sitesRepository;
     m_userRepository = userRepository;
 }
示例#3
0
        private static RouteData GetRouteData(IErrorController controller, Exception exception)
        {
            var routeData = new RouteData();
            routeData.Values["controller"] = GetControllerName(controller.GetType().Name);

            var httpException = exception as HttpException;
            routeData.Values["action"] = httpException != null ? GetErrorAction(httpException.GetHttpCode()) : unknownAction;
            routeData.Values["error"] = exception;
            routeData.Values["message"] = exception.Message;
            return routeData;
        }
示例#4
0
 public HomeController(ISitesRepository sitesRepo, IErrorController errorController)
     : base(errorController)
 {
     m_SitesRepository = sitesRepo;
 }
示例#5
0
 public ControllerBase(IErrorController errorController)
 {
     m_errorController = errorController;
 }
示例#6
0
        /// <summary>
        /// Handles the specified HTTP errorfull context (typically in Application_Error).
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="errorController">The error controller.</param>
        /// <param name="includeExceptionDetails">if set to <c>true</c> [include exception details].</param>
        /// <param name="requestContext"></param>
        /// <returns></returns>
        public static Exception Handle(HttpContext context, IErrorController errorController, bool includeExceptionDetails, RequestContext requestContext)
        {
            Trace.WriteLine("ErrorControllerHandler: Application_Error: begin");

            RouteData routeData;

            if (requestContext != null)
            {
                routeData = requestContext.RouteData;
            }
            else
            {
                routeData      = new RouteData();
                requestContext = new RequestContext(new HttpContextWrapper(context), routeData);
            }

            // get the error for the current request
            Exception exception = context.Error;

            context.ClearError();
            HttpException httpException = exception as HttpException;

            // define the correct action depending on the error (500, 404, 403...)
            routeData.Values.Add("controller", "Error");
            if (httpException == null)
            {
                routeData.Values.Add("action", "Internal");
            }
            else
            { // It's an Http Exception, Let's handle it.
                switch (httpException.GetHttpCode())
                {
                case 404:
                    routeData.Values.Add("action", "NotFound");
                    break;

                case 401:
                case 403:
                    routeData.Values.Add("action", "Forbidden");
                    break;

                case 500:
                    routeData.Values.Add("action", "Internal");
                    break;

                default:
                    routeData.Values.Add("action", "Internal");
                    break;
                }
            }

            // Pass exception details to the target error View.
            routeData.DataTokens.Add(ResultServiceBase.RouteDataExceptionKey, exception);

            // Avoid IIS7 getting in the middle
            context.Response.TrySkipIisCustomErrors = true;

            Trace.WriteLine("ErrorControllerHandler: Application_Error: invoking mvc");

            try
            {
                // Call target Controller and pass the routeData.
                errorController.IncludeExceptionDetails = includeExceptionDetails;
                errorController.Execute(requestContext);
            }
            catch (Exception ex)
            {
                context.Response.Clear();

                Trace.TraceError(ex.ToString());

                if (includeExceptionDetails)
                {
                    BasicHttpErrorResponse.Execute(context, exception, ex);
                }
                else
                {
                    BasicHttpErrorResponse.Execute(context, null);
                }
            }

            Trace.WriteLine("ErrorControllerHandler: Application_Error: end");

            return(exception);
        }
示例#7
0
 /// <summary>
 /// Handles the specified HTTP errorfull context (typically in Application_Error).
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="errorController">The error controller.</param>
 /// <param name="includeExceptionDetails">if set to <c>true</c> [include exception details].</param>
 /// <returns></returns>
 public static Exception Handle(HttpContext context, IErrorController errorController, bool includeExceptionDetails)
 {
     return(Handle(context, errorController, includeExceptionDetails, null));
 }
示例#8
0
 public NullController(IErrorController errController)
     : base(errController)
 {
 }