private void InitData() { queryVM = new OrderQueryVM() { OrderType = SOIncomeOrderType.SO }; this.SearchBuilder.DataContext = queryVM; }
public void Query(OrderQueryVM model, int PageSize, int PageIndex, string SortField, EventHandler <RestClientEventArgs <dynamic> > callback) { string GetProductLineByQueryUrl = "ExternalSYSService/Order/OrderQuery"; OrderQueryFilter filter = model.ConvertVM <OrderQueryVM, OrderQueryFilter>(); filter.PageInfo = new QueryFilter.Common.PagingInfo { PageSize = PageSize, PageIndex = PageIndex, SortBy = SortField }; restClient.QueryDynamicData(GetProductLineByQueryUrl, filter, callback); }
private bool islink = false; //是否是其他页面链接过来的 #endregion #region 初始化加载 public OrderManagement() { InitializeComponent(); this.Loaded += (sender, e) => { OrderFacade service = new OrderFacade(this); this.FilterVM = new OrderQueryVM(); if (!string.IsNullOrEmpty(Request.Param)) { islink = true; FilterVM.OrderSysNoList = Request.Param; this.dgOrderQueryResult.QueryCriteria = Newegg.Oversea.Silverlight.Utilities.UtilityHelper.DeepClone <OrderQueryVM>(this.FilterVM); this.dgOrderQueryResult.Bind(); } }; }
public ActionResult QueryOrderList(OrderQueryVM queryModel) { var results = new List <OrderListViewModel>(); var efOrders = new List <Torder>(); using (var dbContext = new TicketCodeTestDBContext()) { efOrders = dbContext.Torder.ToList(); } if (queryModel.orderid != null) { efOrders = efOrders.Where(item => item.Id == queryModel.orderid).ToList(); } if (queryModel.productid != null) { efOrders = efOrders.Where(item => item.ProductId == queryModel.productid).ToList(); } if (queryModel.supplierid != null) { efOrders = efOrders.Where(item => item.SupplierId == queryModel.supplierid).ToList(); } if (queryModel.contact != null) { efOrders = efOrders.Where(item => item.Phone == queryModel.contact).ToList(); } if (queryModel.couponnumber != null) { efOrders = efOrders.Where(item => item.CouponNumber == queryModel.couponnumber).ToList(); } if (queryModel.batchnumber != null) { efOrders = efOrders.Where(item => item.Batch == queryModel.batchnumber).ToList(); } if (queryModel.logisticsnumber != null) { efOrders = efOrders.Where(item => item.DeliveryNumber == queryModel.logisticsnumber).ToList(); } if (queryModel.orderstatus != null) { efOrders = efOrders.Where(item => item.Status == queryModel.orderstatus).ToList(); } foreach (var item in efOrders) { var orderVM = new OrderListViewModel(); #region convert db to viewmodel orderVM.orderid = item.Id; using (var dbContext = new TicketCodeTestDBContext()) { var efProduct = dbContext.Tproduct.Find(item.ProductId); orderVM.productname = efProduct.Name; orderVM.productid = efProduct.Id; var efSupplier = dbContext.Tsupplier.Find(item.SupplierId); orderVM.suppliername = efSupplier.Name; } orderVM.buycount = item.BuyCount; orderVM.ticketnumber = item.CouponNumber; orderVM.batchnumber = item.Batch; orderVM.createtime = item.Createtime; orderVM.orderstatusDisplay = MapOrderStatus(item.Status); orderVM.contact = item.Phone; orderVM.receiver = item.Receiver; orderVM.receiveraddress = item.ReceiverAddress; orderVM.logisticsnumber = item.DeliveryNumber; #endregion results.Add(orderVM); } return(Json(results)); }