Пример #1
0
        public ActionResult Orders(FilterOrder filterOrder)
        {
            if (filterOrder.DateTimeFrom != null &&
                filterOrder.DateTimeTo != null &&
                filterOrder.DateTimeFrom > filterOrder.DateTimeTo)
            {
                ModelState.AddModelError(string.Empty, GlobalRes.DataTimeFromTo);
            }

            if (filterOrder.DateTimeFrom == null)
            {
                filterOrder.DateTimeFrom = DateTime.UtcNow.AddDays(-30);
            }

            var ordersDTO = _ordersService.GetOrdersWithUnpaidBetweenDates(
                filterOrder.DateTimeFrom,
                filterOrder.DateTimeTo);

            filterOrder.OrdersViewModel = _mapper.Map <IEnumerable <OrderViewModel> >(ordersDTO);

            int count = 0;

            foreach (var i in filterOrder.OrdersViewModel)
            {
                foreach (var j in i.OrderDetails)
                {
                    count += j.Quantity;
                }
            }
            ViewBag.userCount = "Users quantity - " + filterOrder.OrdersViewModel.Count();
            ViewBag.gameCount = "Games quantity - " + count;
            return(View(filterOrder));
        }
Пример #2
0
        public async Task UpdateUserFilter()
        {
            var condition = new Condition
            {
                UserFilterCondition = FilterOperation.Contains,
                FilteringField      = "name",
                Value = "test value updates"
            };

            var order = new FilterOrder
            {
                Asc           = false,
                SortingColumn = "name",
            };

            var createUserFilterRequest = new CreateUserFilterRequest
            {
                Name           = Guid.NewGuid().ToString(),
                Description    = "testDscr_1",
                IsShared       = true,
                UserFilterType = UserFilterType.Launch,
                Conditions     = new List <Condition> {
                    condition
                },
                Orders = new List <FilterOrder> {
                    order
                }
            };

            var userFilterCreatedReponse = await Service.UserFilter.CreateAsync(createUserFilterRequest);

            var updateUserFilterRequest = new UpdateUserFilterRequest
            {
                Name           = Guid.NewGuid().ToString(),
                Description    = "testDscr_Updated",
                IsShared       = true,
                UserFilterType = UserFilterType.TestItem,
                Conditions     = new List <Condition> {
                    condition
                },
                Orders = new List <FilterOrder> {
                    order
                }
            };

            await Service.UserFilter.UpdateAsync(userFilterCreatedReponse.Id, updateUserFilterRequest);

            var updatedUserFilter = await Service.UserFilter.GetAsync(userFilterCreatedReponse.Id);

            Assert.Equal(updatedUserFilter.Id, userFilterCreatedReponse.Id);
            Assert.Equal(updateUserFilterRequest.Name, updatedUserFilter.Name);
            Assert.Equal(updateUserFilterRequest.Description, updatedUserFilter.Description);
            Assert.Equal(updateUserFilterRequest.IsShared, updatedUserFilter.IsShared);
            Assert.Equal(updateUserFilterRequest.UserFilterType, updatedUserFilter.UserFilterType);

            var delMessage = await Service.UserFilter.DeleteAsync(userFilterCreatedReponse.Id);

            Assert.Contains("success", delMessage.Info);
        }
Пример #3
0
        public void FilterOrders_FilterOrder_ReturnedViewResult()
        {
            var fakeFilterOrder = new FilterOrder();

            var res = _sut.HistoryOrders(fakeFilterOrder);

            Assert.IsType <ViewResult>(res);
        }
Пример #4
0
        public async Task CreateDeleteUserFilter()
        {
            var filterName = Guid.NewGuid().ToString();

            var filterEntity = new FilterEntity
            {
                UserFilterCondition = FilterOperation.Contains,
                FilteringField      = "name",
                Value = "test value"
            };

            var order1 = new FilterOrder
            {
                Asc           = true,
                SortingColumn = "name",
            };

            var selectionParameters = new FilterSelectionParameter
            {
                Orders = new List <FilterOrder> {
                    order1
                },
                PageNumber = 1
            };

            var filterElement = new FilterElement
            {
                Name           = filterName,
                Description    = "testDscr_1",
                IsLink         = false,
                Share          = true,
                UserFilterType = UserFilterType.Launch,
                Entities       = new List <FilterEntity> {
                    filterEntity
                },
                SelectionParameters = selectionParameters
            };

            var userFilters = await Service.AddUserFilterAsync(new AddUserFilterRequest { FilterElements = new List <FilterElement> {
                                                                                              filterElement
                                                                                          } });

            var userFilterContainer = await Service.GetUserFiltersAsync(new FilterOption
            {
                Filters = new List <Filter> {
                    new Filter(FilterOperation.Equals, "name", filterName)
                },
                Paging = new Paging(1, 200)
            });

            Assert.Contains(userFilterContainer.FilterElements, f => f.Id.Equals(userFilters.First().Id));

            var deleteMessage = await Service.DeleteUserFilterAsync(userFilters.First().Id);

            Assert.Contains("success", deleteMessage.Info);
        }
