protected override async void OnAppearing() { base.OnAppearing(); if (OrderHeader.OrderID != 0 && !areLinesLoaded) { areLinesLoaded = true; var lines = await dbConnection.GetOrderLines(); OrderLines.Clear(); OrderLines.AddRange(lines.Where(x => x.OrderID == OrderHeader.OrderID)); } }
// This method is used by the Passenger. When this method is called this means // the passenger is ready to place his/her order public async void FinalizeOrder(string flightId, string seatNumber) { HttpClient httpClient = new HttpClient(); var orderLinesJson = JsonConvert.SerializeObject(OrderLines); var res = await httpClient.PostAsync($"http://localhost:60177/api/Order/{flightId}/{seatNumber}/placeOrder", new StringContent(orderLinesJson, System.Text.Encoding.UTF8, "application/json")); if (res.IsSuccessStatusCode) { OrderLines.Clear(); } }
private void ExecuteCancel() { foreach (OrderLineViewModel ol in OrderLines) { MediatorLocator.Instance.GetMediatorToProduct().Send(ol.Product.ID); } OrderLines.Clear(); if (Volunteer) { Volunteer = false; } RaisePropertyChanged(nameof(OnCancelCommand)); MediatorLocator.Instance.GetMediatorForTotal().Send(); }
private void ExecuteOrder() { //Insert a new Order and get its ID CurrentOrderID = RepositoryLocator.Instance.GetOrderRepository().Insert(new Order(Volunteer)); if (CurrentOrderID != 0) { DataTable Entities = SetDataTable(); RepositoryLocator.Instance.GetOrderLineRepository().InsertAll(Entities); MediatorLocator.Instance.GetMediatorToRefreshTurnover().Send(); foreach (OrderLineViewModel ol in OrderLines) { MediatorLocator.Instance.GetMediatorToProduct().Send(ol.Product.ID); } OrderLines.Clear(); if (Volunteer) { Volunteer = false; } RaisePropertyChanged(nameof(OnOrderCommand)); RaisePropertyChanged(nameof(OnCancelCommand)); UpdateTotal(); } }
protected virtual void ClearNavigationProperties() { Devices.Clear(); Invoices.Clear(); OrderLines.Clear(); }
private void ClearControls() { OrderLines.Clear(); OrderHeader = new OrderHeader(); }