public List <OrderViewModel> Search(OrderSearchModel searchModel) { var accounts = _accountContext.Accounts.Select(x => new { x.Id, x.Fullname }).ToList(); var query = _context.Orders.Select(x => new OrderViewModel { Id = x.Id, AccountId = x.AccountId, DiscountAmount = x.DiscountAmount, IsCanceled = x.IsCanceled, IsPaid = x.IsPaid, IssueTrackingNo = x.IssueTrackingNo, PayAmount = x.PayAmount, PaymentMethodId = x.PaymentMethod, RefId = x.RefId, TotalAmount = x.TotalAmount, CreationDate = x.CreateionDate.ToFarsi() }); query = query.Where(x => x.IsCanceled == searchModel.IsCanceled); if (searchModel.AccountId > 0) { query = query.Where(x => x.AccountId == searchModel.AccountId); } var orders = query.OrderByDescending(x => x.Id).ToList(); foreach (var order in orders) { order.AccountFullName = accounts.FirstOrDefault(x => x.Id == order.AccountId)?.Fullname; order.PaymentMethod = PaymentMethod.GetBy(order.PaymentMethodId).Name; } return(orders); }
public void OrderController_Index_ShouldReturnTheSearchModelAsTheModel() { var orderSearchModel = new OrderSearchModel(); var result = _orderController.Index(orderSearchModel); result.Model.Should().Be(orderSearchModel); }
public IPagedList <Order> SearchOrders(OrderSearchModel model, int page = 1, int pageSize = 10) { var query = new OrderSearchQuery(model); return(_orderSearcher.Search(query.GetQuery(), page, pageSize, query.GetFilter(), new Sort(new SortField("id", SortField.INT, true)))); }
public JsonResult getConfirmOrders([System.Web.Http.FromBody] OrderSearchModel data) { OrderBO bo = new OrderBO(); var datas = bo.getConfirmedOrders(data); return(Json(datas)); }
public ActionResult List(OrderSearchModel model) { System.Web.HttpContext.Current.Session["ActiveOrder"] = null; int pageIndex = model.Page ?? 1; var orderList = _orderService.GetOrderDetailItems().Where(x => (string.IsNullOrEmpty(model.OrderNo) || x.OrderNoSeries.Trim().Contains(model.OrderNo.Trim())) & (model.StatusId == 0 || model.StatusId == null || x.StatusId == model.StatusId) & (x.OrderDate >= Convert.ToDateTime(model.StartDateTime) & x.OrderDate <= Convert.ToDateTime(model.EndDateTime)) ); var data = _mapper.Map <List <OrderDetailItemModel> >(orderList); model.StatusList = GetStatusList(); model.Status2List = GetStatusList(); model.OrderDetailItemModels = data.ToPagedList(pageIndex, 10); if (Request.IsAjaxRequest()) { return(PartialView("_OrderList", model)); } return(View(model)); }
public IPagedList <Order> Search(OrderSearchModel model) { var query = new OrderSearchQuery(model); return(_orderSearcher.Search(query.GetQuery(), model.Page, filter: query.GetFilter(), sort: new Sort(new SortField("id", SortField.INT, true)))); }
public HttpResponseMessage GetUserStatics(int limit, int page) { ResultMsg resultMsg = new ResultMsg(); try { if (limit < 1) { limit = 10; } if (page < 1) { page = 1; } OrderSearchModel search = new OrderSearchModel(); search.limit = limit; search.page = page; using (T_AdminRepository repository = new T_AdminRepository()) { var pagelist = repository.GetVSUserPageList(search.page, search.limit); resultMsg.data = pagelist.Data; resultMsg.count = pagelist.TotalItemCount; } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public async Task <IEnumerable <BaseOrderInfo> > GetOrdersAsync(OrderSearchModel orderSearchModel, int skip, int take) { using (IUnitOfWork unitOfWork = _unitOfWorkFactory.Create()) { var orders = unitOfWork.Repository <Order>().Query(); var autos = unitOfWork.Repository <Auto>().Query(); var customers = unitOfWork.Repository <Customer>().Query(); var query = from o in orders join a in autos on o.AutoId equals a.Id join c in customers on o.CustomerId equals c.Id where (orderSearchModel.TypeId > 0 ? a.TypeId == orderSearchModel.TypeId : true) && (orderSearchModel.MarkId > 0 ? a.MarkId == orderSearchModel.MarkId : true) && (orderSearchModel.ModelId > 0 ? a.ModelId == orderSearchModel.ModelId : true) && (!string.IsNullOrWhiteSpace(orderSearchModel.City) ? a.City == orderSearchModel.City : true) && (orderSearchModel.MinYear > 0 ? a.Year >= orderSearchModel.MinYear : true) && (orderSearchModel.MaxYear > 0 ? a.Year <= orderSearchModel.MaxYear : true) select new BaseOrderInfo { OrderId = o.Id, CustomerId = c.Id, CustomerFirstName = c.FirstName, CustomerLastName = c.LastName, CustomerPhotoUrl = c.Avatar, AutoId = a.Id, MarkName = a.MarkName, ModelName = a.ModelName, CarPhotoUrl = a.PhotoLink }; return(await query.Skip(skip).Take(take).ToListAsync()); } }
public void OrderController_Index_ShouldCallOrderServiceGetAllPagedWithPassedArgument() { var orderSearchModel = new OrderSearchModel(); var result = _orderController.Index(orderSearchModel); A.CallTo(() => _orderAdminService.Search(orderSearchModel)).MustHaveHappened(); }
public ActionResult ChargeOrders(OrderSearchModel searchModel) { OrderManagement orderMgt = new OrderManagement(User.Identity.GetUserId <int>()); int pageSize = 30; DateTime sDate = DateTime.MinValue; DateTime eDate = DateTime.MinValue; if (!string.IsNullOrEmpty(searchModel.StartTime)) { DateTime.TryParse(searchModel.StartTime, out sDate); } if (!string.IsNullOrEmpty(searchModel.EndTime)) { DateTime.TryParse(searchModel.EndTime, out eDate); } long sintDate = sDate != DateTime.MinValue ? DateTimeUtil.ConvertDateTimeToInt(sDate) : 0; long eintDate = eDate != DateTime.MinValue ? DateTimeUtil.ConvertDateTimeToInt(eDate) : 0; int page = 1; if (Request["page"] != null) { int.TryParse(Request["page"], out page); } searchModel.Page = page; searchModel.AgencyId = User.Identity.GetUserId <int>(); List <BOrder> orders = orderMgt.FindOrders(searchModel.OrderId != null ? (int)searchModel.OrderId : 0, searchModel.AgencyId != null ? (int)searchModel.AgencyId : 0, searchModel.ResourceId != null ? (int)searchModel.ResourceId : 0, searchModel.ResourceTaocanId != null ? (int)searchModel.ResourceTaocanId : 0, searchModel.RuoteId != null ? (int)searchModel.RuoteId : 0, searchModel.SPName, searchModel.MobileNumber, searchModel.Status, sintDate, eintDate, out total, pageSize, searchModel.Page, true); PageItemsResult <BOrder> result = new PageItemsResult <BOrder>() { CurrentPage = searchModel.Page, Items = orders, PageSize = pageSize, TotalRecords = total, EnablePaging = true }; KMBit.Grids.KMGrid <BOrder> grid = new Grids.KMGrid <BOrder>(result); BigOrderSearchModel model = new BigOrderSearchModel() { SearchModel = searchModel, OrderGrid = grid }; List <BResourceTaocan> taocans = new List <BResourceTaocan>(); agentMgt = new AgentManagement(orderMgt.CurrentLoginUser); List <BAgentRoute> routes = agentMgt.FindTaocans(0); taocans = (from r in routes select r.Taocan).ToList <BResourceTaocan>(); ViewBag.Taocans = new SelectList((from t in taocans select new { Id = t.Taocan.Id, Name = t.Taocan2.Name }), "Id", "Name"); ViewBag.StatusList = new SelectList((from s in StaticDictionary.GetChargeStatusList() select new { Id = s.Id, Name = s.Value }), "Id", "Name"); return(View(model)); }
public ViewResult Index(OrderSearchModel model) { ViewData["shipping-status-options"] = _orderAdminService.GetShippingStatusOptions(); ViewData["payment-status-options"] = _orderAdminService.GetPaymentStatusOptions(); ViewData["results"] = _orderAdminService.Search(model); return(View("Index", model)); }
public void Search() { OrderSearchModel model = new OrderSearchModel(); ActionResult result = orderController.Search(model); Assert.IsTrue(result != null); Assert.Pass(result.ToString()); }
public void OrderController_Index_ShouldReturnTheResultOfTheCallToTheServiceAsViewData() { var orderSearchModel = new OrderSearchModel(); var pagedList = PagedList <Order> .Empty; A.CallTo(() => _orderAdminService.Search(orderSearchModel)).Returns(pagedList); var result = _orderController.Index(orderSearchModel); result.ViewData["results"].Should().Be(pagedList); }
public virtual IActionResult OrderList(OrderSearchModel searchModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders)) { return(AccessDeniedDataTablesJson()); } //prepare model var model = _shipRocketService.PrepareOrderListModel(searchModel); return(Json(model)); }
public ActionResult <IEnumerable <Order> > SearchOrders([FromQuery] OrderSearchModel searchModel) { try { return(this._orderRepository.SearchOrders(searchModel).ToList()); } catch (Exception ex) { this._logger.LogError(exception: ex, message: "Error occurred."); return(BadRequest("Error occurred.")); } }
public OrderSearchQuery(OrderSearchModel orderSearchModel) { SearchText = orderSearchModel.SearchText; OrderId = orderSearchModel.OrderId; DateFrom = orderSearchModel.DateFrom; DateTo = orderSearchModel.DateTo; PaymentStatus = orderSearchModel.PaymentStatus; ShippingStatus = orderSearchModel.ShippingStatus; SalesChannel = orderSearchModel.SalesChannel; OrderTotalFrom = orderSearchModel.OrderTotalFrom; OrderTotalTo = orderSearchModel.OrderTotalTo; }
public IPagedList <Order> SearchOrders(OrderSearchModel model) { var queryOver = _session.QueryOver <Order>(); if (!String.IsNullOrWhiteSpace(model.SearchText)) { queryOver = queryOver.Where(o => o.OrderEmail.IsInsensitiveLike(model.SearchText, MatchMode.Anywhere) || o.BillingAddress.LastName.IsInsensitiveLike(model.SearchText, MatchMode.Anywhere)); } if (model.DateFrom.HasValue) { queryOver = queryOver.Where(o => (o.OrderDate != null && o.OrderDate > model.DateFrom) || (o.OrderDate == null && o.CreatedOn > model.DateFrom.Value)); } if (model.DateTo.HasValue) { queryOver = queryOver.Where(o => (o.OrderDate != null && o.OrderDate < model.DateTo) || (o.OrderDate == null && o.CreatedOn < model.DateTo.Value)); } if (!String.IsNullOrWhiteSpace(model.OrderId)) { queryOver = queryOver.Where(o => o.Id == Convert.ToInt32(model.OrderId)); } if (model.PaymentStatus.HasValue) { queryOver = queryOver.Where(o => o.PaymentStatus == model.PaymentStatus); } if (model.ShippingStatus.HasValue) { queryOver = queryOver.Where(o => o.ShippingStatus == model.ShippingStatus); } if (!String.IsNullOrWhiteSpace(model.SalesChannel)) { queryOver = queryOver.Where(o => o.SalesChannel == model.SalesChannel); } if (model.OrderTotalFrom.HasValue) { queryOver = queryOver.Where(x => x.Total > model.OrderTotalFrom); } if (model.OrderTotalTo.HasValue) { queryOver = queryOver.Where(x => x.Total < model.OrderTotalTo); } return(queryOver.OrderBy(order => order.Id).Desc.Paged(model.Page)); }
private void instances() { _taxesList = new List <QOBDCommon.Entities.Tax>(); _currenciesList = new List <CurrencyModel>(); _order = new Entity.Order(); OrderTask = new NotifyTaskCompletion <List <QOBDCommon.Entities.Order> >(); OrderModelTask = new NotifyTaskCompletion <List <OrderModel> >(); TaxTask = new NotifyTaskCompletion <List <QOBDCommon.Entities.Tax> >(); _title = ""; _orderSearchModel = new OrderSearchModel(); _blockOrderVisibility = "Visible"; _blockSearchResultVisibility = "Hidden"; }
public List <OrderDetailModel> GetList(OrderSearchModel searchModel) { var result = new List <OrderDetailModel>(); for (var i = 0; i < 20; i++) { result.Add(new OrderDetailModel() { OrderNo = i.ToString().PadLeft(9), CreateTime = DateTime.Now, CustomerName = $"顾客{i}", }); } return(result); }
public List <OrderViewModel> Search(OrderSearchModel searchModel) { var accounts = _accountContext.Accounts.Select(x => new { x.Id, x.FullName }); var query = _shopContext.Orders.Select(x => new OrderViewModel { Id = x.Id, AccountId = x.AccountId, DiscountAmount = x.DiscountAmount, IsCanceled = x.IsCanceled, IsPaid = x.IsPaid, IssueTrackingNo = x.IssueTrackingNo, PayAmount = x.PayAmount, RefId = x.RefId, TotalAmount = x.TotalAmount, CreationDate = x.CreationDate.ToFarsi(), }); query = query.Where(x => x.IsCanceled == searchModel.IsCanceled); if (searchModel.AccountId > 0) { query = query.Where(x => x.AccountId == searchModel.AccountId); } if (!string.IsNullOrWhiteSpace(searchModel.AccountName)) { var ords = query.OrderByDescending(x => x.Id).ToList(); foreach (var order in ords) { order.AccountFullname = accounts.FirstOrDefault(x => x.Id == order.AccountId)?.FullName; } query = query.Where(x => x.AccountFullname.Contains(searchModel.AccountName)); } if (!string.IsNullOrWhiteSpace(searchModel.IssueTrackingNo)) { query = query.Where(x => x.IssueTrackingNo.Contains(searchModel.IssueTrackingNo)); } var orders = query.OrderByDescending(x => x.Id).ToList(); foreach (var order in orders) { order.AccountFullname = accounts.FirstOrDefault(x => x.Id == order.AccountId)?.FullName; } return(orders); }
public ActionResult Search(OrderSearchModel model) { var Msg = new Message(); try { List <DVG.WIS.PublicModel.OrderOnListModel> listOrders = new List <DVG.WIS.PublicModel.OrderOnListModel>(); int totalRow = 0; listOrders = _orderBo.GetList(model.KeyWord, model.Status, model.SourceType, model.DeliveryStatus, model.OrderType, model.FromCreatedDate, model.ToCreatedDate, model.RequestType, out totalRow, model.PageIndex, model.PageSize).ToList(); List <District> listDistrict = _districtBoCached.GetAll().ToList(); // nếu là màn hình bếp => lấy list Món ra var isDisplayListOrderDetails = (_userService.GetRole() == UserTypeEnum.Kitchen.GetHashCode() || _userService.GetRole() == UserTypeEnum.Checkfood.GetHashCode()) && (model.Status == OrderStatusEnum.Pending.GetHashCode() || model.Status == OrderStatusEnum.PushToPOS.GetHashCode() || model.Status == OrderStatusEnum.KitchenAccept.GetHashCode() || model.Status == OrderStatusEnum.KitchenDone.GetHashCode()); if (listOrders.Any()) { foreach (var item in listOrders) { var district = listDistrict.Find(x => x.district_id == item.DistrictId); if (district != null) { item.DistrictStr = district.district_name; } if (isDisplayListOrderDetails) { item.lstOrderDetail = _orderBo.GetByOrderId(item.OrderId); } } } var pager = new Pager { CurrentPage = model.PageIndex, PageSize = model.PageSize, TotalItem = totalRow }; Msg.Obj = new { SearchModel = model, Data = listOrders, Pager = pager }; } catch (Exception ex) { Msg.Obj = null; Msg.Title = ex.Message; Msg.Error = true; } return(AuthorizeJson(Msg)); }
public JsonResult getNotPayOrders([System.Web.Http.FromBody] OrderSearchModel data) { OrderBO bo = new OrderBO(); var filUtil = new FileUploadProcess(); var res = bo.getNotPayOrders(data); if (res.IsThereValues()) { foreach (var d in res) { if (d.payment.IsThereValues() && d.payment.file.IsThereValues()) { d.payment.file.fileName = filUtil.GenerateHTTPFilePath(d.payment.file.fileName, JSettings.GoogleCloudStorage.Bucket.OrderPaymentSlip); } } } return(Json(res)); }
public HttpResponseMessage GetOrderList(int limit, int page, int?SearchShopID = null, string SearchDate = null) { ResultMsg resultMsg = new ResultMsg(); try { if (limit < 1) { limit = 10; } if (page < 1) { page = 1; } OrderSearchModel search = new OrderSearchModel(); search.ShopID = SearchShopID; if (!string.IsNullOrWhiteSpace(SearchDate)) { Regex reg = new Regex(@"[0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2}"); var dates = reg.Matches(SearchDate); if (dates.Count > 1) { search.BTimeStart = Convert.ToDateTime(dates[0].Value); search.BTimeEnd = Convert.ToDateTime(dates[1].Value).AddDays(1); } } search.limit = limit; search.page = page; using (IT_Order repository = new T_OrderRepository()) { var pagelist = repository.GetVOrderPageList(search); resultMsg.data = pagelist.Data; resultMsg.count = pagelist.TotalItemCount; } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public ActionResult Search(OrderSearchModel model) { ResponseData responseData = new ResponseData(); try { List <DVG.WIS.PublicModel.OrderOnListModel> listOrders = new List <DVG.WIS.PublicModel.OrderOnListModel>(); int totalRow = 0; listOrders = _orderBo.GetList(model.KeyWord, model.Status, model.SourceType, model.DeliveryStatus, model.OrderType, model.FromCreatedDate, model.ToCreatedDate, model.RequestType, out totalRow, model.PageIndex, model.PageSize).ToList(); List <District> listDistrict = (List <District>)_districtBoCached.GetAll(); // nếu là màn hình bếp => lấy list Món ra var isDisplayListOrderDetails = _userService.GetRole() == UserTypeEnum.Kitchen.GetHashCode() && (model.Status == OrderStatusEnum.PushToPOS.GetHashCode() || model.Status == OrderStatusEnum.KitchenAccept.GetHashCode()); if (listOrders.Any()) { foreach (var item in listOrders) { var district = listDistrict.Find(x => x.district_id == item.DistrictId); if (district != null) { item.DistrictStr = district.district_name; } if (isDisplayListOrderDetails) { item.lstOrderDetail = _orderBo.GetByOrderId(item.OrderId); } } } responseData.Data = listOrders; responseData.TotalRow = totalRow; responseData.Success = true; } catch (Exception ex) { responseData.Data = null; responseData.Success = false; } return(Json(responseData)); }
public PagedList <VOrderModel> GetVOrderPageList(OrderSearchModel search) { var queryList = from o in context.T_Order join s in context.T_Shop on o.ShopID.ToString() equals s.ID.ToString() select new VOrderModel { ID = o.ID, Mobile = o.Mobile, ShopID = o.ShopID, ShopName = s.ShopName, ShopAddress = s.ShopAddress, ShopPhoneNum = s.ShopPhoneNum, BTime = o.BTime, ETime = o.ETime, Duration = o.Duration, Ver_Code = o.Ver_Code, OrderNo = o.OrderNo, ParentNo = o.ParentNo, CardNo = o.CardNo, CTime = o.CTime, FeeCode = o.FeeCode, ReMarks = o.ReMarks, Flag = o.Flag, PayStatus = o.PayStatus }; if (search.ShopID.HasValue) { queryList = queryList.Where(o => o.ShopID == search.ShopID); } if (search.BTimeStart.HasValue) { queryList = queryList.Where(o => o.BTime >= search.BTimeStart); } if (search.BTimeEnd.HasValue) { queryList = queryList.Where(o => o.BTime < search.BTimeEnd); } queryList = queryList.OrderByDescending(o => o.BTime); return(queryList.ToPagedList(search.page, search.limit)); }
public IActionResult Order(int customerId, short?page = 1) { ViewData[GlobalViewBagKeys.ECommerceService] = eCommerce; OrderSearchModel searchModel = new OrderSearchModel { CustomerId = customerId }; return(View(new OrdersListViewModel { Orders = eCommerce.GetOrdersByCustomerId(searchModel, (page - 1) * recordsPerPage, recordsPerPage), PagingInfo = new PagingInfo { CurrentPage = (short)page, RecordsPerPage = recordsPerPage, TotalRecords = eCommerce.CountOrdersByCustomerId(searchModel) }, SearchModel = searchModel })); }
public List <Order> getConfirmedOrders(OrderSearchModel data) { if (data.orderCode == null) { data.orderCode = ""; } PaymentNotificationDAO pDao = new PaymentNotificationDAO(); List <Order> datas = new List <Order>(); var items = dao.getOrders(data.productId).Where(m => m.isPay == true && m.isActive == true && m.isFinish != true && (m.isCreateShipping != true || m.isShipping == true) && m.code.Contains(data.orderCode)).ToList(); foreach (var i in items) { var d = ConvertToScreenModel.Transactions.order(i); datas.Add(d); } return(datas); }
public IActionResult OrdersList(int userId, OrderSearchModel orderSearchModel) { if (userId == 0) { return(R.Fail.WithError(ErrorCodes.ParentEntityMustBeNonZero).Result); } if (userId < 0 || _userService.Count(x => x.Id == userId) == 0) { return(NotFound()); } var orders = _orderService.Get(out int totalResults, x => x.UserId == userId, x => x.CreatedOn, RowOrder.Descending, orderSearchModel.Current, orderSearchModel.RowCount).ToList(); var ordersModel = orders.Select(_orderModelFactory.Create).ToList(); return(R.Success.With("orders", ordersModel) .With("userId", userId) .WithGridResponse(totalResults, orderSearchModel.Current, orderSearchModel.RowCount).Result); }
public IActionResult Orders(OrderSearchModel searchModel) { var orderStatus = new List <OrderStatus>(); switch (searchModel.OrderStatus) { case "closed": orderStatus.Add(OrderStatus.Closed); orderStatus.Add(OrderStatus.Complete); break; case "open": orderStatus.Add(OrderStatus.New); orderStatus.Add(OrderStatus.OnHold); orderStatus.Add(OrderStatus.Shipped); orderStatus.Add(OrderStatus.Processing); orderStatus.Add(OrderStatus.Delayed); orderStatus.Add(OrderStatus.PartiallyShipped); break; case "returned": orderStatus.Add(OrderStatus.Returned); break; case "cancelled": orderStatus.Add(OrderStatus.Cancelled); break; default: break; //do nothing we'll show all orders by default } var orders = _orderService.GetOrders(out int totalResults, userId: CurrentUser.Id, startDate: searchModel.FromDate, endDate: searchModel.ToDate, orderStatus: orderStatus, page: searchModel.Current, count: searchModel.RowCount); var orderModels = orders.Select(x => _orderModelFactory.Create(x)).ToList(); return(R.Success.With("orders", orderModels).Result); }
public List <Order> getNotPayOrders(OrderSearchModel data) { if (data.orderCode == null) { data.orderCode = ""; } PaymentNotificationDAO pDao = new PaymentNotificationDAO(); List <Order> datas = new List <Order>(); List <Order> results = new List <Order>(); var items = dao.getOrders(data.productId) .Where(m => m.isPay == false && m.isActive == true && m.code.Contains(data.orderCode)) .OrderByDescending(m => m.orderDate) .ToList(); foreach (var code in items.GroupBy(m => m.code).Select(m => m.Key)) { var itms = items.Where(m => m.code == code).ToList(); var itm = ConvertToScreenModel.Transactions.order(itms.First()); itm.totalPrice = itms.Select(m => m.totalPrice).Sum(); itm.product.name = string.Join(", ", itms.Select(m => m.M_Product.name)); datas.Add(itm); } foreach (var d in datas) { d.payment = ConvertToScreenModel.Transactions.paymentNotification( pDao.getPaymentNotifications().OrderByDescending(m => m.id).FirstOrDefault(m => m.orderCode == d.code)); if (data.showOnlyPaymentSending == false || (data.showOnlyPaymentSending && d.payment != null)) { results.Add(d); } } return(results); }