Exemplo n.º 1
0
 public Filter AdjustFilter(Filter filter)
 {
     var instanceType = filter.Instance.GetType();
     return instanceType.HasAttribute<NeedsBuildUpAttribute>()
         ? new Filter(container.BuildUp(instanceType, filter.Instance), filter.Scope, filter.Order)
         : filter;
 }
Exemplo n.º 2
0
 public GlimpseFilterCallMetadata(string category, Guid guid, string method, Filter innerFilter, bool isChild)
 {
     Category = category;
     Guid = guid;
     InnerFilter = innerFilter;
     Method = method;
     Order = innerFilter.Order;
     Scope = innerFilter.Scope;
     Type = innerFilter.Instance.GetType();
     IsChild = isChild;
 }
 /// <summary>
 /// Returns an enumerator that contains all the <see cref="T:System.Web.Mvc.IFilterProvider"/> instances in the service locator.
 /// </summary>
 /// <returns>
 /// The enumerator that contains all the <see cref="T:System.Web.Mvc.IFilterProvider"/> instances in the service locator.
 /// </returns>
 /// <param name="controllerContext">The controller context.</param><param name="actionDescriptor">The action descriptor.</param>
 public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
 {
     var key = FilterActionInfo.CreateKey(actionDescriptor.ControllerDescriptor.ControllerType,
                                          actionDescriptor.ActionName);
     IEnumerable<Filter> filters;
     if (!Filters.TryGetValue(key, out filters))
     {
         filters=new Filter[0];
     }
     return filters;
 }
Exemplo n.º 4
0
 public OrderController(IOrderRepository orderRepository, IOrderStatusRepository orderStatusRepository, IProductRepository productRepository,
     ViewOrders order, ViewOrderProfit profit, Filter filter, IOrderItemRepository orderitemRepository)
 {
     this.orderRepository = orderRepository;
     this.orderStatusRepository = orderStatusRepository;
     this.productRepository = productRepository;
     this.order = order;
     this.profit = profit;
     this.filter=filter;
     this.orderitemRepository = orderitemRepository;
 }
Exemplo n.º 5
0
        //
        // GET: /Orders/
        public virtual ActionResult Index(Filter? filter, string q)
        {
            IEnumerable<Order> result;
            var sortedOrders = db.Orders.OrderByDescending(o => o.Id);

            if (filter == null) {
                result = sortedOrders.Include(i => i.OrderLines).ToList();
            }
            else {
                switch (filter) {
                    case Filter.Overdue:
                        result = sortedOrders
                                    .Include(i => i.OrderLines)
                                    .ToList()
                                    .Where(o => o.PaidAt == null && (DateTime.Now - o.CreatedAt).Days > 10);
                        break;
                    case Filter.Ready:
                        result = sortedOrders
                                    .Include(i => i.OrderLines)
                                    .Where(o => o.PaidAt != null && o.ShippedAt == null);
                        break;
                    case Filter.Paid:
                        result = sortedOrders
                                    .Include(i => i.OrderLines)
                                    .Where(o => o.PaidAt != null);
                        break;
                    case Filter.Shipped:
                        result = sortedOrders
                                    .Include(i => i.OrderLines)
                                    .Where(o => o.ShippedAt != null);
                        break;
                    default:
                        result = sortedOrders.Include(i => i.OrderLines);
                        break;
                }
            }
            if (!string.IsNullOrWhiteSpace(q)) { 
				// Suche...
                result = result
                    .Where(p => p.OrderNumber.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1
                            || (p.Address1 ?? "").IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1
                            || (p.Address2 ?? "").IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1
                            || p.Email.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1
                            || p.City.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1
                            || p.Zip.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1
							// Suche nach dem Produkt das bestellt wurde.
                            || p.OrderLines.Any(ol => ol.Product.Name.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1)
                            || p.Firstname.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1
                            || p.Name.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) != -1);
							
            }
            ViewBag.q = q;
            return View(result);
        }
 public GlimpseFilterCallMetadata(string category, Guid guid, string method, Filter innerFilter, bool isChild, object obj)
 {
     Category = category;
     Guid = guid;
     InnerFilter = innerFilter;
     if (innerFilter != null)
     {
         Order = innerFilter.Order;
         Scope = innerFilter.Scope;
     }
     Method = method;
     Type = obj.GetType();
     IsChild = isChild;
 }
        public static void InitializeFilters(Filter[] enumerable)
        {
            var forgeryTokenAttributes = enumerable.Select(f => f.Instance).OfType<ValidateAntiForgeryTokenAttribute>();
            foreach (var attr in forgeryTokenAttributes)
            {
                var validateActionProperty = typeof (ValidateAntiForgeryTokenAttribute).GetProperty("ValidateAction",
                    BindingFlags.Instance | BindingFlags.NonPublic);

                validateActionProperty.SetValue(attr, new Action(() =>
                {
                    /*NOOP*/
                }));
            }
        }
        public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
        {
            var filters = new List<Filter>();
            if (_filterList == null || _filterList.Count == 0)
                return filters;

            foreach (GlobalFilterRegistration registration in _filterList)
            {
                var actionFilter = _container.GetInstance(registration.Type);
                var filter = new Filter(actionFilter, FilterScope.Global, registration.Order);
                filters.Add(filter);
            }

            return filters;
        }
 public GoodsTransferJobAuthorize()
 {
     this.filter = DependencyResolver.Current.GetService<Filter>();
     this.goodsTransferJobService = DependencyResolver.Current.GetService<IGoodsTransferJob>();
     this.JobKey = "FxTask.FxGoods.Transfer.GoodsTransferJobAuthorize";
 }
 public HouseTransferJobAuthorize()
 {
     this.filter = DependencyResolver.Current.GetService<Filter>();
     this.houseTransferJobService = DependencyResolver.Current.GetService<IHouseTransferJob>();
     this.JobKey = "FxTask.FxHouse.Transfer.HouseTransferJobAuthorize";
 }
Exemplo n.º 11
0
 public CarBuyJobAuthorize()
 {
     this.filter = DependencyResolver.Current.GetService<Filter>();
     this.carBuyJobService = DependencyResolver.Current.GetService<ICarBuyJob>();
     this.JobKey = "FxTask.FxCar.Buy.CarBuyJobAuthorize";
 }
Exemplo n.º 12
0
 public void addFilter(Filter ft)
 {
     chain.Add(ft);
 }