public async Task <IEnumerable <Order> > Handle(GetOrders query, CancellationToken cancellationToken) { // Retrieve entities var result = await _repository.GetAsync(); return(result); }
protected void OrdersButton_Click(object sender, EventArgs e) { SqlConnection conn; SqlCommand comm; SqlDataReader reader; string connectionString = ConfigurationManager.ConnectionStrings["DVDconnstring"].ConnectionString; conn = new SqlConnection(connectionString); comm = new SqlCommand("SELECT Orders.OrderID, Orders.CustomerID, DVDsOrdered.DVDID, DVDtable.DVDtitle FROM Orders " + " INNER JOIN DVDsOrdered ON DVDsOrdered.OrderID = Orders.OrderID " + " INNER JOIN DVDtable ON DVDsOrdered.DVDID = DVDtable.DVDID " + " WHERE CustomerID = @CustomerID", conn); comm.Parameters.Add("@CustomerID", System.Data.SqlDbType.Int); comm.Parameters["@CustomerID"].Value = CustNumTextbox.Text; try { conn.Open(); reader = comm.ExecuteReader(); GetOrders.DataSource = reader; GetOrders.DataBind(); reader.Close(); } catch { dbErrorLabel.Text = "Error getting Order Info<br />"; } finally { conn.Close(); } }
public ActionResult OrdersByWarehouse(int id, string OrderId) { Tuple <List <Order>, Order> tuple; List <Order> OrdersList = GetOrders.GetOrdersList3(id).Orders; var CurrentOrderIndex = 0; try { CurrentOrderIndex = OrdersList.FindIndex(a => a.OrderId == OrderId); } catch { CurrentOrderIndex = 0; } if (CurrentOrderIndex == -1) { CurrentOrderIndex = 0; } tuple = new Tuple <List <Order>, Order>(OrdersList, OrdersList[CurrentOrderIndex]); return(View("Orders", model: tuple)); }
public OrdersResponse Get(GetOrders request) { var orders = request.CustomerId.IsNullOrEmpty() ? Db.Select(Db.From <Order>().OrderByDescending(o => o.OrderDate)) .Skip((request.Page.GetValueOrDefault(1) - 1) * PageCount) .Take(PageCount) .ToList() : Db.Select <Order>(x => x.CustomerId == request.CustomerId); if (orders.Count == 0) { return(new OrdersResponse()); } var orderDetails = Db.Select <OrderDetail>(detail => Sql.In(detail.OrderId, orders.ConvertAll(x => x.Id))); var orderDetailsLookup = orderDetails.ToLookup(o => o.OrderId); var customerOrders = orders.ConvertAll(o => new CustomerOrder { Order = o, OrderDetails = orderDetailsLookup[o.Id].ToList() }); return(new OrdersResponse { Results = customerOrders }); }
public ActionResult Orders2(int warehouseID) { OrdersList ordersListRetrieved = GetOrders.GetOrdersList3(warehouseID); var output = ordersListRetrieved.Orders; return(View("~/Views/Order/Orders.cshtml")); }
public async Task <ActionResult> Order3Async(int warehouseID) { OrdersList ordersListRetrieved = await GetOrders.GetOrdersList(warehouseID); var output = ordersListRetrieved.Orders; return(View(output)); }
//returns all the orders public OrdersResponse Get(GetOrders request) { //get data from the database var orders = OrderRepository.GetAllOrders(); //transform to OrdersResponse and return. return(new OrdersResponse() { Orders = OrderMapper.ToOrderResponseList(orders) }); }
static void Main(string[] args) { GetOrders ord = new GetOrders(); List <OrderSql> ords = ord.List(); foreach (OrderSql ordSql in ords) { Console.WriteLine($"{ordSql.Id} , {ordSql.Date} , {ordSql.Amount} , {ordSql.CustomerId}"); } Console.ReadKey(); }
public async Task <IActionResult> GetItems(string username) { var command = new GetOrders(username); var result = await mediator.Send(command); if (result != null) { return(Ok(result)); } return(BadRequest("Try again")); }
public async void get_order_list_Test() { var request = TestFactory.CreateHttpRequestQuerys(new Dictionary <string, StringValues> { { "BuyerName", "aka" } }); var response = (ObjectResult)await GetOrders.Run(request, logger); var orders = ((List <VibOrder>)response.Value); Assert.Equal("aka", orders[0].BuyerName); }
public async Task <IEnumerable <OrderDto> > HandleAsync(GetOrders query) { var documents = _orderRepository.Collection.AsQueryable(); if (query.CustomerId.HasValue) { documents = documents.Where(p => p.CustomerId == query.CustomerId); } var orders = await documents.ToListAsync(); return(orders.Select(p => p.AsDto())); }
public async Task ListOrders() { APIResponse response = await GetOrders.ExecuteStrategy(null); if (response.IsSuccess) { var jsonSerializerSettings = new JsonSerializerSettings(); jsonSerializerSettings.MissingMemberHandling = MissingMemberHandling.Ignore; Orders = JsonConvert.DeserializeObject <List <OrderModel> >(response.Response, jsonSerializerSettings); foreach (var o in Orders) { OrdersList.Add(o); } } }
public IHttpActionResult GetOrders(GetOrders request) { if (!ModelState.IsValid) { return(BadRequest()); } var orders = _db.Orders .Where(c => c.CustomerId == request.Id) .Select(q => new Order { Id = q.Id, Quantity = q.Quantity, Product = q.Product, Price = q.Price }); return(Ok(new { Data = orders })); }
public async Task <IEnumerable <OrderDto> > HandleAsync(GetOrders query) { var documents = _orderRepository.Collection.AsQueryable(); if (query.CustomerId.HasValue) { var identity = _appContext.Identity; if (identity.IsAuthenticated && identity.Id != query.CustomerId && !identity.IsAdmin) { return(Enumerable.Empty <OrderDto>()); } documents = documents.Where(p => p.CustomerId == query.CustomerId); } var orders = await documents.ToListAsync(); return(orders.Select(p => p.AsDto())); }
/// <summary> /// Initializes a new instance of the <see cref="GetOrdersTest"/> class. /// </summary> public GetOrdersTest() { this.orderId = 1; this.customerId = 1; this.customerGuid = Guid.NewGuid(); this.request = new GetVisitorOrdersRequest(this.customerGuid.ToString(), "NopShop"); this.result = new GetVisitorOrdersResult(); this.args = new ServicePipelineArgs(this.request, this.result); this.client = Substitute.For <IOrdersServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IOrdersServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new GetOrders { ClientFactory = clientFactory }; }
public static List <string> GetOrderList(GetOrders orders) { ReadOnlyCollection <object> raw; if (orders == GetOrders.All) { DriverManager.ExecuteScript(getunplannedorders); raw = (ReadOnlyCollection <object>)DriverManager.ExecuteScript("return alldrops()"); } else { DriverManager.ExecuteScript(getplannedorders); raw = (ReadOnlyCollection <object>)DriverManager.ExecuteScript("return getPlannedOrders()"); } List <string> list = new List <string>(); foreach (object item in raw) { list.Add(item.ToString()); } return(list); }
public MainViewModel() { OpenAddOrderViewCommand = new Command(o => OpenAddOrderViewCommandExecute()); ItemsOrder = new GetOrders().GetAllOrders; }
public ActionResult RederDetail(string OrderId) { Order CurrentOrder = GetOrders.GetCurrentOrder2(int.Parse(OrderId)); return(PartialView("_DetailChamber", CurrentOrder)); }
public IActionResult GetOrders(int status, [FromServices] GetOrders getOrders) { return(Ok(getOrders.Exec(status))); }
public IActionResult GetOrders( int status, [FromServices] GetOrders getOrders) => Ok(getOrders.Do(status));
public async Task <IEnumerable <OrderDto> > Handle(GetOrders request, CancellationToken cancellationToken) { var query = await repo.ReadAll(); return(mapper.Map <IEnumerable <OrderDto> >(query)); }
public IActionResult GetOrders(OrderStatus status, [FromServices] GetOrders getOrders) => Ok(getOrders.ForStatus(status));
public async Task <IActionResult> Get([FromRoute] GetOrders query) => Select(await Dispatcher.QueryAsync(query));
public async Task <IActionResult> GetOrders( int status, [FromServices] GetOrders getOrders) => Ok(await getOrders.Do(status));