Пример #5
0
        public IIRFilter(SystemPanel _owner, BinaryReader src) : base(_owner, src)
        {
            filterOrder = (FilterOrder)src.ReadInt32();
            filterType  = (BiQuad.BiQuadMode)src.ReadInt32();
            channels    = src.ReadInt32();
            fc          = src.ReadDouble();
            Q           = src.ReadDouble();

            init();
        }
Пример #6
0
 public Filter()
 {
     mFilterMode  = FilterMode.LowPass;
     mFilterOrder = FilterOrder.Fourth_24db_oct;
     cutoff       = .99f;
     resonance    = 0f;
     cutoffMod    = 0f;
     buf0         = buf1 = buf2 = buf3 = 0f;
     CalculateFeedbackAmount();
 }
Пример #7
0
        public IIRFilter(int _channels, FilterOrder _filterOrder, BiQuad.BiQuadMode _filterType) : base()
        {
            filterOrder = _filterOrder;
            filterType  = _filterType;
            channels    = _channels;

            fc = 1000;
            Q  = 1 / Math.Sqrt(2);

            init();
        }
        public List <Customer> GetFilterBatch(FilterOrder filter)
        {
            var query        = CustomerQueries.GetFilterBatch;
            var whereBuilder = new List <string>();

            if (filter != null)
            {
                if (filter.ValueFrom != null && filter.ValueFrom.Value > 0)
                {
                    whereBuilder.Add($" o.OrderValue >= {filter.ValueFrom} ");
                }
                if (filter.ValueTo != null && filter.ValueTo.Value > 0)
                {
                    whereBuilder.Add($" o.OrderValue <= {filter.ValueTo} ");
                }
                if (filter.DateFrom != null && filter.DateFrom.Value > OrderRepository.MIN_DATE)
                {
                    whereBuilder.Add($" o.OrderDate >= '{filter.DateFrom.Value.ToString("yyyyMMdd")}' ");
                }
                if (filter.DateTo != null && filter.DateTo.Value > OrderRepository.MIN_DATE)
                {
                    whereBuilder.Add($" o.OrderDate >= '{filter.DateTo.Value.ToString("yyyyMMdd")}' ");
                }
                if (!String.IsNullOrWhiteSpace(filter.Text))
                {
                    var whereText = new List <string>();
                    foreach (var word in filter.Text.Split(' ').Where(w => w.Length > 2))
                    {
                        whereText.Add($" o.ReferenceNumber LIKE '%{word}%' ");
                        whereText.Add($" c.FirstName LIKE '%{word}%' ");
                        whereText.Add($" c.LastName LIKE '%{word}%' ");
                    }
                    whereBuilder.Add($" ({String.Join(" OR ", whereText)}) ");
                }

                query = whereBuilder.Count > 0 ?
                        $" SELECT * FROM  ( {query} WHERE {String.Join(" AND ", whereBuilder)} ) AS QUERY WHERE QUERY.Id IS NOT NULL " :
                        $" SELECT * FROM  ( {query} ) AS QUERY WHERE QUERY.Id IS NOT NULL ";
            }
            if (filter.RowFrom != null || filter.RowTo != null)
            {
                whereBuilder.Clear();
                if (filter.RowFrom != null)
                {
                    whereBuilder.Add($" rownumber >= {filter.RowFrom} ");
                }
                if (filter.RowTo != null)
                {
                    whereBuilder.Add($" rownumber <= {filter.RowTo} ");
                }
                query = $" {query} AND {String.Join(" AND ", whereBuilder)} ";
            }
            return(DapperConnection.DoQuery <Customer>(query));
        }
