public DashboardController(IManageUsersHandler _manageuserHandler, IDashboardHandler _dashboardHandler, IConfiguration _config, IEMailHandler _emailHandler)
 {
     manageuserHandler = _manageuserHandler;
     dashboardHandler  = _dashboardHandler;
     emailHandler      = _emailHandler;
     config            = _config;
 }
        /// <summary>
        /// Initializes a new instance of the HandlerHelper class.
        /// </summary>
        /// <param name="handler">The handler to initialize this instance with.</param>
        public HandlerHelper(IDashboardHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler", "handler cannot be null.");
            }

            this.Handler = handler;
        }
        /// <summary>
        /// Initializes a new instance of the HandlerHelper class.
        /// </summary>
        /// <param name="handler">The handler to initialize this instance with.</param>
        public HandlerHelper(IDashboardHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler", "handler cannot be null.");
            }

            this.Handler = handler;
        }
Exemple #4
0
        /// <summary>
        /// Enables a factory to reuse an existing handler instance.
        /// </summary>
        /// <param name="handler">The <see cref="IHttpHandler"/> object to reuse. </param>
        public void ReleaseHandler(IHttpHandler handler)
        {
            IDashboardHandler apiHandler = handler as IDashboardHandler;

            if (apiHandler != null && !apiHandler.IsReusable)
            {
                apiHandler.Dispose();
                apiHandler = null;
            }
        }
Exemple #5
0
        /// <summary>
        /// Creates an <see cref="IDashboardHandler"/> for the given HTTP verb and URL path.
        /// </summary>
        /// <param name="verb">The HTTP verb to create the handler for.</param>
        /// <param name="path">The URL path to create the handler for.</param>
        /// <param name="repositoryFactory">The repository factory to use when creating the route.</param>
        /// <returns>The created handler.</returns>
        public IDashboardHandler CreateHandler(string verb, string path, IRepositoryFactory repositoryFactory)
        {
            Match match = this.Expression.Match(path);

            IDashboardHandler handler = (IDashboardHandler)typeof(T)
                                        .GetConstructor(new Type[] { typeof(IRepositoryFactory) })
                                        .Invoke(new object[] { repositoryFactory });

            for (int i = 1; i < match.Groups.Count; i++)
            {
                handler.RouteParameters.Add(match.Groups[i].Value);
            }

            return(handler);
        }
Exemple #6
0
        public IHttpHandler GetHandler(HttpContextBase context, string requestType, string url, string pathTranslated)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context", "context cannot be null.");
            }

            requestType = requestType ?? "GET";

            if (this.Mode == DashboardEnabledMode.On ||
                (this.Mode == DashboardEnabledMode.LocalOnly &&
                 context.Request.IsLocal))
            {
                string            handlerUrl         = ResolveHandlerUrl(this.HandlerUrl, context);
                string            handlerRelativeUrl = GetHandlerRelativeUrl(handlerUrl, context.Request.RawUrl);
                QueryString       queryString        = QueryString.FromUrl(context.Request.Url);
                IDashboardHandler handler            = DashboardRouter.GetHandler(requestType, handlerRelativeUrl, this.RepositoryFactory);

                if (handler != null)
                {
                    handler.ApplicationName           = this.ApplicationName;
                    handler.HandlerUrl                = handlerUrl;
                    handler.HandlerRelativeRequestUrl = handlerRelativeUrl;
                    handler.QueryString               = queryString;
                    handler.Verb = requestType.ToUpperInvariant();
                }
                else
                {
                    context.Response.StatusCode = 404;
                    context.Response.End();
                }

                return(handler);
            }
            else
            {
                context.Response.StatusCode = 403;
                context.Response.End();
            }

            return(null);
        }
Exemple #7
0
 public DashboardController(IDashboardHandler _dashboardHandler)
 {
     dashboardHandler = _dashboardHandler;
 }
 public DashboardController(IDashboardHandler _dashboardHandler, IJobPostHandler jobpastHandler, IHomeHandler homeHandler)
 {
     dashboardHandler = _dashboardHandler;
     _jobpastHandler  = jobpastHandler;
     _homeHandler     = homeHandler;
 }
 public DashboardController(IDashboardHandler handler)
 {
     this.handler = handler;
 }
Exemple #10
0
 public DashboardController(IManageUsersHandler _manageuserHandler, IDashboardHandler _dashboardHandler)
 {
     manageuserHandler = _manageuserHandler;
     dashboardHandler  = _dashboardHandler;
 }