public async Task <IActionResult> Card(string sortType, int?minPrice, int?maxPrice, int?currentPosition, string select) { if (User.Identity.IsAuthenticated) { FilterOrders filterUserOrders = new FilterOrders(selectFromSelectList: select, minPrice: minPrice, maxPrice: maxPrice, countVisablePozitins: 3, currentPozition: currentPosition, sortType: sortType); string loadCurrentPosition = _session.GetString("CurrentPositionProduct"); if (loadCurrentPosition != null) { filterUserOrders.CurrentPosition = Convert.ToInt32(loadCurrentPosition); _session.Remove("CurrentPositionProduct"); } UserCardAndFilters userCard = await _dataProcessingConveyor.GetUserCardAndFiltersAsync(User.Identity.Name, filterUserOrders); return(View(userCard)); } return(NotFound()); }
public List <BigCommerce4Net.Domain.Order> GetBigCommerceOrders(FilterOrders filter) { //API Call to get all Orders from the BigCommerce - paged by 250 // apply paging if record per day is more than 250 var bigCommerceOrders = _client.Orders.GetList(filter); return(bigCommerceOrders.ToList()); }
public async Task <ActionResult <PaginationList <OrdersListDTO> > > Filter([FromQuery] FilterOrders request) { if (User.GetUserRole() == Data.Entities.User.Roles.Admin) { return(await _service.Filter(request)); } return(await _service.Filter(request, User.GetUserId().Value)); }
public IEnumerable <Order> GetCurrentOrders(FilterOrders filter, params Expression <Func <Order, object> >[] includeProperties) { filter.PeriodDate = _periodDatetime; filter.DateTimeIntervalFlag = DateTimeIntervalFlag.AfterDateTime; var filterExpression = _orderPipeLine.ApplyFilters(filter); var orders = _decoratorOrderRepository.GetOrders(filterExpression, includeProperties).ToList(); return(orders); }
public Expression <Func <Order, bool> > ApplyFilters(FilterOrders filters) { Register(new DateFromFilter(filters.DateFrom)); Register(new DateToFilter(filters.DateTo)); Register(new PeriodDateFilter(filters.PeriodDate, filters.DateTimeIntervalFlag)); return(Process(x => true)); }
public async Task <PaginationList <OrdersListDTO> > Filter(FilterOrders request) { var query = _repository .Where(o => o.Address == request.Address || o.PhoneNumber == request.Phone || o.Status == request.OrderStatus); if (request.OrderingBy == FilterOrders.OrderingByCreatedAtTypes.Desc) { query = query.OrderByDescending(o => o.CreatedAt); } else { query = query.OrderBy(o => o.CreatedAt); } return(_mapper.Map <PaginationList <OrdersListDTO> >(await query.Paginate(request.PaginationOptions))); }
public JsonResult GetOpportunitys(string filter) { JavaScriptSerializer serializer = new JavaScriptSerializer(); FilterOrders model = serializer.Deserialize <FilterOrders>(filter); int totalCount = 0; int pageCount = 0; var list = OrdersBusiness.BaseBusiness.GetOpportunitys(model.SearchType, model.TypeID, model.StageID, model.UserID, model.TeamID, model.AgentID, model.BeginTime, model.EndTime, model.Keywords, model.PageSize, model.PageIndex, ref totalCount, ref pageCount, CurrentUser.UserID, CurrentUser.AgentID, CurrentUser.ClientID); JsonDictionary.Add("items", list); JsonDictionary.Add("totalCount", totalCount); JsonDictionary.Add("pageCount", pageCount); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public void Should_Get_GetMarketplaceOrdersJson() { // Arrange var bcOrderService = new BigCommerceOrdersService(); bcOrderService.Credential = _credentialRepo; var curDateTime = DateTime.Now.AddDays(-120); var filter = new FilterOrders { MinimumDateCreated = curDateTime.Date }; // Act var bigCommerceOrders = bcOrderService.GetBigCommerceOrders(filter); var result = JsonConvert.SerializeObject(bigCommerceOrders); // Assert Assert.True(result != null); }
public JsonResult GetOrders(string filter) { JavaScriptSerializer serializer = new JavaScriptSerializer(); FilterOrders model = serializer.Deserialize <FilterOrders>(filter); int totalCount = 0; int pageCount = 0; var list = OrdersBusiness.BaseBusiness.GetOrders(model.SearchOrderType, model.SearchType, model.EntrustType, model.TypeID, model.Status, (EnumOrderSourceType)model.SourceType, model.OrderStatus, model.PublicStatus, model.Mark, model.PayStatus, model.WarningStatus, model.ReturnStatus, model.UserID, model.TeamID, model.BeginTime, model.EndTime, model.Keywords, model.OrderBy, model.PageSize, model.PageIndex, ref totalCount, ref pageCount, CurrentUser.UserID, CurrentUser.ClientID); JsonDictionary.Add("items", list); JsonDictionary.Add("totalCount", totalCount); JsonDictionary.Add("pageCount", pageCount); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public async Task <IActionResult> CardAjax(string sortType, int?minPrice, int?maxPrice, int?currentPosition, string select) { if (User.Identity.IsAuthenticated) { FilterOrders filterUserOrders = new FilterOrders(selectFromSelectList: select, minPrice: minPrice, maxPrice: maxPrice, countVisablePozitins: 3, currentPozition: currentPosition, sortType: sortType); UserCardAndFilters userCard = await _dataProcessingConveyor.GetUserCardAndFiltersAsync(User.Identity.Name, filterUserOrders); return(new JsonResult(new { orders = userCard.Orders.Select(t => new { jsId = t.Id, jsDataReservation = t.DataReservation.ToShortDateString(), jsOrderStatusId = t.StatusId, jsStatus = t.StatusName, jsTotalFixPrice = t.TotalFixCost, jsCurrentPosition = currentPosition }).ToList() , orderPositions = userCard.OrderPositions.Select(t => new { jsCount = t.Count, jsFixPrice = t.FixPrice, jsMainPicturePath = t.MainPicturePath, jsOrderId = t.OrderId, jsProductId = t.ProductId, jsProductName = t.ProductName, jsProductTypeName = t.ProductTypeName }).ToList() })); } return(NotFound()); }
public IEnumerable <MarketplaceOrder> GetMarketplaceOrders(DateTime createdAfter) { var marketplaceOrders = new List <MarketplaceOrder>(); var filter = new FilterOrders { MinimumDateCreated = createdAfter.Date }; Console.WriteLine("{0} fetching orders for {1}...", ChannelName, createdAfter); //API Call to get all Orders from the BigCommerce - paged by 250 // apply paging if record per day is more than 250 var bigCommerceOrders = GetBigCommerceOrders(filter); foreach (var item in bigCommerceOrders) { marketplaceOrders.Add(convertOrderResponseToMarketplaceOrder(item)); } return(marketplaceOrders); }
public IList <Brand> GetList() { FilterOrders filter = new FilterOrders(); return(GetList(filter)); }
public IList <Order> GetList(int recordsPerPage = 250) { FilterOrders filter = new FilterOrders(); return(GetList(filter, recordsPerPage)); }
public async Task <UserCardAndFilters> GetUserCardAndFiltersAsync(string userName, FilterOrders filters) { UserCardAndFilters result = new UserCardAndFilters { Filters = filters, SortEnumArray = sortEnumArrayUserOrder }; string keyName = $"UserCardAndFilters{userName}{filters.GetFilterName()}"; var cacheResult = _cacheService.Get <UserCardAndFilters>(keyName); if (cacheResult == null) { cacheResult = new UserCardAndFilters { Filters = filters, SortEnumArray = sortEnumArrayUserOrder }; User user = await _fcdUserAndSignManager.GetUserAsync(userName); cacheResult.SetUserCardMini(user); if (user != null) { UserCardAndFilters userOrderAndOrderPositions = await _fcdStoreContext.GetUserOrdersAndOrderPositionsAsync(user.Id, (int)filters.CurrentPosition); cacheResult.Orders = userOrderAndOrderPositions.Orders; cacheResult.OrderPositions = userOrderAndOrderPositions.OrderPositions; } _dataFiltering.Filtering(cacheResult); _cacheService.Set <UserCardAndFilters>(keyName, cacheResult); } result.Id = cacheResult.Id; result.Name = cacheResult.Name; result.Email = cacheResult.Email; result.Orders = cacheResult.Orders; result.OrderPositions = cacheResult.OrderPositions; _dataFiltering.SetFilters(result); result.Orders = _dataFiltering.Paginator <OrderMini>(result.Orders, (int)filters.CountVisablePositions, (int)filters.CurrentPosition); return(result); }