Пример #9
0
        public async Task UpdatePreferences()
        {
            var filterEntity = new FilterEntity
            {
                UserFilterCondition = Filtering.FilterOperation.Contains,
                FilteringField      = "name",
                Value = "test value"
            };

            var order1 = new FilterOrder
            {
                Asc           = true,
                SortingColumn = "name",
            };

            var selectionParameters = new FilterSelectionParameter
            {
                Orders = new List <FilterOrder> {
                    order1
                },
                PageNumber = 1
            };

            var filterElement = new FilterElement
            {
                Name           = Guid.NewGuid().ToString(),
                Description    = "testDscr_1",
                IsLink         = false,
                Share          = true,
                UserFilterType = UserFilterType.Launch,
                Entities       = new List <FilterEntity> {
                    filterEntity
                },
                SelectionParameters = selectionParameters
            };

            var userFilters = await Service.AddUserFilterAsync(new AddUserFilterRequest { FilterElements = new List <FilterElement> {
                                                                                              filterElement
                                                                                          } });

            var message = await Service.UpdatePreferencesAsync(new UpdatePreferenceRequest { FilderIds = userFilters.Select(x => x.Id) }, Username);

            Assert.Equal(base.Service.Project, message.ProjectRef);

            var allPreferences = await Service.GetAllPreferences(Username);

            Assert.True(allPreferences.FilterIds.Intersect(userFilters.Select(x => x.Id)).Any());

            userFilters.ForEach(async x => await Service.DeleteUserFilterAsync(x.Id));
        }
