示例#1
0
        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));
            }
        }
示例#2
0
        // 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();
            }
        }
示例#3
0
        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();
        }
示例#4
0
        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();
            }
        }
示例#5
0
 protected virtual void ClearNavigationProperties()
 {
     Devices.Clear();
     Invoices.Clear();
     OrderLines.Clear();
 }
示例#6
0
 private void ClearControls()
 {
     OrderLines.Clear();
     OrderHeader = new OrderHeader();
 }