async Task SearchItemsCommand() { OrderList.Clear(); List <CompactOrderModel> tmplist = await App.OrderTable.GetOrdersAsync(OrderSearch.ToLower()); OrderList = new ObservableCollection <CompactOrderModel>(tmplist); }
public StandardResult <List <OrderResult> > GetOrderResult(OrderSearch search = null) { var result = new StandardResult <List <OrderResult> >(); using (var db = base.NewDB()) { result.Body = db.Query <OrderResult>(@"SELECT order_type, ( CASE order_type WHEN 1 THEN '特' WHEN 2 THEN '平' WHEN 4 THEN '平' ELSE '其他' END ) AS ordertypename, sort, sum(total_in_money) as Money FROM t_orders WHERE customer_id = 16 AND issue = @Issue GROUP BY order_type, sort order by sort asc" , new { Issue = search.Issue }).ToList(); } return(result); }
public ActionResult GetOrders(OrderSearch condition) { string where = OrderSearch.StrWhere(condition); PageJsonModel <OrderShowVM> page = new PageJsonModel <OrderShowVM>(); page.pageIndex = condition.pageIndex; page.strForm = @" [Order] left join C_User on [Order].UserName=C_User.UserName "; page.strSelect = " [Order].*,C_User.Name C_User_Name,(select C_UserType.Name from C_UserType where C_UserType.Lever= C_User.C_UserTypeID) C_UserTypeName "; page.pageSize = condition.pageSize; page.strWhere = string.Format(" and [Order].ParentUser='' ") + where; if (string.IsNullOrWhiteSpace(condition.orderby) == false) { page.strOrder = Common.FilteSQLStr(condition.orderby); } else { page.strOrder = " [Order].ID Desc"; } page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult EditOrder(int id, int annId) { try { OrderSearch persistedValues = TempData.Peek("orderSearch") as OrderSearch; OrderService _order = new OrderService(); var order = _order.SearchEditOrder(id, annId); if (order.IsLocked == true && order.LockedBy != CurrentUser.UserId) { if (order.LockedOn != null && order.LockedOn.Value.AddMinutes(lockExpiryMin) < DateTime.UtcNow) { order.IsAlloweToEdit = true; _order.LockOrder(id, CurrentUser.UserId); } else { order.IsAlloweToEdit = false; } } else { order.IsAlloweToEdit = true; _order.LockOrder(id, CurrentUser.UserId); } return(View(order)); } catch (Exception ex) { return(View("Error")); } }
public ActionResult GetNoSendOrders(OrderSearch condition) { string where = string.Empty; //订单编号 if (!string.IsNullOrWhiteSpace(condition.OrderNo)) { where += " and [Order].OrderNo like '%" + Common.Filter(condition.OrderNo) + "%' "; } if (!string.IsNullOrWhiteSpace(condition.keyword)) { where += string.Format(" and ([Order].OrderNo like '%{0}%' or [Order].OrderName like '%{0}%' or [Order].OrderMan like '%{0}%' or [Order].OrderMobile like '%{0}%' or [Order].[Address] like '%{0}%') ", condition.keyword); } where += string.Format(" and [Order].OrderState='待发货' and [Order].AuditState='已审核'"); PageJsonModel <OrderShowVM> page = new PageJsonModel <OrderShowVM>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = " [Order] left join C_User on [Order].UserName=C_User.UserName "; page.strSelect = @" [Order].*,C_User.Name C_User_Name,(select Name from C_UserType where C_UserType.Lever= C_User.C_UserTypeID) C_UserTypeName "; page.strWhere = string.Format(" and [Order].ParentUser='' ") + where; page.strOrder = " DatAudit Asc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult GetSentOrders(OrderSearch condition) { string where = string.Empty; //订单编号 if (!string.IsNullOrWhiteSpace(condition.OrderNo)) { where += " and OrderNo like '%" + Common.Filter(condition.OrderNo) + "%' "; } if (!string.IsNullOrWhiteSpace(condition.keyword)) { where += string.Format(@" and ([Order].OrderNo like '%{0}%' or [Order].OrderName like '%{0}%' or [Order].OrderMan like '%{0}%' or [Order].OrderMobile like '%{0}%' or [Order].[Address] like '%{0}%' or OrderPost.[PostName] like '%{0}%' or OrderPost.[PostNo] like '%{0}%') ", condition.keyword); } PageJsonModel <OrderShowVM> page = new PageJsonModel <OrderShowVM>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = " [Order] left join C_User on [Order].UserName=C_User.UserName left join OrderPost on OrderPost.OrderNo=[Order].OrderNo "; page.strSelect = @" [Order].*,C_User.Name C_User_Name, ISNULL(OrderPost.PostName,'') PostName,ISNULL(OrderPost.PostNo,'') PostNo,ISNULL(OrderPost.Dat,0) PostDat,(select Name from C_UserType where C_UserType.Lever= C_User.C_UserTypeID) C_UserTypeName "; page.strWhere = " and [Order].ParentUser='' and OrderPost.PostNo is not null " + where; page.strOrder = " OrderPost.Dat Desc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult Search(OrderSearch orderSearch) { var orders = db.Orders.Where(o => o.CustomerId == orderSearch.CustomerId); ViewBag.Odr = orders; return(View());// orders.ToList()); }
public PageResponse <OrderDTO> Execute(OrderSearch request) { var query = _unitOfWork.Order.Find(o => o.UserId == request.UserId); if (request.MinTotal.HasValue) { query = query.Where(o => o.Total >= request.MinTotal); } if (request.MaxTotal.HasValue) { query = query.Where(o => o.Total <= request.MaxTotal); } var totalCount = query.Count(); query = query.Skip((request.PageNumber - 1) * request.PerPage).Take(request.PerPage); var pagesCount = (int)Math.Ceiling((double)totalCount / request.PerPage); var response = new PageResponse <OrderDTO> { CurrentPage = request.PageNumber, TotalCount = totalCount, PageCount = pagesCount, Data = query.Select(o => new OrderDTO() { Id = o.Id, Total = o.Total, Description = o.Description, CreatedAt = o.CreatedAt }) }; return(response); }
/// <summary> /// Handler to search order data /// </summary> /// <returns></returns> public async Task <ListResponse> Order_Search(OrderSearch orderSearch) { ListResponse response = new ListResponse(); List <OrderModel> lstOrder = new List <OrderModel>(); List <OrderItem> lstOrderItem = new List <OrderItem>(); DynamicParameters param = new DynamicParameters(); if (orderSearch != null) { AutoGenerateInputParams(param, orderSearch); orderSearch.GenerateSQLParams(param); } using (SqlConnection con = await CreateConnectionAsync()) { GridReader reader = await con.QueryMultipleAsync("dbo.Orders_GetAll", param, commandType : System.Data.CommandType.StoredProcedure); lstOrder = (await reader.ReadAsync <OrderModel>()).AsList <OrderModel>(); lstOrderItem = (await reader.ReadAsync <OrderItem>()).AsList <OrderItem>(); } foreach (OrderModel order in lstOrder) { order.OrderItemList = new List <OrderItem>(); order.OrderItemList = lstOrderItem.Where(ord => ord.OrderNumber == order.OrderNumber).ToList(); } response.Result = lstOrder.AsList(); //response.TotalRecords = ret.Count(); return(response); }
public PageResponse <GetOrderDto> Execute(OrderSearch search) { var query = context.Orders.Include(x => x.OrderInfo).Include(y => y.User).AsQueryable(); DateTime dateTime = new DateTime(); string date = search.OrderDate.Date.ToString("yyyy-MM-dd"); if (search.OrderDate != dateTime) { query = query.Where(x => x.Date.Date.ToString() == date); } var skipCount = search.PerPage * (search.Page - 1); var response = new PageResponse <GetOrderDto> { CurrentPage = search.Page, ItemsPerPage = search.PerPage, TotalCount = query.Count(), Items = query.Skip(skipCount).Take(search.PerPage).Select(x => new GetOrderDto { Adress = x.Address, orderStatus = x.OrderStatus, FirstName = x.User.FirstName, LastName = x.User.LastName, Date = x.Date, ProductName = x.OrderInfo.Select(x => x.Name), Quantity = x.OrderInfo.Select(x => x.Quantity), Price = x.OrderInfo.Select(x => x.Price) }).ToList() }; return(response); }
public ActionResult CreateOrder() { OrderSearch persistedValues = TempData.Peek("orderSearch") as OrderSearch; OrderService _order = new OrderService(); Order order = new Order(); var dropDownValues = _order.GetDropDownValue(); order.Territories = dropDownValues.Territory.Select(x => new SelectListItem() { Text = x.TerritoryName, Value = x.TerritoryID.ToString() }).Distinct().ToList(); order.Languages = dropDownValues.Language.Select(x => new SelectListItem() { Text = x.LanguageName, Value = x.LanguageID.ToString() }).Distinct().ToList(); order.Titles = dropDownValues.Title.Select(x => new SelectListItem() { Text = x.Name, Value = x.VideoVersion }).Distinct().ToList(); order.Assets = dropDownValues.Assets; order.OrderCategories = dropDownValues.orderCategory; order.OrderTypes = dropDownValues.OrderTypes; order.LocalEdits = dropDownValues.LocalEdits; return(View(order)); }
public StandardResult <List <OrderView> > GetList(OrderSearch search = null) { Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true; var result = new StandardResult <List <OrderView> >(); using (var db = base.NewDB()) { StringBuilder sqlCommonText = new StringBuilder("select * from view_orders where 1=1"); if (search != null) { if (!string.IsNullOrWhiteSpace(search.Issue)) { sqlCommonText.Append(" and issue=@Issue"); } if (search.OrderType != 0) { sqlCommonText.Append(" and ORDER_TYPE=@OrderType"); } if (search.CustomerId != 0) { sqlCommonText.Append(" and CustomerId=@CustomerId"); } } var list = db.Query <OrderView>(sqlCommonText.ToString(), search); result.Body = list.ToList(); return(result); } }
public FileResult ExportOrder(OrderSearch orderSearch) { ExportReportService _export = new ExportReportService(); DownLoadFile downloadFile = _export.GenerateOrderReport(orderSearch); //string path = ConfigurationManager.AppSettings["directoryPath"]; string path = App.Config.ReportDirectoryPath; //string downloadFile = string.Format(path, file); ////Stream fs = File.OpenRead(@"c:\testdocument.docx"); //FileStream stream = new FileStream(downloadFile, FileMode.Open, FileAccess.Read); //byte[] buffer = new byte[2048]; //byte[] bufferByte; //using (MemoryStream ms = new MemoryStream()) //{ // int read; // while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) // { // ms.Write(buffer, 0, read); // } // bufferByte = ms.ToArray(); //}; //stream.Close(); //_export.DeleteFile(downloadFile); return(File(downloadFile.bufferByte, "application/vnd.ms-excel", downloadFile.FileName)); }
public ActionResult SearchOrder(OrderSearch model) { var result = new CustomJsonResult(); result.Result = _orderService.Admin_SearchOrder(model); result.Optional = model.Total; return(Json(result)); }
public async Task <ListResponse> Order_SearchPaginated(int PageNumber, int PageSize) //OrderSearch req) { OrderSearch orderSearch = new OrderSearch(); orderSearch.PageNumber = PageNumber; orderSearch.PageSize = PageSize; return(await _orderProvider.Order_Search(orderSearch)); }
public IActionResult Get( [FromQuery] OrderSearch search, [FromServices] IGetOrdersQuery query) { var result = _executor.ExecuteQuery(query, search); return(Ok(result)); }
private void cmdSearch_Click(object sender, EventArgs e) { OrderSearch os = new OrderSearch(); if (cbCustomers.SelectedItem != null) os.CustomerID = ((Customer)cbCustomers.SelectedItem).CustomerID; if (cbEmployees.SelectedItem != null) os.EmployeeID = ((Employee)cbEmployees.SelectedItem).EmployeeID; gdOrder.DataSource = mClient.Send<IList<Order>>(os); }
public PagedResponse <OrderDto> Execute(OrderSearch search) { var query = _context.Orders.Include(x => x.OrderLines) .Include(x => x.User) .AsQueryable(); #region Filters if (search.MinOrderLines != null) { query = query.Where(o => o.OrderLines.Count() >= search.MinOrderLines); } if (search.Date != null) { query = query.Where(x => x.OrderDate == search.Date); } if (search.MinPrice != null) { query = query.Where(o => o.OrderLines.Sum(ol => ol.Price * ol.Quantity) >= search.MinPrice); } if (search.MaxPrice != null) { query = query.Where(o => o.OrderLines.Sum(ol => ol.Price * ol.Quantity) <= search.MaxPrice); } if (search.userId != null) { query = query.Where(o => o.UserId == search.userId); } #endregion var skipCount = search.PerPage * (search.Page - 1); var response = new PagedResponse <OrderDto> { TotalCount = query.Count(), CurrentPage = search.Page, ItemsPerPage = search.PerPage, Items = query.Skip(skipCount) .Take(search.PerPage) .Select(o => new OrderDto { Id = o.Id, Address = o.Address, CreatedAt = o.CreatedAt, UserFullname = o.User.Fullname, OrderLines = o.OrderLines.Select(ol => new OrderLineDto { Id = ol.Id, Price = ol.Price, Quantity = ol.Quantity, Title = ol.Title }) }) }; return(response); }
public ActionResult SearchOrder(OrderSearch orderSearch, int?pageNumber) { //_logger.Info("SearchOrder HTTPGet started"); OrderService _order = new OrderService(); try { if (pageNumber == 0) { pageNumber = null; } orderSearch.Territory = string.IsNullOrEmpty(orderSearch.TerritoryConcat) ? orderSearch.Territory : orderSearch.TerritoryConcat.Split('|'); var orders = _order.SearchOrders(orderSearch).ToPagedList(pageNumber ?? 1, 10); TempData["orderSearch"] = orderSearch; OrderSearch searchValues = _order.GetSearchValues(); searchValues.SelectedTitleList = searchValues.SelectedTitles.Select(x => new SelectListItem() { Text = x.Name, Value = x.VideoVersion }).Distinct().ToList(); searchValues.TerritoryList = searchValues.Territories.Select(x => new SelectListItem() { Text = x, Value = x }).Distinct().ToList(); OrderMgt orderMgt = new OrderMgt(); orderMgt.orders = orders; orderMgt.OrderSearch = orderSearch; orderMgt.OrderSearch.ContentDistributors = searchValues.ContentDistributors; orderMgt.OrderSearch.ContentProviders = searchValues.ContentProviders; orderMgt.OrderSearch.SelectedTitleList = searchValues.SelectedTitleList; orderMgt.OrderSearch.EditTypes = searchValues.EditTypes; orderMgt.OrderSearch.LocalEdits = searchValues.LocalEdits; orderMgt.OrderSearch.OrderStatuses = searchValues.OrderStatuses; orderMgt.OrderSearch.MediaTypes = searchValues.MediaTypes; orderMgt.OrderSearch.GreenLights = searchValues.GreenLights; orderMgt.OrderSearch.GreenLights = searchValues.GreenLights; orderMgt.OrderSearch.TerritoryList = searchValues.TerritoryList; orderMgt.OrderSearch.SortByList = searchValues.SortByList; orderMgt.OrderSearch.SortOrderList = searchValues.SortOrderList; orderMgt.OrderSearch.OrderTypes = searchValues.OrderTypes; orderMgt.UserId = CurrentUser.UserId; orderMgt.OrderUnlockPeriod = lockExpiryMin; //_logger.Info("SearchOrder HTTPGet completed"); return(View("Orders", orderMgt)); } catch (Exception ex) { //_logger.Error(ex.Message + (ex.InnerException != null ? ex.InnerException.ToString() : string.Empty)); return(View("Error")); } }
public IList<Order> OnOrderSearch(ISession session, OrderSearch e) { Expression exp = new Expression(); if (e.CustomerID != null) exp &= Models.Orders.customerID == e.CustomerID; if (e.EmployeeID > 0) exp &= Models.Orders.employeeID == e.EmployeeID; return exp.List<Models.Orders, Order>(); }
/// <summary> /// Finds the carts. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="options">The options.</param> /// <param name="totalRecords">The total records.</param> /// <returns></returns> public Cart[] FindCarts(OrderSearchParameters parameters, OrderSearchOptions options, out int totalRecords) { OrderSearch search = new OrderSearch(this); search.SearchOptions = options; search.SearchParameters = parameters; MetaStorageCollectionBase <Cart> orders = Cart.Search(search, out totalRecords); return(orders.ToArray()); }
/// <summary> /// Searches for Purchase Order. /// </summary> /// <param name="search">The search.</param> /// <param name="totalRecords">The total records.</param> /// <returns></returns> public static MetaStorageCollectionBase <PurchaseOrder> Search(OrderSearch search, out int totalRecords) { Guid searchGuid = Guid.NewGuid(); // Perform order search totalRecords = search.Search(searchGuid); // Load results and return them back return(LoadSearchResults(searchGuid)); }
//查询订单界面 private void showOrderSearch() { this.PanelRightMain.Controls.Clear(); OrderSearch orderSearch = new OrderSearch(user.UserID); orderSearch.TopLevel = false; orderSearch.Dock = DockStyle.Fill;//把子窗体设置为控件 orderSearch.FormBorderStyle = FormBorderStyle.None; PanelRightMain.Controls.Add(orderSearch); orderSearch.Show(); }
public ActionResult Orders(OrderSearch orderSearch, int?pageNumber) { try { OrderService _order = new OrderService(); OrderSearch searchValues = _order.GetSearchValues(); //to persist values between pages OrderSearch persistedValues = TempData.Peek("orderSearch") as OrderSearch; if (persistedValues != null) { searchValues.SelectedTitle = persistedValues.SelectedTitle; searchValues.ContentProvider = persistedValues.ContentProvider; searchValues.ContentDistributor = persistedValues.ContentDistributor;; searchValues.EditType = persistedValues.EditType; searchValues.LocalEdit = persistedValues.LocalEdit; searchValues.OrderStatus = persistedValues.OrderStatus; searchValues.GreenLightSent = persistedValues.GreenLightSent; searchValues.GreenLightReceived = persistedValues.GreenLightReceived; searchValues.Territory = persistedValues.Territory; searchValues.MediaType = persistedValues.MediaType; searchValues.StartDate = persistedValues.StartDate; searchValues.EndDate = persistedValues.EndDate; searchValues.SortBy = persistedValues.SortBy; searchValues.SortOrder = persistedValues.SortOrder; } var orders = _order.SearchOrders(searchValues).ToPagedList(pageNumber ?? 1, 10); searchValues.SelectedTitleList = searchValues.SelectedTitles.Select(x => new SelectListItem() { Text = x, Value = x }).Distinct().ToList(); searchValues.TerritoryList = searchValues.Territories.Select(x => new SelectListItem() { Text = x, Value = x }).Distinct().ToList(); OrderMgt orderMgt = new OrderMgt(); orderMgt.orders = orders; orderMgt.OrderSearch = searchValues; if (TempData["SavedStatus"] != null) { orderMgt.SavedStatus = Convert.ToBoolean(TempData["SavedStatus"]); } orderMgt.UserId = CurrentUser.UserId; orderMgt.OrderUnlockPeriod = lockExpiryMin; return(View(orderMgt)); } catch (Exception ex) { return(View("Error")); } }
/// <summary> /// Finds the payment plans. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="options">The options.</param> /// <param name="totalRecords">The total records.</param> /// <returns></returns> public PaymentPlan[] FindPaymentPlans(OrderSearchParameters parameters, OrderSearchOptions options, out int totalRecords) { OrderSearch search = new OrderSearch(this); search.SearchOptions = options; search.SearchParameters = parameters; MetaStorageCollectionBase <PaymentPlan> orders = PaymentPlan.Search(search, out totalRecords); return(orders.ToArray()); }
public PageResponse <OrderWithUserDataDto> Execute(OrderSearch search) { var query = _context.Orders.AsQueryable(); query = query.Include(o => o.OrderLines).Include(o => o.User); if (search.OrderDate != default(DateTime)) { query = query.Where(o => o.CreatedAt.Date == search.OrderDate); } return(query.Paged <OrderWithUserDataDto, Order>(search, _mapper)); }
public ActionResult <PageResponse <OrderDTO> > Get([FromQuery] OrderSearch search) { try { var id = GetTokenId.getId(User); var orders = _orderService.GetOrders(search, id); return(Ok(orders)); } catch (Exception e) { return(Ok(e.Message)); } }
/// <summary> /// Method to check the validation while fetching the order /// </summary> /// <param name="response"></param> /// <param name="orderSearch"></param> /// <returns></returns> private ListResponse ValidateOrderSearch(ListResponse listResponse, OrderSearch orderSearch) { if (orderSearch.PageNumber <= 0) { listResponse.SetError(ErrorCodes.INVALID_PAGE_NO_Required); } if (orderSearch.PageSize <= 0) { listResponse.SetError(ErrorCodes.INVALID_PAGE_SIZE_Required); } return(listResponse); }
public ActionResult LoadMyOrders(OrderSearch condition) { PageJsonModel <Order> page = new PageJsonModel <Order>(); page.pageIndex = condition.pageIndex; page.pageSize = condition.pageSize; page.strForm = " [Order] "; page.strSelect = " * "; page.strWhere = string.Format(" and UserName='******' ", CurrentUser.UserName); if (!string.IsNullOrWhiteSpace(condition.OrderState)) { condition.OrderState = Common.Filter(condition.OrderState); page.strWhere += string.Format(" and OrderState='{0}' ", condition.OrderState); } if (!string.IsNullOrWhiteSpace(condition.AuditState)) { condition.AuditState = Common.Filter(condition.AuditState); page.strWhere += string.Format(" and AuditState='{0}' ", condition.AuditState); } //姓名 if (string.IsNullOrWhiteSpace(condition.Name) == false) { page.strWhere += " and C_User.Name = '" + Common.Filter(condition.Name) + "' "; } //订单编号 if (!string.IsNullOrWhiteSpace(condition.OrderNo)) { page.strWhere += " and [Order].OrderNo like '%" + Common.Filter(condition.OrderNo) + "%' "; } //订单创建时间 if (!string.IsNullOrWhiteSpace(condition.DatCreateB)) { page.strWhere += string.Format(" and [Order].DatCreate >='{0} 00:00:00' ", Common.Filter(condition.DatCreateB)); } if (!string.IsNullOrWhiteSpace(condition.DatCreateE)) { page.strWhere += string.Format(" and [Order].DatCreate <'{0} 23:59:59' ", Common.Filter(condition.DatCreateE)); } page.strWhere += " and OrderState!='已删除' "; page.strOrder = "ID desc"; page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
private void cmdSearch_Click(object sender, EventArgs e) { OrderSearch os = new OrderSearch(); if (cbCustomers.SelectedItem != null) { os.CustomerID = ((Customer)cbCustomers.SelectedItem).CustomerID; } if (cbEmployees.SelectedItem != null) { os.EmployeeID = ((Employee)cbEmployees.SelectedItem).EmployeeID; } gdOrder.DataSource = mClient.Send <IList <Order> >(os); }
public ActionResult CancelEdit(Order order) { try { OrderService _order = new OrderService(); _order.UnlockOrder(order.OrderId, CurrentUser.UserId); OrderSearch orderSearch = TempData.Peek("orderSearch") as OrderSearch; return(RedirectToAction("SearchOrder", orderSearch)); } catch (Exception ex) { return(View("Error")); } }
public IList <Order> OnOrderSearch(ISession session, OrderSearch e) { Expression exp = new Expression(); if (e.CustomerID != null) { exp &= Models.Orders.customerID == e.CustomerID; } if (e.EmployeeID > 0) { exp &= Models.Orders.employeeID == e.EmployeeID; } return(exp.List <Models.Orders, Order>()); }
public IPage<Order> GetList(OrderSearch search,int pageIndex, int pageSize) { var query = _orderRepository.Table; query = query.OrderByDescending(o => o.OrderTime); return new Page<Order>(query, pageIndex, pageSize); }