Пример #10
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (FilterOrder != null)
         {
             hashCode = hashCode * 59 + FilterOrder.GetHashCode();
         }
         if (FilterScope != null)
         {
             hashCode = hashCode * 59 + FilterScope.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #11
0
        public OrderPagination getAll(int skip, int limit, FilterOrder filter)
        {
            var query = conn.Orders.Where(tg => tg.DeletedAt == null);

            if (filter.text.Length > 0)
            {
                query = query.Where(tg => tg.Code.Contains(filter.text));
            }
            if (filter.ValueStatus != -1)
            {
                query = query.Where(tg => tg.OrderStatu.Value == filter.ValueStatus);
            }
            var count = query.Count();

            query = query.OrderByDescending(t => t.CreatedAt).Skip(skip).Take(limit);
            return(new OrderPagination(count, query));
        }
Пример #12
0
        public async Task FindUserFilters()
        {
            var condition = new Condition
            {
                UserFilterCondition = FilterOperation.Contains,
                FilteringField      = "name",
                Value = "test value"
            };

            var order = new FilterOrder
            {
                Asc           = true,
                SortingColumn = "name",
            };

            var createUserFilterRequest = new CreateUserFilterRequest
            {
                Name           = Guid.NewGuid().ToString(),
                Description    = "testDscr_1",
                IsShared       = true,
                UserFilterType = UserFilterType.Launch,
                Conditions     = new List <Condition> {
                    condition
                },
                Orders = new List <FilterOrder> {
                    order
                }
            };

            var userFilterCreatedResponse = await Service.UserFilter.CreateAsync(createUserFilterRequest);

            var userFilterContainer = await Service.UserFilter.GetAsync(new FilterOption
            {
                Filters = new List <Filter> {
                    new Filter(FilterOperation.Equals, "name", createUserFilterRequest.Name)
                },
                Paging = new Paging(1, 200)
            });

            Assert.Contains(userFilterContainer.Items, f => f.Id.Equals(userFilterCreatedResponse.Id));

            var deleteMessage = await Service.UserFilter.DeleteAsync(userFilterCreatedResponse.Id);

            Assert.Contains("success", deleteMessage.Info);
        }
Пример #13
0
        public async Task GetUserFilters()
        {
            var filterEntity = new FilterEntity
            {
                UserFilterCondition = FilterOperation.Contains,
                FilteringField      = "name",
                Value = "test value"
            };

            var order1 = new FilterOrder
            {
                Asc           = true,
                SortingColumn = "name",
            };

            var selectionParameters = new FilterSelectionParameter
            {
                Orders = new List <FilterOrder> {
                    order1
                },
                PageNumber = 1
            };

            var filterElement = new FilterElement
            {
                Name           = Guid.NewGuid().ToString(),
                Description    = "testDscr_1",
                IsLink         = false,
                Share          = true,
                UserFilterType = UserFilterType.Launch,
                Entities       = new List <FilterEntity> {
                    filterEntity
                },
                SelectionParameters = selectionParameters
            };

            var userFilters = await Service.AddUserFilterAsync(new AddUserFilterRequest { FilterElements = new List <FilterElement> {
                                                                                              filterElement
                                                                                          } });

            var userFilterContainer = await Service.GetUserFiltersAsync();

            Assert.True(userFilterContainer.FilterElements.Any());
        }
Пример #14
0
        public async Task UpdatePreferences()
        {
            var condition = new Condition
            {
                UserFilterCondition = FilterOperation.Contains,
                FilteringField      = "name",
                Value = "test value"
            };

            var order = new FilterOrder
            {
                Asc           = true,
                SortingColumn = "name",
            };

            var createUserFilterRequest = new CreateUserFilterRequest
            {
                Name           = Guid.NewGuid().ToString(),
                Description    = "testDscr_1",
                IsShared       = true,
                UserFilterType = UserFilterType.Launch,
                Conditions     = new List <Condition> {
                    condition
                },
                Orders = new List <FilterOrder> {
                    order
                }
            };

            var userFilterCreatedReponse = await Service.UserFilter.CreateAsync(createUserFilterRequest);

            var message = await Service.Project.UpdatePreferencesAsync(Service.ProjectName, Username, userFilterCreatedReponse.Id);

            message.Info.Should().Contain("successfully added");

            var allPreferences = await Service.Project.GetAllPreferences(Service.ProjectName, Username);

            allPreferences.Filters.Should().ContainSingle(p => p.Id == userFilterCreatedReponse.Id);

            var delMessage = await Service.UserFilter.DeleteAsync(userFilterCreatedReponse.Id);

            delMessage.Info.Should().Contain("successfully deleted");
        }
Пример #15
0
        public ActionResult HistoryOrders(FilterOrder filterOrder)
        {
            if (filterOrder.DateTimeFrom != null &&
                filterOrder.DateTimeTo != null &&
                filterOrder.DateTimeFrom > filterOrder.DateTimeTo)
            {
                ModelState.AddModelError(string.Empty, GlobalRes.DataTimeFromTo);
            }

            if (filterOrder.DateTimeTo == null)
            {
                filterOrder.DateTimeTo = DateTime.UtcNow.AddDays(-30);
            }

            var ordersDTO = _ordersService.GetOrdersBetweenDates(filterOrder.DateTimeFrom, filterOrder.DateTimeTo);

            filterOrder.OrdersViewModel = _mapper.Map <IEnumerable <OrderViewModel> >(ordersDTO);

            return(View(filterOrder));
        }
Пример #16
0
        public async Task UpdatePreferences()
        {
            var condition = new Condition
            {
                UserFilterCondition = FilterOperation.Contains,
                FilteringField      = "name",
                Value = "test value"
            };

            var order = new FilterOrder
            {
                Asc           = true,
                SortingColumn = "name",
            };

            var createUserFilterRequest = new CreateUserFilterRequest
            {
                Name           = Guid.NewGuid().ToString(),
                Description    = "testDscr_1",
                IsShared       = true,
                UserFilterType = UserFilterType.Launch,
                Conditions     = new List <Condition> {
                    condition
                },
                Orders = new List <FilterOrder> {
                    order
                }
            };

            var userFilterCreatedReponse = await Service.UserFilter.CreateAsync(createUserFilterRequest);

            var message = await Service.Project.UpdatePreferencesAsync(Service.ProjectName, Username, userFilterCreatedReponse.Id);

            //Assert.Equal(base.Service.ProjectName, message.ProjectRef);

            var allPreferences = await Service.Project.GetAllPreferences(Service.ProjectName, Username);

            //Assert.True(allPreferences.FilterIds.Intersect(userFilters.Select(x => x.Id)).Any());

            await Service.UserFilter.DeleteAsync(userFilterCreatedReponse.Id);
        }
Пример #17
0
        public async Task <IList <OrderHistoryDto> > GetOrderHistory(FilterOrder filterOrder)
        {
            IList <Order> orders;

            if (filterOrder.ClientId.HasValue)
            {
                orders = await _orderRepository.Get(o => o.ClientId == filterOrder.ClientId.Value);
            }
            else
            {
                orders = await _orderRepository.Get();
            }

            var ordersHistory = new List <OrderHistoryDto>();

            foreach (Order order in orders)
            {
                ordersHistory.Add(order.MapOrderToHistoryDto());
            }

            return(ordersHistory);
        }
Пример #18
0
        /// <summary>
        /// Returns true if ComDayCqWcmCoreImplWarpTimeWarpFilterProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCqWcmCoreImplWarpTimeWarpFilterProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCqWcmCoreImplWarpTimeWarpFilterProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FilterOrder == other.FilterOrder ||
                     FilterOrder != null &&
                     FilterOrder.Equals(other.FilterOrder)
                     ) &&
                 (
                     FilterScope == other.FilterScope ||
                     FilterScope != null &&
                     FilterScope.Equals(other.FilterScope)
                 ));
        }
        public async Task <ActionResult <IList <Order> > > Get([FromQuery] FilterOrder filterOrder)
        {
            var result = await _orderServices.GetOrderHistory(filterOrder);

            return(Ok(result));
        }
Пример #20
0
 public RequestFilter()
 {
     Filtering = new FilterQuery[] { };
     Ordering  = new FilterOrder[] { };
     Paging    = new FilterPage();
 }
Пример #21
0
 public void SetFilterOrder(FilterOrder newOrder)
 {
     mFilterOrder = newOrder;
 }